From owner-freebsd-current@FreeBSD.ORG Mon May 16 19:27:51 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 6A283106564A; Mon, 16 May 2011 19:27:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 135E38FC1D; Mon, 16 May 2011 19:27:49 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id WAA07226; Mon, 16 May 2011 22:27:48 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1QM3SG-00044E-73; Mon, 16 May 2011 22:27:48 +0300 Message-ID: <4DD17AB3.1070606@FreeBSD.org> Date: Mon, 16 May 2011 22:27:47 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.17) Gecko/20110503 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: John Baldwin References: <4DCD357D.6000109@FreeBSD.org> <201105161152.10458.jhb@freebsd.org> <201105161346.34134.max@love2party.net> <201105161421.27665.jhb@freebsd.org> In-Reply-To: <201105161421.27665.jhb@freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Max Laier , FreeBSD current , neel@FreeBSD.org, 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: Mon, 16 May 2011 19:27:51 -0000 on 16/05/2011 21:21 John Baldwin said the following: > How about this: ... > /* > * Shared mutex to restrict busywaits between smp_rendezvous() and > @@ -311,39 +312,62 @@ restart_cpus(cpumask_t map) > void > smp_rendezvous_action(void) > { > - void* local_func_arg = smp_rv_func_arg; > - void (*local_setup_func)(void*) = smp_rv_setup_func; > - void (*local_action_func)(void*) = smp_rv_action_func; > - void (*local_teardown_func)(void*) = smp_rv_teardown_func; > + void *local_func_arg; > + void (*local_setup_func)(void*); > + void (*local_action_func)(void*); > + void (*local_teardown_func)(void*); > + int generation; > > /* Ensure we have up-to-date values. */ > atomic_add_acq_int(&smp_rv_waiters[0], 1); > while (smp_rv_waiters[0] < smp_rv_ncpus) > cpu_spinwait(); > > - /* setup function */ > + /* Fetch rendezvous parameters after acquire barrier. */ > + local_func_arg = smp_rv_func_arg; > + local_setup_func = smp_rv_setup_func; > + local_action_func = smp_rv_action_func; > + local_teardown_func = smp_rv_teardown_func; I want to ask once again - please pretty please convince me that the above cpu_spinwait() loop is really needed and, by extension, that the assignments should be moved behind it. Please :) -- Andriy Gapon