Re: include/asm-arm/memory.h changes break zaurus sl-5500 boot

From: Russell King
Date: Mon Apr 03 2006 - 03:37:29 EST


On Mon, Apr 03, 2006 at 09:15:04AM +0900, KAMEZAWA Hiroyuki wrote:
> On Mon, 3 Apr 2006 00:23:14 +0200
> Pavel Machek <pavel@xxxxxx> wrote:
> > > Not surprising given this gem:
> > >
> > > > -#define arch_local_page_offset(pfn, nid) (LOCAL_MAP_NR((pfn) << PAGE_OFFSET))
> > >
> > > PAGE_OFFSET being 3GB - that's one hell of a shift value!
> >
> > Unfortunately this is mainline now. Is there some better fix than
> > simply reverting the offending patches?
>
> Maybe this one will fix (against 2.6.16-mm2)
>
> LOCAL_MAP_NR(kaddr) returns page offset in a node.

LOCAL_MAP_NR does not take a kernel virtual address. If you look at how
it's defined (Eg):

#define LOCAL_MAP_NR(addr) \
(((unsigned long)(addr) & 0x07ffffff) >> PAGE_SHIFT)

then you will notice that it's actually converting an offset into a node
into an index. This means that converting a PFN to a virtual address is
just a complete and utter waste of time.

So:

> -#define arch_local_page_offset(pfn, nid) (LOCAL_MAP_NR((pfn) << PAGE_OFFSET))
> +#define arch_local_page_offset(pfn, nid) (LOCAL_MAP_NR(__va((pfn) << PAGE_SHIFT)))

this should be:

#define arch_local_page_offset(pfn, nid) LOCAL_MAP_NR((pfn) << PAGE_SHIFT)

Please also avoid the over-use of parens. It's a disease which just makes
things harder to read (eg, the have I got enough close parens at the end
of the line to balance.)

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/