Regression in net2280 locking
Hello, I use a 'USB controller: PLX Technology, Inc. Device 3380 (rev ab)' for a custom usb gadget. With a more recent kernel (4.12+) the cpu hangs and the gadget device is not functioning at all. I used git-bisect and a basic test gadget from the kernel tree (tools/usb/ffs-aio-example/simple/device_app/aio_simple.c) to find the first bad commit: f16443a034c7aa359ddf6f0f9bc40d01ca31faea The bug still occurs with 4.18.0-rc7+. Steps to reproduce: 1. Compile and run the testtool 'tools/usb/ffs-aio-example/simple/device_app/aio_simple.c' 2. Connect with a host system 3. Disconnect from host system 4. Kernel suffers CPU lockups Shell output: --- $ ./a.out /dev/usb_gadget/aio_simple_gadget Event Bind Event Enable <- connected to host submit: in submit: out Event Suspend <- disconnected from host ---hangs--- <- Event Disable is missing --- Dmesg: --- Sending NMI from CPU 0 to CPUs 1: NMI backtrace for cpu 1 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.18.0-rc7+ #1 Hardware name: To be filled by O.E.M. To be filled by O.E.M./'TA32', BIOS TA32R020 03/25/2015 RIP: 0010:native_queued_spin_lock_slowpath+0x149/0x1c0 Code: eb e5 8b 0f 89 ca 89 c8 80 ce 01 f0 0f b1 17 0f 94 c2 84 d2 74 7b f7 c1 00 ff ff ff 75 48 85 c9 74 0e 8b 07 84 c0 74 08 f3 90 <8b> 07 84 c0 75 f8 b8 01 00 00 00 66 89 07 c3 8b 17 b8 00 02 00 00 RSP: 0018:95c579083d88 EFLAGS: 0002 RAX: 0101 RBX: 0083 RCX: 0001 RDX: 0101 RSI: RDI: 95c575f38358 RBP: 95c575f38400 R08: R09: R10: 95c579083c10 R11: 0006 R12: R13: 95c536844c10 R14: 0086 R15: FS: () GS:95c57908() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 562f27fc38bc CR3: 1a00a000 CR4: 001006e0 Call Trace: _raw_spin_lock_irqsave+0x32/0x40 net2280_disable+0x3f/0xe0 [net2280] usb_ep_disable+0x79/0x90 [udc_core] ffs_func_eps_disable.isra.16+0x4e/0x90 [usb_f_fs] ffs_func_set_alt+0x96/0x2c0 [usb_f_fs] ? scan_dma_completions+0xd6/0x1d0 [net2280] reset_config+0x38/0xa0 [libcomposite] composite_disconnect+0x31/0x60 [libcomposite] stop_activity+0x5c/0x80 [net2280] net2280_irq+0xb7/0x11c0 [net2280] __handle_irq_event_percpu+0x81/0x1a0 handle_irq_event_percpu+0x30/0x80 handle_irq_event+0x3c/0x60 handle_edge_irq+0x94/0x1f0 handle_irq+0x1f/0x30 do_IRQ+0x41/0xd0 common_interrupt+0xf/0xf RIP: 0010:cpuidle_enter_state+0x10d/0x270 Code: e8 f8 fd b2 ff 44 8b 6b 04 49 89 c7 0f 1f 44 00 00 31 ff e8 95 08 b3 ff 80 7c 24 07 00 0f 85 de 00 00 00 fb 66 0f 1f 44 00 00 <4d> 29 f7 48 ba cf f7 53 e3 a5 9b c4 20 4c 89 f8 4d 89 fc 48 f7 ea RSP: 0018:a10e80393e88 EFLAGS: 0246 ORIG_RAX: ffdb RAX: 95c5790a20c0 RBX: 95c5790aa200 RCX: 001f RDX: RSI: 00dcb565c18b RDI: RBP: 0003 R08: fffbe16f1f40 R09: 006f1db87e00 R10: 04ed R11: 95c5790a0fe8 R12: a6cbf580 R13: 0001 R14: 006f14016b16 R15: 006f140e6066 ? cpuidle_enter_state+0xfb/0x270 do_idle+0x226/0x2a0 cpu_startup_entry+0x6f/0x80 start_secondary+0x1a4/0x200 secondary_startup_64+0xa5/0xb0 INFO: rcu_sched detected stalls on CPUs/tasks: 1-...0: (2 GPs behind) idle=3de/0/1 softirq=7741/7742 fqs=10502 (detected by 0, t=21007 jiffies, g=6361, c=6360, q=905) --- Architecture: x86-64 Kernel Version: 4.18.0-rc7+ build from master Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb/dwc3: Fix spelling of 'optimizations'
'optimizations' was misspelled as 'optmization'. Fixed it. It is a coding style change which should have no impact on runtime execution of code. Signed-off-by: Faisal Mehmood --- drivers/usb/dwc3/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 103807587dc6..ab90f680deed 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -748,7 +748,7 @@ static void dwc3_core_setup_global_control(struct dwc3 *dwc) /* check if current dwc3 is on simulation board */ if (dwc->hwparams.hwparams6 & DWC3_GHWPARAMS6_EN_FPGA) { - dev_info(dwc->dev, "Running with FPGA optmizations\n"); + dev_info(dwc->dev, "Running with FPGA optimizations\n"); dwc->is_fpga = true; } -- 2.18.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Strange bug with Prodipe MIDI 49C USB
Hello, I just bought a midi keyboard Prodipe MIDI 49C USB for use within linux Rosegarden and LMMS. When I plug it in, nothing happen, no keyboard appears in software or in lsusb. Changing USB cable did nothing. The keyboard work fine with W7 32b and 64b and with W10 64b with Rosegarden and LMMS too. It is detected as "Worlde Controller KS49". In dmesg, I found that the keyboard is detected and disconnected again and again. I've done some tests with: Acer D150 Atom270 2Gb XUbuntu 32b 4.15.0-29-generic. Acer D150 Atom270 2Gb KXstudio 32b 3.13.0-19-lowlatency. Lenovo I5 3320 4Gb Xubuntu 64b 4.15.0-29-generic. AMD 5050e 8Gb Xubuntu 64b 4.15.0-29-generic. This is a part of dmesg: [ 805.156100] usb usb1-port8: Cannot enable. Maybe the USB cable is bad? [ 805.156122] usb usb1-port8: unable to enumerate USB device [ 805.468061] usb 5-2: new full-speed USB device number 72 using ohci-pci [ 805.669060] usb 5-2: New USB device found, idVendor=0218, idProduct=0201 [ 805.669064] usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 805.669065] usb 5-2: Product: WORLDE Controller KS49 [ 805.669067] usb 5-2: Manufacturer: WORLDE [ 805.684743] usb 5-2: USB disconnect, device number 72 [ 806.248086] usb 5-2: new full-speed USB device number 73 using ohci-pci [ 806.444267] usb 5-2: New USB device found, idVendor=0218, idProduct=0201 [ 806.444271] usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 806.444273] usb 5-2: Product: WORLDE Controller KS49 [ 806.444274] usb 5-2: Manufacturer: WORLDE [ 806.459697] usb 5-2: USB disconnect, device number 73 [ 807.080059] usb 5-2: new full-speed USB device number 74 using ohci-pci [ 807.279738] usb 5-2: New USB device found, idVendor=0218, idProduct=0201 [ 807.279742] usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 807.279744] usb 5-2: Product: WORLDE Controller KS49 [ 807.279746] usb 5-2: Manufacturer: WORLDE [ 807.297581] usb 5-2: USB disconnect, device number 74 [ 807.560239] usb usb1-port8: attempt power cycle ... I just add some lines in quirks.c from Prodipe 25 but with the Prodipe 49 device ID. file: /drivers/usb/core/quirks.c line 185 /* WORLDE easy key (easykey.49) MIDI controller */ { USB_DEVICE(0x0218, 0x0201), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, It work well now. Test with Kernel 4.17.13 and 4.15 Possible to add this in kernel sources ? Best regards.
Re: [PATCH 6/7] usb: gadget: f_uac2: disable IN/OUT ep if unused
Hello Felipe, On Fri, Jul 27, 2018 at 08:57:29PM +0200, Eugeniu Rosca wrote: > Hi Felipe, > > On Thu, Jul 26, 2018 at 01:51:35PM +0300, Felipe Balbi wrote: > > Eugeniu Rosca writes: > > > > > From: Andreas Pape > > > > > > Via p_chmask/c_chmask the user can define whether uac2 shall support > > > playback and/or capture. This has only effect on the created ALSA device, > > > but not on the USB descriptor. This patch adds playback/capture > > > descriptors > > > dependent on that parameter. > > > > > > Signed-off-by: Andreas Pape > > > Signed-off-by: Eugeniu Rosca > > > > unfortunately doesn't apply: > > > > checking file drivers/usb/gadget/function/f_uac2.c > > Hunk #13 FAILED at 678. > > 1 out of 14 hunks FAILED > > > > Please rebase on testing/next after a couple hours > > I've checked the reason for which you are experiencing the conflict and > what I can see is that your testing/next branch [1] (currently based on > v4.18-rc6) lacks two uac2 fixes which already reached vanilla master via > v4.18-rc6+ merge commit [2]: > > $ git log --oneline --right-only --cherry-pick \ > balbi/testing/next..linux/master drivers/usb/gadget/function/f_uac2.c > eec24f2a0d4d usb: gadget: f_uac2: fix endianness of 'struct cntrl_*_lay3' > e87581fe0509 usb: gadget: f_uac2: fix error handling in afunc_bind (again) > > So, the conflicts are caused by an older state of testing/next > relative to mainline. If I rebase [3] on top of [1], you will then face > additional conflicts when rebasing [1] on top of v4.18. > > Let me know if we are on the same page. > > Best regards, > Eugeniu. > > [1] > https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git/log/?h=testing/next > [2] > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cd3f77d74ac3 > [3] https://patchwork.kernel.org/patch/10480073/ I can see that the testing/next branch is still based on v4.18-rc6. Could you please feedback if you are going to rebase it to a later -rc, so that patch "[6/7] usb: gadget: f_uac2: disable IN/OUT ep if unused" from my series applies without conflicts? Thank you very much. Best regards, Eugeniu. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Strange bug with Prodipe MIDI 49C USB
On Tue, Aug 07, 2018 at 05:50:21PM +, Maxence Duprès wrote: > > > Hello, > > I just bought a midi keyboard Prodipe MIDI 49C USB for use within linux > Rosegarden and LMMS. > When I plug it in, nothing happen, no keyboard appears in software or in > lsusb. Changing USB cable did nothing. > > The keyboard work fine with W7 32b and 64b and with W10 64b with > Rosegarden and LMMS too. It is detected as "Worlde Controller KS49". > > In dmesg, I found that the keyboard is detected and disconnected again > and again. > > I've done some tests with: > Acer D150 Atom270 2Gb XUbuntu 32b 4.15.0-29-generic. > Acer D150 Atom270 2Gb KXstudio 32b 3.13.0-19-lowlatency. > Lenovo I5 3320 4Gb Xubuntu 64b 4.15.0-29-generic. > AMD 5050e 8Gb Xubuntu 64b 4.15.0-29-generic. > > This is a part of dmesg: > [ 805.156100] usb usb1-port8: Cannot enable. Maybe the USB cable is bad? > [ 805.156122] usb usb1-port8: unable to enumerate USB device > [ 805.468061] usb 5-2: new full-speed USB device number 72 using ohci-pci > [ 805.669060] usb 5-2: New USB device found, idVendor=0218, idProduct=0201 > [ 805.669064] usb 5-2: New USB device strings: Mfr=1, Product=2, > SerialNumber=0 > [ 805.669065] usb 5-2: Product: WORLDE Controller KS49 > [ 805.669067] usb 5-2: Manufacturer: WORLDE > [ 805.684743] usb 5-2: USB disconnect, device number 72 > [ 806.248086] usb 5-2: new full-speed USB device number 73 using ohci-pci > [ 806.444267] usb 5-2: New USB device found, idVendor=0218, idProduct=0201 > [ 806.444271] usb 5-2: New USB device strings: Mfr=1, Product=2, > SerialNumber=0 > [ 806.444273] usb 5-2: Product: WORLDE Controller KS49 > [ 806.444274] usb 5-2: Manufacturer: WORLDE > [ 806.459697] usb 5-2: USB disconnect, device number 73 > [ 807.080059] usb 5-2: new full-speed USB device number 74 using ohci-pci > [ 807.279738] usb 5-2: New USB device found, idVendor=0218, idProduct=0201 > [ 807.279742] usb 5-2: New USB device strings: Mfr=1, Product=2, > SerialNumber=0 > [ 807.279744] usb 5-2: Product: WORLDE Controller KS49 > [ 807.279746] usb 5-2: Manufacturer: WORLDE > [ 807.297581] usb 5-2: USB disconnect, device number 74 > [ 807.560239] usb usb1-port8: attempt power cycle > > ... > > I just add some lines in quirks.c from Prodipe 25 but with the Prodipe > 49 device ID. > > file: /drivers/usb/core/quirks.c line 185 > > /* WORLDE easy key (easykey.49) MIDI controller */ > { USB_DEVICE(0x0218, 0x0201), .driver_info = > USB_QUIRK_CONFIG_INTF_STRINGS }, > > It work well now. Test with Kernel 4.17.13 and 4.15 > > Possible to add this in kernel sources ? Sure, care to make up a patch for this so that we can properly credit you with the authorship of it? thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Should usb_gadget_disconnect() call driver's ->disconnect?
Felipe: The documentation doesn't state whether a gadget driver's ->disconnect() callback will be invoked when usb_gadget_disconnect() runs. Probably the UDC drivers' behavior has changed over the years. In any case, it's likely that various UDC drivers do behave differently. My current feeling is that ->disconnect() should be invoked only when Vbus turns off, but I can't guarantee that all UDCs will do this. How do you feel about documenting this ambiguity as in the patch below? If you think this is okay, I'll submit it formally. Alan Stern Index: usb-4.x/drivers/usb/gadget/udc/core.c === --- usb-4.x.orig/drivers/usb/gadget/udc/core.c +++ usb-4.x/drivers/usb/gadget/udc/core.c @@ -672,6 +672,10 @@ EXPORT_SYMBOL_GPL(usb_gadget_connect); * as a disconnect (when a VBUS session is active). Not all systems * support software pullup controls. * + * Whether or not the gadget driver's ->disconnect() callback will be + * invoked is undefined. Gadget drivers should be prepared for either + * possibility. + * * Returns zero on success, else negative errno. */ int usb_gadget_disconnect(struct usb_gadget *gadget) -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Regression in net2280 locking
On Tue, 7 Aug 2018, D. Ziesche wrote: > Hello, > > I use a 'USB controller: PLX Technology, Inc. Device 3380 (rev ab)' for > a custom usb gadget. > With a more recent kernel (4.12+) the cpu hangs and the gadget device is > not functioning at all. > > I used git-bisect and a basic test gadget from the kernel tree > (tools/usb/ffs-aio-example/simple/device_app/aio_simple.c) to find the > first > bad commit: f16443a034c7aa359ddf6f0f9bc40d01ca31faea > The bug still occurs with 4.18.0-rc7+. > > Steps to reproduce: > 1. Compile and run the testtool > 'tools/usb/ffs-aio-example/simple/device_app/aio_simple.c' > 2. Connect with a host system > 3. Disconnect from host system > 4. Kernel suffers CPU lockups > > Shell output: > --- > $ ./a.out /dev/usb_gadget/aio_simple_gadget > Event Bind > Event Enable <- connected to host > submit: in > submit: out > Event Suspend <- disconnected from host > ---hangs--- <- Event Disable is missing > --- Yes, I see the problem. Commit f16443a034c7 was wrong in several respects. One was fixed later in commit 7dbd8f4cabd9, but the problem in net2280 remained. I think the patch below (which is mostly a reversion of the relevant parts of f16443a034c7) should fix it. Can you please test the patch and let me know? Alan Stern Index: usb-4.x/drivers/usb/gadget/udc/net2280.c === --- usb-4.x.orig/drivers/usb/gadget/udc/net2280.c +++ usb-4.x/drivers/usb/gadget/udc/net2280.c @@ -1545,7 +1545,7 @@ static int net2280_pullup(struct usb_gad writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl); } else { writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl); - stop_activity(dev, dev->driver); + stop_activity(dev, NULL); } spin_unlock_irqrestore(&dev->lock, flags); @@ -2466,8 +2466,11 @@ static void stop_activity(struct net2280 nuke(&dev->ep[i]); /* report disconnect; the driver is already quiesced */ - if (driver) + if (driver) { + spin_unlock(&dev->lock); driver->disconnect(&dev->gadget); + spin_lock(&dev->lock); + } usb_reinit(dev); } @@ -3381,12 +3384,14 @@ static void handle_stat1_irqs(struct net if (disconnect || reset) { stop_activity(dev, dev->driver); ep0_start(dev); + spin_unlock(&dev->lock); if (reset) usb_gadget_udc_reset (&dev->gadget, dev->driver); else (dev->driver->disconnect) (&dev->gadget); + spin_lock(&dev->lock); return; } } -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Strange bug with Prodipe MIDI 49C USB
This is a proposed patch for KS49. The original patch for KS25: https://lore.kernel.org/patchwork/patch/753077/ About the authorship, I don't know what it is. My real name is Roux Laurent. diff -Naur 1/drivers/usb/core/quirks.c 2/drivers/usb/core/quirks.c --- 1/drivers/usb/core/quirks.c 2018-08-06 16:18:22.0 +0200 +++ 2/drivers/usb/core/quirks.c 2018-08-07 22:22:03.868499000 +0200 @@ -182,6 +182,10 @@ { USB_DEVICE(0x0218, 0x0401), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + /* WORLDE Controller KS49 or Prodipe MIDI 49C USB controller */ + { USB_DEVICE(0x0218, 0x0201), .driver_info = + USB_QUIRK_CONFIG_INTF_STRINGS }, + /* HP 5300/5370C scanner */ { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, Le 07/08/2018 à 20:57, Greg KH a écrit : > On Tue, Aug 07, 2018 at 05:50:21PM +, Maxence Duprès wrote: >> >> >> Hello, >> >> I just bought a midi keyboard Prodipe MIDI 49C USB for use within linux >> Rosegarden and LMMS. >> When I plug it in, nothing happen, no keyboard appears in software or in >> lsusb. Changing USB cable did nothing. >> >> The keyboard work fine with W7 32b and 64b and with W10 64b with >> Rosegarden and LMMS too. It is detected as "Worlde Controller KS49". >> >> In dmesg, I found that the keyboard is detected and disconnected again >> and again. >> >> I've done some tests with: >> Acer D150 Atom270 2Gb XUbuntu 32b 4.15.0-29-generic. >> Acer D150 Atom270 2Gb KXstudio 32b 3.13.0-19-lowlatency. >> Lenovo I5 3320 4Gb Xubuntu 64b 4.15.0-29-generic. >> AMD 5050e 8Gb Xubuntu 64b 4.15.0-29-generic. >> >> This is a part of dmesg: >> [ 805.156100] usb usb1-port8: Cannot enable. Maybe the USB cable is bad? >> [ 805.156122] usb usb1-port8: unable to enumerate USB device >> [ 805.468061] usb 5-2: new full-speed USB device number 72 using ohci-pci >> [ 805.669060] usb 5-2: New USB device found, idVendor=0218, idProduct=0201 >> [ 805.669064] usb 5-2: New USB device strings: Mfr=1, Product=2, >> SerialNumber=0 >> [ 805.669065] usb 5-2: Product: WORLDE Controller KS49 >> [ 805.669067] usb 5-2: Manufacturer: WORLDE >> [ 805.684743] usb 5-2: USB disconnect, device number 72 >> [ 806.248086] usb 5-2: new full-speed USB device number 73 using ohci-pci >> [ 806.444267] usb 5-2: New USB device found, idVendor=0218, idProduct=0201 >> [ 806.444271] usb 5-2: New USB device strings: Mfr=1, Product=2, >> SerialNumber=0 >> [ 806.444273] usb 5-2: Product: WORLDE Controller KS49 >> [ 806.444274] usb 5-2: Manufacturer: WORLDE >> [ 806.459697] usb 5-2: USB disconnect, device number 73 >> [ 807.080059] usb 5-2: new full-speed USB device number 74 using ohci-pci >> [ 807.279738] usb 5-2: New USB device found, idVendor=0218, idProduct=0201 >> [ 807.279742] usb 5-2: New USB device strings: Mfr=1, Product=2, >> SerialNumber=0 >> [ 807.279744] usb 5-2: Product: WORLDE Controller KS49 >> [ 807.279746] usb 5-2: Manufacturer: WORLDE >> [ 807.297581] usb 5-2: USB disconnect, device number 74 >> [ 807.560239] usb usb1-port8: attempt power cycle >> >> ... >> >> I just add some lines in quirks.c from Prodipe 25 but with the Prodipe >> 49 device ID. >> >> file: /drivers/usb/core/quirks.c line 185 >> >> /* WORLDE easy key (easykey.49) MIDI controller */ >> { USB_DEVICE(0x0218, 0x0201), .driver_info = >> USB_QUIRK_CONFIG_INTF_STRINGS }, >> >> It work well now. Test with Kernel 4.17.13 and 4.15 >> >> Possible to add this in kernel sources ? > Sure, care to make up a patch for this so that we can properly credit > you with the authorship of it? > > thanks, > > greg k-h