Re: [PATCH] rt2x00usb: mark device removed when get ENOENT usb error
On 09/11/2017 11:59, Stanislaw Gruszka wrote: > ENOENT usb error mean "specified interface or endpoint does not exist or > is not enabled". Mark device not present when we encounter this error > similar like we do with ENODEV error. > > Otherwise we can have infinite loop in rt2x00usb_work_rxdone(), because > we remove and put again RX entries to the queue infinitely. > > We can have similar situation when submit urb will fail all the time > with other error, so we need consider to limit number of entries > processed by rxdone work. But for now, since the patch fixes > reproducible soft lockup issue on single processor systems > and taken ENOENT error meaning, let apply this fix. > > Patch adds additional ENOENT check not only in rx kick routine, but > also on other places where we check for ENODEV error. > > Reported-by: Richard Genoud <richard.gen...@gmail.com> > Debugged-by: Richard Genoud <richard.gen...@gmail.com> > Cc: sta...@vger.kernel.org > Signed-off-by: Stanislaw Gruszka <sgrus...@redhat.com> Tested-by: Richard Genoud <richard.gen...@gmail.com> (on 4.14-rc8) This is working like a charm now ! Thanks !! Richard. > --- > drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c > b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c > index e2f4f5778267..086aad22743d 100644 > --- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c > +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c > @@ -57,7 +57,7 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev, > if (status >= 0) > return 0; > > - if (status == -ENODEV) { > + if (status == -ENODEV || status == -ENOENT) { > /* Device has disappeared. */ > clear_bit(DEVICE_STATE_PRESENT, >flags); > break; > @@ -321,7 +321,7 @@ 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) > + if (status == -ENODEV || status == -ENOENT) > clear_bit(DEVICE_STATE_PRESENT, >flags); > set_bit(ENTRY_DATA_IO_FAILED, >flags); > rt2x00lib_dmadone(entry); > @@ -410,7 +410,7 @@ 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) > + if (status == -ENODEV || status == -ENOENT) > clear_bit(DEVICE_STATE_PRESENT, >flags); > set_bit(ENTRY_DATA_IO_FAILED, >flags); > rt2x00lib_dmadone(entry); >
Re: Soft lockup in rt2x00usb_work_rxdone()
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()
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()
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_tim
Re: Soft lockup in rt2x00usb_work_rxdone()
2017-11-07 9:53 GMT+01:00 Stanislaw Gruszka <sgrus...@redhat.com>: > 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
Soft lockup in rt2x00usb_work_rxdone()
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,
Re: [PATCH 4/4] Revert rt2x00: Endless loop on hub port power down
On 26/11/2014 15:29, Stanislaw Gruszka wrote: This reverts commit 2ad69ac5976191e9bb7dc4044204a504653ad1bb. It causes wireless device disappear when we get -EPROTO error form USB request. I encounter such situation occasionally when resume form suspend with RT3070 adapter: [ 289.619985] ieee80211 phy0: rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x0404 with error -71 [ 289.639368] ieee80211 phy0: rt2800_wait_bbp_ready: Error - BBP register access failed, aborting [ 289.639374] ieee80211 phy0: rt2800usb_set_device_state: Error - Device failed to enter state 4 (-5) Without the patch, except printing error, device works just fine after resume. Currently after timeouts and REGISTER_BUSY_COUNT tuning, we should not have any endless loop, though we can wait quite long when driver is trying to communicate with the device through non functioning USB connection. Generally the problem that commit 2ad69ac597619 solves is kinda artificial. Cc: Richard Genoud richard.gen...@gmail.com Signed-off-by: Stanislaw Gruszka sgrus...@redhat.com --- drivers/net/wireless/rt2x00/rt2x00usb.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index c2346f8..892270d 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c @@ -64,12 +64,6 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev, } } while (time_before(jiffies, expire)); - /* If the port is powered down, we get a -EPROTO error, and this - * leads to a endless loop. So just say that the device is gone. - */ - if (status == -EPROTO) - clear_bit(DEVICE_STATE_PRESENT, rt2x00dev-flags); - rt2x00_err(rt2x00dev, Vendor Request 0x%02x failed for offset 0x%04x with error %d\n, request, offset, status); It tested this serie but unfortunately, reverting this still caused an infinite loop. (cf https://lkml.org/lkml/2014/4/3/492 to reproduce) [ 642.007812] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.023437] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.031250] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.046875] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.054687] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.062500] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.078125] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.085937] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.101562] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.117187] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.125000] ieee80211 phy0: rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 4 in queue 0 [ 642.132812] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.25] ieee80211 phy0: rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x1700 with error -71 [ 642.359375] ieee80211 phy0: rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x0438 with error -71 [ 642.468750] ieee80211 phy0: rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x0438 with error -71 [ 642.476562] ieee80211 phy0: rt2800usb_watchdog: Warning - TX HW queue 1 timed out, invoke forced kick [ 642.585937] ieee80211 phy0: rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x0408 with error -71 [ 642.695312] ieee80211 phy0: rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x0408 with error -71 [ 642.718750] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.734375] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.742187] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.757812] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.765625] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.773437] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.789062] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.796875] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [ 642.812500
Re: [PATCH 4/4] Revert rt2x00: Endless loop on hub port power down
2014-12-02 13:15 GMT+01:00 Stanislaw Gruszka sgrus...@redhat.com: On Tue, Dec 02, 2014 at 12:17:57PM +0100, Richard Genoud wrote: It tested this serie but unfortunately, reverting this still caused an infinite loop. (cf https://lkml.org/lkml/2014/4/3/492 to reproduce) It is possible to disable internal hub? It fails here, but perhaps I do not have compiled proper options in the kernel: [stasiu@localhost Downloads]$ lsusb -t /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M |__ Port 3: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 12M |__ Port 4: Dev 4, If 0, Class=Vendor Specific Class, Driver=btusb, 12M |__ Port 4: Dev 4, If 1, Class=Vendor Specific Class, Driver=btusb, 12M |__ Port 4: Dev 4, If 2, Class=Vendor Specific Class, Driver=, 12M |__ Port 4: Dev 4, If 3, Class=Application Specific Interface, Driver=, 12M |__ Port 6: Dev 5, If 0, Class=Video, Driver=uvcvideo, 480M |__ Port 6: Dev 5, If 1, Class=Video, Driver=uvcvideo, 480M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M |__ Port 2: Dev 2, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M |__ Port 3: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M [stasiu@localhost Downloads]$ sudo ./hub-ctrl -b 1 -d 1 -P 1 -p 0 Device not found. [stasiu@localhost Downloads]$ sudo ./hub-ctrl -b 1 -d 2 -P 2 -p 0 Device not found. I've just tried on my machine, and it doesn't work on root_hub. root@lnx-rg:~$ lsusb -t /: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M |__ Port 3: Dev 2, If 0, Class=hub, Driver=hub/4p, 480M |__ Port 1: Dev 3, If 0, Class=HID, Driver=usbhid, 1.5M |__ Port 4: Dev 4, If 0, Class=vend., Driver=ftdi_sio, 12M /: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M |__ Port 4: Dev 2, If 0, Class=stor., Driver=usb-storage, 480M |__ Port 5: Dev 10, If 0, Class=hub, Driver=hub/4p, 480M |__ Port 1: Dev 11, If 0, Class=vend., Driver=rt2800usb, 480M |__ Port 6: Dev 12, If 0, Class=vend., Driver=rt2800usb, 480M /: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M root@lnx-rg:~$ /home/rgenoud/bin/hub-ctrl -b 7 -d 1 -P 6 -p 0 Device not found. but with an external hub: (not every usb hubs have individual port power management) root@lnx-rg:~$ lsusb -t /: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M |__ Port 3: Dev 2, If 0, Class=hub, Driver=hub/4p, 480M |__ Port 1: Dev 3, If 0, Class=HID, Driver=usbhid, 1.5M |__ Port 4: Dev 4, If 0, Class=vend., Driver=ftdi_sio, 12M /: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M |__ Port 4: Dev 2, If 0, Class=stor., Driver=usb-storage, 480M |__ Port 5: Dev 10, If 0, Class=hub, Driver=hub/4p, 480M |__ Port 1: Dev 11, If 0, Class=vend., Driver=rt2800usb, 480M /: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M root@lnx-rg:~$ /home/rgenoud/bin/hub-ctrl -b 7 -d 10 -P 1 -p 0 [ 642.476562] ieee80211 phy0: rt2800usb_watchdog: Warning - TX HW queue 1 timed out, invoke forced kick [ 642.585937] ieee80211 phy0: rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x0408 with error -71 [ 642.695312] ieee80211 phy0: rt2x00usb_vendor_request: Error - Vendor Request 0x06 failed for offset 0x0408 with error -71 [ 642.796875] ieee80211 phy0: rt2800usb_tx_sta_fifo_read_completed: Warning - TX status read failed -71 [...] So it seems the forced kick is not done Forced kick does not mean to remove device, it means restarting hardware queue. It is not done, because it requires write to PBF_CFG register (0x0408), which is not possible. I do not see an infinite loop. What I can see is continues failures when sending requests to to the hardware. I consider this as proper behaviour, taking that USB layer continuously return -EPROTO error. If for example there will be not possible to down interface or remove rt2800usb module in such condition, I would consider