From: Marc Zyngier <maz@kernel.org>
To: Jan Henrik Weinstock <jan@mwa.re>
Cc: oliver.upton@linux.dev, james.morse@arm.com,
suzuki.poulose@arm.com, yuzenghui@huawei.com,
catalin.marinas@arm.com, will@kernel.org,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
linux-kernel@vger.kernel.org, "Lukas Jünger" <lukas@mwa.re>
Subject: Re: KVM exit to userspace on WFI
Date: Fri, 20 Oct 2023 20:56:32 +0100 [thread overview]
Message-ID: <87ttql5aq7.wl-maz@kernel.org> (raw)
In-Reply-To: <CANi1PHhzk80HvwQbBM46gpJ6_AA_P6+m5Jo0Nuy_MAdA4C2BhQ@mail.gmail.com>
Hi Jan,
On Fri, 20 Oct 2023 19:45:05 +0100,
Jan Henrik Weinstock <jan@mwa.re> wrote:
>
> Hi all,
>
> I am looking for a way to have KVM_RUN exit back to userspace once the
> vcpu encounters a WFI. It seems the kvm_run->request_interrupt_window
> flag is currently ignored by arm64.
Well, that's consistent with arm64 not being an x86 implementation. We
can inject interrupts any time, and there is no notion of "interrupt
window".
> So my solution thus far is to
> patch kvm_handle_wfx in arch/arm64/kvm/handle_exit.c and return to
> userspace with KVM_EXIT_IRQ_WINDOW_OPEN - working example attached.
> Any chance to get this (or something similar) mainline?
Certainly not as such. For start, this won't hit all WFIs, but only
those that actively trap. And we don't even *try* to trap WFx in a
number of cases (vcpu alone in its run queue and/or direct injection).
There isn't even any guarantee that WFx is anything other than a NOP
(it is architecturally only a hint), in which case no trap applies.
So your "working example" really isn't one, as the architecture
doesn't give you a way to do what you're asking for. If you want to
cause an exit, writing to 'immediate_exit' and delivering a signal is
the way.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2023-10-20 19:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 18:45 KVM exit to userspace on WFI Jan Henrik Weinstock
2023-10-20 19:56 ` Marc Zyngier [this message]
2023-10-25 12:12 ` Jan Henrik Weinstock
2023-10-25 12:42 ` Marc Zyngier
2023-10-27 17:41 ` Jan Henrik Weinstock
2023-10-30 12:36 ` Marc Zyngier
2023-10-31 19:21 ` Jan Henrik Weinstock
2023-11-04 12:13 ` Marc Zyngier
2023-11-08 9:38 ` Jan Henrik Weinstock
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=87ttql5aq7.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=jan@mwa.re \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas@mwa.re \
--cc=oliver.upton@linux.dev \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/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