All of lore.kernel.org
 help / color / mirror / Atom feed
* USB gadgets with configfs hang reboot
@ 2016-01-15 22:48 Tony Lindgren
       [not found] ` <20160115224839.GA19432-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 45+ messages in thread
From: Tony Lindgren @ 2016-01-15 22:48 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman,
	Robert Baldyga, Andrzej Pietrasiewicz

Hi all,

Looks like there's some issue with the USB gadgets and configfs.

I'm seeing rmmod of the UDC driver cause a warning and then reboot
hangs the system. This happens at least with v4.4, and I've reproduced
it with dwc3 and musb so it seems to be generic.

I think Felipe is offline for next few days, but anyways here are
the error messages and a shells script to reproduce the issue.

Cheers,

Tony

Warning on rmmod $udc_module after gadgets are configured:

kobject: 'udc' (c202f700): kobject_release, parent c20ab818 (delayed 400)
kobject: '4a030000.dwc3' (c21b7c10): kobject_release, parent   (null) (delayed 200)
kobject: 'gadget' (c21911c0): kobject_release, parent   (null) (delayed 200)
------------[ cut here ]------------
WARNING: CPU: 1 PID: 1609 at lib/debugobjects.c:263 debug_print_object+0x8c/0xb8()
ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x10
Modules linked in: bluetooth cpufreq_dt leds_gpio led_class omap4_keypad matrix_keymap omap_wdt evdev ti_soc_thermal thermal_sys hwmon snd_soc_omap_mcbsp wlcore_sdio wl18xx wl12xx wlcore mac80211 cfg80211 omapfb connector_hdmi encoder_tpds
CPU: 1 PID: 1609 Comm: rmmod Not tainted 4.4.0-00009-g37797bf #228
Hardware name: Generic OMAP5 (Flattened Device Tree)
[<c0017c08>] (unwind_backtrace) from [<c0013f60>] (show_stack+0x10/0x14)
[<c0013f60>] (show_stack) from [<c034f180>] (dump_stack+0x84/0x9c)
[<c034f180>] (dump_stack) from [<c003cb64>] (warn_slowpath_common+0x78/0xb4)
[<c003cb64>] (warn_slowpath_common) from [<c003cbd0>] (warn_slowpath_fmt+0x30/0x40)
[<c003cbd0>] (warn_slowpath_fmt) from [<c0368e6c>] (debug_print_object+0x8c/0xb8)
[<c0368e6c>] (debug_print_object) from [<c036960c>] (__debug_check_no_obj_freed+0x1a0/0x228)
[<c036960c>] (__debug_check_no_obj_freed) from [<c0166080>] (kfree+0x80/0x1bc)
[<c0166080>] (kfree) from [<c03ed13c>] (release_nodes+0x164/0x1c8)
[<c03ed13c>] (release_nodes) from [<c03e9dc0>] (__device_release_driver+0x90/0x114)
[<c03e9dc0>] (__device_release_driver) from [<c03e9e64>] (device_release_driver+0x20/0x2c)
[<c03e9e64>] (device_release_driver) from [<c03e96b0>] (bus_remove_device+0xd8/0x108)
[<c03e96b0>] (bus_remove_device) from [<c03e69b0>] (device_del+0x10c/0x210)
[<c03e69b0>] (device_del) from [<c03eba8c>] (platform_device_del+0x18/0x88)
[<c03eba8c>] (platform_device_del) from [<c03ebb08>] (platform_device_unregister+0xc/0x20)
[<c03ebb08>] (platform_device_unregister) from [<c04e0e10>] (of_platform_device_destroy+0x8c/0x98)
[<c04e0e10>] (of_platform_device_destroy) from [<c03e6554>] (device_for_each_child+0x50/0x7c)
[<c03e6554>] (device_for_each_child) from [<c04e0d6c>] (of_platform_depopulate+0x2c/0x44)
[<c04e0d6c>] (of_platform_depopulate) from [<bf176208>] (dwc3_omap_remove+0x3c/0x5c [dwc3_omap])
[<bf176208>] (dwc3_omap_remove [dwc3_omap]) from [<c03ebbb4>] (platform_drv_remove+0x24/0x3c)
[<c03ebbb4>] (platform_drv_remove) from [<c03e9db8>] (__device_release_driver+0x88/0x114)
[<c03e9db8>] (__device_release_driver) from [<c03ea5d4>] (driver_detach+0xb4/0xb8)
[<c03ea5d4>] (driver_detach) from [<c03e9940>] (bus_remove_driver+0x4c/0xa0)
[<c03e9940>] (bus_remove_driver) from [<c00cb574>] (SyS_delete_module+0x11c/0x1e4)
[<c00cb574>] (SyS_delete_module) from [<c000f740>] (ret_fast_syscall+0x0/0x1c)
---[ end trace 3d4a0455591ff9ed ]---

Error on reboot after rmmod $udc_module:

Alignment trap: not handling instruction e1932f9f at [<c009168c>]
Unhandled fault: alignment exception (0x001) at 0x6b6b6c6f
pgd = c27b0000
[6b6b6c6f] *pgd=00000000
Internal error: : 1 [#1] SMP ARM
Modules linked in: usb_f_rndis usb_f_ecm bluetooth leds_gpio led_class cpufreq_dt omap4_keypad omap_wdt matrix_keymap ti_soc_thermal evdev thermal_sys hwmon snd_soc_omap_mcbsp wlcore_sdio wl18xx wl12xx wlcore mac80211 cfg80211 omapfb conn]
CPU: 1 PID: 1935 Comm: reboot Not tainted 4.4.0-00009-g37797bf #228
Hardware name: Generic OMAP5 (Flattened Device Tree)
task: c27a6340 ti: c2502000 task.ti: c2502000
PC is at __lock_acquire+0x25c/0x148c
LR is at 0x1
pc : [<c0091690>]    lr : [<00000001>]    psr: 20080093
sp : c2503d88  ip : c2502000  fp : c096db04
r10: c11ac224  r9 : c27a6340  r8 : c09a54e0
r7 : 00000000  r6 : 00000000  r5 : 00000000  r4 : 6b6b6b6b
r3 : 6b6b6c6f  r2 : 6b6b6b6b  r1 : 00000001  r0 : ee4e828c
Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c5387d  Table: 827b006a  DAC: 00000051
Process reboot (pid: 1935, stack limit = 0xc2502218)
Stack: (0xc2503d88 to 0xc2504000)
3d80:                   ee4e828c c27a6898 c27a6898 00000000 c27a6340 c0b504e8
3da0: 00000000 c27a6898 c27a6898 00000000 ee4e81b8 ee4e828c 00000000 00000000
3dc0: 00000000 c09e5294 60080013 c0093140 00000001 00000000 00000000 c03e826c
3de0: 00000000 00000000 01234567 ee08bdd8 00000000 ee4e8258 ee4e81b8 c23f6330
3e00: c127002c c11ac224 c27a6340 00000000 00000001 c0653250 00000001 00000000
3e20: c03e826c c27a6870 c27a6340 60080013 00000001 c27a6870 c127002c ee08bdc8
3e40: ee4e81b8 c23f633c ee4e81b8 c23f6330 c127002c cc5b4b00 c09ea020 00000000
3e60: 00000001 c03e826c 00000000 01234567 c096b1b4 fee1dead cc5b4b00 c2502000
3e80: 00000000 c005fc54 00000000 c005ff1c c22c4ec0 c22c4ed0 00000000 00000000
3ea0: 00000000 c09e5294 0000005c 00000002 c27a6878 00000000 c09a54e0 c27a6340
3ec0: c11ac224 c00918a8 0000005c 00000000 c27a6878 c27a6870 00000001 c27a6870
3ee0: c09e497a c22c4ec0 c22c4ec0 00000000 c005bb4c c096e6e8 00000000 00000000
3f00: 00000002 c09e5294 600f0013 c0093140 00000000 00000000 00000000 c0199274
3f20: 00000000 00000000 c018f378 ede1e4a0 ed137018 ee11a900 c005bb4c 00000000
3f40: c27a6340 00000000 c27a6340 600f0013 00000000 c27a6870 00000000 c27a67c4
3f60: c09ebd48 00000000 c27a6340 00000000 c2502000 00000000 00000001 c005bb50
3f80: 00000000 c2502000 00000001 00000004 00000001 00000004 00000000 00000058
3fa0: c000f8e4 c000f740 00000001 00000004 fee1dead 28121969 01234567 cc5b4b00
3fc0: 00000001 00000004 00000000 00000058 00000000 00000000 00000000 00000001
3fe0: 00000058 bebfcc84 b6ed9ec5 b6e61966 80080030 fee1dead afffd861 afffdc61
[<c0091690>] (__lock_acquire) from [<c0093140>] (lock_acquire+0xac/0x12c)
[<c0093140>] (lock_acquire) from [<c0653250>] (mutex_lock_nested+0x38/0x3c8)
[<c0653250>] (mutex_lock_nested) from [<c03e826c>] (device_shutdown+0xcc/0x1bc)
[<c03e826c>] (device_shutdown) from [<c005fc54>] (kernel_restart+0xc/0x50)
[<c005fc54>] (kernel_restart) from [<c005ff1c>] (SyS_reboot+0x138/0x1f4)
[<c005ff1c>] (SyS_reboot) from [<c000f740>] (ret_fast_syscall+0x0/0x1c)
Code: 0affff87 e2843f41 f5d3f000 e1932f9f (e2822001)
---[ end trace f16e89fb774cf929 ]---

Test script to reproduce the problem, need to uncomment the reboot part:

8< --------------------
#!/bin/bash

# Change for your UDC controller
udc_module=dwc3-omap
udc_name=4a030000.dwc3

#
# Calling this and then doing rmmod $udc_module
# followed by reboot seems to produce the follow:
# WARNING: CPU: 1 PID: 1617 at lib/debugobjects.c:263
#
start_usb_gadgets() {
	vendor=0x1d6b
	product=0x0106
	file=$1

	mount -t configfs none /sys/kernel/config
	mkdir /sys/kernel/config/usb_gadget/g1
	old_pwd=$(pwd)
	cd /sys/kernel/config/usb_gadget/g1

	echo $product > idProduct
	echo $vendor > idVendor
	mkdir strings/0x409
	echo 123456789 > strings/0x409/serialnumber
	echo foo > strings/0x409/manufacturer
	echo "Multi Gadget" > strings/0x409/product

	mkdir configs/c.1
	echo 120 > configs/c.1/MaxPower
	mkdir configs/c.1/strings/0x409
	echo "Conf 1" > configs/c.1/strings/0x409/configuration

	mkdir configs/c.2
	echo 500 > configs/c.2/MaxPower
	mkdir configs/c.2/strings/0x409
	echo "Conf 2" > configs/c.2/strings/0x409/configuration

	mkdir functions/mass_storage.0
	echo $file > functions/mass_storage.0/lun.0/file
	ln -s functions/mass_storage.0 configs/c.1
	ln -s functions/mass_storage.0 configs/c.2

	# Not configuring further here just produces
	# WARNING: CPU: 1 PID: 1609 at lib/debugobjects.c:263

	mkdir functions/acm.0
	ln -s functions/acm.0 configs/c.1
	ln -s functions/acm.0 configs/c.2

	mkdir functions/ecm.0
	ln -s functions/acm.0 configs/c.1
	ln -s functions/acm.0 configs/c.2

	# Adding rndis seems to cause alignment trap or some
	# random oops on reboot after rmmod $udc_module
	mkdir functions/rndis.0
	ln -s functions/rndis.0 configs/c.1
	ln -s functions/rndis.0 configs/c.2

	echo $udc_name > /sys/kernel/config/usb_gadget/g1/UDC
	cd $old_pwd
}

function rmmod_and_shutdown() {
	rmmod $udc_module
	reboot
}

modprobe $udc_module

start_usb_gadgets ""

# uncomment this to reproduce bug
# rmmod_and_shutdown
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2016-05-06 12:32 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-15 22:48 USB gadgets with configfs hang reboot Tony Lindgren
     [not found] ` <20160115224839.GA19432-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-01-16  0:09   ` Tony Lindgren
2016-01-16 10:40   ` Ivaylo Dimitrov
     [not found]     ` <569A1E32.1020502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-01-18 16:16       ` Tony Lindgren
2016-03-23 18:24       ` Ivaylo Dimitrov
     [not found]         ` <56F2DF79.6010903-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-24  6:50           ` Felipe Balbi
     [not found]             ` <87fuvgxtc3.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-24  7:03               ` Ivaylo Dimitrov
     [not found]                 ` <56F3914B.4010206-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-24  7:11                   ` Felipe Balbi
     [not found]                     ` <87a8loxsdm.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-24 18:46                       ` Ivaylo Dimitrov
     [not found]                         ` <56F4361C.9040907-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-30 10:22                           ` Felipe Balbi
     [not found]                             ` <877fgkqn8c.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-30 13:29                               ` Ivaylo Dimitrov
     [not found]                                 ` <56FBD4BF.6090905-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-30 13:38                                   ` Felipe Balbi
     [not found]                                     ` <87h9fohyr1.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-30 14:01                                       ` Ivaylo Dimitrov
     [not found]                                         ` <56FBDC51.9020602-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-30 14:33                                           ` Pali Rohár
2016-03-30 18:50                                           ` Ivaylo Dimitrov
     [not found]                                             ` <56FC1FD8.6090003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-30 18:54                                               ` Ivaylo Dimitrov
2016-03-30 19:25                                               ` Alan Stern
     [not found]                                                 ` <Pine.LNX.4.44L0.1603301509180.2194-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-03-30 19:41                                                   ` Tony Lindgren
2016-03-31 16:32                                                   ` Ivaylo Dimitrov
     [not found]                                                     ` <56FD512C.2070108-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-31 17:00                                                       ` Alan Stern
     [not found]                                                         ` <Pine.LNX.4.44L0.1603311255560.1516-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-04-01 17:02                                                           ` Michal Nazarewicz
     [not found]                                                             ` <xa1tmvpdz2h4.fsf-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>
2016-04-01 19:18                                                               ` Alan Stern
     [not found]                                                                 ` <Pine.LNX.4.44L0.1604011452580.1957-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-04-01 22:16                                                                   ` Michal Nazarewicz
     [not found]                                                                     ` <xa1tbn5tynyp.fsf-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>
2016-04-02 14:55                                                                       ` Alan Stern
     [not found]                                                                         ` <Pine.LNX.4.44L0.1604021031030.19366-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-04-04 12:57                                                                           ` Michal Nazarewicz
     [not found]                                                                             ` <xa1ty48tilai.fsf-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>
2016-04-04 15:04                                                                               ` Alan Stern
     [not found]                                                                                 ` <Pine.LNX.4.44L0.1604041038510.1704-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-04-04 18:18                                                                                   ` Michal Nazarewicz
     [not found]                                                                                     ` <xa1ttwjhi6fo.fsf-deATy8a+UHjQT0dZR+AlfA@public.gmane.org>
2016-04-04 19:37                                                                                       ` Alan Stern
2016-04-04 16:18                                                                               ` Ivaylo Dimitrov
     [not found]                                                                                 ` <570293E8.2060406-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-04 18:48                                                                                   ` Michal Nazarewicz
2016-04-05 15:18                                                               ` Michal Nazarewicz
2016-04-04  4:45                                                           ` Felipe Balbi
2016-04-04  4:41                                           ` Felipe Balbi
2016-04-08 20:13       ` Ivaylo Dimitrov
     [not found]         ` <57081105.2050206-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-18  7:02           ` Ivaylo Dimitrov
     [not found]             ` <571486A1.2060006-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-06 12:32               ` Pali Rohár
2016-04-18  7:55           ` Felipe Balbi
     [not found]             ` <87oa97gxkw.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-25 19:00               ` Ivaylo Dimitrov
     [not found]                 ` <571E6943.30305-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-26  6:22                   ` Felipe Balbi
     [not found]                     ` <87a8kgrisz.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-26 15:03                       ` Alan Stern
     [not found]                         ` <Pine.LNX.4.44L0.1604261102000.2038-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2016-04-26 16:44                           ` Ivaylo Dimitrov
     [not found]                             ` <571F9AD4.8010900-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-26 16:49                               ` Tony Lindgren
     [not found]                                 ` <20160426164918.GA5995-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2016-04-26 18:13                                   ` Ivaylo Dimitrov
2016-01-22 10:35   ` Andrzej Pietrasiewicz
     [not found]     ` <56A205E4.6050305-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-01-22 18:28       ` Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.