Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Naveen N Rao <naveen@kernel.org>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Gleixner <tglx@kernel.org>,
	 Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	 Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	 kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kai Huang <kai.huang@intel.com>,  Yosry Ahmed <yosry@kernel.org>
Subject: Re: [PATCH] x86/apic: KVM: Use cpu_physical_id() to get APIC ID of running vCPU for AVIC
Date: Tue, 16 Jun 2026 13:27:51 +0530	[thread overview]
Message-ID: <ajDsUg236ilh40YZ@blrnaveerao1> (raw)
In-Reply-To: <20260612185459.591892-1-seanjc@google.com>

On Fri, Jun 12, 2026 at 11:54:59AM -0700, Sean Christopherson wrote:
> Use cpu_physical_id() instead of default_cpu_present_to_apicid() when
> getting the APIC ID of the pCPU on which a vCPU is running/loaded, as the
> kernel has gone way off the rails if a vCPU is loaded on a pCPU that has
> been physically removed from the system.

Or, has been unloaded from a pCPU that is then soft-offlined and 
physically hot unplugged before that vCPU ever got a chance to run 
again!

> Even if the impossible were to
> happen, the absolutely worst case scenario is that hardware will ring the
> AIVC doorbell on the wrong pCPU, i.e. a severely broken system will
> experience mild performance issues.

Indeed, sending a doorbell to BAD_APICID doesn't seem to do anything 
bad, so I think we are ok with this.

> 
> Kill off KVM's superfluous kvm_cpu_get_apicid() wrapper along with the
> for-KVM export of default_cpu_present_to_apicid(), as they existed purely
> for the wonky AVIC usage.
> 
> Cc: Kai Huang <kai.huang@intel.com>
> Cc: Yosry Ahmed <yosry@kernel.org>
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Acked-by: Naveen N Rao (AMD) <naveen@kernel.org>


- Naveen


      parent reply	other threads:[~2026-06-16  7:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 18:54 [PATCH] x86/apic: KVM: Use cpu_physical_id() to get APIC ID of running vCPU for AVIC Sean Christopherson
2026-06-12 21:26 ` Yosry Ahmed
2026-06-15  2:00 ` Huang, Kai
2026-06-16  7:57 ` Naveen N Rao [this message]

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=ajDsUg236ilh40YZ@blrnaveerao1 \
    --to=naveen@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kai.huang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    --cc=yosry@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