From: Marc Zyngier <maz@kernel.org>
To: Maximilian Dittgen <mdittgen@amazon.de>
Cc: <oliver.upton@linux.dev>, <pbonzini@redhat.com>,
<shuah@kernel.org>, <linux-arm-kernel@lists.infradead.org>,
<kvmarm@lists.linux.dev>, <linux-kselftest@vger.kernel.org>,
<kvm@vger.kernel.org>, <lilitj@amazon.de>, <sauravsc@amazon.de>,
<nh-open-source@amazon.com>
Subject: Re: [RFC PATCH 01/13] KVM: Introduce config option for per-vCPU vLPI enablement
Date: Thu, 20 Nov 2025 16:18:37 +0000 [thread overview]
Message-ID: <864iqosmn6.wl-maz@kernel.org> (raw)
In-Reply-To: <20251120140305.63515-2-mdittgen@amazon.de>
On Thu, 20 Nov 2025 14:02:50 +0000,
Maximilian Dittgen <mdittgen@amazon.de> wrote:
>
> Add CONFIG_ARM_GIC_V3_PER_VCPU_VLPI to control whether vLPI direct
> injection is to be enabled on a system-wide or a per-vCPU basis.
>
> When enabled, vPEs can be allocated/deallocated to vCPUs on an ad-hoc,
> per-vCPU basis in runtime. When disabled, keep current vgic_v4_init
> behavior of automatic vCPU vPE allocation upon VM initialization.
>
> We declare three ioctls numbers to manage per-vCPU vLPI enablement:
> - KVM_ENABLE_VCPU_VLPI, which given a vCPU ID, allocates a vPE and
> initializes the vCPU for receiving direct vLPI interrupts.
> - KVM_DISABLE_VCPU_VLPI, which given a vCPU ID, disables the vCPU’s
> ability to receive direct vLPI interrupts and frees its underlying vPE
> structure.
> - KVM_QUERY_VCPU_VLPI, which given a vCPU ID, returns a boolean
> describing whether the vCPU is configured to receive direct vLPI
> interrupts.
>
> This commit declares the kconfig, ioctl numbers, and documentation.
> Implementation will come throughout this patch set.
>
> Signed-off-by: Maximilian Dittgen <mdittgen@amazon.de>
> ---
> Documentation/virt/kvm/api.rst | 56 ++++++++++++++++++++++++++++++++++
> arch/arm64/kvm/arm.c | 15 +++++++++
> arch/arm64/kvm/vgic/vgic-v4.c | 9 ++++++
> arch/arm64/kvm/vgic/vgic.h | 2 ++
> drivers/irqchip/Kconfig | 13 ++++++++
> include/uapi/linux/kvm.h | 6 ++++
> 6 files changed, 101 insertions(+)
>
> diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
> index 27f726ff8fe0..dcfb326dff10 100644
> --- a/Documentation/virt/kvm/api.rst
> +++ b/Documentation/virt/kvm/api.rst
> @@ -6517,6 +6517,62 @@ the capability to be present.
>
> `flags` must currently be zero.
>
> +4.XXX KVM_ENABLE_VCPU_VLPI
> +--------------------------
> +
> +:Capability: KVM_CAP_ARM_PER_VCPU_VLPI
> +:Architectures: arm64
> +:Type: vm ioctl
> +:Parameters: int vcpu_id (in)
> +:Returns: 0 on success, negative value on error
> +
> +This ioctl enables GICv4 direct vLPI injection for the specified vCPU.
> +Allocates vPE structures (doorbell IRQ, vPE table entry, virtual pending
> +table, vPEID) and upgrades existing software-forwarded LPIs targeting
> +this vCPU to hardware-forwarded vLPIs.
> +
> +If GICv4.1 is supported and vSGIs are disabled on the specified vCPU,
> +this ioctl enables vCPU vSGI support.
> +
> +Requires CONFIG_ARM_GIC_V3_PER_VCPU_VLPI and GICv4 hardware support.
> +
> +Returns -EINVAL if vGICv4 is not initialized or if the passed vcpu_id
> +does not map to a vCPU.
> +
> +4.XXX KVM_DISABLE_VCPU_VLPI
> +---------------------------
> +
> +:Capability: KVM_CAP_ARM_PER_VCPU_VLPI
> +:Architectures: arm64
> +:Type: vm ioctl
> +:Parameters: int vcpu_id (in)
> +:Returns: 0 on success, negative value on error
> +
> +This ioctl disables GICv4 direct vLPI injection for the specified vCPU.
> +Downgrades hardware-forwarded vLPIs to software-forwarded LPIs and frees
> +vPE structures. Pending interrupts in the virtual pending table may be
> +lost.
I'm going to put my foot down on that immediately.
There is no conceivable case where losing interrupts in acceptable.
Ever. If that's what you want, please write your own hypervisor. I
wish you luck!
> +
> +If vSGIs are enabled on the specified vCPU, this ioctl disables them.
So what? Something that didn't have an active state now has one that
the guest doesn't know about? There is exactly *one* bit that defines
that, and it doesn't exist in some quantum superposition.
This whole thing is completely insane, has not been thought out at
all, is ignoring the basis of the architecture, and I'm really sorry
that you wasted your time on that.
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2025-11-20 16:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 14:02 [RFC PATCH 00/13] Introduce per-vCPU vLPI injection control API Maximilian Dittgen
2025-11-20 14:02 ` [RFC PATCH 01/13] KVM: Introduce config option for per-vCPU vLPI enablement Maximilian Dittgen
2025-11-20 16:18 ` Marc Zyngier [this message]
2025-11-20 14:02 ` [RFC PATCH 02/13] KVM: arm64: Disable auto vCPU vPE assignment with per-vCPU vLPI config Maximilian Dittgen
2025-11-20 14:02 ` [RFC PATCH 03/13] KVM: arm64: Refactor out locked section of kvm_vgic_v4_set_forwarding() Maximilian Dittgen
2025-11-20 14:02 ` [RFC PATCH 04/13] KVM: arm64: Implement vLPI QUERY ioctl for per-vCPU vLPI injection API Maximilian Dittgen
2025-11-20 14:02 ` [RFC PATCH 05/13] KVM: arm64: Implement vLPI ENABLE " Maximilian Dittgen
2025-11-20 14:02 ` [RFC PATCH 06/13] KVM: arm64: Resolve race between vCPU scheduling and vLPI enablement Maximilian Dittgen
2025-11-20 14:02 ` [RFC PATCH 07/13] KVM: arm64: Implement vLPI DISABLE ioctl for per-vCPU vLPI Injection API Maximilian Dittgen
2025-11-20 14:02 ` [RFC PATCH 08/13] KVM: arm64: Make per-vCPU vLPI control ioctls atomic Maximilian Dittgen
2025-11-20 14:02 ` [RFC PATCH 09/13] KVM: arm64: Couple vSGI enablement with per-vCPU vPE allocation Maximilian Dittgen
2025-11-20 14:02 ` [RFC PATCH 10/13] KVM: selftests: fix MAPC RDbase target formatting in vgic_lpi_stress Maximilian Dittgen
2025-11-20 14:03 ` [RFC PATCH 11/13] KVM: Ioctl to set up userspace-injected MSIs as software-bypassing vLPIs Maximilian Dittgen
2025-11-20 14:03 ` [RFC PATCH 12/13] KVM: arm64: selftests: Add support for stress testing direct-injected vLPIs Maximilian Dittgen
2025-11-20 14:03 ` [RFC PATCH 13/13] KVM: arm64: selftests: Add test for per-vCPU vLPI control API Maximilian Dittgen
2025-11-20 14:40 ` [RFC PATCH 00/13] Introduce per-vCPU vLPI injection " Marc Zyngier
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=864iqosmn6.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=lilitj@amazon.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mdittgen@amazon.de \
--cc=nh-open-source@amazon.com \
--cc=oliver.upton@linux.dev \
--cc=pbonzini@redhat.com \
--cc=sauravsc@amazon.de \
--cc=shuah@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;
as well as URLs for NNTP newsgroup(s).