Re: Soft lockup in rt2x00usb_work_rxdone()

2017-11-09 Thread Stanislaw Gruszka
On Wed, Nov 08, 2017 at 12:07:15PM +0100, Richard Genoud wrote:
> (maybe if there was more than one CPU on the board, I could do
> something, but that's not the case)

I reproduced the problem with nosmp option. I think we need
to check also for ENOENT error (not only for ENODEV).
Will post the fix in a second.

Thanks for reporting and debugging
Stanislaw 


Re: Soft lockup in rt2x00usb_work_rxdone()

2017-11-08 Thread Stanislaw Gruszka
On Wed, Nov 08, 2017 at 12:07:15PM +0100, Richard Genoud wrote:
> > No, that not I wanted you to do. Please remove those options and just
> > do
> > below on tracing directory.
> > 
> > echo 0 > tracing_on 
> > cat trace >  /dev/null
> > echo "function_graph" > current_tracer 
> > echo "rt2*" > set_ftrace_filter 
> > echo 1 > tracing_on
> > echo 1-2.2 > /sys/bus/usb/drivers/usb/unbind
> > echo 0 > tracing_on
> > cat trace > ~/trace.txt
> 
> Well, there's clearly a misunderstanding here :
> After the command "echo 1-2.2 > /sys/bus/usb/drivers/usb/unbind"
> I can't type *anything*
> The only thing I can do is plug off the board.
> This command never returns, so I can't stop the tracing...
> 
> Or I missed something ?
> 
> (maybe if there was more than one CPU on the board, I could do
> something, but that's not the case)

I was not aware that soft-lock up can hung the system.

Below patch should prevent/help with the issue. This is
not right fix, it's for futher debugging.

Regards
Stanislaw 

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c 
b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
index e2f4f5778267..d76ca608c722 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
@@ -321,8 +321,8 @@ static bool rt2x00usb_kick_tx_entry(struct queue_entry 
*entry, void *data)
 
status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
if (status) {
-   if (status == -ENODEV)
-   clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
+   printk("submit TX urb ERROR %d\n", status);
+   clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
rt2x00lib_dmadone(entry);
}
@@ -410,8 +410,8 @@ static bool rt2x00usb_kick_rx_entry(struct queue_entry 
*entry, void *data)
 
status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
if (status) {
-   if (status == -ENODEV)
-   clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
+   printk("submit RX urb ERROR %d\n", status);
+   clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
rt2x00lib_dmadone(entry);
}


Re: Soft lockup in rt2x00usb_work_rxdone()

2017-11-08 Thread Richard Genoud
Le mercredi 08 novembre 2017 à 11:37 +0100, Stanislaw Gruszka a écrit :
> On Tue, Nov 07, 2017 at 12:01:23PM +0100, Richard Genoud wrote:
> > Le mardi 07 novembre 2017 à 11:13 +0100, Stanislaw Gruszka a
> > écrit :
> > > On Tue, Nov 07, 2017 at 11:06:39AM +0100, Richard Genoud wrote:
> > > > > 3 short articles how to configure and use ftrace are here:
> > > > > https://lwn.net/Articles/365835/
> > > > > https://lwn.net/Articles/366796/
> > > > > https://lwn.net/Articles/370423/
> > > > > 
> > > > 
> > > > I tried with ftrace, but I don't think there's a way to dump
> > > > the
> > > > trace
> > > > when there's a soft lock-up
> > > > (I can't do anything after the unbind, even the heartbeat led
> > > > stopped blinking).
> > > > I saw the /proc/sys/kernel/ftrace_dump_on_oops file, but
> > > > there's no
> > > > /proc/sys/kernel/ftrace_dump_on_soft_lock-up file :)
> > > 
> > > You should configure function trace with rt2x* functions. After
> > > that
> > > start tracing, unbind the device, then stop tracing and provide
> > > trace
> > > output.
> > 
> > Ok, I found a way to display the trace (after the unbind, the board
> > is
> > frozen and I can't type anything).
> > Adding
> > CONFIG_SOFTLOCKUP_DETECTOR=y
> > CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
> > along with echo 1 > /proc/sys/kernel/ftrace_dump_on_oops does the
> > trick
> 
> No, that not I wanted you to do. Please remove those options and just
> do
> below on tracing directory.
> 
> echo 0 > tracing_on 
> cat trace >  /dev/null
> echo "function_graph" > current_tracer 
> echo "rt2*" > set_ftrace_filter 
> echo 1 > tracing_on
> echo 1-2.2 > /sys/bus/usb/drivers/usb/unbind
> echo 0 > tracing_on
> cat trace > ~/trace.txt

Well, there's clearly a misunderstanding here :
After the command "echo 1-2.2 > /sys/bus/usb/drivers/usb/unbind"
I can't type *anything*
The only thing I can do is plug off the board.
This command never returns, so I can't stop the tracing...

Or I missed something ?

(maybe if there was more than one CPU on the board, I could do
something, but that's not the case)

> 
> and provide trace.txt to me (can be in private email if big).
> 
> Thanks
> Stanislaw

Thanks,
Richard.


Re: Soft lockup in rt2x00usb_work_rxdone()

2017-11-08 Thread Stanislaw Gruszka
On Tue, Nov 07, 2017 at 12:13:47PM +0100, Richard Genoud wrote:
> Le mardi 07 novembre 2017 à 11:13 +0100, Stanislaw Gruszka a écrit :
> > On Tue, Nov 07, 2017 at 11:06:39AM +0100, Richard Genoud wrote:
> > > > 3 short articles how to configure and use ftrace are here:
> > > > https://lwn.net/Articles/365835/
> > > > https://lwn.net/Articles/366796/
> > > > https://lwn.net/Articles/370423/
> > > > 
> > > 
> > > I tried with ftrace, but I don't think there's a way to dump the
> > > trace
> > > when there's a soft lock-up
> > > (I can't do anything after the unbind, even the heartbeat led
> > > stopped blinking).
> > > I saw the /proc/sys/kernel/ftrace_dump_on_oops file, but there's no
> > > /proc/sys/kernel/ftrace_dump_on_soft_lock-up file :)
> > 
> > You should configure function trace with rt2x* functions. After that
> > start tracing, unbind the device, then stop tracing and provide trace
> > output.
> Here is another trace, with rt2* as function filter.
> (sorry for the noise)
> 
> Dumping ftrace buffer:
> -
> CPU:0 [LOST 3606923 EVENTS]
>  0)   0.000 us|  } /* rt2x00usb_clear_entry */
>  0)   0.000 us|} /* rt2x00lib_rxdone */
>  0)   0.000 us|rt2x00queue_get_entry();
>  0)   |rt2x00lib_rxdone() {
>  0)   0.000 us|  rt2x00queue_index_inc();
>  0)   |  rt2x00usb_clear_entry() {
>  0)   |rt2x00usb_kick_rx_entry() {

We do that only if: 

if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) &&
test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
rt2x00dev->ops->lib->clear_entry(entry);

so looks like DEVICE_STATE_PRESENT is not cleared. That mean
usb driver do not call disconnect callback on unbind. That seems
to be usb driver bug. Anyway please provide requested traces,
so I will see what happen.

Stanislaw


Re: Soft lockup in rt2x00usb_work_rxdone()

2017-11-08 Thread Stanislaw Gruszka
On Tue, Nov 07, 2017 at 12:01:23PM +0100, Richard Genoud wrote:
> Le mardi 07 novembre 2017 à 11:13 +0100, Stanislaw Gruszka a écrit :
> > On Tue, Nov 07, 2017 at 11:06:39AM +0100, Richard Genoud wrote:
> > > > 3 short articles how to configure and use ftrace are here:
> > > > https://lwn.net/Articles/365835/
> > > > https://lwn.net/Articles/366796/
> > > > https://lwn.net/Articles/370423/
> > > > 
> > > 
> > > I tried with ftrace, but I don't think there's a way to dump the
> > > trace
> > > when there's a soft lock-up
> > > (I can't do anything after the unbind, even the heartbeat led
> > > stopped blinking).
> > > I saw the /proc/sys/kernel/ftrace_dump_on_oops file, but there's no
> > > /proc/sys/kernel/ftrace_dump_on_soft_lock-up file :)
> > 
> > You should configure function trace with rt2x* functions. After that
> > start tracing, unbind the device, then stop tracing and provide trace
> > output.
> Ok, I found a way to display the trace (after the unbind, the board is
> frozen and I can't type anything).
> Adding
> CONFIG_SOFTLOCKUP_DETECTOR=y
> CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
> along with echo 1 > /proc/sys/kernel/ftrace_dump_on_oops does the trick

No, that not I wanted you to do. Please remove those options and just do
below on tracing directory.

echo 0 > tracing_on 
cat trace >  /dev/null
echo "function_graph" > current_tracer 
echo "rt2*" > set_ftrace_filter 
echo 1 > tracing_on
echo 1-2.2 > /sys/bus/usb/drivers/usb/unbind
echo 0 > tracing_on
cat trace > ~/trace.txt

and provide trace.txt to me (can be in private email if big).

Thanks
Stanislaw


Re: Soft lockup in rt2x00usb_work_rxdone()

2017-11-07 Thread Richard Genoud
Le mardi 07 novembre 2017 à 11:13 +0100, Stanislaw Gruszka a écrit :
> On Tue, Nov 07, 2017 at 11:06:39AM +0100, Richard Genoud wrote:
> > > 3 short articles how to configure and use ftrace are here:
> > > https://lwn.net/Articles/365835/
> > > https://lwn.net/Articles/366796/
> > > https://lwn.net/Articles/370423/
> > > 
> > 
> > I tried with ftrace, but I don't think there's a way to dump the
> > trace
> > when there's a soft lock-up
> > (I can't do anything after the unbind, even the heartbeat led
> > stopped blinking).
> > I saw the /proc/sys/kernel/ftrace_dump_on_oops file, but there's no
> > /proc/sys/kernel/ftrace_dump_on_soft_lock-up file :)
> 
> You should configure function trace with rt2x* functions. After that
> start tracing, unbind the device, then stop tracing and provide trace
> output.
Here is another trace, with rt2* as function filter.
(sorry for the noise)

Dumping ftrace buffer:
-
CPU:0 [LOST 3606923 EVENTS]
 0)   0.000 us|  } /* rt2x00usb_clear_entry */
 0)   0.000 us|} /* rt2x00lib_rxdone */
 0)   0.000 us|rt2x00queue_get_entry();
 0)   |rt2x00lib_rxdone() {
 0)   0.000 us|  rt2x00queue_index_inc();
 0)   |  rt2x00usb_clear_entry() {
 0)   |rt2x00usb_kick_rx_entry() {
 0)   |  rt2x00lib_dmastart() {
 0)   0.000 us|rt2x00queue_index_inc();
 0)   0.000 us|  }
 0)   |  rt2x00lib_dmadone() {
 0)   0.000 us|rt2x00queue_index_inc();
 0)   0.000 us|  }
 0)   0.000 us|}
 0)   0.000 us|  }
 0)   0.000 us|}
 0)   0.000 us|rt2x00queue_get_entry();
 0)   |rt2x00lib_rxdone() {
 0)   0.000 us|  rt2x00queue_index_inc();
 0)   |  rt2x00usb_clear_entry() {
 0)   |rt2x00usb_kick_rx_entry() {
 0)   |  rt2x00lib_dmastart() {
 0)   0.000 us|rt2x00queue_index_inc();
 0)   0.000 us|  }
 0)   |  rt2x00lib_dmadone() {
 0)   0.000 us|rt2x00queue_index_inc();
 0)   0.000 us|  }
 0)   0.000 us|}
 0)   0.000 us|  }
 0)   0.000 us|}
 0)   0.000 us|rt2x00queue_get_entry();
 0)   |rt2x00lib_rxdone() {
 0)   0.000 us|  rt2x00queue_index_inc();
 0)   |  rt2x00usb_clear_entry() {
 0)   |rt2x00usb_kick_rx_entry() {
 0)   |  rt2x00lib_dmastart() {
 0)   0.000 us|rt2x00queue_index_inc();
 0)   0.000 us|  }
 0)   |  rt2x00lib_dmadone() {
 0)   0.000 us|rt2x00queue_index_inc();
 0)   0.000 us|  }
 0)   0.000 us|}
 0)   0.000 us|  }
 0)   0.000 us|}

> 
> Thanks
> Stanislaw


Re: Soft lockup in rt2x00usb_work_rxdone()

2017-11-07 Thread Richard Genoud
Le mardi 07 novembre 2017 à 11:13 +0100, Stanislaw Gruszka a écrit :
> On Tue, Nov 07, 2017 at 11:06:39AM +0100, Richard Genoud wrote:
> > > 3 short articles how to configure and use ftrace are here:
> > > https://lwn.net/Articles/365835/
> > > https://lwn.net/Articles/366796/
> > > https://lwn.net/Articles/370423/
> > > 
> > 
> > I tried with ftrace, but I don't think there's a way to dump the
> > trace
> > when there's a soft lock-up
> > (I can't do anything after the unbind, even the heartbeat led
> > stopped blinking).
> > I saw the /proc/sys/kernel/ftrace_dump_on_oops file, but there's no
> > /proc/sys/kernel/ftrace_dump_on_soft_lock-up file :)
> 
> You should configure function trace with rt2x* functions. After that
> start tracing, unbind the device, then stop tracing and provide trace
> output.
Ok, I found a way to display the trace (after the unbind, the board is
frozen and I can't type anything).
Adding
CONFIG_SOFTLOCKUP_DETECTOR=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
along with echo 1 > /proc/sys/kernel/ftrace_dump_on_oops does the trick

(trace is after the stack dump)

# cd /sys/kernel/debug/tracing/
# echo 1 > /proc/sys/kernel/ftrace_dump_on_oops
# 
# echo rt2x00usb* > set_ftrace_filter
# echo 0 > tracing_on
# echo function > current_tracer
# echo 1 > tracing_on
# echo 1-2.2 > /sys/bus/usb/drivers/usb/unbind
[board frozen]
watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [kworker/u2:3:188]
CPU: 0 PID: 188 Comm: kworker/u2:3 Not tainted 4.14.0-rc8-00040-g53fb1fe423ba 
#13
Hardware name: Atmel AT91SAM9
Workqueue: phy0 rt2x00usb_work_rxdone
task: c7b34400 task.stack: c7b4e000
PC is at rb_commit+0x1a8/0x2e4
LR is at ring_buffer_unlock_commit+0x20/0xa4
pc : []lr : []psr: 8013
sp : c7b4fda8  ip :   fp : c7b4fdc4
r10: c664ee34  r9 : c7b2ed18  r8 : 6013
r7 : 001c4851  r6 : c780a0e0  r5 : c7319340  r4 : 8a48
r3 : c7319340  r2 : c664e000  r1 : 0e38  r0 : 0e24
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 0005317f  Table: 2727  DAC: 0053
CPU: 0 PID: 188 Comm: kworker/u2:3 Not tainted 4.14.0-rc8-00040-g53fb1fe423ba 
#13
Hardware name: Atmel AT91SAM9
Workqueue: phy0 rt2x00usb_work_rxdone
[] (unwind_backtrace) from [] (show_stack+0x20/0x24)
[] (show_stack) from [] (dump_stack+0x20/0x28)
[] (dump_stack) from [] (show_regs+0x1c/0x20)
[] (show_regs) from [] (watchdog_timer_fn+0x148/0x1ac)
[] (watchdog_timer_fn) from [] 
(hrtimer_run_queues+0x128/0x250)
[] (hrtimer_run_queues) from [] (run_local_timers+0x18/0x68)
[] (run_local_timers) from [] 
(update_process_times+0x38/0x6c)
[] (update_process_times) from [] 
(tick_nohz_handler+0xc0/0x10c)
[] (tick_nohz_handler) from [] (ch2_irq+0x30/0x38)
[] (ch2_irq) from [] (__handle_irq_event_percpu+0x74/0x1dc)
[] (__handle_irq_event_percpu) from [] 
(handle_irq_event_percpu+0x2c/0x68)
[] (handle_irq_event_percpu) from [] 
(handle_irq_event+0x38/0x4c)
[] (handle_irq_event) from [] 
(handle_fasteoi_irq+0xa0/0x114)
[] (handle_fasteoi_irq) from [] 
(generic_handle_irq+0x28/0x38)
[] (generic_handle_irq) from [] 
(__handle_domain_irq+0x90/0xb8)
[] (__handle_domain_irq) from [] (aic_handle+0xb0/0xb8)
[] (aic_handle) from [] (__irq_svc+0x68/0x84)
Exception stack(0xc7b4fd58 to 0xc7b4fda0)
fd40:   0e24 0e38
fd60: c664e000 c7319340 8a48 c7319340 c780a0e0 001c4851 6013 c7b2ed18
fd80: c664ee34 c7b4fdc4  c7b4fda8 c006d724 c006c694 8013 
[] (__irq_svc) from [] (rb_commit+0x1a8/0x2e4)
[] (rb_commit) from [] (ring_buffer_unlock_commit+0x20/0xa4)
[] (ring_buffer_unlock_commit) from [] 
(trace_function+0xe0/0xf0)
[] (trace_function) from [] (function_trace_call+0xbc/0x11c)
[] (function_trace_call) from [] (ftrace_graph_call+0x0/0xc)
[] (ftrace_graph_call) from [] 
(rt2x00usb_kick_rx_entry+0x14/0x118)
[] (rt2x00usb_kick_rx_entry) from [] 
(rt2x00usb_clear_entry+0x30/0x34)
[] (rt2x00usb_clear_entry) from [] 
(rt2x00lib_rxdone+0x58c/0x5b8)
[] (rt2x00lib_rxdone) from [] 
(rt2x00usb_work_rxdone+0x60/0x7c)
[] (rt2x00usb_work_rxdone) from [] 
(process_one_work+0x1e4/0x3a0)
[] (process_one_work) from [] (worker_thread+0x2c8/0x45c)
[] (worker_thread) from [] (kthread+0x114/0x130)
[] (kthread) from [] (ret_from_fork+0x14/0x2c)
Kernel panic - not syncing: softlockup: hung tasks
CPU: 0 PID: 188 Comm: kworker/u2:3 Tainted: G L  
4.14.0-rc8-00040-g53fb1fe423ba #13
Hardware name: Atmel AT91SAM9
Workqueue: phy0 rt2x00usb_work_rxdone
[] (unwind_backtrace) from [] (show_stack+0x20/0x24)
[] (show_stack) from [] (dump_stack+0x20/0x28)
[] (dump_stack) from [] (panic+0xc8/0x260)
[] (panic) from [] (watchdog_timer_fn+0x180/0x1ac)
[] (watchdog_timer_fn) from [] 
(hrtimer_run_queues+0x128/0x250)
[] (hrtimer_run_queues) from [] (run_local_timers+0x18/0x68)
[] (run_local_timers) from [] 
(update_process_times+0x38/0x6c)
[] (update_process_times) from [] 
(tick_nohz_handler+0xc0/0x10c)
[] (tick_nohz_handler) from [] (ch2_irq+0x30/0x38)
[] (ch2_irq

Re: Soft lockup in rt2x00usb_work_rxdone()

2017-11-07 Thread Stanislaw Gruszka

On Tue, Nov 07, 2017 at 11:06:39AM +0100, Richard Genoud wrote:
> > 3 short articles how to configure and use ftrace are here:
> > https://lwn.net/Articles/365835/
> > https://lwn.net/Articles/366796/
> > https://lwn.net/Articles/370423/
> >
> I tried with ftrace, but I don't think there's a way to dump the trace
> when there's a soft lock-up
> (I can't do anything after the unbind, even the heartbeat led stopped 
> blinking).
> I saw the /proc/sys/kernel/ftrace_dump_on_oops file, but there's no
> /proc/sys/kernel/ftrace_dump_on_soft_lock-up file :)

You should configure function trace with rt2x* functions. After that
start tracing, unbind the device, then stop tracing and provide trace
output.

Thanks
Stanislaw


Re: Soft lockup in rt2x00usb_work_rxdone()

2017-11-07 Thread Richard Genoud
2017-11-07 9:53 GMT+01:00 Stanislaw Gruszka :
> Hi
Hi !
>
> On Mon, Nov 06, 2017 at 04:57:09PM +0100, Richard Genoud wrote:
>> I get a soft lock-up while unbinding the USB driver on a TP-Link TL-WN727Nv3 
>> (chipset 5370):
>>
>> # echo 1-2.2 > /sys/bus/usb/drivers/usb/unbind
>> watchdog: BUG: soft lockup - CPU#0 stuck for 23s! [kworker/u2:3:308]
> ...
>> I can trigger this each time.
>
> I can not reproduce this on my system (I'm using 4.14.0-rc6, but I don't
> think it's an issue). I think the problem may be caused by usb
> host controler driver, which can be different on your system.
>
> Does ftrace work on your platform ? If so could you use ftrace
> to provide rt2x00 functions trace when the  probllem happen ?
>
> 3 short articles how to configure and use ftrace are here:
> https://lwn.net/Articles/365835/
> https://lwn.net/Articles/366796/
> https://lwn.net/Articles/370423/
>
I tried with ftrace, but I don't think there's a way to dump the trace
when there's a soft lock-up
(I can't do anything after the unbind, even the heartbeat led stopped blinking).
I saw the /proc/sys/kernel/ftrace_dump_on_oops file, but there's no
/proc/sys/kernel/ftrace_dump_on_soft_lock-up file :)

Or I missed something in ftrace ?

Thanks !
Richard.

> Thanks
> Stanislaw


Re: Soft lockup in rt2x00usb_work_rxdone()

2017-11-07 Thread Stanislaw Gruszka
Hi

On Mon, Nov 06, 2017 at 04:57:09PM +0100, Richard Genoud wrote:
> I get a soft lock-up while unbinding the USB driver on a TP-Link TL-WN727Nv3 
> (chipset 5370):
> 
> # echo 1-2.2 > /sys/bus/usb/drivers/usb/unbind
> watchdog: BUG: soft lockup - CPU#0 stuck for 23s! [kworker/u2:3:308]
...
> I can trigger this each time.

I can not reproduce this on my system (I'm using 4.14.0-rc6, but I don't
think it's an issue). I think the problem may be caused by usb
host controler driver, which can be different on your system.

Does ftrace work on your platform ? If so could you use ftrace
to provide rt2x00 functions trace when the  probllem happen ? 

3 short articles how to configure and use ftrace are here:
https://lwn.net/Articles/365835/
https://lwn.net/Articles/366796/
https://lwn.net/Articles/370423/

Thanks
Stanislaw


Soft lockup in rt2x00usb_work_rxdone()

2017-11-06 Thread Richard Genoud
Hi,

I get a soft lock-up while unbinding the USB driver on a TP-Link TL-WN727Nv3 
(chipset 5370):

# echo 1-2.2 > /sys/bus/usb/drivers/usb/unbind
watchdog: BUG: soft lockup - CPU#0 stuck for 23s! [kworker/u2:3:308]
CPU: 0 PID: 308 Comm: kworker/u2:3 Not tainted 4.14.0-rc8 #11
Hardware name: Atmel AT91SAM9
Workqueue: phy0 rt2x00usb_work_rxdone
task: c7b91000 task.stack: c7bee000
PC is at rt2x00lib_rxdone+0x590/0x5b8
LR is at rt2x00lib_dmadone+0x54/0x58
pc : []lr : []psr: 8013
sp : c7befebc  ip : 0052  fp : c7befee4
r10:   r9 : c79b2b58  r8 : 
r7 : c7816d00  r6 : c780e200  r5 : c79c68dc  r4 : c7134ce0
r3 : 0001  r2 : c70bc200  r1 : a55f  r0 : 
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 0005317f  Table: 261b8000  DAC: 0053
CPU: 0 PID: 308 Comm: kworker/u2:3 Not tainted 4.14.0-rc8 #11
Hardware name: Atmel AT91SAM9
Workqueue: phy0 rt2x00usb_work_rxdone
[] (unwind_backtrace) from [] (show_stack+0x20/0x24)
[] (show_stack) from [] (dump_stack+0x20/0x28)
[] (dump_stack) from [] (show_regs+0x1c/0x20)
[] (show_regs) from [] (watchdog_timer_fn+0x148/0x1ac)
[] (watchdog_timer_fn) from [] 
(hrtimer_run_queues+0x128/0x250)
[] (hrtimer_run_queues) from [] (run_local_timers+0x18/0x68)
[] (run_local_timers) from [] 
(update_process_times+0x38/0x6c)
[] (update_process_times) from [] 
(tick_nohz_handler+0xc0/0x10c)
[] (tick_nohz_handler) from [] (ch2_irq+0x30/0x38)
[] (ch2_irq) from [] (__handle_irq_event_percpu+0x74/0x1dc)
[] (__handle_irq_event_percpu) from [] 
(handle_irq_event_percpu+0x2c/0x68)
[] (handle_irq_event_percpu) from [] 
(handle_irq_event+0x38/0x4c)
[] (handle_irq_event) from [] 
(handle_fasteoi_irq+0xa0/0x114)
[] (handle_fasteoi_irq) from [] 
(generic_handle_irq+0x28/0x38)
[] (generic_handle_irq) from [] 
(__handle_domain_irq+0x90/0xb8)
[] (__handle_domain_irq) from [] (aic_handle+0xb0/0xb8)
[] (aic_handle) from [] (__irq_svc+0x68/0x84)
Exception stack(0xc7befe68 to 0xc7befeb0)
fe60:    a55f c70bc200 0001 c7134ce0 c79c68dc
fe80: c780e200 c7816d00  c79b2b58  c7befee4 0052 c7befebc
fea0: c0331fdc c0332978 8013 
[] (__irq_svc) from [] (rt2x00lib_rxdone+0x590/0x5b8)
[] (rt2x00lib_rxdone) from [] 
(rt2x00usb_work_rxdone+0x60/0x7c)
[] (rt2x00usb_work_rxdone) from [] 
(process_one_work+0x1e4/0x3a0)
[] (process_one_work) from [] (worker_thread+0x2c8/0x45c)
[] (worker_thread) from [] (kthread+0x114/0x130)
[] (kthread) from [] (ret_from_fork+0x14/0x2c)

I can trigger this each time.

NB: if the wifi is deactivated properly before the unbind, there's no problem :

# ifconfig wlan0 down ; echo 1-2.2 > /sys/bus/usb/drivers/usb/unbind
wlan0: deauthenticating from 06:18:d6:91:9e:29 by local choice (Reason: 
3=DEAUTH_LEAVING)



Full dmesg:
 
## Booting kernel from Legacy Image at 20007fc0 ...
   Image Name:   Linux-4.14.0-rc8
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:4522192 Bytes = 4.3 MiB
   Load Address: 20008000
   Entry Point:  20008000
## Flattened Device Tree blob at 2640
   Booting using the fdt blob at 0x2640
   XIP Kernel Image ... OK
   Loading Device Tree to 27df2000, end 27dfcbb3 ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.14.0-rc8 (rgenoud@lnx-rg) (gcc version 4.7.3 (GCC)) #11 Mon Nov 
6 16:22:49 CET 2017
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
CPU: VIVT data cache, VIVT instruction cache
OF: fdt: Machine model: Paratronic LNS
Memory policy: Data cache writeback
On node 0 totalpages: 32768
free_area_init_node: node 0, pgdat c08a4b78, node_mem_map c7efb000
  Normal zone: 256 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 32768 pages, LIFO batch:7
random: fast init done
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0 
Built 1 zonelists, mobility grouping on.  Total pages: 32512
Kernel command line: loglevel=8 ro root=ubi0:rootfs rootfstype=ubifs 
ubi.mtd=ubi lpj=995328 ubi.fm_autoconvert=1 panic=2 
mtdparts=atmel_nand:256M(all),128k@0(dtb),10112k(kernel),251392k(ubi),512k(bbt)ro
 atmel-nand-controller.use_dma=0 spidev.bufsiz=53200 video=320x240-32
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 120624K/131072K available (5847K kernel code, 475K rwdata, 1504K 
rodata, 480K init, 245K bss, 10448K reserved, 0K cma-reserved)
Virtual kernel memory layout:
vector  : 0x - 0x1000   (   4 kB)
fixmap  : 0xffc0 - 0xfff0   (3072 kB)
vmalloc : 0xc880 - 0xff80   ( 880 MB)
lowmem  : 0xc000 - 0xc800   ( 128 MB)
  .text : 0xc0008000 - 0xc05be200   (5849 kB)
  .init : 0xc07be000 - 0xc0836000   ( 480 kB)
  .data : 0xc0836000 - 0xc08accd0   ( 476 kB)
   .bss : 0xc08b20e8 - 0xc08ef77c   ( 246 kB)
ftrace: allocating 23621 entries in 70 pages
NR_IRQS: 16, nr_