[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a02bfdf3448cdd7738c9a11a1624baf0d8bdffdd.camel@intel.com>
Date: Wed, 28 Jan 2026 06:40:33 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "khushit.shah@...anix.com" <khushit.shah@...anix.com>, "seanjc@...gle.com"
<seanjc@...gle.com>, "dwmw2@...radead.org" <dwmw2@...radead.org>
CC: "Kohler, Jon" <jon@...anix.com>, "x86@...nel.org" <x86@...nel.org>,
"bp@...en8.de" <bp@...en8.de>, "hpa@...or.com" <hpa@...or.com>,
"mingo@...hat.com" <mingo@...hat.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "dave.hansen@...ux.intel.com"
<dave.hansen@...ux.intel.com>, "pbonzini@...hat.com" <pbonzini@...hat.com>,
"shaju.abraham@...anix.com" <shaju.abraham@...anix.com>,
"stable@...r.kernel.org" <stable@...r.kernel.org>, "kvm@...r.kernel.org"
<kvm@...r.kernel.org>, "tglx@...utronix.de" <tglx@...utronix.de>
Subject: Re: [PATCH v6] KVM: x86: Add x2APIC "features" to control EOI
broadcast suppression
> > >
> > > > Ah, so userspace which checks all the kernel's capabilities *first*
> > > > will not see KVM_X2APIC_ENABLE_SUPPRESS_EOI_BROADCAST advertised,
> > > > because it needs to enable KVM_CAP_SPLIT_IRQCHIP first?
> > > > > > I guess that's tolerable¹ but the documentation could make it clearer,
> > > > perhaps? I can see VMMs silently failing to detect the feature because
> > > > they just don't set split-irqchip before checking for it? > > > > > > ¹ although I still kind of hate it and would have preferred to have the
> > > > I/O APIC patch; userspace still has to intentionally *enable* that
> > > > combination. But OK, I've reluctantly conceded that.
> > > > To make it even more robust, perhaps we can grab kvm->lock mutex in
> > > kvm_vm_ioctl_enable_cap() for KVM_CAP_X2APIC_API, so that it won't race with
> > > KVM_CREATE_IRQCHIP (which already grabs kvm->lock) and
> > > KVM_CAP_SPLIT_IRQCHIP?
> > > > Even more, we can add additional check in KVM_CREATE_IRQCHIP to return -
> > > EINVAL when it sees kvm->arch.suppress_eoi_broadcast_mode is
> > > KVM_X2APIC_ENABLE_SUPPRESS_EOI_BROADCAST?
> >
> > If we do that, then the query for KVM_CAP_X2APIC_API could advertise
> > the KVM_X2APIC_ENABLE_SUPPRESS_EOI_BROADCAST for a freshly created KVM,
> > even before userspace has enabled *either* KVM_CREATE_IRQCHIP nor
> > KVM_CAP_SPLIT_IRQCHIP?
> >
> > That would be slightly better than the existing proposed awfulness
> > where the kernel doesn't *admit* to having the _ENABLE_ capability
> > until userspace first enables the KVM_CAP_SPLIT_IRQCHIP.
>
>
> How about we make an explicit _ENABLE_ bit for split IRQCHIP?
> When/if in-kernel IRQCHIP starts supporting I/O APIC 0x20, we
> can add a separate bit for that in the CAP.
>
> This way:
> - The flag name (KVM_X2APIC_SPLIT_ENABLE_SEOIB) is self-documenting.
> - We always advertise it in KVM_CHECK_EXTENSION.
> - Enabling requires split IRQCHIP to be configured first.
> - Mutex protects against races with KVM_CAP_SPLIT_IRQCHIP.
>
> Diff below (compile tested):
>
(Somehow I only saw this reply after I replied to David.)
Looks better to me, so Ack.
Powered by blists - more mailing lists