mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	"Tian, Kevin" <kevin.tian@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"Yamahata, Isaku" <isaku.yamahata@intel.com>,
	"Huang, Kai" <kai.huang@intel.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>,
	"Hansen, Dave" <dave.hansen@intel.com>,
	"Gao, Chao" <chao.gao@intel.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: Q. about KVM and CPU hotplug
Date: Tue, 30 Nov 2021 17:27:02 +0100	[thread overview]
Message-ID: <527c1261-8f21-bcbe-e28e-652a1e37ab14@redhat.com> (raw)
In-Reply-To: <8735ndd9hd.ffs@tglx>

On 11/30/21 15:05, Thomas Gleixner wrote:
> Why is this hotplug callback in the CPU starting section to begin with?

Just because the old notifier implementation used CPU_STARTING - in fact 
the commit messages say that CPU_STARTING was added partly *for* KVM 
(commit e545a6140b69, "kernel/cpu.c: create a CPU_STARTING cpu_chain 
notifier", 2008-09-08).

> If you stick it into the online section which runs on the hotplugged CPU
> in thread context:
> 
> 	CPUHP_AP_ONLINE_IDLE,
> 
> -->   	CPUHP_AP_KVM_STARTING,
> 
> 	CPUHP_AP_SCHED_WAIT_EMPTY,
> 
> then it is allowed to fail and it still works in the right way.

Yes, moving it to the online section should be fine; it wouldn't solve 
the TDX problem however.  Failure would rollback the hotplug and forbid 
hotplug altogether when TDX is loaded, which is not acceptable.

Paolo

> When onlining a CPU then there cannot be any vCPU task run on the
> CPU at that point.
> 
> When offlining a CPU then it's guaranteed that all user tasks and
> non-pinned kernel tasks have left the CPU, i.e. there cannot be a vCPU
> task around either.


  reply	other threads:[~2021-11-30 16:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30  8:27 Tian, Kevin
2021-11-30  9:28 ` Paolo Bonzini
2021-11-30 14:05   ` Thomas Gleixner
2021-11-30 16:27     ` Paolo Bonzini [this message]
2021-12-01  7:18       ` Tian, Kevin
2021-11-30 20:02   ` Sean Christopherson
2021-12-01  6:59   ` Tian, Kevin
2021-12-01 10:30     ` Thomas Gleixner
2021-12-04  3:57       ` Tian, Kevin

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=527c1261-8f21-bcbe-e28e-652a1e37ab14@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=chao.gao@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=isaku.yamahata@intel.com \
    --cc=jun.nakajima@intel.com \
    --cc=kai.huang@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®