[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230919090446.GC21729@noisy.programming.kicks-ass.net>
Date: Tue, 19 Sep 2023 11:04:46 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Alexander Graf <graf@...zon.de>
Cc: David Woodhouse <dwmw2@...radead.org>, kvm@...r.kernel.org,
Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
Nicolas Saenz Julienne <nsaenz@...zon.es>,
"Griffoul, Fred" <fgriffo@...zon.com>
Subject: Re: [RFC] KVM: x86: Allow userspace exit on HLT and MWAIT, else
yield on MWAIT
On Mon, Sep 18, 2023 at 01:59:50PM +0200, Alexander Graf wrote:
> The problem with MWAIT is that you don't really know when it's done.
This isn't really a problem. MWAIT is allowed (expected even) to return
early.
REP;NOP is a valid implementation of MWAIT.
MWAIT must not delay waking (much) after either:
- write to monitored address
- interrupt pending
But it doesn't say anything about not waking up sooner.
Now, obviously on real hardware you prefer if MWAIT were to also do the
whole C-state thing and safe your some actual power, but this is virt,
real hardware is not a concern and wakeup-timeliness also not much.
IIRC the ARM64 WFE thing has a 10khz timer or something it wakes from if
nothing else. So I suppose what I'm saying is that: nanosleep(100000)
might be a suitable MWAIT implementation.
It's virt, it sucks anyway :-)
Powered by blists - more mailing lists