Skip to contentSkip to conversation

swap_dup: Bad swap file entry 00480020

DISCUSSION bogdan antonovici 5 participants 10 messages Jul 21, 2005 – Aug 5, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

I have an MPC860 system, 16M flash, 16M SDRAM, no disk, just kernel support for ramdisk. root fs is nfs mounted.
I get messages like the one bellow:

swap_dup: Bad swap file entry 00480020
VM: killing process chat
swap_free: Bad swap file entry 00480020

and after a while a get an oops:

Oops: kernel access of bad area, sig: 11
NIP: C0045154 XER: 20000000 LR: C0045464 SP: C0CBBE60 REGS: c0cbbdb0

TRAP: 0300 Not tainted
MSR: 00009032 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
DAR: 00E9A01C, DSISR: C0000000
TASK = c0cba000[36] 'pppd' Last syscall: 142
last math 00000000 last altivec 00000000
GPR00: C0045464 C0CBBE60 C0CBA000 C0CBBE88 C01DE8C0 00000000 C010E2B8 0000001F
GPR08: C0CBA000 00000000 C0C4E03C 00000001 84444448 100B0C5C 10040000 10040000
GPR16: 10040000 10040000 10040000 10040000 C0CBBEF8 00000000 00000001 7FFFFFFF
GPR24: 00000004 00000001 00000145 C0CBBED8 00000004 C0E9A000 C0E9A008 00E9A008
Call backtrace:
C0087D84 C0045464 C0045858 C0009448 C00041DC 1001DB84 10006F24 10006A8C 0FE4BDA0 00000000

At the time of swap messages i was running a proprietary driver, my application and few daemons.

ps
PID Uid VmSize Stat Command
1 root 584 S init
2 root SW [keventd]
3 root SWN [ksoftirqd_CPU0]
4 root SW [kswapd]
5 root SW [bdflush]
6 root SW [kupdated]
7 root SW [rpciod]
9 root 760 S -ash

   21 root        616 S   sectionmond
   22 root        608 S   sectionmond
   23 root        608 S   sectionmond
   24 root        608 S   sectionmond
   25 root        612 S   sectionmond
   26 root        608 S   sectionmond
   30 root       1304 S   /ppcnetsnmp/sbin/snmpd
   39 root        916 S   pppd /dev/ttyS1 19200 defaultroute demand idle

5 192.
109 root 680 R ps

I look on the net for some clues but it's quite confusing, i noticed many emails on swap_dup/swap_free error messages but i couldn't figure out what should i search for.
I tested the ram with mtest from pppboot2.0.

Has any of you an idea what is all about?

Thank you
Bogdan

#1 lore raw
Quoted 2 lines · bogdan antonovici

At the time of swap messages i was running a proprietary driver, my application and few daemons.

Looks like your driver may have written over some of the page tables in the kernel space.

Quoted 3 lines

I look on the net for some clues but it's quite confusing, i noticed many emails on swap_dup/swap_free error messages but i couldn't figure out what should i search for.

Those messages are likely due to a bug with swapping to disk that has been in some 2.4 kernels, but I don't believe that is the case here, since you don't have a disk or swapping enabled.

	-- Dan
#2 lore raw

I wasn't so worry about the driver because the same driver worked with a different application without seeing these kind of messages or oopses. Dan, from your answer i understand that the swap code discovers a corruption in tables but why is swap code run when swap wasn't activated? I will try to have a look on the driver code.

Bogdan
----- Original Message -----
From: Dan Malek
To: bogdan antonovici
Cc: linuxppc-dev ; [email protected] ; ppckernel
Sent: Thursday, July 21, 2005 12:59 PM
Subject: Re: swap_dup: Bad swap file entry 00480020

Quoted 2 lines · bogdan antonovici

At the time of swap messages i was running a proprietary driver, my application and few daemons.

Looks like your driver may have written over some of the page tables in the kernel space.

Quoted 3 lines

I look on the net for some clues but it's quite confusing, i noticed many emails on swap_dup/swap_free error messages but i couldn't figure out what should i search for.

Those messages are likely due to a bug with swapping to disk that has been in some 2.4 kernels, but I don't believe that is the case here, since you don't have a disk or swapping enabled.

-- Dan

#3 lore raw
In reply to Dan Malek

Hi Dan,

I checked the driver code. I found a pointer that was in my opinion initialized too late and i corrected that but other than that i haven't found anything.
I ran the driver alone, enabling the interrupts and the interrupt routine doesn't cause any trouble.
I started my application and i haven't seen any sign of trouble. But once i started also the snmpd after few interrupts i got the message:

__alloc_pages: 0-order allocation failed (gfp=0x1d2/0)
VM: killing process sectionmond

sectionmond being my application.
My read and write driver operation are requesting a page for a buffer but they also release it. Should i declare the buffer pointer with volatile attribute?
Do you know what may cause that message?
Thanks
Bogdan

Quoted 19 lines · Dan Malek
Quoted 2 lines · bogdan antonovici

At the time of swap messages i was running a proprietary driver, my application and few daemons.

Looks like your driver may have written over some of the page tables in the kernel space.

Quoted 3 lines

I look on the net for some clues but it's quite confusing, i noticed many emails on swap_dup/swap_free error messages but i couldn't figure out what should i search for.

Those messages are likely due to a bug with swapping to disk that has been in some 2.4 kernels, but I don't believe that is the case here, since you don't have a disk or swapping enabled.

	-- Dan
#4 lore raw
Quoted 11 lines · bogdan antonovici

Hi Dan,

I checked the driver code. I found a pointer that was in my opinion initialized too late and i corrected that but other than that i haven't found anything.
I ran the driver alone, enabling the interrupts and the interrupt routine doesn't cause any trouble.
I started my application and i haven't seen any sign of trouble. But once i started also the snmpd after few interrupts i got the message:

Quoted 2 lines

__alloc_pages: 0-order allocation failed (gfp=0x1d2/0)
VM: killing process sectionmond

Thats a different problem: you ran out of memory and the VM can't swap out any data.

So its likely that the pagetable corruption is gone (it was indeed a bug in the driver as Dan suspected).

Quoted 5 lines

sectionmond being my application.
My read and write driver operation are requesting a page for a buffer but they also release it. Should i declare the buffer pointer with volatile attribute?
Do you know what may cause that message?

Out of memory condition.

#5 lore raw

Yes, it was. After some research on the previous message i realized that it run out of memory so i did mem=8M and it hasn't been crashed since then. I still would like to understand why that swap code was run when the swapping wasn't activated at all.
Thank you.
Bogdan
----- Original Message -----
From: Marcelo Tosatti
To: bogdan antonovici
Cc: Dan Malek ; linuxppc-dev ; ppckernel ; [email protected]
Sent: Friday, July 22, 2005 7:57 AM
Subject: Re: swap_dup: Bad swap file entry 00480020

Quoted 11 lines · bogdan antonovici

Hi Dan,

I checked the driver code. I found a pointer that was in my opinion initialized too late and i corrected that but other than that i haven't found anything.
I ran the driver alone, enabling the interrupts and the interrupt routine doesn't cause any trouble.
I started my application and i haven't seen any sign of trouble. But once i started also the snmpd after few interrupts i got the message:

Quoted 2 lines

__alloc_pages: 0-order allocation failed (gfp=0x1d2/0)
VM: killing process sectionmond

Thats a different problem: you ran out of memory and the VM can't swap out any data.

So its likely that the pagetable corruption is gone (it was indeed a bug in the driver as Dan suspected).

Quoted 5 lines

sectionmond being my application.
My read and write driver operation are requesting a page for a buffer but they also release it. Should i declare the buffer pointer with volatile attribute?
Do you know what may cause that message?

Out of memory condition.

#6 lore raw
Quoted 5 lines · Bogdan Antonovici

Yes, it was. After some research on the previous message i realized that it run out of memory so i did mem=8M and it hasn't been crashed since then.
I still would like to understand why that swap code was run when the swapping wasn't activated at all.

The "swap" code also kicks in for things like mmap of a file, this is the same code path.

Ben.

#7 lore raw
In reply to Dan Malek

Dan,

It hasn't crashed since i corrected that pointer initialization in driver. You were right. Thank you.
Bogdan
----- Original Message -----
From: Dan Malek
To: bogdan antonovici
Cc: linuxppc-dev ; [email protected] ; ppckernel
Sent: Thursday, July 21, 2005 12:59 PM
Subject: Re: swap_dup: Bad swap file entry 00480020

Quoted 2 lines · bogdan antonovici

At the time of swap messages i was running a proprietary driver, my application and few daemons.

Looks like your driver may have written over some of the page tables in the kernel space.

Quoted 3 lines

I look on the net for some clues but it's quite confusing, i noticed many emails on swap_dup/swap_free error messages but i couldn't figure out what should i search for.

Those messages are likely due to a bug with swapping to disk that has been in some 2.4 kernels, but I don't believe that is the case here, since you don't have a disk or swapping enabled.

-- Dan

#8 lore raw
Quoted 2 lines · Bogdan Antonovici

It hasn't crashed since i corrected that pointer initialization in driver. You were right. Thank you.

Glad to hear it. I wasn't looking forward to debugging such a problem in the VM subsystem at this time :-)

Have fun!

	-- Dan
#9 lore raw
In reply to Bogdan Antonovici

BTW, I posted a fix for a bug in the 2.6 page table attribute settings for PPC440 that cause corruption when swapping. I don't know if is the same for 2.4.

http://patchwork.ozlabs.org/linuxppc/patch?id=1458

-Geoff

Quoted 50 lines · Bogdan Antonovici

Dan,

It hasn't crashed since i corrected that pointer initialization in driver. You were right.
Thank you.
Bogdan

----- Original Message -----
From: Dan Malek <mailto:[email protected]>
To: bogdan antonovici <mailto:[email protected]>
Cc: linuxppc-dev <mailto:[email protected]> ; [email protected] <mailto:[email protected]> ; ppckernel <mailto:[email protected]>
Sent: Thursday, July 21, 2005 12:59 PM
Subject: Re: swap_dup: Bad swap file entry 00480020

Quoted 2 lines · bogdan antonovici

At the time of swap messages i was running a proprietary driver, my application and few daemons.

Looks like your driver may have written over some of the page tables in the kernel space.

Quoted 3 lines

I look on the net for some clues but it's quite confusing, i noticed many emails on swap_dup/swap_free error messages but i couldn't figure out what should i search for.

Those messages are likely due to a bug with swapping to disk that has been in some 2.4 kernels, but I don't believe that is the case here, since you don't have a disk or swapping enabled.

-- Dan

------------------------------------------------------------------------

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev