From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Alex Nixon <alex.nixon@citrix.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH 1/7] x86/paravirt: Add hooks for CPU hotplugging
Date: Thu, 21 Aug 2008 11:19:56 -0700 [thread overview]
Message-ID: <48ADB1CC.7080004@goop.org> (raw)
In-Reply-To: <1219341888-23191-1-git-send-email-alex.nixon@citrix.com>
Alex Nixon wrote:
> Signed-off-by: Alex Nixon <alex.nixon@citrix.com>
> Cc: Jeremy Fitzhardinge <jeremy@goop.org>
> Cc: Ingo Molnar <mingo@elte.hu>
> ---
> arch/x86/kernel/paravirt.c | 8 ++++++++
> arch/x86/kernel/process_32.c | 10 ++++++++--
> arch/x86/kernel/process_64.c | 9 +++++++--
> arch/x86/kernel/smpboot.c | 8 ++++----
> include/asm-x86/paravirt.h | 27 +++++++++++++++++++++++++++
> include/asm-x86/smp.h | 13 +++++++++++--
> 6 files changed, 65 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
> index 7cd2747..8ffe4d1 100644
> --- a/arch/x86/kernel/paravirt.c
> +++ b/arch/x86/kernel/paravirt.c
> @@ -125,6 +125,7 @@ static void *get_call_destination(u8 type)
> .pv_apic_ops = pv_apic_ops,
> .pv_mmu_ops = pv_mmu_ops,
> .pv_lock_ops = pv_lock_ops,
> + .pv_hotplug_ops = pv_hotplug_ops,
>
I think I'd prefer these to be part of smp_ops. We're only talking
about three new operations, and they're the logical compliments of the
existing smp_ops functions for bringing up cpus.
J
> };
> return *((void **)&tmpl + type);
> }
> @@ -455,9 +456,16 @@ struct pv_mmu_ops pv_mmu_ops = {
> .set_fixmap = native_set_fixmap,
> };
>
> +struct pv_hotplug_ops pv_hotplug_ops = {
> + .cpu_die = native_cpu_die,
> + .cpu_disable = native_cpu_disable,
> + .play_dead = native_play_dead,
> +};
> +
> EXPORT_SYMBOL_GPL(pv_time_ops);
> EXPORT_SYMBOL (pv_cpu_ops);
> EXPORT_SYMBOL (pv_mmu_ops);
> EXPORT_SYMBOL_GPL(pv_apic_ops);
> EXPORT_SYMBOL_GPL(pv_info);
> EXPORT_SYMBOL (pv_irq_ops);
> +EXPORT_SYMBOL (pv_hotplug_ops);
> diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
> index 593b73e..53887cd 100644
> --- a/arch/x86/kernel/process_32.c
> +++ b/arch/x86/kernel/process_32.c
> @@ -77,6 +77,12 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
> #ifdef CONFIG_HOTPLUG_CPU
> #include <asm/nmi.h>
>
> +#ifdef CONFIG_PARAVIRT
> +#include <asm/paravirt.h>
> +#else
> +#define play_dead native_play_dead
> +#endif
> +
> static void cpu_exit_clear(void)
> {
> int cpu = raw_smp_processor_id();
> @@ -93,7 +99,7 @@ static void cpu_exit_clear(void)
> }
>
> /* We don't actually take CPU down, just spin without interrupts. */
> -static inline void play_dead(void)
> +void native_play_dead(void)
> {
> /* This must be done before dead CPU ack */
> cpu_exit_clear();
> @@ -109,7 +115,7 @@ static inline void play_dead(void)
> wbinvd_halt();
> }
> #else
> -static inline void play_dead(void)
> +void play_dead(void)
> {
> BUG();
> }
> diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
> index 8248dc0..7512044 100644
> --- a/arch/x86/kernel/process_64.c
> +++ b/arch/x86/kernel/process_64.c
> @@ -86,13 +86,18 @@ void exit_idle(void)
> return;
> __exit_idle();
> }
> +#ifdef CONFIG_PARAVIRT
> +#include <asm/paravirt.h>
> +#else
> +#define play_dead native_play_dead
> +#endif
>
> #ifdef CONFIG_HOTPLUG_CPU
> DECLARE_PER_CPU(int, cpu_state);
>
> #include <linux/nmi.h>
> /* We halt the CPU with physical CPU hotplug */
> -static inline void play_dead(void)
> +void native_play_dead(void)
> {
> idle_task_exit();
> mb();
> @@ -104,7 +109,7 @@ static inline void play_dead(void)
> wbinvd_halt();
> }
> #else
> -static inline void play_dead(void)
> +void native_play_dead(void)
> {
> BUG();
> }
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index eea2fd6..2a555a1 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -1340,7 +1340,7 @@ static void __ref remove_cpu_from_maps(int cpu)
> numa_remove_cpu(cpu);
> }
>
> -int __cpu_disable(void)
> +int native_cpu_disable(void)
> {
> int cpu = smp_processor_id();
>
> @@ -1379,7 +1379,7 @@ int __cpu_disable(void)
> return 0;
> }
>
> -void __cpu_die(unsigned int cpu)
> +void native_cpu_die(unsigned int cpu)
> {
> /* We don't do anything here: idle task is faking death itself. */
> unsigned int i;
> @@ -1397,12 +1397,12 @@ void __cpu_die(unsigned int cpu)
> printk(KERN_ERR "CPU %u didn't die...\n", cpu);
> }
> #else /* ... !CONFIG_HOTPLUG_CPU */
> -int __cpu_disable(void)
> +int native_cpu_disable(void)
> {
> return -ENOSYS;
> }
>
> -void __cpu_die(unsigned int cpu)
> +void native_cpu_die(unsigned int cpu)
> {
> /* We said "no" in __cpu_disable */
> BUG();
> diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
> index eca8c4f..fd922c3 100644
> --- a/include/asm-x86/paravirt.h
> +++ b/include/asm-x86/paravirt.h
> @@ -332,6 +332,12 @@ struct pv_lock_ops {
> void (*spin_unlock)(struct raw_spinlock *lock);
> };
>
> +struct pv_hotplug_ops {
> + void (*play_dead)(void);
> + int (*cpu_disable)(void);
> + void (*cpu_die)(unsigned int);
> +};
> +
> /* This contains all the paravirt structures: we get a convenient
> * number for each function using the offset which we use to indicate
> * what to patch. */
> @@ -343,6 +349,7 @@ struct paravirt_patch_template {
> struct pv_apic_ops pv_apic_ops;
> struct pv_mmu_ops pv_mmu_ops;
> struct pv_lock_ops pv_lock_ops;
> + struct pv_hotplug_ops pv_hotplug_ops;
> };
>
> extern struct pv_info pv_info;
> @@ -353,6 +360,7 @@ extern struct pv_irq_ops pv_irq_ops;
> extern struct pv_apic_ops pv_apic_ops;
> extern struct pv_mmu_ops pv_mmu_ops;
> extern struct pv_lock_ops pv_lock_ops;
> +extern struct pv_hotplug_ops pv_hotplug_ops;
>
> #define PARAVIRT_PATCH(x) \
> (offsetof(struct paravirt_patch_template, x) / sizeof(void *))
> @@ -1408,6 +1416,25 @@ static __always_inline void __raw_spin_unlock(struct raw_spinlock *lock)
>
> #endif
>
> +#ifdef CONFIG_HOTPLUG_CPU
> +
> +static inline int __cpu_disable(void)
> +{
> + return PVOP_CALL0(int, pv_hotplug_ops.cpu_disable);
> +}
> +
> +static inline void __cpu_die(unsigned int cpu)
> +{
> + PVOP_VCALL1(pv_hotplug_ops.cpu_die, cpu);
> +}
> +
> +static inline void play_dead(void)
> +{
> + PVOP_VCALL0(pv_hotplug_ops.play_dead);
> +}
> +
> +#endif
> +
> /* These all sit in the .parainstructions section to tell us what to patch. */
> struct paravirt_patch_site {
> u8 *instr; /* original instructions */
> diff --git a/include/asm-x86/smp.h b/include/asm-x86/smp.h
> index 29324c1..f7d153f 100644
> --- a/include/asm-x86/smp.h
> +++ b/include/asm-x86/smp.h
> @@ -113,11 +113,20 @@ void native_smp_prepare_boot_cpu(void);
> void native_smp_prepare_cpus(unsigned int max_cpus);
> void native_smp_cpus_done(unsigned int max_cpus);
> int native_cpu_up(unsigned int cpunum);
> +int native_cpu_disable(void);
> +void native_cpu_die(unsigned int cpu);
> +void native_play_dead(void);
> +
> void native_send_call_func_ipi(cpumask_t mask);
> void native_send_call_func_single_ipi(int cpu);
>
> -extern int __cpu_disable(void);
> -extern void __cpu_die(unsigned int cpu);
> +
> +#ifdef CONFIG_PARAVIRT
> +#include <asm/paravirt.h>
> +#else
> +#define __cpu_disable native_cpu_disable
> +#define __cpu_die native_cpu_die
> +#endif
>
> void smp_store_cpu_info(int id);
> #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
>
prev parent reply other threads:[~2008-08-21 18:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-21 18:04 [PATCH 1/7] x86/paravirt: Add hooks for CPU hotplugging Alex Nixon
2008-08-21 18:04 ` [PATCH 2/7] x86/paravirt: Add paravirt hook for wbinvd_halt Alex Nixon
2008-08-21 18:04 ` [PATCH 3/7] Xen: Add Xen implementation of wbinvd_halt Alex Nixon
2008-08-21 18:04 ` [PATCH 4/7] x86_32: Clean up play_dead Alex Nixon
2008-08-21 18:04 ` [PATCH 5/7] x86: Unify x86_32 and x86_64 play_dead into one function Alex Nixon
2008-08-21 18:04 ` [PATCH 6/7] x86: Separate generic cpu disabling code from APIC writes in cpu_disable Alex Nixon
2008-08-21 18:04 ` [PATCH 7/7] Xen: Implement CPU hotplugging Alex Nixon
2008-08-21 18:37 ` Jeremy Fitzhardinge
2008-08-21 18:16 ` [PATCH 2/7] x86/paravirt: Add paravirt hook for wbinvd_halt Jeremy Fitzhardinge
2008-08-21 18:19 ` Jeremy Fitzhardinge [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=48ADB1CC.7080004@goop.org \
--to=jeremy@goop.org \
--cc=alex.nixon@citrix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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.