2006-05-20 12:37:50

by Liu haixiang

[permalink] [raw]
Subject: Oops in kthread

Hi All,

Today I debug one kernel thread created by kthread_run. And after
several hours run, there is one Oops coming from kthread. Please see
below mesage:
====================
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pc = 00000000
*pde = 00000000
Oops: 0000 [#1]

Pid : 261, Comm: CallbackManager
PC is at 0x0
PC : 00000000 SP : 869bbf8c SR : 40008100 TEA : c016db88 Tainted: P
R0 : 00000000 R1 : 00000000 R2 : 005770c5 R3 : 40008101
R4 : 8b000006 R5 : 00000003 R6 : 07b1ce60 R7 : 00000079
R8 : c01c0800 R9 : 07b1ce60 R10 : 00000003 R11 : 00000000
R12 : 0000004c R13 : 00000000 R14 : 00000079
MACH: 0000025c MACL: 000001c8 GBR : 00000000 PR : c01b514a

Call trace:
[<8442d184>] kthread+0xe4/0x140
[<c01b4f80>] CallbackManager+0x0/0x2c0 [fdma]
[<8440f4c0>] complete+0x0/0xc0
[<8442d080>] kthread_should_stop+0x0/0x20
[<84403004>] kernel_thread_helper+0x4/0x20

Then I do objdump the kernel/kthread.c. Please see attached dumped
contents. And find the offset 0xe4. The assembly line code is:
e4: 08 20 tst r0,r0

Does anybody can explain to me which C code in kthread create this
Oops?Is there any easy way to translate assembly code to C?

best regards

Liu haixiang


Attachments:
(No filename) (1.21 kB)
kthread-objdump.txt (19.81 kB)
Download all attachments

2006-05-20 13:25:10

by Balbir Singh

[permalink] [raw]
Subject: Re: Oops in kthread

On 5/20/06, Liu haixiang <[email protected]> wrote:
> Hi All,
>
> Today I debug one kernel thread created by kthread_run. And after
> several hours run, there is one Oops coming from kthread. Please see
> below mesage:
> ====================
> Unable to handle kernel NULL pointer dereference at virtual address 00000000
> pc = 00000000
> *pde = 00000000
> Oops: 0000 [#1]
>
> Pid : 261, Comm: CallbackManager
> PC is at 0x0
> PC : 00000000 SP : 869bbf8c SR : 40008100 TEA : c016db88 Tainted: P
> R0 : 00000000 R1 : 00000000 R2 : 005770c5 R3 : 40008101
> R4 : 8b000006 R5 : 00000003 R6 : 07b1ce60 R7 : 00000079
> R8 : c01c0800 R9 : 07b1ce60 R10 : 00000003 R11 : 00000000
> R12 : 0000004c R13 : 00000000 R14 : 00000079
> MACH: 0000025c MACL: 000001c8 GBR : 00000000 PR : c01b514a
>

Your kernel is Tainted. I do not see a list of loaded modules in the
oops log. A quick grep through the kernel sources did not reveal any
routine called "CallbackManager". From the trace CallbackManager
(which is also the name of the thread) belongs to a module called
fdma.

Are you writing fdma or do you have the source code for it? If your
planning to submit fdma to the linux kernel, I would recommend that
you go through the coding standards for the kernel. I don't think
CallbackManager is an acceptable naming convention.

> Call trace:
> [<8442d184>] kthread+0xe4/0x140
> [<c01b4f80>] CallbackManager+0x0/0x2c0 [fdma]
> [<8440f4c0>] complete+0x0/0xc0
> [<8442d080>] kthread_should_stop+0x0/0x20
> [<84403004>] kernel_thread_helper+0x4/0x20
>
> Then I do objdump the kernel/kthread.c. Please see attached dumped
> contents. And find the offset 0xe4. The assembly line code is:
> e4: 08 20 tst r0,r0
>
> Does anybody can explain to me which C code in kthread create this
> Oops?Is there any easy way to translate assembly code to C?
>

Try running objdump -d -l on the object file. It should dump the line
numbers and the corresponding disassembled assembly code.

> best regards
>
> Liu haixiang
>
>
>

Balbir
Linux Technology Center,
India Software Labs,
Bangalore

2006-05-20 13:44:49

by Arjan van de Ven

[permalink] [raw]
Subject: Re: Oops in kthread

On Sat, 2006-05-20 at 20:37 +0800, Liu haixiang wrote:
> Hi All,
>
> Today I debug one kernel thread created by kthread_run. And after
> several hours run, there is one Oops coming from kthread. Please see
> below mesage:
> ====================
> Unable to handle kernel NULL pointer dereference at virtual address 00000000
> pc = 00000000
> *pde = 00000000
> Oops: 0000 [#1]
>
> Pid : 261, Comm: CallbackManager
> PC is at 0x0
> PC : 00000000 SP : 869bbf8c SR : 40008100 TEA : c016db88 Tainted: P
> R0 : 00000000 R1 : 00000000 R2 : 005770c5 R3 : 40008101
> R4 : 8b000006 R5 : 00000003 R6 : 07b1ce60 R7 : 00000079
> R8 : c01c0800 R9 : 07b1ce60 R10 : 00000003 R11 : 00000000
> R12 : 0000004c R13 : 00000000 R14 : 00000079
> MACH: 0000025c MACL: 000001c8 GBR : 00000000 PR : c01b514a
>
> Call trace:
> [<8442d184>] kthread+0xe4/0x140
> [<c01b4f80>] CallbackManager+0x0/0x2c0 [fdma]

you forgot to attach the source code for "fdma"... so how can we help
you?

2006-05-21 06:06:39

by Liu haixiang

[permalink] [raw]
Subject: Re: Oops in kthread

Hi Balbir,

The FDMA is my coded module. And in my code, I didn't call kthread in
my code but only call kthread_run once to create one kernel thread
CallbackManager.

So I don't understand why there is Oops from kthread and called by my
CallbackManager.

Can anybody explain to me when kthread will be called by the kernel?
Then I can understand well why Oops happen.

best regards

Liu haixiang

2006/5/20, Balbir Singh <[email protected]>:
> On 5/20/06, Liu haixiang <[email protected]> wrote:
> > Hi All,
> >
> > Today I debug one kernel thread created by kthread_run. And after
> > several hours run, there is one Oops coming from kthread. Please see
> > below mesage:
> > ====================
> > Unable to handle kernel NULL pointer dereference at virtual address 00000000
> > pc = 00000000
> > *pde = 00000000
> > Oops: 0000 [#1]
> >
> > Pid : 261, Comm: CallbackManager
> > PC is at 0x0
> > PC : 00000000 SP : 869bbf8c SR : 40008100 TEA : c016db88 Tainted: P
> > R0 : 00000000 R1 : 00000000 R2 : 005770c5 R3 : 40008101
> > R4 : 8b000006 R5 : 00000003 R6 : 07b1ce60 R7 : 00000079
> > R8 : c01c0800 R9 : 07b1ce60 R10 : 00000003 R11 : 00000000
> > R12 : 0000004c R13 : 00000000 R14 : 00000079
> > MACH: 0000025c MACL: 000001c8 GBR : 00000000 PR : c01b514a
> >
>
> Your kernel is Tainted. I do not see a list of loaded modules in the
> oops log. A quick grep through the kernel sources did not reveal any
> routine called "CallbackManager". From the trace CallbackManager
> (which is also the name of the thread) belongs to a module called
> fdma.
>
> Are you writing fdma or do you have the source code for it? If your
> planning to submit fdma to the linux kernel, I would recommend that
> you go through the coding standards for the kernel. I don't think
> CallbackManager is an acceptable naming convention.
>
> > Call trace:
> > [<8442d184>] kthread+0xe4/0x140
> > [<c01b4f80>] CallbackManager+0x0/0x2c0 [fdma]
> > [<8440f4c0>] complete+0x0/0xc0
> > [<8442d080>] kthread_should_stop+0x0/0x20
> > [<84403004>] kernel_thread_helper+0x4/0x20
> >
> > Then I do objdump the kernel/kthread.c. Please see attached dumped
> > contents. And find the offset 0xe4. The assembly line code is:
> > e4: 08 20 tst r0,r0
> >
> > Does anybody can explain to me which C code in kthread create this
> > Oops?Is there any easy way to translate assembly code to C?
> >
>
> Try running objdump -d -l on the object file. It should dump the line
> numbers and the corresponding disassembled assembly code.
>
> > best regards
> >
> > Liu haixiang
> >
> >
> >
>
> Balbir
> Linux Technology Center,
> India Software Labs,
> Bangalore
>

2006-05-21 06:14:42

by Balbir Singh

[permalink] [raw]
Subject: Re: Oops in kthread

On 5/21/06, Liu haixiang <[email protected]> wrote:
> Hi Balbir,
>
> The FDMA is my coded module. And in my code, I didn't call kthread in
> my code but only call kthread_run once to create one kernel thread
> CallbackManager.
>
> So I don't understand why there is Oops from kthread and called by my
> CallbackManager.
>
> Can anybody explain to me when kthread will be called by the kernel?
> Then I can understand well why Oops happen.
>
> best regards
>
> Liu haixiang
>

Please post the source code, it is easier to help out, otherwise its
like shooting in the dark.

Balbir
Linux Technology Center,
India Software Labs,
Bangalore

2006-05-21 09:26:26

by David Greaves

[permalink] [raw]
Subject: Re: Oops in kthread

Liu haixiang wrote:
> Hi Balbir,
>
> The FDMA is my coded module. And in my code, I didn't call kthread in
> my code but only call kthread_run once to create one kernel thread
> CallbackManager.
>
> So I don't understand why there is Oops from kthread and called by my
> CallbackManager.
>
> Can anybody explain to me when kthread will be called by the kernel?
> Then I can understand well why Oops happen.
Have you seen the kernel-newbies mailing list?
http://www.kernelnewbies.org/

It's for people who want to develop kernel code. It's full of people
asking (and answering) questions like this and you'll probably more
helpful answers (though you'll still probably need to provide source).

David