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
This commit is contained in:
Nathan Whitehorn 2016-08-24 16:49:14 +00:00
parent 95f9709424
commit e21d69e9a7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=304756

View File

@ -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