From: Ivan Vecera <ivecera@redhat.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
mingo@redhat.com, hpa@zytor.com, nhorman@redhat.com,
jmarchan@redhat.com, pavel@suse.cz
Subject: Re: [PATCH] x86: call machine_shutdown and stop all CPUs in native_machine_halt
Date: Tue, 11 Nov 2008 13:47:21 +0100 [thread overview]
Message-ID: <49197ED9.6090906@redhat.com> (raw)
In-Reply-To: <20081106204351.GG3578@elte.hu>
Ingo Molnar wrote:
> looks good. One small detail:
>
>> +#ifdef CONFIG_X86_LOCAL_APIC
>> + disable_local_APIC();
>> +#endif
>
> could you please avoid this #ifdef by putting an inline void function
> for disable_local_APIC() into arch/x86/include/asm/apic.h for the
> !CONFIG_X86_LOCAL_APIC case?
>
> Ingo
OK, here is the result.
Ivan
---
arch/x86/include/asm/apic.h | 1 +
arch/x86/include/asm/system.h | 2 ++
arch/x86/kernel/process.c | 14 ++++++++++++++
arch/x86/kernel/reboot.c | 5 +++++
arch/x86/kernel/smp.c | 13 -------------
5 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 3b1510b..25caa07 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -193,6 +193,7 @@ extern u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask);
static inline void lapic_shutdown(void) { }
#define local_apic_timer_c2_ok 1
static inline void init_apic_mappings(void) { }
+static inline void disable_local_APIC(void) { }
#endif /* !CONFIG_X86_LOCAL_APIC */
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
index 2ed3f0f..07c3e40 100644
--- a/arch/x86/include/asm/system.h
+++ b/arch/x86/include/asm/system.h
@@ -314,6 +314,8 @@ extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
void default_idle(void);
+void stop_this_cpu(void *dummy);
+
/*
* Force strict CPU ordering.
* And yes, this is required on UP too when we're talking
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index c622772..3380458 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -8,6 +8,7 @@
#include <linux/pm.h>
#include <linux/clockchips.h>
#include <asm/system.h>
+#include <asm/apic.h>
unsigned long idle_halt;
EXPORT_SYMBOL(idle_halt);
@@ -122,6 +123,19 @@ void default_idle(void)
EXPORT_SYMBOL(default_idle);
#endif
+void stop_this_cpu(void *dummy)
+{
+ local_irq_disable();
+ /*
+ * Remove this CPU:
+ */
+ cpu_clear(smp_processor_id(), cpu_online_map);
+ disable_local_APIC();
+ if (hlt_works(smp_processor_id()))
+ for (;;) halt();
+ for (;;);
+}
+
static void do_nothing(void *unused)
{
}
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 724adfc..34f8d37 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -461,6 +461,11 @@ static void native_machine_restart(char *__unused)
static void native_machine_halt(void)
{
+ /* stop other cpus and apics */
+ machine_shutdown();
+
+ /* stop this cpu */
+ stop_this_cpu(NULL);
}
static void native_machine_power_off(void)
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 18f9b19..3f92b13 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -140,19 +140,6 @@ void native_send_call_func_ipi(cpumask_t mask)
send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
}
-static void stop_this_cpu(void *dummy)
-{
- local_irq_disable();
- /*
- * Remove this CPU:
- */
- cpu_clear(smp_processor_id(), cpu_online_map);
- disable_local_APIC();
- if (hlt_works(smp_processor_id()))
- for (;;) halt();
- for (;;);
-}
-
/*
* this function calls the 'stop' function on all other CPUs in the system.
*/
--
1.5.6.3
next prev parent reply other threads:[~2008-11-11 12:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-20 12:13 [PATCH] x86: call machine_shutdown and stop all CPUs in native_machine_halt Ivan Vecera
2008-10-20 14:39 ` Neil Horman
2008-10-20 16:00 ` Ingo Molnar
2008-10-21 12:36 ` Ivan Vecera
2008-11-06 16:10 ` Ivan Vecera
2008-11-06 16:15 ` Neil Horman
2008-11-10 22:49 ` Pavel Machek
2008-11-11 12:48 ` Ivan Vecera
2008-11-06 20:43 ` Ingo Molnar
2008-11-11 12:47 ` Ivan Vecera [this message]
2008-11-11 13:47 ` 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=49197ED9.6090906@redhat.com \
--to=ivecera@redhat.com \
--cc=hpa@zytor.com \
--cc=jmarchan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=nhorman@redhat.com \
--cc=pavel@suse.cz \
--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