Author: mav Date: Sat Feb 23 18:32:42 2013 New Revision: 247195 URL: http://svnweb.freebsd.org/changeset/base/247195
Log: Add basic and not very reliable protection against going to sleep with thread scheduled by interrupt fired after we entered critical section. None of cpu_sleep() implementations on ARM check sched_runnable() now, so put the first line of defence here. This mostly fixes unexpectedly long sleeps in synthetic tests of calloutng code and probably other situations. Modified: head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Sat Feb 23 16:14:07 2013 (r247194) +++ head/sys/arm/arm/machdep.c Sat Feb 23 18:32:42 2013 (r247195) @@ -45,6 +45,7 @@ #include "opt_compat.h" #include "opt_ddb.h" #include "opt_platform.h" +#include "opt_sched.h" #include "opt_timer.h" #include <sys/cdefs.h> @@ -70,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mutex.h> #include <sys/pcpu.h> #include <sys/ptrace.h> +#include <sys/sched.h> #include <sys/signalvar.h> #include <sys/syscallsubr.h> #include <sys/sysctl.h> @@ -433,19 +435,24 @@ void cpu_idle(int busy) { + CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", + busy, curcpu); #ifndef NO_EVENTTIMERS if (!busy) { critical_enter(); cpu_idleclock(); } #endif - cpu_sleep(0); + if (!sched_runnable()) + cpu_sleep(0); #ifndef NO_EVENTTIMERS if (!busy) { cpu_activeclock(); critical_exit(); } #endif + CTR2(KTR_SPARE2, "cpu_idle(%d) at %d done", + busy, curcpu); } int _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"