linux-mips
[Top] [All Lists]

cat /proc/iomem crash +patch

To: linux-mips <linux-mips@linux-mips.org>
Subject: cat /proc/iomem crash +patch
From: Ken Giusti <manwithastinkydog@yahoo.com>
Date: Wed, 2 Jun 2004 05:33:46 -0700 (PDT)
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Hi,

I'm running 2.4 on a swarm card with 2Gig of memory.
I've got CONFIG_64BIT_PHYS_ADDR=y configured.  I get
the following memory map during boot:

Determined physical RAM map:
 memory: 0fe82e00 @ 00000000 (usable)
 memory: 1ffffe00 @ 80000000 (usable)
 memory: 0ffffe00 @ c0000000 (usable)
 memory: 3ffffe00 @ 100000000 (usable)

"cat"ing /proc/iomem would cause an oops.   I traced
this to setup.c::resource_init(), which was
incorrectly
truncating the start address of the 0x100000000 memory
entry to fit in a 32 bit ulong.  This would cause
the request_resource call to fail, triggering a bug
which would insert an invalid root node in the iomem
map. 

Here's a patch that works for me:

cvs diff: Diffing .
Index: setup.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/kernel/setup.c,v
retrieving revision 1.168
diff -u -r1.168 setup.c
--- setup.c     8 Feb 2004 14:57:04 -0000       1.168
+++ setup.c     2 Jun 2004 12:24:37 -0000
@@ -382,7 +382,7 @@
         */
        for (i = 0; i < boot_mem_map.nr_map; i++) {
                struct resource *res;
-               unsigned long start, end;
+               phys_t start, end;
 
                start = boot_mem_map.map[i].addr;
                end = boot_mem_map.map[i].addr +
boot_mem_map.map[i].size - 1;
@@ -406,15 +406,16 @@
                res->end = end;
 
                res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
-               request_resource(&iomem_resource, res);
+               if (request_resource(&iomem_resource, res) == 0) {
 
-               /*
-                *  We don't know which RAM region contains kernel
data,
-                *  so we try it repeatedly and let the resource
manager
-                *  test it.
-                */
-               request_resource(res, &code_resource);
-               request_resource(res, &data_resource);
+                       /*
+                        *  We don't know which RAM region contains kernel
data,
+                        *  so we try it repeatedly and let the resource
manager
+                        *  test it.
+                        */
+                       request_resource(res, &code_resource);
+                       request_resource(res, &data_resource);
+               }
        }
 }

-K





        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

<Prev in Thread] Current Thread [Next in Thread>
  • cat /proc/iomem crash +patch, Ken Giusti <=