Re: [PATCH 5/5] KVM: selftests: Add MONITOR/MWAIT quirk test

From: Sean Christopherson
Date: Thu Jun 09 2022 - 09:56:18 EST


On Thu, Jun 09, 2022, Yuan Yao wrote:
> On Wed, Jun 08, 2022 at 10:45:16PM +0000, Sean Christopherson wrote:
> > +static void guest_monitor_wait(int testcase)
> > +{
> > + /*
> > + * If both MWAIT and its quirk are disabled, MONITOR/MWAIT should #UD,
> > + * in all other scenarios KVM should emulate them as nops.
> > + */
> > + bool fault_wanted = (testcase & MWAIT_QUIRK_DISABLED) &&
> > + (testcase & MWAIT_DISABLED);
> > + u8 vector;
> > +
> > + GUEST_SYNC(testcase);
> > +
> > + vector = kvm_asm_safe("monitor");
> > + if (fault_wanted)
> > + GUEST_ASSERT_2(vector == UD_VECTOR, testcase, vector);
> > + else
> > + GUEST_ASSERT_2(!vector, testcase, vector);
> > +
> > + vector = kvm_asm_safe("monitor");
>
> emmm... should one of the "monitor" be "mwait" ?

/facepalm

Thanks for catching my copy+paste fail!