From 157202af7d033e97e4b90bd3f50c05a18da20a7b Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Fri, 22 Apr 2005 17:41:15 +0000 Subject: [PATCH] Don't call cpu_mb1 after lwkt_setcpu_self, but call it internally after the processing is done in lwkt_setcpu_self. The extern call should automatically invalidate all non-local data and keeping it in lwkt_setcpu_self ensures that it continues to work even with IPO. Requested-by: dillon --- sys/kern/kern_proc.c | 3 +-- sys/kern/kern_time.c | 34 +++++++++------------------------- sys/kern/lwkt_thread.c | 3 ++- sys/netinet/tcp_subr.c | 5 +---- 4 files changed, 13 insertions(+), 32 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 713acfc09a..87ee1b867a 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -32,7 +32,7 @@ * * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 * $FreeBSD: src/sys/kern/kern_proc.c,v 1.63.2.9 2003/05/08 07:47:16 kbyanc Exp $ - * $DragonFly: src/sys/kern/kern_proc.c,v 1.19 2005/04/20 16:37:09 cpressey Exp $ + * $DragonFly: src/sys/kern/kern_proc.c,v 1.20 2005/04/22 17:41:15 joerg Exp $ */ #include @@ -628,7 +628,6 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) continue; rgd = globaldata_find(nid); lwkt_setcpu_self(rgd); - cpu_mb1(); /* CURRENT CPU HAS CHANGED */ TAILQ_FOREACH(td, &mycpu->gd_tdallq, td_allq) { if (td->td_proc) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index ddb8939130..7fb98c9411 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -32,7 +32,7 @@ * * @(#)kern_time.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/kern/kern_time.c,v 1.68.2.1 2002/10/01 08:00:41 bde Exp $ - * $DragonFly: src/sys/kern/kern_time.c,v 1.23 2005/04/22 10:12:26 joerg Exp $ + * $DragonFly: src/sys/kern/kern_time.c,v 1.24 2005/04/22 17:41:15 joerg Exp $ */ #include @@ -92,10 +92,8 @@ settime(tv) struct timespec ts; int origcpu; - if ((origcpu = mycpu->gd_cpuid) != 0) { + if ((origcpu = mycpu->gd_cpuid) != 0) lwkt_setcpu_self(globaldata_find(0)); - cpu_mb1(); - } crit_enter(); microtime(&tv1); @@ -145,10 +143,8 @@ settime(tv) lease_updatetime(delta.tv_sec); crit_exit(); - if (origcpu != 0) { + if (origcpu != 0) lwkt_setcpu_self(globaldata_find(origcpu)); - cpu_mb1(); - } resettodr(); return (0); @@ -462,10 +458,8 @@ kern_adjtime(int64_t delta, int64_t *odelta) { int origcpu; - if ((origcpu = mycpu->gd_cpuid) != 0) { + if ((origcpu = mycpu->gd_cpuid) != 0) lwkt_setcpu_self(globaldata_find(0)); - cpu_mb1(); - } crit_enter(); *odelta = ntp_delta; @@ -473,10 +467,8 @@ kern_adjtime(int64_t delta, int64_t *odelta) kern_adjtime_common(); crit_exit(); - if (origcpu != 0) { + if (origcpu != 0) lwkt_setcpu_self(globaldata_find(origcpu)); - cpu_mb1(); - } } void @@ -484,20 +476,16 @@ kern_reladjtime(int64_t delta) { int origcpu; - if ((origcpu = mycpu->gd_cpuid) != 0) { + if ((origcpu = mycpu->gd_cpuid) != 0) lwkt_setcpu_self(globaldata_find(0)); - cpu_mb1(); - } crit_enter(); ntp_delta += delta; kern_adjtime_common(); crit_exit(); - if (origcpu != 0) { + if (origcpu != 0) lwkt_setcpu_self(globaldata_find(origcpu)); - cpu_mb1(); - } } static void @@ -505,19 +493,15 @@ kern_adjfreq(int64_t rate) { int origcpu; - if ((origcpu = mycpu->gd_cpuid) != 0) { + if ((origcpu = mycpu->gd_cpuid) != 0) lwkt_setcpu_self(globaldata_find(0)); - cpu_mb1(); - } crit_enter(); ntp_tick_permanent = rate; crit_exit(); - if (origcpu != 0) { + if (origcpu != 0) lwkt_setcpu_self(globaldata_find(origcpu)); - cpu_mb1(); - } } /* ARGSUSED */ diff --git a/sys/kern/lwkt_thread.c b/sys/kern/lwkt_thread.c index 23446c2cc0..5c59e2c6d6 100644 --- a/sys/kern/lwkt_thread.c +++ b/sys/kern/lwkt_thread.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/lwkt_thread.c,v 1.71 2005/04/13 04:02:08 dillon Exp $ + * $DragonFly: src/sys/kern/lwkt_thread.c,v 1.72 2005/04/22 17:41:15 joerg Exp $ */ /* @@ -1110,6 +1110,7 @@ lwkt_setcpu_self(globaldata_t rgd) lwkt_switch(); /* we are now on the target cpu */ crit_exit_quick(td); + cpu_mb1(); } #endif } diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 4e0cb3ab87..bf5a186094 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -82,7 +82,7 @@ * * @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95 * $FreeBSD: src/sys/netinet/tcp_subr.c,v 1.73.2.31 2003/01/24 05:11:34 sam Exp $ - * $DragonFly: src/sys/netinet/tcp_subr.c,v 1.46 2005/04/11 09:43:50 hmp Exp $ + * $DragonFly: src/sys/netinet/tcp_subr.c,v 1.47 2005/04/22 17:41:15 joerg Exp $ */ #include "opt_compat.h" @@ -1140,9 +1140,6 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) rgd = globaldata_find(cpu_id); lwkt_setcpu_self(rgd); - /* indicate change of CPU */ - cpu_mb1(); - gencnt = tcbinfo[cpu_id].ipi_gencnt; n = tcbinfo[cpu_id].ipi_count; -- 2.41.0