From owner-p4-projects@FreeBSD.ORG Thu Dec 20 23:42:33 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0A1FA16A468; Thu, 20 Dec 2007 23:42:33 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B69716A41A for ; Thu, 20 Dec 2007 23:42:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 85BFE13C4CE for ; Thu, 20 Dec 2007 23:42:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBKNgW07002995 for ; Thu, 20 Dec 2007 23:42:32 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBKNgWSY002992 for perforce@freebsd.org; Thu, 20 Dec 2007 23:42:32 GMT (envelope-from jhb@freebsd.org) Date: Thu, 20 Dec 2007 23:42:32 GMT Message-Id: <200712202342.lBKNgWSY002992@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 131339 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2007 23:42:33 -0000 http://perforce.freebsd.org/chv.cgi?CH=131339 Change 131339 by jhb@jhb_mutex on 2007/12/20 23:41:43 Tidy. Affected files ... .. //depot/projects/smpng/sys/kern/subr_smp.c#46 edit Differences ... ==== //depot/projects/smpng/sys/kern/subr_smp.c#46 (text+ko) ==== @@ -106,8 +106,8 @@ /* Variables needed for SMP rendezvous. */ static void (*volatile smp_rv_setup_func)(void *arg); static void (*volatile smp_rv_action_func)(void *arg); -static void (* volatile smp_rv_teardown_func)(void *arg); -static void * volatile smp_rv_func_arg; +static void (*volatile smp_rv_teardown_func)(void *arg); +static void *volatile smp_rv_func_arg; static volatile int smp_rv_waiters[3]; /* @@ -286,7 +286,8 @@ return 1; } -void smp_no_rendevous_barrier(void *dummy) +void +smp_no_rendevous_barrier(void *dummy) { #ifdef SMP KASSERT((!smp_started),("smp_no_rendevous called and smp is started")); @@ -309,7 +310,6 @@ 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; - /* Ensure we have up-to-date values. */ atomic_add_acq_int(&smp_rv_waiters[0], 1); @@ -320,21 +320,17 @@ if (local_setup_func != smp_no_rendevous_barrier) { if (smp_rv_setup_func != NULL) smp_rv_setup_func(smp_rv_func_arg); + /* spin on entry rendezvous */ atomic_add_int(&smp_rv_waiters[1], 1); while (smp_rv_waiters[1] < mp_ncpus) cpu_spinwait(); } - atomic_add_int(&smp_rv_waiters[1], 1); - while (smp_rv_waiters[1] < mp_ncpus) - cpu_spinwait(); - /* action function */ if (local_action_func != NULL) local_action_func(local_func_arg); - /* spin on exit rendezvous */ atomic_add_int(&smp_rv_waiters[2], 1); if (local_teardown_func == smp_no_rendevous_barrier) @@ -376,18 +372,16 @@ smp_rv_waiters[2] = 0; atomic_store_rel_int(&smp_rv_waiters[0], 0); - - - /* signal other processors, which will enter the IPI with interrupts off */ + /* Signal other processors, which will enter the IPI with interrupts off */ ipi_all_but_self(IPI_RENDEZVOUS); /* call executor function */ smp_rendezvous_action(); - if (teardown_func == smp_no_rendevous_barrier) { + if (teardown_func == smp_no_rendevous_barrier) while (atomic_load_acq_int(&smp_rv_waiters[2]) < mp_ncpus) cpu_spinwait(); - } + /* release lock */ mtx_unlock_spin(&smp_ipi_mtx); } @@ -409,9 +403,9 @@ mp_setvariables_for_up, NULL) void -smp_rendezvous(void (* setup_func)(void *), - void (* action_func)(void *), - void (* teardown_func)(void *), +smp_rendezvous(void (*setup_func)(void *), + void (*action_func)(void *), + void (*teardown_func)(void *), void *arg) {