Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Mar 2009 17:30:38 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r189891 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern
Message-ID:  <200903161730.n2GHUc7L067488@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rwatson
Date: Mon Mar 16 17:30:38 2009
New Revision: 189891
URL: http://svn.freebsd.org/changeset/base/189891

Log:
  Merge r189545 from head to stable/7:
  
  By default, don't compile in counters of calls to various time
  query functions in the kernel, as these effectively serialize
  parallel calls to the gettimeofday(2) system call, as well as
  other kernel services that use timestamps.
  
  Use the NetBSD version of the fix (kern_tc.c:1.32 by ad@) as
  they have picked up our timecounter code and also ran into the
  same problem.
  
  Reported by:    kris
  Obtained from:  NetBSD

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/kern/kern_tc.c

Modified: stable/7/sys/kern/kern_tc.c
==============================================================================
--- stable/7/sys/kern/kern_tc.c	Mon Mar 16 17:25:09 2009	(r189890)
+++ stable/7/sys/kern/kern_tc.c	Mon Mar 16 17:30:38 2009	(r189891)
@@ -103,6 +103,7 @@ static int timestepwarnings;
 SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW,
     &timestepwarnings, 0, "");
 
+#ifdef TC_COUNTERS
 #define TC_STATS(foo) \
 	static u_int foo; \
 	SYSCTL_UINT(_kern_timecounter, OID_AUTO, foo, CTLFLAG_RD, &foo, 0, "");\
@@ -114,7 +115,11 @@ TC_STATS(ngetbinuptime); TC_STATS(ngetna
 TC_STATS(ngetbintime);   TC_STATS(ngetnanotime);   TC_STATS(ngetmicrotime);
 TC_STATS(nsetclock);
 
+#define	TC_COUNT(var)	var++
 #undef TC_STATS
+#else
+#define	TC_COUNT(var)	/* nothing */
+#endif /* TC_COUNTERS */
 
 static void tc_windup(void);
 static void cpu_tick_calibrate(int);
@@ -180,7 +185,7 @@ binuptime(struct bintime *bt)
 	struct timehands *th;
 	u_int gen;
 
-	nbinuptime++;
+	TC_COUNT(nbinuptime);
 	do {
 		th = timehands;
 		gen = th->th_generation;
@@ -194,7 +199,7 @@ nanouptime(struct timespec *tsp)
 {
 	struct bintime bt;
 
-	nnanouptime++;
+	TC_COUNT(nnanouptime);
 	binuptime(&bt);
 	bintime2timespec(&bt, tsp);
 }
@@ -204,7 +209,7 @@ microuptime(struct timeval *tvp)
 {
 	struct bintime bt;
 
-	nmicrouptime++;
+	TC_COUNT(nmicrouptime);
 	binuptime(&bt);
 	bintime2timeval(&bt, tvp);
 }
@@ -213,7 +218,7 @@ void
 bintime(struct bintime *bt)
 {
 
-	nbintime++;
+	TC_COUNT(nbintime);
 	binuptime(bt);
 	bintime_add(bt, &boottimebin);
 }
@@ -223,7 +228,7 @@ nanotime(struct timespec *tsp)
 {
 	struct bintime bt;
 
-	nnanotime++;
+	TC_COUNT(nnanotime);
 	bintime(&bt);
 	bintime2timespec(&bt, tsp);
 }
@@ -233,7 +238,7 @@ microtime(struct timeval *tvp)
 {
 	struct bintime bt;
 
-	nmicrotime++;
+	TC_COUNT(nmicrotime);
 	bintime(&bt);
 	bintime2timeval(&bt, tvp);
 }
@@ -244,7 +249,7 @@ getbinuptime(struct bintime *bt)
 	struct timehands *th;
 	u_int gen;
 
-	ngetbinuptime++;
+	TC_COUNT(ngetbinuptime);
 	do {
 		th = timehands;
 		gen = th->th_generation;
@@ -258,7 +263,7 @@ getnanouptime(struct timespec *tsp)
 	struct timehands *th;
 	u_int gen;
 
-	ngetnanouptime++;
+	TC_COUNT(ngetnanouptime);
 	do {
 		th = timehands;
 		gen = th->th_generation;
@@ -272,7 +277,7 @@ getmicrouptime(struct timeval *tvp)
 	struct timehands *th;
 	u_int gen;
 
-	ngetmicrouptime++;
+	TC_COUNT(ngetmicrouptime);
 	do {
 		th = timehands;
 		gen = th->th_generation;
@@ -286,7 +291,7 @@ getbintime(struct bintime *bt)
 	struct timehands *th;
 	u_int gen;
 
-	ngetbintime++;
+	TC_COUNT(ngetbintime);
 	do {
 		th = timehands;
 		gen = th->th_generation;
@@ -301,7 +306,7 @@ getnanotime(struct timespec *tsp)
 	struct timehands *th;
 	u_int gen;
 
-	ngetnanotime++;
+	TC_COUNT(ngetnanotime);
 	do {
 		th = timehands;
 		gen = th->th_generation;
@@ -315,7 +320,7 @@ getmicrotime(struct timeval *tvp)
 	struct timehands *th;
 	u_int gen;
 
-	ngetmicrotime++;
+	TC_COUNT(ngetmicrotime);
 	do {
 		th = timehands;
 		gen = th->th_generation;
@@ -406,7 +411,7 @@ tc_setclock(struct timespec *ts)
 	struct bintime bt, bt2;
 
 	cpu_tick_calibrate(1);
-	nsetclock++;
+	TC_COUNT(nsetclock);
 	nanotime(&tbef);
 	timespec2bintime(ts, &bt);
 	binuptime(&bt2);



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