LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ivan Vecera <ivecera@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	nhorman@redhat.com, jmarchan@redhat.com,
	Ivan Vecera <ivecera@redhat.com>
Subject: [PATCH] x86: call machine_shutdown and stop all CPUs in native_machine_halt
Date: Mon, 20 Oct 2008 14:13:07 +0200	[thread overview]
Message-ID: <1224504787-11403-1-git-send-email-ivecera@redhat.com> (raw)

Function machine_halt (resp. native_machine_halt) is empty for x86
architectures. When command 'halt -f' is invoked, the message
"System halted." is displayed but this is not really true because
all CPUs are still running.
There are also similar inconsistencies for other arches (some uses
power-off for halt or forever-loop with IRQs enabled/disabled).
IMO there should be used the same approach for all architectures
OR what does the message "System halted" really mean?

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 arch/x86/kernel/reboot.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index f4c93f1..15ad949 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -465,6 +465,14 @@ static void native_machine_restart(char *__unused)
 
 static void native_machine_halt(void)
 {
+	/* stop other cpus and apics */
+	machine_shutdown();
+
+	/* stop this cpu */
+	local_irq_disable();
+	if (hlt_works(smp_processor_id()))
+		for (;;) halt();
+	for (;;);
 }
 
 static void native_machine_power_off(void)
-- 
1.5.6.3


             reply	other threads:[~2008-10-20 12:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-20 12:13 Ivan Vecera [this message]
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
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=1224504787-11403-1-git-send-email-ivecera@redhat.com \
    --to=ivecera@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jmarchan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nhorman@redhat.com \
    --cc=tglx@linutronix.de \
    --subject='Re: [PATCH] x86: call machine_shutdown and stop all CPUs in native_machine_halt' \
    /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

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).