Author: nwhitehorn Date: Wed Aug 24 16:49:14 2016 New Revision: 304756 URL: https://svnweb.freebsd.org/changeset/base/304756
Log: Close a race when making the CPU idle under pHyp. If an interrupt occurs between the beginning of the idle function and actually going idle, the CPU could go to sleep with pending work. MFC after: 1 month Modified: head/sys/powerpc/pseries/platform_chrp.c Modified: head/sys/powerpc/pseries/platform_chrp.c ============================================================================== --- head/sys/powerpc/pseries/platform_chrp.c Wed Aug 24 16:44:27 2016 (r304755) +++ head/sys/powerpc/pseries/platform_chrp.c Wed Aug 24 16:49:14 2016 (r304756) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bus.h> #include <sys/pcpu.h> #include <sys/proc.h> +#include <sys/sched.h> #include <sys/smp.h> #include <vm/vm.h> #include <vm/pmap.h> @@ -492,7 +493,18 @@ chrp_reset(platform_t platform) static void phyp_cpu_idle(sbintime_t sbt) { - phyp_hcall(H_CEDE); + register_t msr; + + msr = mfmsr(); + + mtmsr(msr & ~PSL_EE); + if (sched_runnable()) { + mtmsr(msr); + return; + } + + phyp_hcall(H_CEDE); /* Re-enables interrupts internally */ + mtmsr(msr); } static void _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"