Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Aug 2011 12:25:51 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        freebsd-arch@FreeBSD.org, Hans Petter Selasky <hselasky@FreeBSD.org>
Subject:   Re: skipping locks, mutex_owned, usb
Message-ID:  <4E5A099F.4060903@FreeBSD.org>
In-Reply-To: <4E53986B.5000804@FreeBSD.org>
References:  <4E53986B.5000804@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
on 23/08/2011 15:09 Andriy Gapon said the following:
> This "XXX cludge" [sic] pattern is scattered around a few functions in the ukbd
> code and perhaps other usb code:
> func()
> {
> 	if (!mtx_owned(&Giant)) {
> 		mtx_lock(&Giant);
>                 func();
>                 mtx_unlock(&Giant);
> 		return;
> 	}
> 
> 	// etc ...
> }

Ohhh, nothing seems simple with the USB code:

/* make sure that the BUS mutex is not locked */
drop_bus = 0;
while (mtx_owned(&xroot->udev->bus->bus_mtx)) {
        mtx_unlock(&xroot->udev->bus->bus_mtx);
        drop_bus++;
}

/* make sure that the transfer mutex is not locked */
drop_xfer = 0;
while (mtx_owned(xroot->xfer_mtx)) {
        mtx_unlock(xroot->xfer_mtx);
        drop_xfer++;
}

So many unconventional tricks.

-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4E5A099F.4060903>