Re: ARM Linux Paging Problems

Russell King - ARM Linux <[email protected]>
Newsgroups gmane.linux.ports.arm.general
Message-ID <[email protected]>
On Wed, Jun 17, 2009 at 05:16:14PM -0400, Stephen Lim wrote:
> An Update:
> 
> 
> After some investigation, the following results have been obtained.
> 
> After eliminating 8MB banks/segments of memory to address a total of 32 MB
> of RAM the issues and problems go away.

I think I see the reason.  The kernel's LH7A40x code is not setup to
handle the 64MB layout:

# ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
#  define KVADDR_TO_NID(addr) \
  (  ((((unsigned long) (addr) - PAGE_OFFSET) >> 24) &  1)\
   | ((((unsigned long) (addr) - PAGE_OFFSET) >> 25) & ~1))
# else  /* 2 banks per node */
#  define KVADDR_TO_NID(addr) \
      (((unsigned long) (addr) - PAGE_OFFSET) >> 26)
# endif

With CONFIG_LH7A40X_ONE_BANK_PER_NODE set:
KVADDR_TO_NID(0xc0000000) => 0
KVADDR_TO_NID(0xc1000000) => 1
KVADDR_TO_NID(0xc2000000) => 0
KVADDR_TO_NID(0xc3000000) => 1

So, every 3rd and 4th out of four banks aliases onto the 1st and 2nd as
far as the kernel's VM setup is concerned.

Without, these all alias to node 0.  But...

# ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
#  define LOCAL_MAP_NR(addr) \
       (((unsigned long)(addr) & 0x003fffff) >> PAGE_SHIFT)
# else  /* 2 banks per node */
#  define LOCAL_MAP_NR(addr) \
       (((unsigned long)(addr) & 0x01ffffff) >> PAGE_SHIFT)
# endif

this then falls about, aliasing 0xc2000000..0xc3000000 onto
0xc0000000..0xc1000000.

Solution?  Someone needs to fix the LH7A40x code, or you could move forward
to a more recent kernel which supports sparsemem (which should cope with your
configuration.)  That's the positive point.

The negative point is that the mainline kernel LH7A40x code has received
little in the way of supportive maintainence; the last time it was
/possibly/ run on hardware was 2006.  Since then there's been IRQ changes,
timer updates, the sparsemem stuff, clk API conversions, and a number of
cleanups.

>From my side it would be nice to get the mainline kernel code tested
on hardware, esp. the sparsemem stuff.  If that does work then we need
to kill the discontigmem support there.

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.