Re: [PATCH] Newbus locking

From: Attilio Rao <attilio_at_freebsd.org>
Date: Sat, 1 Aug 2009 14:12:01 +0200
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
Received on Sat Aug 01 2009 - 10:12:03 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:53 UTC