Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 May 2015 20:36:38 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r283667 - projects/hps_head/sys/kern
Message-ID:  <201505282036.t4SKace2045507@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu May 28 20:36:37 2015
New Revision: 283667
URL: https://svnweb.freebsd.org/changeset/base/283667

Log:
  Direct callouts must be executed after cpu_new_callout() is called in
  the callout_process() function. Direct callouts can restart themselves
  or another callout which also can call cpu_new_callout(). If this
  happens from the completion callback the computed "cc_firstevent" will
  be wrong.

Modified:
  projects/hps_head/sys/kern/kern_timeout.c

Modified: projects/hps_head/sys/kern/kern_timeout.c
==============================================================================
--- projects/hps_head/sys/kern/kern_timeout.c	Thu May 28 20:33:28 2015	(r283666)
+++ projects/hps_head/sys/kern/kern_timeout.c	Thu May 28 20:36:37 2015	(r283667)
@@ -632,6 +632,10 @@ callout_process(sbintime_t now)
 		 */
 	} while (((int)(firstb - lastb)) <= 0);
 
+	cc->cc_firstevent = last;
+#ifndef NO_EVENTTIMERS
+	cpu_new_callout(curcpu, last, first);
+#endif
 	/*
 	 * Check for expired direct callouts, if any:
 	 */
@@ -639,11 +643,6 @@ callout_process(sbintime_t now)
 		LIST_REMOVE(tmp, c_links.le);
 		softclock_call_cc(tmp, cc, 1);
 	}
-
-	cc->cc_firstevent = last;
-#ifndef NO_EVENTTIMERS
-	cpu_new_callout(curcpu, last, first);
-#endif
 #ifdef CALLOUT_PROFILING
 	callout_update_stats(cc, 1);
 #endif



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