Only use up to 45MB of 64MB memory and throw out "Unable to handle kernel NULL pointer der eference at virtual address 00000000” excep tion

Samuel Xue <[email protected]>
Newsgroups gmane.linux.ports.arm.general
Message-ID <[email protected]>



Hello, 

I encounter a problem with memory usage. Can you provide any suggestions? Thanks a  lot!
Linux kernel version 2.6.12.5

CPU: Sharp LH7A404

Upgrade to 64MB SDRAM

Currently use CONFIG_DISCONTIGMEM.

 

Run a simple test program as below:

            int n = 0;

            char *p;

            

            while( 1 )

            {

                        if
((p = malloc(1<<20)) == NULL) {

                                    printf("malloc
failure after %d MiB\n", n);

                                    return
0;

                        }

                        printf(
"malloc succeed! p = 0x%08x\n", p );

                        memset
(p, 0, (1<<20));

                        printf
("got %d MiB\n", ++n);

            }

 

It can only use up to around 45MB then get “Unable to handle
kernel NULL pointer dereference at virtual address 00000000” exception. Sometimes the process is killed and sometimes the system hangs.


 

Add some print information shown as below:

************************************************************************

XXX->arch_get_unmapped_area(): addr = 0x00000000 len =
1052672

XXX->arch_get_unmapped_area(): 3 addr = 0x4267a000

malloc succeed! p = 0x4267a008

got 38 MiB

XXX->arch_get_unmapped_area(): addr = 0x00000000 len =
1052672

XXX->arch_get_unmapped_area(): 3 addr = 0x4277b000

malloc succeed! p = 0x4277b008

XXX->do_page_fault(): RUN TO HERE 3-> addr =
0x00000000

XXX->do_page_fault(): RUN TO HERE 4-> addr =
0x00000000

Unable to handle kernel NULL pointer dereference at virtual
address 00000000

pgd = c1260000

[00000000] *pgd=c120e031, *pte=00000000, *ppte=00000000

Internal error: Oops: 817 [#1]

Modules linked in: usb_storage usbhid ohci_hcd usbcore
sd_mod scsi_mod cosmos_kmi_m vfat fat nls_iso8859_1 nls_cp437

CPU: 0

pc : [<c004c2e0>]   
lr : [<c004c650>]    Not
tainted

sp : c2125e50  ip :
00000000  fp : c2125e88

r10: c017da54  r9 :
00000000  r8 : 000000d2

r7 : c0182228  r6 :
c0182244  r5 : 00000000  r4 : c0182228

r3 : 00100100  r2 :
00200200  r1 : cd0003f8  r0 : 00000000

Flags: nzCv  IRQs
off  FIQs on  Mode SVC_32 
Segment user

Control: C000717F 
Table: C1260000  DAC: 00000015

Process test (pid: 173, stack limit = 0xc2124194)

Stack: (0xc2125e50 to 0xc2126000)

5e40:                                     60000093
00000001 60000013 000000d2

5e60: c0182228 0000000e 00000000 00000000 000000d2 00000000
c017da54 c2125ed0

5e80: c2125e8c c004c650 c004c274 00000000 00000000 c2124000
00000000 c20c87c0

5ea0: 00000010 cc35f92c c000005f 00000800 c20f8490 cc35f938
4284e000 c2105100

5ec0: c0196100 c2125f0c c2125ed4 c005665c c004c584 00000001
00000000 00000000

5ee0: 00000001 000010a0 c1260000 00000000 4284e000 c2105100
c20f8490 cc35f938

5f00: c2125f48 c2125f10 c0056c48 c00565c0 cc35f938 c12610a0
c12610a0 00000800

5f20: ffffffeb 4284e000 c210512c c20f8490 c20c87c0 00000800
c2105100 c2125f88

5f40: c2125f4c c00208d4 c0056ac0 c2125f58 c0033700 c2125fb0
00000817 4284e000

5f60: 00000817 c2125fec c017d41c 4284e000 c2125fb0 00000000
4014f600 c2125fac

5f80: c2125f8c c0020b68 c00207f4 ffffffff c2125fec 00000002
c017d014 00008728

5fa0: 00000000 c2125fb0 c0019fa0 c0020b3c bef85d44 00000000
4284e000 4284e000

5fc0: bef85dc4 00008804 00000002 00008810 00008728 00000000
4014f600 bef85d60

5fe0: 4014f624 bef85d44 0000849c 000084cc 00000010 ffffffff
dfde37ff feffffb3

Backtrace:

Function entered at [<c004c264>] from
[<c004c650>]

Function entered at [<c004c574>] from
[<c005665c>]

Function entered at [<c00565b0>] from
[<c0056c48>]

Function entered at [<c0056ab0>] from
[<c00208d4>]

Function entered at [<c00207e4>] from
[<c0020b68>]

Function entered at [<c0020b2c>] from
[<c0019fa0>]

 r8 = 00008728  r7 = C017D014 
r6 = 00000002  r5 = C2125FEC

 r4 = FFFFFFFF

Code: e5961010 e59f31dc e8911001 e59f21d8 (e58c0000)

 Segmentation fault

************************************************************************

I added some print information in mem_init(). The memory
mapping shows ok as below:

 

************************************************************************

XXX->mem_init(): pgdat = 0xc017d560 nr_zones = 1
node_start_pfn = 0x000c0000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 0

 

XXX->mem_init(): pgdat = 0xc017db48 nr_zones = 1
node_start_pfn = 0x000c1000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 1

 

XXX->mem_init(): pgdat = 0xc017e130 nr_zones = 1
node_start_pfn = 0x000c2000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 2

 

XXX->mem_init(): pgdat = 0xc017e718 nr_zones = 1
node_start_pfn = 0x000c3000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 3

 

XXX->mem_init(): pgdat = 0xc017ed00 nr_zones = 1
node_start_pfn = 0x000c4000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 4

 

XXX->mem_init(): pgdat = 0xc017f2e8 nr_zones = 1
node_start_pfn = 0x000c5000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 5

 

XXX->mem_init(): pgdat = 0xc017f8d0 nr_zones = 1
node_start_pfn = 0x000c6000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 6

 

XXX->mem_init(): pgdat = 0xc017feb8 nr_zones = 1
node_start_pfn = 0x000c7000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 7

 

XXX->mem_init(): pgdat = 0xc01804a0 nr_zones = 1
node_start_pfn = 0x000c8000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 8

 

XXX->mem_init(): pgdat = 0xc0180a88 nr_zones = 1
node_start_pfn = 0x000c9000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 9

 

XXX->mem_init(): pgdat = 0xc0181070 nr_zones = 1
node_start_pfn = 0x000ca000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 10

 

XXX->mem_init(): pgdat = 0xc0181658 nr_zones = 1
node_start_pfn = 0x000cb000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 11

 

XXX->mem_init(): pgdat = 0xc0181c40 nr_zones = 1
node_start_pfn = 0x000cc000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 12

 

XXX->mem_init(): pgdat = 0xc0182228 nr_zones = 1
node_start_pfn = 0x000cd000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 13

 

XXX->mem_init(): pgdat = 0xc0182810 nr_zones = 1
node_start_pfn = 0x000ce000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 14

 

XXX->mem_init(): pgdat = 0xc0182df8 nr_zones = 1
node_start_pfn = 0x000cf000 node_present_pages = 0x00000400 node_spanned_pages
= 0x00000400 node_id = 15

Memory: 4MB 4MB 4MB 4MB 4MB 4MB 4MB 4MB 4MB 4MB 4MB 4MB 4MB
4MB 4MB 4MB = 64MB total



Memory: 62152KB available (1409K
code, 481K data, 68K init)



 

I did memory test on the physical SDRAM and it looks ok. Process using under 45MB memory runs fine.
CPU generates section translation fault (1MB) then page fault (4KB). I am not quite familiar with the exact procedure how new memory requests are handled.
Why CPU generates a page fault with NULL virtual address suddenly? Is
there something wrong with mapping page tables? Or potential hardware issue? Any ideas?
Thanks!
Samuel



      
-------------------------------------------------------------------
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.