Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Dec 2010 09:03:17 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216250 - in head/sys/cddl/dev/dtrace: amd64 i386
Message-ID:  <201012070903.oB793HUO060296@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Tue Dec  7 09:03:17 2010
New Revision: 216250
URL: http://svn.freebsd.org/changeset/base/216250

Log:
  dtrace_gethrtime_init: pin to master while examining other CPUs
  
  Also use pc_cpumask to be future-friendly.
  
  Reviewed by:	jhb
  MFC after:	2 weeks

Modified:
  head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
  head/sys/cddl/dev/dtrace/i386/dtrace_subr.c

Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
==============================================================================
--- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c	Tue Dec  7 08:20:20 2010	(r216249)
+++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c	Tue Dec  7 09:03:17 2010	(r216250)
@@ -405,6 +405,7 @@ dtrace_gethrtime_init_cpu(void *arg)
 static void
 dtrace_gethrtime_init(void *arg)
 {
+	struct pcpu *pc;
 	uint64_t tsc_f;
 	cpumask_t map;
 	int i;
@@ -437,15 +438,14 @@ dtrace_gethrtime_init(void *arg)
 	nsec_scale = ((uint64_t)NANOSEC << SCALE_SHIFT) / tsc_f;
 
 	/* The current CPU is the reference one. */
+	sched_pin();
 	tsc_skew[curcpu] = 0;
-
 	CPU_FOREACH(i) {
 		if (i == curcpu)
 			continue;
 
-		map = 0;
-		map |= (1 << curcpu);
-		map |= (1 << i);
+		pc = pcpu_find(i);
+		map = PCPU_GET(cpumask) | pc->pc_cpumask;
 
 		smp_rendezvous_cpus(map, dtrace_gethrtime_init_sync,
 		    dtrace_gethrtime_init_cpu,
@@ -453,6 +453,7 @@ dtrace_gethrtime_init(void *arg)
 
 		tsc_skew[i] = tgt_cpu_tsc - hst_cpu_tsc;
 	}
+	sched_unpin();
 }
 
 SYSINIT(dtrace_gethrtime_init, SI_SUB_SMP, SI_ORDER_ANY, dtrace_gethrtime_init, NULL);

Modified: head/sys/cddl/dev/dtrace/i386/dtrace_subr.c
==============================================================================
--- head/sys/cddl/dev/dtrace/i386/dtrace_subr.c	Tue Dec  7 08:20:20 2010	(r216249)
+++ head/sys/cddl/dev/dtrace/i386/dtrace_subr.c	Tue Dec  7 09:03:17 2010	(r216250)
@@ -405,6 +405,7 @@ dtrace_gethrtime_init_cpu(void *arg)
 static void
 dtrace_gethrtime_init(void *arg)
 {
+	struct pcpu *pc;
 	uint64_t tsc_f;
 	cpumask_t map;
 	int i;
@@ -437,15 +438,14 @@ dtrace_gethrtime_init(void *arg)
 	nsec_scale = ((uint64_t)NANOSEC << SCALE_SHIFT) / tsc_f;
 
 	/* The current CPU is the reference one. */
+	sched_pin();
 	tsc_skew[curcpu] = 0;
-
 	CPU_FOREACH(i) {
 		if (i == curcpu)
 			continue;
 
-		map = 0;
-		map |= (1 << curcpu);
-		map |= (1 << i);
+		pc = pcpu_find(i);
+		map = PCPU_GET(cpumask) | pc->pc_cpumask;
 
 		smp_rendezvous_cpus(map, dtrace_gethrtime_init_sync,
 		    dtrace_gethrtime_init_cpu,
@@ -453,6 +453,7 @@ dtrace_gethrtime_init(void *arg)
 
 		tsc_skew[i] = tgt_cpu_tsc - hst_cpu_tsc;
 	}
+	sched_unpin();
 }
 
 SYSINIT(dtrace_gethrtime_init, SI_SUB_SMP, SI_ORDER_ANY, dtrace_gethrtime_init, NULL);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012070903.oB793HUO060296>