Date: Tue, 24 Feb 2004 10:58:39 -0500 From: John Baldwin <jhb@FreeBSD.org> To: Don Lewis <truckman@FreeBSD.org> Cc: cg@FreeBSD.org Subject: Re: exclusive sleep mutex pcm0 (sound cdev) r = 0 Message-ID: <200402241058.39196.jhb@FreeBSD.org> In-Reply-To: <200402241552.i1OFqB7E074413@gw.catspoiler.org> References: <200402241552.i1OFqB7E074413@gw.catspoiler.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 24 February 2004 10:52 am, Don Lewis wrote: > On 24 Feb, John Baldwin wrote: > > On Tuesday 24 February 2004 10:27 am, Don Lewis wrote: > >> I currently have some patches for the channel mutexes that are > >> undergoing testing. Once these have been committed, I'll take another > >> look at the "sound cdev" mutex. My current thought is to convert most > >> uses of it to a lockmgr lock. > > > > Eek, why not a sx lock if you must go to a sleepable lock? > > That was my initial thought, but I was scared off by the following > statement in the sx(9) man page: > > A thread may not own a shared lock and an exclusive lock > simultaneously; attempting to do so will result in deadlock. > > My plan is to hold this lock across large portions of the open() and > ioctl() methods (and possibly read() and write() as well). Some of > these may call code outside of my direct control, such as methods in the > hardware specific drivers, as well as things like malloc(). I'm > concerned about causing a deadlock by violating the sx usage rules. It means on the same lock, i.e. you can't try to do sx_slock(&foo) and then do sx_xlock(&foo). You can mix shared/exclusive of different locks ok. -- John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402241058.39196.jhb>