NetBSD-Bugs archive

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

kern/48593: USB host controllers almost never detach on shutdown

>Number:         48593
>Category:       kern
>Synopsis:       USB host controllers almost never detach on shutdown
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 12 12:35:00 +0000 2014
>Originator:     Joerg Grundmann
>Release:        6.1.3
CenterTools GmbH
NetBSD joerg-netbsd.localdomain 6.1.3 NetBSD 6.1.3 (GENERIC) i386
At lease the USB host controller drivers will not detach on shutdown, even when 
DETACH_SHUTDOWN is set. The cause is that most of the drivers don't specify the 
flag DVF_DETACH_SHUTDOWN (for example wsmouse and wskbd). This causes that the 
complete tree will not detach on shutdown.

If DETACH_FORCE is specified, the detach works partly. But if only one detach 
fails, the system panics (this seems to be intended behaviour).

In my opinion it makes sense to detach all drivers by default and only specify 
a flag named DVF_DONT_DETACH_SHUTDOWN for drivers which should not detach at 
- Just shutdown the system using poweroff.
- You can set DDB breakpoints in detach functions for ehci/uhci/ohci drivers 
and you will see that they will never get called if, for example, a usb 
keyboard or mouse is present.
- I tested this on VMWare 10 with USB 2.0 controller
- I fixed this problem by setting the variable detachall = true (instead of 
false, which is default) in sys/kern/subr_autoconf.c. Now all drivers with a 
detach callback are detaching. USB controller drivers, too.

- To fix this properly, also make sure that only drivers which need to stay 
attached have DVF_DONT_DETACH_SHUTDOWN (instead of DVF_DETACH_SHUTDOWN) set (I 
don't need this so I did not change it. But it would be a proper fix).

- Another fix could be to set the flag DVF_DETACH_SHUTDOWN (using 
almost all drivers. I think it's a good thing to detach all drivers by default.

Home | Main Index | Thread Index | Old Index