All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtlwifi: Fix scheduling while atomic splat
@ 2017-03-21 14:24 Larry Finger
  2017-03-21 17:32 ` Kalle Valo
  2017-03-30 16:43 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Larry Finger @ 2017-03-21 14:24 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Larry Finger, Ping-Ke Shih

Following commit cceb0a597320 ("rtlwifi: Add work queue for c2h cmd."),
the following BUG is reported when rtl8723be is used:

BUG: sleeping function called from invalid context at mm/slab.h:432
in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/0
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W  O    4.11.0-rc3-wl+ #276
Hardware name: TOSHIBA TECRA A50-A/TECRA A50-A, BIOS Version 4.50   09/29/2014
Call Trace:
 <IRQ>
 dump_stack+0x63/0x89
 ___might_sleep+0xe9/0x130
 __might_sleep+0x4a/0x90
 kmem_cache_alloc_trace+0x19f/0x200
 ? rtl_c2hcmd_enqueue+0x3e/0x110 [rtlwifi]
 rtl_c2hcmd_enqueue+0x3e/0x110 [rtlwifi]
 rtl8723be_c2h_packet_handler+0xac/0xc0 [rtl8723be]
 rtl8723be_rx_command_packet+0x37/0x5c [rtl8723be]
 _rtl_pci_rx_interrupt+0x200/0x6b0 [rtl_pci]
 _rtl_pci_interrupt+0x20c/0x5d0 [rtl_pci]
 __handle_irq_event_percpu+0x3f/0x1d0
 handle_irq_event_percpu+0x23/0x60
 handle_irq_event+0x3c/0x60
 handle_fasteoi_irq+0xa2/0x170
 handle_irq+0x20/0x30
 do_IRQ+0x48/0xd0
 common_interrupt+0x89/0x89
...

Although commit cceb0a597320 converted most c2h commands to use a work
queue, the Bluetooth coexistence routines can be in atomic mode when
they execute such a call.

Fixes: cceb0a597320 ("rtlwifi: Add work queue for c2h cmd.")
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
---
Kalle,

This patch should be applied to kernel 4.11.

Thanks,

Larry
---
 drivers/net/wireless/realtek/rtlwifi/base.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c
index 07b4091..c55be12 100644
--- a/drivers/net/wireless/realtek/rtlwifi/base.c
+++ b/drivers/net/wireless/realtek/rtlwifi/base.c
@@ -1755,12 +1755,14 @@ void rtl_c2hcmd_enqueue(struct ieee80211_hw *hw, u8 tag, u8 len, u8 *val)
 	unsigned long flags;
 	struct rtl_c2hcmd *c2hcmd;
 
-	c2hcmd = kmalloc(sizeof(*c2hcmd), GFP_KERNEL);
+	c2hcmd = kmalloc(sizeof(*c2hcmd),
+			 in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
 
 	if (!c2hcmd)
 		goto label_err;
 
-	c2hcmd->val = kmalloc(len, GFP_KERNEL);
+	c2hcmd->val = kmalloc(len,
+			      in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
 
 	if (!c2hcmd->val)
 		goto label_err2;
-- 
2.10.2

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

* Re: [PATCH] rtlwifi: Fix scheduling while atomic splat
  2017-03-21 14:24 [PATCH] rtlwifi: Fix scheduling while atomic splat Larry Finger
@ 2017-03-21 17:32 ` Kalle Valo
  2017-03-30 16:43 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2017-03-21 17:32 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless, Ping-Ke Shih

Larry Finger <Larry.Finger@lwfinger.net> writes:

> Following commit cceb0a597320 ("rtlwifi: Add work queue for c2h cmd."),
> the following BUG is reported when rtl8723be is used:
>
> BUG: sleeping function called from invalid context at mm/slab.h:432
> in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/0
> CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W  O    4.11.0-rc3-wl+ #276
> Hardware name: TOSHIBA TECRA A50-A/TECRA A50-A, BIOS Version 4.50   09/29/2014
> Call Trace:
>  <IRQ>
>  dump_stack+0x63/0x89
>  ___might_sleep+0xe9/0x130
>  __might_sleep+0x4a/0x90
>  kmem_cache_alloc_trace+0x19f/0x200
>  ? rtl_c2hcmd_enqueue+0x3e/0x110 [rtlwifi]
>  rtl_c2hcmd_enqueue+0x3e/0x110 [rtlwifi]
>  rtl8723be_c2h_packet_handler+0xac/0xc0 [rtl8723be]
>  rtl8723be_rx_command_packet+0x37/0x5c [rtl8723be]
>  _rtl_pci_rx_interrupt+0x200/0x6b0 [rtl_pci]
>  _rtl_pci_interrupt+0x20c/0x5d0 [rtl_pci]
>  __handle_irq_event_percpu+0x3f/0x1d0
>  handle_irq_event_percpu+0x23/0x60
>  handle_irq_event+0x3c/0x60
>  handle_fasteoi_irq+0xa2/0x170
>  handle_irq+0x20/0x30
>  do_IRQ+0x48/0xd0
>  common_interrupt+0x89/0x89
> ...
>
> Although commit cceb0a597320 converted most c2h commands to use a work
> queue, the Bluetooth coexistence routines can be in atomic mode when
> they execute such a call.
>
> Fixes: cceb0a597320 ("rtlwifi: Add work queue for c2h cmd.")
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Ping-Ke Shih <pkshih@realtek.com>
> ---
> Kalle,
>
> This patch should be applied to kernel 4.11.

Ok, I'll queue this for 4.11.

-- 
Kalle Valo

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

* Re: rtlwifi: Fix scheduling while atomic splat
  2017-03-21 14:24 [PATCH] rtlwifi: Fix scheduling while atomic splat Larry Finger
  2017-03-21 17:32 ` Kalle Valo
@ 2017-03-30 16:43 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2017-03-30 16:43 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless, Larry Finger, Ping-Ke Shih

Larry Finger <Larry.Finger@lwfinger.net> wrote:
> Following commit cceb0a597320 ("rtlwifi: Add work queue for c2h cmd."),
> the following BUG is reported when rtl8723be is used:
> 
> BUG: sleeping function called from invalid context at mm/slab.h:432
> in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/0
> CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W  O    4.11.0-rc3-wl+ #276
> Hardware name: TOSHIBA TECRA A50-A/TECRA A50-A, BIOS Version 4.50   09/29/2014
> Call Trace:
>  <IRQ>
>  dump_stack+0x63/0x89
>  ___might_sleep+0xe9/0x130
>  __might_sleep+0x4a/0x90
>  kmem_cache_alloc_trace+0x19f/0x200
>  ? rtl_c2hcmd_enqueue+0x3e/0x110 [rtlwifi]
>  rtl_c2hcmd_enqueue+0x3e/0x110 [rtlwifi]
>  rtl8723be_c2h_packet_handler+0xac/0xc0 [rtl8723be]
>  rtl8723be_rx_command_packet+0x37/0x5c [rtl8723be]
>  _rtl_pci_rx_interrupt+0x200/0x6b0 [rtl_pci]
>  _rtl_pci_interrupt+0x20c/0x5d0 [rtl_pci]
>  __handle_irq_event_percpu+0x3f/0x1d0
>  handle_irq_event_percpu+0x23/0x60
>  handle_irq_event+0x3c/0x60
>  handle_fasteoi_irq+0xa2/0x170
>  handle_irq+0x20/0x30
>  do_IRQ+0x48/0xd0
>  common_interrupt+0x89/0x89
> ...
> 
> Although commit cceb0a597320 converted most c2h commands to use a work
> queue, the Bluetooth coexistence routines can be in atomic mode when
> they execute such a call.
> 
> Fixes: cceb0a597320 ("rtlwifi: Add work queue for c2h cmd.")
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless-drivers.git, thanks.

893dc68f1b18 rtlwifi: Fix scheduling while atomic splat

-- 
https://patchwork.kernel.org/patch/9636661/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

end of thread, other threads:[~2017-03-30 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21 14:24 [PATCH] rtlwifi: Fix scheduling while atomic splat Larry Finger
2017-03-21 17:32 ` Kalle Valo
2017-03-30 16:43 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.