From: Paolo Bonzini <pbonzini@redhat.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
rt@linutronix.de, Gleb Natapov <gleb@kernel.org>,
kvm@vger.kernel.org
Subject: Re: [PATCH 14/16] x86: kvm: Convert to hotplug state machine
Date: Thu, 18 Aug 2016 19:06:20 +0200 [thread overview]
Message-ID: <8912020e-bf85-67b0-f401-538893c4ca5e@redhat.com> (raw)
In-Reply-To: <20160818125731.27256-15-bigeasy@linutronix.de>
On 18/08/2016 14:57, Sebastian Andrzej Siewior wrote:
> Install the callbacks via the state machine. The online & down callbacks are
> invoke on the target CPU so we can avoid using smp_call_function_single().
> local_irq_disable() is used because smp_call_function_single() used to invoke
> the function with interrupts disabled.
>
> Cc: Gleb Natapov <gleb@kernel.org>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: kvm@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> arch/x86/kernel/kvm.c | 42 +++++++++++++++---------------------------
> 1 file changed, 15 insertions(+), 27 deletions(-)
>
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index 1726c4c12336..d1fcb2d3c976 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -423,12 +423,7 @@ static void __init kvm_smp_prepare_boot_cpu(void)
> kvm_spinlock_init();
> }
>
> -static void kvm_guest_cpu_online(void *dummy)
> -{
> - kvm_guest_cpu_init();
> -}
> -
> -static void kvm_guest_cpu_offline(void *dummy)
> +static void kvm_guest_cpu_offline(void)
> {
> kvm_disable_steal_time();
> if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
> @@ -437,29 +432,21 @@ static void kvm_guest_cpu_offline(void *dummy)
> apf_task_wake_all();
> }
>
> -static int kvm_cpu_notify(struct notifier_block *self, unsigned long action,
> - void *hcpu)
> +static int kvm_cpu_online(unsigned int cpu)
> {
> - int cpu = (unsigned long)hcpu;
> - switch (action) {
> - case CPU_ONLINE:
> - case CPU_DOWN_FAILED:
> - case CPU_ONLINE_FROZEN:
> - smp_call_function_single(cpu, kvm_guest_cpu_online, NULL, 0);
> - break;
> - case CPU_DOWN_PREPARE:
> - case CPU_DOWN_PREPARE_FROZEN:
> - smp_call_function_single(cpu, kvm_guest_cpu_offline, NULL, 1);
> - break;
> - default:
> - break;
> - }
> - return NOTIFY_OK;
> + local_irq_disable();
> + kvm_guest_cpu_init();
> + local_irq_enable();
> + return 0;
> }
>
> -static struct notifier_block kvm_cpu_notifier = {
> - .notifier_call = kvm_cpu_notify,
> -};
> +static int kvm_cpu_down_prepare(unsigned int cpu)
> +{
> + local_irq_disable();
> + kvm_guest_cpu_offline();
> + local_irq_enable();
> + return 0;
> +}
> #endif
>
> static void __init kvm_apf_trap_init(void)
> @@ -494,7 +481,8 @@ void __init kvm_guest_init(void)
>
> #ifdef CONFIG_SMP
> smp_ops.smp_prepare_boot_cpu = kvm_smp_prepare_boot_cpu;
> - register_cpu_notifier(&kvm_cpu_notifier);
> + cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "X86_KVM_ONLINE",
> + kvm_cpu_online, kvm_cpu_down_prepare);
> #else
> kvm_guest_cpu_init();
> #endif
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
next prev parent reply other threads:[~2016-08-18 17:22 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-18 12:57 cpu hotplug: convert more drivers Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 01/16] cpuhotplug: Remove CPU_STARTING and CPU_DYING notifier Sebastian Andrzej Siewior
2016-09-06 15:19 ` [tip:smp/hotplug] cpu/hotplug: " tip-bot for Thomas Gleixner
2016-09-06 16:37 ` tip-bot for Thomas Gleixner
2016-08-18 12:57 ` [PATCH 02/16] relayfs: Convert to hotplug state machine Sebastian Andrzej Siewior
2016-09-06 15:20 ` [tip:smp/hotplug] " tip-bot for Richard Weinberger
2016-09-06 16:38 ` tip-bot for Richard Weinberger
2016-08-18 12:57 ` [PATCH 03/16] slab: " Sebastian Andrzej Siewior
2016-08-18 17:08 ` Sebastian Andrzej Siewior
2016-08-23 12:53 ` [PATCH 03/16 v2] " Sebastian Andrzej Siewior
2016-09-06 15:21 ` [tip:smp/hotplug] " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:38 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 04/16] slub: " Sebastian Andrzej Siewior
2016-09-06 15:21 ` [tip:smp/hotplug] " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:38 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 05/16] mm: writeback: " Sebastian Andrzej Siewior
2016-09-06 15:22 ` [tip:smp/hotplug] mm/writeback: " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:39 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 06/16] kernel: softirq: " Sebastian Andrzej Siewior
2016-09-06 15:22 ` [tip:smp/hotplug] kernel/softirq: " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:39 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 07/16] rcu: rcutorture: " Sebastian Andrzej Siewior
2016-08-18 16:20 ` Paul E. McKenney
2016-08-18 12:57 ` [PATCH 08/16] net: mvneta: " Sebastian Andrzej Siewior
2016-09-06 15:23 ` [tip:smp/hotplug] net/mvneta: " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:40 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 09/16] md: raid5: " Sebastian Andrzej Siewior
2016-09-06 15:23 ` [tip:smp/hotplug] md/raid5: " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:40 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 10/16] cpuidle: pseries: " Sebastian Andrzej Siewior
2016-08-22 16:09 ` Daniel Lezcano
2016-08-22 19:04 ` Sebastian Andrzej Siewior
2016-08-23 14:16 ` Daniel Lezcano
2016-08-23 16:32 ` Sebastian Andrzej Siewior
2016-08-24 9:09 ` [PATCH 10/16 v2] " Sebastian Andrzej Siewior
2016-09-06 15:24 ` [tip:smp/hotplug] cpuidle/pseries: " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:41 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 11/16] cpuidle: powernv: " Sebastian Andrzej Siewior
2016-08-24 9:12 ` Sebastian Andrzej Siewior
2016-09-06 15:24 ` [tip:smp/hotplug] cpuidle/powernv: " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:41 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 12/16] cpuidle: coupled: " Sebastian Andrzej Siewior
2016-08-23 14:24 ` Daniel Lezcano
2016-08-24 9:14 ` [PATCH 12/16 v2] " Sebastian Andrzej Siewior
2016-09-06 15:25 ` [tip:smp/hotplug] cpuidle/coupled: " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:42 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 13/16] MIPS: BUS: CDMM: " Sebastian Andrzej Siewior
2016-09-06 15:25 ` [tip:smp/hotplug] MIPS/BUS/CDMM: " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:42 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 14/16] x86: kvm: " Sebastian Andrzej Siewior
2016-08-18 17:06 ` Paolo Bonzini [this message]
2016-09-06 15:25 ` [tip:smp/hotplug] x86/kvm: " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:43 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 15/16] powerpc: powermac: " Sebastian Andrzej Siewior
2016-09-06 15:26 ` [tip:smp/hotplug] powerpc/powermac: " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:43 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 12:57 ` [PATCH 16/16] powerpc: mmu nohash: " Sebastian Andrzej Siewior
2016-09-06 15:26 ` [tip:smp/hotplug] powerpc/mmu " tip-bot for Sebastian Andrzej Siewior
2016-09-06 16:44 ` tip-bot for Sebastian Andrzej Siewior
2016-08-18 13:40 ` cpu hotplug: convert more drivers Ingo Molnar
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=8912020e-bf85-67b0-f401-538893c4ca5e@redhat.com \
--to=pbonzini@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rt@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;
as well as URLs for NNTP newsgroup(s).