Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maxim Levitsky" <mlevitsk@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v2 1/2] KVM: nVMX: don't check PIR.ON when processing nested posted interrupts
Date: Sun, 11 Oct 2026 00:25:08 +0000	[thread overview]
Message-ID: <sashiko-outbox-166942@kernel.org> (raw)
In-Reply-To: <20261011001303.723721-2-mlevitsk@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] x86/kvm: direct usage of __smp_mb__after_atomic() bypasses KCSAN
--

commit b3864bd32325846a2ccca43a4ce66f3b92dcb341
Author: Maxim Levitsky <mlevitsk@redhat.com>

KVM: nVMX: don't check PIR.ON when processing nested posted interrupts
    
Despite the suggestion to test and set the PIR.ON and avoid sending
a posted interrupt if it is already set, there is no requirement
for this bit to be set for posted interrupt processing to happen
when the target CPU receives the posted notification vector.

> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index ddf6df7bee93b..50548e3483181 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -4033,8 +4033,16 @@ static int vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu)
>  
>  	vmx->nested.pi_pending = false;
>  
> -	if (!pi_test_and_clear_on(vmx->nested.pi_desc))
> -		return 0;
> +	/*
> +	 * Don't test the value of PID.ON.
> +	 * It is valid to trigger a posted interrupt without setting this bit
> +	 */
> +	pi_clear_on(vmx->nested.pi_desc);
> +
> +	/* Ensure that guests sees the change to PIR.ON before KVM harvest
> +	 * the PIR
> +	 */
> +	__smp_mb__after_atomic();

[Severity: Low]
Does this code intentionally bypass KCSAN instrumentation?

By calling the architecture-internal macro __smp_mb__after_atomic() directly
instead of the generic smp_mb__after_atomic() API, KCSAN instrumentation
(provided by kcsan_mb()) is skipped.

While this does not cause a functional memory ordering bug on x86, it violates
kernel API conventions and could lead to false positives when running KCSAN.

>  
>  	max_irr = pi_find_highest_vector(vmx->nested.pi_desc);
>  	if (max_irr > 0) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261011001303.723721-1-mlevitsk@redhat.com?part=1

  reply	other threads:[~2026-10-11  0:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11  0:13 [PATCH v2 0/2] KVM: nVMX: fix nested APICv emulation for windows guests Maxim Levitsky
2026-10-11  0:13 ` [PATCH v2 1/2] KVM: nVMX: don't check PIR.ON when processing nested posted interrupts Maxim Levitsky
2026-10-11  0:25   ` sashiko-bot [this message]
2026-10-11  0:13 ` [PATCH v2 2/2] KVM: nVMX: avoid losing the posted notification interrupt when exiting L2 Maxim Levitsky
2026-10-11  0:25   ` sashiko-bot
2026-10-12 13:04 ` [PATCH v2 0/2] KVM: nVMX: fix nested APICv emulation for windows guests Paolo Bonzini

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=sashiko-outbox-166942@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=mlevitsk@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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