Date: Wed, 18 May 2011 13:27:50 -0700 From: Max Laier <max@love2party.net> To: John Baldwin <jhb@freebsd.org> Cc: neel@freebsd.org, Andriy Gapon <avg@freebsd.org>, Attilio Rao <attilio@freebsd.org>, FreeBSD current <freebsd-current@freebsd.org>, Stephan Uphoff <ups@freebsd.org>, Peter Grehan <grehan@freebsd.org> Subject: Re: proposed smp_rendezvous change Message-ID: <4DD42BC6.80104@love2party.net> In-Reply-To: <201105171635.17704.jhb@freebsd.org> References: <4DCD357D.6000109@FreeBSD.org> <201105171256.41091.jhb@freebsd.org> <4DD2C99D.50203@love2party.net> <201105171635.17704.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 05/17/2011 01:35 PM, John Baldwin wrote: ... > Yeah, I already have a patch to do that, but hadn't added atomic ops to > critical_enter() and critical_exit(). But it also wasn't as fancy in the > critical_exit() case. Here is what I have and I think it might actually > be ok (it doesn't use an atomic read and clear, but I think it is safe). > Hmm, actually, it will need to use the read and clear: Looks good to me. I was slightly surprised by this: > Index: kern/kern_synch.c > =================================================================== > --- kern/kern_synch.c (revision 222024) > +++ kern/kern_synch.c (working copy) > @@ -400,9 +400,7 @@ > if (!TD_ON_LOCK(td)&& !TD_IS_RUNNING(td)) > mtx_assert(&Giant, MA_NOTOWNED); > #endif > - KASSERT(td->td_critnest == 1 || (td->td_critnest == 2&& > - (td->td_owepreempt)&& (flags& SW_INVOL) != 0&& > - newtd == NULL) || panicstr, > + KASSERT(td->td_critnest == 1 || panicstr, > ("mi_switch: switch in a critical section")); > KASSERT((flags& (SW_INVOL | SW_VOL)) != 0, > ("mi_switch: switch must be voluntary or involuntary")); part of the patch. But that is in fact correct and much more expressive and safe than the version we had before. Thanks, Max P.S. I'd like to see this and the rendezvous changes in stable/7 in the not too distant future. Mind if I MFH these when you are done - unless you are planing to do it already, anyways.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4DD42BC6.80104>