Re: [PATCH v13 09/19] x86: Secure Launch kernel early boot stub

From: Sean Christopherson
Date: Tue Apr 15 2025 - 18:16:08 EST


On Tue, Apr 15, 2025, Andrew Cooper wrote:
> On 11/04/2025 10:40 pm, Sean Christopherson wrote:
> > On Thu, Apr 10, 2025, Ross Philipson wrote:
> >> + * instruction can return for a number of reasons. Test to see if it returned
> >> + * because the monitor was written to.
> >> + */
> >> + monitor
> >> +
> >> +1:
> >> + mfence
> >> + mwait
> >> + movl (%eax), %edx
> > Why load the value into EDX? At a glance, the value is never consumed.
> >
> >> + testl %edx, %edx
> >> + jz 1b
> > This usage of MONITOR/MWAIT is flawed. The monitor needs to be re-armed in each
> > loop, otherwise mwait will be a glorified nop.
> >
> > More importantly, the exit condition needs to be checked before monitor,
>
> after monitor and before mwait.

Gah, yeah, I mean to say "before mwait".