Skip to contentSkip to conversation

Gadget regression with u_ether in Linux next

DISCUSSION Tony Lindgren 4 participants 4 messages Sep 16, 2016 – Sep 19, 2016 2 messages not in the archive USB

lore
Share & tools
lore
#0 lore raw

Hi,

Looks like commit c9ffc78745f8 ("usb: gadget: NCM: Protect dev->port_usb using dev->lock") causes hangs for me with Linux next.

Reverting c9ffc78745f8 makes the issues go away, some more info below.

Regards,

Tony

8< --------------------
With gadgets configured and after connecting the cable:

configfs-gadget gadget: high-speed config #1: c configfs-gadget gadget: init ecm
configfs-gadget gadget: notify connect false configfs-gadget gadget: reset acm ttyGS0 configfs-gadget gadget: activate acm ttyGS0
gserial_connect: start ttyGS0
configfs-gadget gadget: acm ttyGS0 serial state 0003 configfs-gadget gadget: notify speed 425984000 configfs-gadget gadget: activate ecm
usb0: qlen 10
configfs-gadget gadget: ecm_open
usb0: eth_start
configfs-gadget gadget: packet filter 0c configfs-gadget gadget: ecm req21.43 v000c i0000 l0 configfs-gadget gadget: acm ttyGS0 req21.20 v0000 i0002 l7
IPv6: ADDRCONF(NETDEV_CHANGE): usb0: link becomes ready configfs-gadget gadget: packet filter 0e configfs-gadget gadget: ecm req21.43 v000e i0000 l0 configfs-gadget gadget: notify connect true configfs-gadget gadget: notify speed 425984000

BUG: spinlock lockup suspected on CPU#0, swapper/0/0
 lock: 0xdd4f7e00, .magic: dead4ead, .owner: <none>/-1, .owner_cpu: -1
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.8.0-rc6-next-20160915+ #608
Hardware name: Generic OMAP36xx (Flattened Device Tree)
[<c01102c0>] (unwind_backtrace) from [<c010c41c>] (show_stack+0x10/0x14)
[<c010c41c>] (show_stack) from [<c048d01c>] (dump_stack+0xb0/0xe4)
[<c048d01c>] (dump_stack) from [<c0196b4c>] (do_raw_spin_lock+0x114/0x1b8)
[<c0196b4c>] (do_raw_spin_lock) from [<c07cc650>] (_raw_spin_lock_irqsave+0x40/0x4c)
[<c07cc650>] (_raw_spin_lock_irqsave) from [<bf046ff0>] (rx_submit+0x14/0x1a0 [u_ether])
[<bf046ff0>] (rx_submit [u_ether]) from [<bf01325c>] (usb_gadget_giveback_request+0x64/0)

[<bf01325c>] (usb_gadget_giveback_request [udc_core]) from [<bf1b85b8>] (musb_g_giveback) [<bf1b85b8>] (musb_g_giveback [musb_hdrc]) from [<bf1af160>] (musb_interrupt+0x174/0x30c) [<bf1af160>] (musb_interrupt [musb_hdrc]) from [<bf1dc664>] (omap2430_musb_interrupt+0x8) [<bf1dc664>] (omap2430_musb_interrupt [omap2430]) from [<c01a0950>] (__handle_irq_event_) [<c01a0950>] (__handle_irq_event_percpu) from [<c01a0cf0>] (handle_irq_event_percpu+0x1c) [<c01a0cf0>] (handle_irq_event_percpu) from [<c01a0d64>] (handle_irq_event+0x38/0x5c) [<c01a0d64>] (handle_irq_event) from [<c01a405c>] (handle_level_irq+0xb8/0x144) [<c01a405c>] (handle_level_irq) from [<c019fc84>] (generic_handle_irq+0x20/0x34) [<c019fc84>] (generic_handle_irq) from [<c01a01c8>] (__handle_domain_irq+0x64/0xdc) [<c01a01c8>] (__handle_domain_irq) from [<c07cce70>] (__irq_svc+0x70/0x98) [<c07cce70>] (__irq_svc) from [<c0618150>] (cpuidle_enter_state+0xb8/0x3c4) [<c0618150>] (cpuidle_enter_state) from [<c01869cc>] (cpu_startup_entry+0x130/0x220) [<c01869cc>] (cpu_startup_entry) from [<c0b00c0c>] (start_kernel+0x354/0x3c8) --
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to a message not in the archive
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Tony Lindgren

Hi,

Quoted 8 lines

Looks like commit c9ffc78745f8 ("usb: gadget: NCM: Protect dev->port_usb using dev->lock") causes hangs for me with Linux next.

Reverting c9ffc78745f8 makes the issues go away, some more info below.

Regards,

Tony

Sorry. There was a mistake with the commit. spinlock not acquired in if (dev->wrap) condition was also being tried to get unlocked.

Please revert/remove the commit.

Thanks,
Harish
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Acked-by Jim Baxter
#3 lore raw
In reply to a message not in the archive

Hi Greg,

Quoted 6 lines · Tony Lindgren

Hi,

Looks like commit c9ffc78745f8 ("usb: gadget: NCM: Protect dev->port_usb using dev->lock") causes hangs for me with Linux next.

Reverting c9ffc78745f8 makes the issues go away, some more info below.

Can you revert this commit from your tree?

Here's the full commit for reference:

commit c9ffc78745f89e300fe704348dd8e6800acf4d18

Author: Harish Jenny K N <[email protected]>
Date:   Fri Sep 9 11:30:42 2016 +0200

usb: gadget: NCM: Protect dev->port_usb using dev->lock

This commit incorporates findings from
https://lkml.org/lkml/2016/4/25/594

The function has been modified to make sure we hold the dev lock when accessing the net device pointer.

drivers/usb/gadget/function/u_ether.c +4 -2
index 9c8c9ed1dc9e..8cb08033b7c1 100644
@@ -553,14 +553,16 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
                spin_lock_irqsave(&dev->lock, flags);
                if (dev->port_usb)
                        skb = dev->wrap(dev->port_usb, skb);
-               spin_unlock_irqrestore(&dev->lock, flags);
                if (!skb) {
                        /* Multi frame CDC protocols may store the frame for
                         * later which is not a dropped frame.
                         */
                        if (dev->port_usb &&
-                                       dev->port_usb->supports_multi_frame)
+                                       dev->port_usb->supports_multi_frame) {
+                               spin_unlock_irqrestore(&dev->lock, flags);
                                goto multiframe;
+                       }
+                       spin_unlock_irqrestore(&dev->lock, flags);
                        goto drop;
                }
        }
Signature · 1 line
balbi
#5 lore raw
In reply to a message not in the archive
Quoted 24 lines · Felipe Balbi

Hi Greg,

Quoted 6 lines · Tony Lindgren

Hi,

Looks like commit c9ffc78745f8 ("usb: gadget: NCM: Protect dev->port_usb using dev->lock") causes hangs for me with Linux next.

Reverting c9ffc78745f8 makes the issues go away, some more info below.

Can you revert this commit from your tree?

Here's the full commit for reference:

commit c9ffc78745f89e300fe704348dd8e6800acf4d18

Author: Harish Jenny K N <[email protected]>
Date:   Fri Sep 9 11:30:42 2016 +0200

usb: gadget: NCM: Protect dev->port_usb using dev->lock

This commit incorporates findings from
https://lkml.org/lkml/2016/4/25/594

Quoted 6 lines

The function has been modified to make sure we hold the dev lock when accessing the net device pointer.

Now reverted, thanks.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html