lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fac971fe6625456f3c9ad69d859008117e35826a.camel@infradead.org>
Date: Tue, 02 Dec 2025 17:10:44 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Khushit Shah <khushit.shah@...anix.com>, "pbonzini@...hat.com"
 <pbonzini@...hat.com>, "kai.huang@...el.com" <kai.huang@...el.com>, 
 "mingo@...hat.com" <mingo@...hat.com>, "x86@...nel.org" <x86@...nel.org>,
 "bp@...en8.de" <bp@...en8.de>, "hpa@...or.com" <hpa@...or.com>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
 "kvm@...r.kernel.org" <kvm@...r.kernel.org>,  "dave.hansen@...ux.intel.com"
 <dave.hansen@...ux.intel.com>, "tglx@...utronix.de" <tglx@...utronix.de>, 
 Jon Kohler <jon@...anix.com>, Shaju Abraham <shaju.abraham@...anix.com>,
 "stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: Re: [PATCH v3] KVM: x86: Add x2APIC "features" to control EOI
 broadcast suppression

On Tue, 2025-12-02 at 08:36 -0800, Sean Christopherson wrote:
> 
> Hmm, I suppose that could work for uAPI.  Having both an ENABLE and a DISABLE
> is obviously a bit odd, but slowing down the reader might actually be a good
> thing in this case.  And the documentation should be easy enough to write.
> 
> I was worried that having ENABLE and DISABLE controls would lead to confusing code
> internally, but there's no reason KVM's internal tracking needs to match uAPI.
> 
> How about this?
> 
> ---
>  arch/x86/include/asm/kvm_host.h |  7 +++++++
>  arch/x86/include/uapi/asm/kvm.h |  6 ++++--
>  arch/x86/kvm/lapic.c            | 16 +++++++++++++++-
>  arch/x86/kvm/x86.c              | 15 ++++++++++++---
>  4 files changed, 38 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 5a3bfa293e8b..b4c41255f01d 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1226,6 +1226,12 @@ enum kvm_irqchip_mode {
>  	KVM_IRQCHIP_SPLIT,        /* created with KVM_CAP_SPLIT_IRQCHIP */
>  };
>  
> +enum kvm_suppress_eoi_broadcast_mode {
> +	KVM_SUPPRESS_EOI_QUIRKED,
> +	KVM_SUPPRESS_EOI_ENABLED,
> +	KVM_SUPPRESS_EOI_DISABLED,
> +};
> +

Looks good. I'd probably call it KVM_SUPPRESS_EOI_LEGACY though?

And just for clarity I wouldn't embed the explicit checks against e.g
arch.suppress_eoi_broadcast != KVM_SUPPRESS_EOI_LEGACY. I'd make static
inline functions like

static inline bool kvm_lapic_advertise_directed_eoi(kvm)
{
	/* Legacy behaviour was to advertise this feature but it
didn't 
	 * actually work. */
	return kvm->arch.suppress_eoi_broadcast != KVM_SUPPRESS_EOI_DISABLED;
}

static inline bool kvm_lapic_suppress_directed_eoi(kvm)
{
	/* Legacy behaviour advertised this feature but didn't
actually
	 * suppress the EOI. */
	return kvm->arch.suppress_eoi_broadcast == KVM_SUPPRESS_EOI_ENABLED;
}

Because it keeps the batshittery in one place and clearly documented?

I note your version did actually suppress the broadcast even in the
DISABLED case if the guest had managed to set that bit in SPIV, but I
don't think it *can* so that difference doesn't matter anyway, right?

Download attachment "smime.p7s" of type "application/pkcs7-signature" (5069 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ