From owner-freebsd-current@FreeBSD.ORG Wed May 18 20:27:56 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BBB51065673; Wed, 18 May 2011 20:27:56 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by mx1.freebsd.org (Postfix) with ESMTP id 0406B8FC0C; Wed, 18 May 2011 20:27:55 +0000 (UTC) Received: from [10.54.190.172] (gw-105.extranet.sea01.isilon.com [74.85.160.105]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0LoZAI-1Pm5gY3BIg-00gYPe; Wed, 18 May 2011 22:27:55 +0200 Message-ID: <4DD42BC6.80104@love2party.net> Date: Wed, 18 May 2011 13:27:50 -0700 From: Max Laier User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110419 Lightning/1.0b2pre Thunderbird/3.1.9 MIME-Version: 1.0 To: John Baldwin References: <4DCD357D.6000109@FreeBSD.org> <201105171256.41091.jhb@freebsd.org> <4DD2C99D.50203@love2party.net> <201105171635.17704.jhb@freebsd.org> In-Reply-To: <201105171635.17704.jhb@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:C9bOm2M9KQKK1EBcln6j0sWPEAPxc7N/2/aNyWXj071 F/FH5D7i1TMxpbvgBiNL0d6ZEsuPXq2G4/C8ib1choUgl/wDO7 Mjg2zNYsYdXn++4oVPmlSqTUrdEDBLF09LDAyvnv6QIwlHWo8k si/D/bxZN9ld3bKzQpqufjSMiyFDO+XzAA+xgsZ0EeqKHYprKL s/fJWyK485Ysgg533WOXQ== Cc: neel@freebsd.org, Andriy Gapon , Attilio Rao , FreeBSD current , Stephan Uphoff , Peter Grehan Subject: Re: proposed smp_rendezvous change X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2011 20:27:56 -0000 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.