Re: USB gadgets with configfs hang reboot

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

 



Hi Tony,

W dniu 15.01.2016 o 23:48, Tony Lindgren pisze:
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 can't reproduce your problem on 4.4-rc4 nor on 4.4 release
with the script you provided

I'm using Odroid XU3, which has dwc3.

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

<snip>


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

for me these are:

udc_module=dwc3-exynos
udc_name=12400000.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

I assume you meant ecm.0 here and in the next line.

	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

I have it uncommented, no problems.

But before I run this script I need to modprobe libcomposite,
though.

AP
--
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