Re: Oddity with EP configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2017-06-14 at 10:33 +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2017-06-13 at 15:08 +1000, Benjamin Herrenschmidt wrote:
> > Now, what I observe is that when the mass storage gets bound to the
> > UDC driver:
> > 
> >  - First the endpoints are properly allocated by my match callback,
> > ie, epautoconf is called to allocate EPs to the function.
> > 
> >  - But right away, composite.c calls usb_ep_autoconfig_release()
> > effectively releasing those 2 endpoints.
> 
> I confirmed this by reverting to my old "single UDC" driver (so a more
> standard setup without all my hooks) and putting a WARN_ON(!ep-
> > claimed) in usb_ep_enable().

Ok,  this is a global issue. Creating functions via configfs leads
to the same problem. I've added traces to epautoconf and to EP release
and reset and you can see what happens here (I also have the
WARN_ON(!ep->claimed) in usb_ep_enable):

# cd /sys/kernel/config/usb_gadget
# mkdir g1
# cd g1
# echo "0x1d6b" > idVendor
# echo "0x0104" > idProduct
# mkdir strings/0x409
# echo "0123456789" > strings/0x409/serialnumber
# echo "Foo Inc." > strings/0x409/manufacturer
# echo "Bar Gadget" > strings/0x409/product
# mkdir configs/c.1
# mkdir configs/c.1/strings/0x409
# echo "Main config" > configs/c.1/strings/0x409/configuration
# mkdir functions/mass_storage.usb0
[   69.240000] Mass Storage Function, version: 2009/09/11
[   69.240000] LUN: removable file: (no medium)
# ln -s functions/mass_storage.usb0 configs/c.1
# echo "1e6a0000.usb-vhub" >UDC
[   78.200000] udc 1e6a0000.usb-vhub: registering UDC driver [g1]
[   78.200000] EP@9e11b244 "ep1" reset
[   78.210000] EP@9e11b2a0 "ep2" reset
[   78.210000] EP@9e11b2fc "ep3" reset
[   78.210000] EP@9e11b358 "ep4" reset
[   78.210000] EP@9e11b3b4 "ep5" reset
[   78.210000] EP@9e11b410 "ep6" reset
[   78.210000] EP@9e11b46c "ep7" reset
[   78.230000] EP@9e11b4c8 "ep8" reset
[   78.230000] EP@9e11b524 "ep9" reset
[   78.230000] EP@9e11b580 "ep10" reset
[   78.230000] EP@9e11b5dc "ep11" reset
[   78.230000] EP@9e11b638 "ep12" reset
[   78.230000] EP@9e11b694 "ep13" reset
[   78.230000] EP@9e11b6f0 "ep14" reset
[   78.230000] EP@9e11b74c "ep15" reset
[   78.260000] configfs-gadget gadget: adding 'Mass Storage Function'/9e0c8b60 to config 'c'/9f4a06a8
[   78.260000] configfs-gadget gadget: I/O thread pid: 502
[   78.260000] EP@9e11b244 "ep1" claimed
[   78.260000] EP@9e11b2a0 "ep2" claimed
[   78.260000] EP@9e11b244 "ep1" reset
[   78.260000] EP@9e11b2a0 "ep2" reset
[   78.260000] EP@9e11b2fc "ep3" reset
[   78.300000] EP@9e11b358 "ep4" reset
[   78.300000] EP@9e11b3b4 "ep5" reset
[   78.300000] EP@9e11b410 "ep6" reset
[   78.300000] EP@9e11b46c "ep7" reset
[   78.300000] EP@9e11b4c8 "ep8" reset
[   78.300000] EP@9e11b524 "ep9" reset
[   78.300000] EP@9e11b580 "ep10" reset
[   78.300000] EP@9e11b5dc "ep11" reset
[   78.300000] EP@9e11b638 "ep12" reset
[   78.300000] EP@9e11b694 "ep13" reset
[   78.300000] EP@9e11b6f0 "ep14" reset
[   78.300000] EP@9e11b74c "ep15" reset
[   78.300000] EP@9e11b244 "ep1" reset
[   78.300000] EP@9e11b2a0 "ep2" reset
[   78.340000] EP@9e11b2fc "ep3" reset
[   78.340000] EP@9e11b358 "ep4" reset
[   78.340000] EP@9e11b3b4 "ep5" reset
[   78.340000] EP@9e11b410 "ep6" reset
[   78.340000] EP@9e11b46c "ep7" reset
[   78.340000] EP@9e11b4c8 "ep8" reset
[   78.340000] EP@9e11b524 "ep9" reset
[   78.340000] EP@9e11b580 "ep10" reset
[   78.340000] EP@9e11b5dc "ep11" reset
[   78.340000] EP@9e11b638 "ep12" reset
[   78.340000] EP@9e11b694 "ep13" reset
[   78.340000] EP@9e11b6f0 "ep14" reset
[   78.340000] EP@9e11b74c "ep15" reset
[   78.340000] aspeed_vhub 1e6a0000.usb-vhub: start
[   78.400000] aspeed_vhub 1e6a0000.usb-vhub: pullup(1)
[   78.400000] aspeed_vhub 1e6a0000.usb-vhub: USB bus suspend
[   78.400000] configfs-gadget gadget: suspend
# [   78.570000] aspeed_vhub 1e6a0000.usb-vhub: USB bus resume
[   78.570000] configfs-gadget gadget: resume
[   78.570000] aspeed_vhub 1e6a0000.usb-vhub: USB bus reset
[   78.570000] aspeed_vhub 1e6a0000.usb-vhub: USB status=09ca0712
[   78.640000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 06/80/0100/0000/0040 [in] st=0
[   78.650000] aspeed_vhub 1e6a0000.usb-vhub: USB bus reset
[   78.650000] aspeed_vhub 1e6a0000.usb-vhub: USB status=62c26014
[   78.730000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 05/00/001e/0000/0000 [out] st=0
[   78.730000] aspeed_vhub 1e6a0000.usb-vhub: SET_ADDRESS: Got address 1e
[   78.750000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 06/80/0100/0000/0012 [in] st=0
[   78.760000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 06/80/0200/0000/0009 [in] st=0
[   78.770000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 06/80/0200/0000/0020 [in] st=0
[   78.780000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 06/80/0300/0000/00ff [in] st=0
[   78.780000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 06/80/0302/0409/00ff [in] st=0
[   78.800000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 06/80/0301/0409/00ff [in] st=0
[   78.800000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 06/80/0303/0409/00ff [in] st=0
[   78.800000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 09/00/0001/0000/0000 [out] st=0
[   78.800000] configfs-gadget gadget: high-speed config #1: c
[   78.800000] configfs-gadget gadget: set_config: interface 0 (Mass Storage Function) requested delayed status
[   78.800000] configfs-gadget gadget: delayed_status count 1
[   78.840000] ------------[ cut here ]------------
[   78.840000] WARNING: CPU: 0 PID: 502 at /home/benh/work/bmc/linux/drivers/usb/gadget/udc/core.c:106 usb_ep_enable+0x30/0xac
[   78.840000] Modules linked in:
[   78.840000] CPU: 0 PID: 502 Comm: file-storage Not tainted 4.12.0-rc5-00043-g6c2471b-dirty #259
[   78.840000] Hardware name: Generic DT based system
[   78.840000] [<801097f0>] (unwind_backtrace) from [<80106940>] (show_stack+0x20/0x24)
[   78.840000] [<80106940>] (show_stack) from [<80300ed4>] (dump_stack+0x20/0x28)
[   78.840000] [<80300ed4>] (dump_stack) from [<8011470c>] (__warn+0xec/0x108)
[   78.900000] [<8011470c>] (__warn) from [<80114840>] (warn_slowpath_null+0x30/0x38)
[   78.900000] [<80114840>] (warn_slowpath_null) from [<8040a4f0>] (usb_ep_enable+0x30/0xac)
[   78.900000] [<8040a4f0>] (usb_ep_enable) from [<8041de20>] (do_set_interface+0xac/0x2f8)
[   78.900000] [<8041de20>] (do_set_interface) from [<8041e318>] (handle_exception+0x2ac/0x348)
[   78.900000] [<8041e318>] (handle_exception) from [<8041e4a0>] (fsg_main_thread+0xec/0x1484)
[   78.900000] [<8041e4a0>] (fsg_main_thread) from [<80130398>] (kthread+0x148/0x160)
[   78.900000] [<80130398>] (kthread) from [<80102858>] (ret_from_fork+0x14/0x3c)
[   78.900000] ---[ end trace b751b32969d48194 ]---
[   78.900000] aspeed_vhub 1e6a0000.usb-vhub: EP1: Enabling [in] bulk num 1 maxpacket=512
[   78.970000] ------------[ cut here ]------------
[   78.970000] WARNING: CPU: 0 PID: 502 at /home/benh/work/bmc/linux/drivers/usb/gadget/udc/core.c:106 usb_ep_enable+0x30/0xac
[   78.970000] Modules linked in:
[   78.970000] CPU: 0 PID: 502 Comm: file-storage Tainted: G        W       4.12.0-rc5-00043-g6c2471b-dirty #259
[   78.970000] Hardware name: Generic DT based system
[   78.970000] [<801097f0>] (unwind_backtrace) from [<80106940>] (show_stack+0x20/0x24)
[   78.970000] [<80106940>] (show_stack) from [<80300ed4>] (dump_stack+0x20/0x28)
[   78.970000] [<80300ed4>] (dump_stack) from [<8011470c>] (__warn+0xec/0x108)
[   78.970000] [<8011470c>] (__warn) from [<80114840>] (warn_slowpath_null+0x30/0x38)
[   78.970000] [<80114840>] (warn_slowpath_null) from [<8040a4f0>] (usb_ep_enable+0x30/0xac)
[   78.970000] [<8040a4f0>] (usb_ep_enable) from [<8041de5c>] (do_set_interface+0xe8/0x2f8)
[   79.050000] [<8041de5c>] (do_set_interface) from [<8041e318>] (handle_exception+0x2ac/0x348)
[   79.050000] [<8041e318>] (handle_exception) from [<8041e4a0>] (fsg_main_thread+0xec/0x1484)
[   79.050000] [<8041e4a0>] (fsg_main_thread) from [<80130398>] (kthread+0x148/0x160)
[   79.050000] [<80130398>] (kthread) from [<80102858>] (ret_from_fork+0x14/0x3c)
[   79.050000] ---[ end trace b751b32969d48195 ]---
[   79.050000] aspeed_vhub 1e6a0000.usb-vhub: EP2: Enabling [out] bulk num 2 maxpacket=512
[   79.050000] configfs-gadget gadget: usb_composite_setup_continue
[   79.050000] configfs-gadget gadget: usb_composite_setup_continue: Completing delayed status
[   79.050000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 06/80/0304/0409/00ff [in] st=0
[   79.050000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 06/80/0305/0409/00ff [in] st=0
[   79.140000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 06/80/0300/0000/00ff [in] st=0
[   79.150000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet 06/80/0302/0409/00ff [in] st=0
[   80.130000] aspeed_vhub 1e6a0000.usb-vhub: EP0: SETUP packet fe/a1/0000/0000/0001 [in] st=0
[   80.140000] configfs-gadget gadget: sending command-failure status
[   80.150000] configfs-gadget gadget: sending command-failure status
[   80.160000] configfs-gadget gadget: sending command-failure status
[   80.160000] configfs-gadget gadget: sending command-failure status
[   80.170000] configfs-gadget gadget: sending command-failure status
[   80.180000] configfs-gadget gadget: sending command-failure status
[   80.180000] configfs-gadget gadget: sending command-failure status
[   80.200000] configfs-gadget gadget: sending command-failure status
[   80.210000] configfs-gadget gadget: sending command-failure status
[   80.230000] configfs-gadget gadget: sending command-failure status
[   80.230000] configfs-gadget gadget: sending command-failure status
[   80.240000] configfs-gadget gadget: sending command-failure status
[   80.250000] configfs-gadget gadget: sending command-failure status
[   80.250000] configfs-gadget gadget: sending command-failure status
[   80.260000] configfs-gadget gadget: sending command-failure status
[   80.270000] configfs-gadget gadget: sending command-failure status
[   80.290000] configfs-gadget gadget: sending command-failure status
[   80.300000] configfs-gadget gadget: sending command-failure status
[   80.300000] configfs-gadget gadget: sending command-failure status
[   80.300000] configfs-gadget gadget: sending command-failure status
[   82.370000] configfs-gadget gadget: sending command-failure status
[   84.420000] configfs-gadget gadget: sending command-failure status
[   86.470000] configfs-gadget gadget: sending command-failure status
[   88.520000] configfs-gadget gadget: sending command-failure status
[   90.570000] configfs-gadget gadget: sending command-failure status

CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7 | VT102 | Offline | ttyUSB0                                                                   
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux