[PATCH] Newbus locking
Attilio Rao
attilio at freebsd.org
Sat Aug 1 12:12:03 UTC 2009
2009/8/1 Hans Petter Selasky <hselasky at c2i.net>:
>
> Attilio: Your newbus_lock() must be moved into usb_probe_and_attach(), and
> maybe in usb_suspend_resume(). newbus_lock() should be locked always after
> "udev->default_sx + 1" in usb_device.c. "udev->default_sx + 1" is the lock
> protecting enumeration on a per-device level. Try on a usb device:
>
> usbconfig -u XXX -a YYY set_config 255
>
> Then:
>
> usbconfig -u XXX -a YYY set_config 0
>
> And I think you will have a prompt panic, because the newbus lock is not
> locked.
Nice catch, pho just reported that to me. I'm going to fix it now. Thanks.
> BTW: Why do none of the device_get_xxx() functions not have newbus lock
> assertions in them?
Because not all the device_get_ functions need to be locked. Generally
the context alredy provide correct locking for them.
Attilio
--
Peace can only be achieved by understanding - A. Einstein
More information about the freebsd-current
mailing list