All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: shrutiss@google.com
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] x86/apic/savic: Forward APIC_SPIV writes to the hypervisor
Date: Tue, 29 Sep 2026 06:01:53 +0000	[thread overview]
Message-ID: <20260929060154.0F8FD1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929055255.1380202-1-shrutiss@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] x86/apic: lost interrupts due to incorrect APIC_SPIV update order
--

commit 26f070fb302ca5a93ef870d540aaf2cf4fb25a54
Author: Shruti <shrutiss@google.com>

x86/apic/savic: Forward APIC_SPIV writes to the hypervisor

This commit updates savic_write() to forward APIC_SPIV writes to the
hypervisor so that the emulated APIC state stays in sync with the guest's
local backing page.

> diff --git a/arch/x86/kernel/apic/x2apic_savic.c b/arch/x86/kernel/apic/x2apic_savic.c
> --- a/arch/x86/kernel/apic/x2apic_savic.c
> +++ b/arch/x86/kernel/apic/x2apic_savic.c
[ ... ]
> @@ -223,6 +222,10 @@ static void savic_write(u32 reg, u32 data)
>  	case APIC_EILVTn(0) ... APIC_EILVTn(3):
>  		apic_set_reg(ap, reg, data);
>  		break;
> +	case APIC_SPIV:
> +		savic_ghcb_msr_write(reg, data);
> +		apic_set_reg(ap, reg, data);

[Severity: High]
Does this specific ordering cause a regression where interrupts could be
dropped?

When a vCPU writes to APIC_SPIV to enable the APIC, savic_ghcb_msr_write()
notifies the hypervisor. The hypervisor then marks the emulated APIC as
software-enabled and may immediately inject a pending interrupt before
resuming the guest.

When the guest resumes, the hardware AVIC evaluates the injected interrupt
against the local APIC backing page. Because apic_set_reg() has not yet
executed, the local backing page still reflects a software-disabled APIC,
causing the hardware AVIC to drop the interrupt.

Would reversing the order of these two calls ensure the local backing page
is ready before the hypervisor is notified?

> +		break;
>  	case APIC_ICR:
>  		savic_icr_write(data, 0);
>  		break;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260929055255.1380202-1-shrutiss@google.com?part=1

  reply	other threads:[~2026-09-29  6:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29  5:52 [PATCH] x86/apic/savic: Forward APIC_SPIV writes to the hypervisor shrutiss
2026-09-29  6:01 ` sashiko-bot [this message]
2026-09-30  5:04 ` Borislav Petkov

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=20260929060154.0F8FD1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shrutiss@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.