Linux PARISC architecture development
 help / color / mirror / Atom feed
* [PATCH] fix BUG: sleeping function called from invalid context at mm/slab.c:3044
@ 2008-12-17 22:57 Helge Deller
  2008-12-17 23:41 ` Kyle McMartin
  2008-12-18 10:23 ` Randolph Chung
  0 siblings, 2 replies; 3+ messages in thread
From: Helge Deller @ 2008-12-17 22:57 UTC (permalink / raw)
  To: linux-parisc

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

Since unwind_frame_init_from_blocked_task() may be called from
interrupt/in_atomic context, it needs to kmalloc() memory with
GFP_ATOMIC instead of GFP_KERNEL.

This fixes this warning (ShowTasks called from sysrq handler):

BUG: sleeping function called from invalid context at mm/slab.c:3044
in_atomic(): 1, irqs_disabled(): 1, pid: 2119, name: miniruby
Backtrace:
 [<10132e78>] __might_sleep+0x4c/0x118
 [<1018f644>] kmem_cache_alloc+0x2c/0xb4
 [<1011bae0>] unwind_frame_init_from_blocked_task+0x30/0xa0
 [<1010fd3c>] parisc_show_stack+0x3c/0xac
 [<10132c7c>] show_state_filter+0x80/0xd8
 [<102f4074>] __handle_sysrq+0xd0/0x1b0
 [<102f9558>] receive_chars+0x22c/0x318
 [<102f9940>] serial8250_handle_port+0x40/0x88
 [<102f9a8c>] serial8250_interrupt+0x104/0x10c
 [<10161920>] handle_IRQ_event+0x44/0x94
 [<10161acc>] __do_IRQ+0x15c/0x1dc
 [<102c442c>] superio_interrupt+0x74/0xa8
 [<10161920>] handle_IRQ_event+0x44/0x94
 [<10161acc>] __do_IRQ+0x15c/0x1dc
 [<10110fb4>] do_cpu_irq_mask+0x90/0xbc
 [<10114068>] intr_return+0x0/0x4

Signed-off-by: Helge Deller <deller@gmx.de>

[-- Attachment #2: invalid_context_fix.patch --]
[-- Type: text/x-patch, Size: 470 bytes --]

diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c
index 6773c58..69dad5a 100644
--- a/arch/parisc/kernel/unwind.c
+++ b/arch/parisc/kernel/unwind.c
@@ -372,7 +372,7 @@ void unwind_frame_init_from_blocked_task(struct unwind_frame_info *info, struct
 	struct pt_regs *r = &t->thread.regs;
 	struct pt_regs *r2;
 
-	r2 = kmalloc(sizeof(struct pt_regs), GFP_KERNEL);
+	r2 = kmalloc(sizeof(struct pt_regs), GFP_ATOMIC);
 	if (!r2)
 		return;
 	*r2 = *r;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix BUG: sleeping function called from invalid context at mm/slab.c:3044
  2008-12-17 22:57 [PATCH] fix BUG: sleeping function called from invalid context at mm/slab.c:3044 Helge Deller
@ 2008-12-17 23:41 ` Kyle McMartin
  2008-12-18 10:23 ` Randolph Chung
  1 sibling, 0 replies; 3+ messages in thread
From: Kyle McMartin @ 2008-12-17 23:41 UTC (permalink / raw)
  To: Helge Deller; +Cc: linux-parisc

On Wed, Dec 17, 2008 at 11:57:34PM +0100, Helge Deller wrote:
> Since unwind_frame_init_from_blocked_task() may be called from
> interrupt/in_atomic context, it needs to kmalloc() memory with
> GFP_ATOMIC instead of GFP_KERNEL.
> 

that's right, it used to just allocate r2 but i introduced this bug when
i killed some stack heavy things a while back.

applied, kyle

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix BUG: sleeping function called from invalid context at mm/slab.c:3044
  2008-12-17 22:57 [PATCH] fix BUG: sleeping function called from invalid context at mm/slab.c:3044 Helge Deller
  2008-12-17 23:41 ` Kyle McMartin
@ 2008-12-18 10:23 ` Randolph Chung
  1 sibling, 0 replies; 3+ messages in thread
From: Randolph Chung @ 2008-12-18 10:23 UTC (permalink / raw)
  To: Helge Deller; +Cc: linux-parisc

i knew there was a reason why this was a stack variable before... ;-) 
(of course, that is not ideal either)

randolph

Helge Deller wrote:
> Since unwind_frame_init_from_blocked_task() may be called from
> interrupt/in_atomic context, it needs to kmalloc() memory with
> GFP_ATOMIC instead of GFP_KERNEL.
> 
> This fixes this warning (ShowTasks called from sysrq handler):
> 
> BUG: sleeping function called from invalid context at mm/slab.c:3044
> in_atomic(): 1, irqs_disabled(): 1, pid: 2119, name: miniruby
> Backtrace:
>  [<10132e78>] __might_sleep+0x4c/0x118
>  [<1018f644>] kmem_cache_alloc+0x2c/0xb4
>  [<1011bae0>] unwind_frame_init_from_blocked_task+0x30/0xa0
>  [<1010fd3c>] parisc_show_stack+0x3c/0xac
>  [<10132c7c>] show_state_filter+0x80/0xd8
>  [<102f4074>] __handle_sysrq+0xd0/0x1b0
>  [<102f9558>] receive_chars+0x22c/0x318
>  [<102f9940>] serial8250_handle_port+0x40/0x88
>  [<102f9a8c>] serial8250_interrupt+0x104/0x10c
>  [<10161920>] handle_IRQ_event+0x44/0x94
>  [<10161acc>] __do_IRQ+0x15c/0x1dc
>  [<102c442c>] superio_interrupt+0x74/0xa8
>  [<10161920>] handle_IRQ_event+0x44/0x94
>  [<10161acc>] __do_IRQ+0x15c/0x1dc
>  [<10110fb4>] do_cpu_irq_mask+0x90/0xbc
>  [<10114068>] intr_return+0x0/0x4
> 
> Signed-off-by: Helge Deller <deller@gmx.de>
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-18 10:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-17 22:57 [PATCH] fix BUG: sleeping function called from invalid context at mm/slab.c:3044 Helge Deller
2008-12-17 23:41 ` Kyle McMartin
2008-12-18 10:23 ` Randolph Chung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox