Date: Thu, 20 Dec 2007 23:42:32 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 131339 for review Message-ID: <200712202342.lBKNgWSY002992@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712202342.lBKNgWSY002992>