From: Alex Nixon <alex.nixon@citrix.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Alex Nixon <alex.nixon@citrix.com>,
Jeremy Fitzhardinge <jeremy@goop.org>,
Ingo Molnar <mingo@elte.hu>
Subject: [PATCH 3/5] x86: Unify x86_32 and x86_64 play_dead into one function
Date: Fri, 22 Aug 2008 11:52:13 +0100 [thread overview]
Message-ID: <1219402335-29773-3-git-send-email-alex.nixon@citrix.com> (raw)
In-Reply-To: <1219402335-29773-2-git-send-email-alex.nixon@citrix.com>
Add the new play_dead into smpboot.c, as it fits more cleanly in there alongside other CONFIG_HOTPLUG functions.
Separate out the common code into its own function.
Signed-off-by: Alex Nixon <alex.nixon@citrix.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/process_32.c | 32 --------------------------------
arch/x86/kernel/process_64.c | 23 -----------------------
arch/x86/kernel/smpboot.c | 29 +++++++++++++++++++++++++++++
include/asm-x86/smp.h | 1 +
4 files changed, 30 insertions(+), 55 deletions(-)
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index c4abfab..aff137c 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -74,38 +74,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
return ((unsigned long *)tsk->thread.sp)[3];
}
-#ifdef CONFIG_HOTPLUG_CPU
-#include <asm/nmi.h>
-
-/* We don't actually take CPU down, just spin without interrupts. */
-void native_play_dead(void)
-{
- int cpu = raw_smp_processor_id();
-
- idle_task_exit();
-
- reset_lazy_tlbstate();
-
- irq_ctx_exit(cpu);
-
- mb();
- /* Ack it */
- __get_cpu_var(cpu_state) = CPU_DEAD;
-
- /*
- * With physical CPU hotplug, we should halt the cpu
- */
- local_irq_disable();
- /* mask all interrupts, flush any and all caches, and halt */
- wbinvd_halt();
-}
-#else
-void native_play_dead(void)
-{
- BUG();
-}
-#endif /* CONFIG_HOTPLUG_CPU */
-
/*
* The idle thread. There's no useful work to be
* done, so just try to conserve power and have a
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 1cca50c..b2bab8e 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -87,29 +87,6 @@ void exit_idle(void)
__exit_idle();
}
-#ifdef CONFIG_HOTPLUG_CPU
-DECLARE_PER_CPU(int, cpu_state);
-
-#include <linux/nmi.h>
-/* We halt the CPU with physical CPU hotplug */
-void native_play_dead(void)
-{
- idle_task_exit();
- mb();
- /* Ack it */
- __get_cpu_var(cpu_state) = CPU_DEAD;
-
- local_irq_disable();
- /* mask all interrupts, flush any and all caches, and halt */
- wbinvd_halt();
-}
-#else
-void native_play_dead(void)
-{
- BUG();
-}
-#endif /* CONFIG_HOTPLUG_CPU */
-
/*
* The idle thread. There's no useful work to be
* done, so just try to conserve power and have a
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index c6832ca..58d8c6c 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1399,6 +1399,29 @@ void native_cpu_die(unsigned int cpu)
}
printk(KERN_ERR "CPU %u didn't die...\n", cpu);
}
+
+void play_dead_common(void)
+{
+ idle_task_exit();
+ reset_lazy_tlbstate();
+ irq_ctx_exit(raw_smp_processor_id());
+
+ mb();
+ /* Ack it */
+ __get_cpu_var(cpu_state) = CPU_DEAD;
+
+ /*
+ * With physical CPU hotplug, we should halt the cpu
+ */
+ local_irq_disable();
+}
+
+void native_play_dead(void)
+{
+ play_dead_common();
+ wbinvd_halt();
+}
+
#else /* ... !CONFIG_HOTPLUG_CPU */
int native_cpu_disable(void)
{
@@ -1410,4 +1433,10 @@ void native_cpu_die(unsigned int cpu)
/* We said "no" in __cpu_disable */
BUG();
}
+
+void native_play_dead(void)
+{
+ BUG();
+}
+
#endif
diff --git a/include/asm-x86/smp.h b/include/asm-x86/smp.h
index dba14d3..95b28c1 100644
--- a/include/asm-x86/smp.h
+++ b/include/asm-x86/smp.h
@@ -135,6 +135,7 @@ 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 play_dead_common(void);
void native_send_call_func_ipi(cpumask_t mask);
void native_send_call_func_single_ipi(int cpu);
--
1.5.4.3
next prev parent reply other threads:[~2008-08-22 10:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-22 10:52 [PATCH 1/5] x86: Add cpu hotplug hooks into smp_ops Alex Nixon
2008-08-22 10:52 ` [PATCH 2/5] x86_32: Clean up play_dead Alex Nixon
2008-08-22 10:52 ` Alex Nixon [this message]
2008-08-22 10:52 ` [PATCH 4/5] x86: Separate generic cpu disabling code from APIC writes in cpu_disable Alex Nixon
2008-08-22 10:52 ` [PATCH 5/5] Xen: Implement CPU hotplugging Alex Nixon
2008-08-25 9:25 ` Ingo Molnar
2008-08-25 9:41 ` Ingo Molnar
2008-08-24 5:57 ` [PATCH 3/5] x86: Unify x86_32 and x86_64 play_dead into one function Jeremy Fitzhardinge
2008-08-25 8:59 ` [PATCH 1/5] x86: Add cpu hotplug hooks into smp_ops 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=1219402335-29773-3-git-send-email-alex.nixon@citrix.com \
--to=alex.nixon@citrix.com \
--cc=jeremy@goop.org \
--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 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®