From: Peter Zijlstra <peterz@infradead.org>
To: Alexander Graf <graf@amazon.de>
Cc: David Woodhouse <dwmw2@infradead.org>,
kvm@vger.kernel.org, Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org,
Nicolas Saenz Julienne <nsaenz@amazon.es>,
"Griffoul, Fred" <fgriffo@amazon.com>
Subject: Re: [RFC] KVM: x86: Allow userspace exit on HLT and MWAIT, else yield on MWAIT
Date: Tue, 19 Sep 2023 11:04:46 +0200 [thread overview]
Message-ID: <20230919090446.GC21729@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <db756c13-eee5-414a-a28d-2ce08e7b77d9@amazon.de>
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 :-)
next prev parent reply other threads:[~2023-09-19 9:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-18 9:06 [RFC] KVM: x86: Allow userspace exit on HLT and MWAIT, else yield on MWAIT David Woodhouse
2023-09-18 9:41 ` Alexander Graf
2023-09-18 11:10 ` David Woodhouse
2023-09-18 11:59 ` Alexander Graf
2023-09-19 9:04 ` Peter Zijlstra [this message]
2023-09-22 12:00 ` Paolo Bonzini
2023-09-23 7:22 ` David Woodhouse
2023-09-23 9:24 ` Paolo Bonzini
2023-09-23 16:43 ` Alexander Graf
2023-09-26 17:20 ` Paolo Bonzini
2023-09-26 17:28 ` David Woodhouse
2023-09-26 20:29 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230919090446.GC21729@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=fgriffo@amazon.com \
--cc=graf@amazon.de \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nsaenz@amazon.es \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox