From: Ben Thomas <bthomas@virtualiron.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] shutdown.c - halt_action
Date: Fri, 03 Nov 2006 16:29:39 -0500 [thread overview]
Message-ID: <454BB4C3.70907@virtualiron.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 976 bytes --]
It's not always desirable for a system to halt. The hypervisor has a
number of places where it does request a halt, and this might be useful
for debugging, but not always in a production environment. Add a
hypervisor command line parameter, halt_action, which allows the
overriding of any halt requests. The parameter takes the form of
halt_action=halt, halt_action=reboot or halt_action=reboot:20
for halting, rebooting after a default 10 seconds, or rebooting after
a specified number of seconds. The default is halt_action=halt
and preserves existing behavior.
Signed-off-by: Ben Thomas (ben@virtualiron.com)
--
------------------------------------------------------------------------
Ben Thomas Virtual Iron Software
bthomas@virtualiron.com Tower 1, Floor 2
978-849-1214 900 Chelmsford Street
Lowell, MA 01851
[-- Attachment #2: 10090-halt_action.patch --]
[-- Type: text/x-patch, Size: 2347 bytes --]
# It's not always desirable for a system to halt. The hypervisor has a
# number of places where it does request a halt, and this might be useful
# for debugging, but not always in a production environment. Add a
# hypervisor command line parameter, halt_action, which allows the
# overriding of any halt requests. The parameter takes the form of
# halt_action=halt, halt_action=reboot or halt_action=reboot:20
# for halting, rebooting after a default 10 seconds, or rebooting after
# a specified number of seconds. The default preserves is halt_action=halt
# and preserves existing behavior.
#
# Signed-off-by: Ben Thomas (ben@virtualiron.com)
Index: xen-unstable.hg/xen/arch/x86/shutdown.c
===================================================================
--- xen-unstable.hg.orig/xen/arch/x86/shutdown.c 2006-10-26 10:56:41.000000000 -0400
+++ xen-unstable.hg/xen/arch/x86/shutdown.c 2006-10-30 11:17:59.000000000 -0500
@@ -29,6 +29,29 @@
static long no_idt[2];
static int reboot_mode;
+void machine_restart(char * __unused);
+
+enum {HALT_ACTION_HALT, HALT_ACTION_REBOOT};
+static int halt_action = HALT_ACTION_HALT;
+static long halt_action_wait = 10;
+
+static void __init halt_action_set(char *str)
+{
+ if (strcmp(str, "halt") == 0)
+ halt_action = HALT_ACTION_HALT;
+ else if (strncmp(str, "reboot", strlen("reboot")) == 0)
+ {
+ halt_action = HALT_ACTION_REBOOT;
+ str += strlen("reboot");
+ if (*str == ':')
+ halt_action_wait = simple_strtol(++str, NULL, 10);
+ else
+ halt_action_wait = 10;
+ } else
+ printk("halt_action '%s' not recognized", str);
+}
+custom_param("halt_action", halt_action_set);
+
static inline void kb_wait(void)
{
int i;
@@ -48,6 +71,19 @@
{
watchdog_disable();
console_start_sync();
+ if (halt_action != HALT_ACTION_HALT)
+ {
+ printk("%s - reboot requested\n", __FUNCTION__);
+ halt_action = HALT_ACTION_HALT; // We may end up back here - don't loop
+ if (halt_action_wait > 0)
+ {
+ printk("%s - delay %ld seconds before reboot...\n", __FUNCTION__, halt_action_wait);
+ mdelay(halt_action_wait * 1000);
+ }
+ printk("%s - rebooting...\n", __FUNCTION__);
+ machine_restart(0);
+ // We shouldn't get back here, but if we do just halt
+ }
smp_call_function(__machine_halt, NULL, 1, 0);
__machine_halt(NULL);
}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2006-11-03 21:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-03 21:29 Ben Thomas [this message]
2006-11-04 7:46 ` [PATCH] shutdown.c - halt_action Keir Fraser
2006-11-06 22:06 ` Ben Thomas
2006-11-06 22:16 ` Keir Fraser
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=454BB4C3.70907@virtualiron.com \
--to=bthomas@virtualiron.com \
--cc=xen-devel@lists.xensource.com \
/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.