From: Avi Kivity <avi@qumranet.com>
To: Ingo Molnar <mingo@elte.hu>, "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: [PATCH] Fix emergency_restart (sysrq-b) with kvm loaded on Intel hosts
Date: Mon, 25 Aug 2008 12:11:46 +0300 [thread overview]
Message-ID: <1219655506-27418-1-git-send-email-avi@qumranet.com> (raw)
Enabling Intel VT has the curious side effect whereby the INIT signal is
blocked. Rather than comment on the wisdom of this side effect, this patch
adds an emergency restart reboot notifier, and modifies the kvm reboot
notifier to disable VT on emergency reboot.
Signed-off-by: Avi Kivity <avi@qumranet.com>
---
include/linux/notifier.h | 1 +
kernel/sys.c | 3 +++
virt/kvm/kvm_main.c | 10 ++++++++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index da2698b..59123e4 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -203,6 +203,7 @@ static inline int notifier_to_errno(int ret)
#define SYS_RESTART SYS_DOWN
#define SYS_HALT 0x0002 /* Notify of system halt */
#define SYS_POWER_OFF 0x0003 /* Notify of system power off */
+#define SYS_EMERGENCY_RESTART 0x0004 /* sysrq-b; no locks taken */
#define NETLINK_URELEASE 0x0001 /* Unicast netlink socket released */
diff --git a/kernel/sys.c b/kernel/sys.c
index 038a7bc..289dba3 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -270,6 +270,9 @@ out_unlock:
*/
void emergency_restart(void)
{
+ struct raw_notifier_head list = { .head = reboot_notifier_list.head };
+
+ raw_notifier_call_chain(&list, SYS_EMERGENCY_RESTART, NULL);
machine_emergency_restart();
}
EXPORT_SYMBOL_GPL(emergency_restart);
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 0309571..125041f 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1550,14 +1550,20 @@ EXPORT_SYMBOL_GPL(kvm_handle_fault_on_reboot);
static int kvm_reboot(struct notifier_block *notifier, unsigned long val,
void *v)
{
- if (val == SYS_RESTART) {
+ switch (val) {
+ case SYS_RESTART:
+ printk(KERN_INFO "kvm: exiting hardware virtualization\n");
+ /* coming through! */
+ case SYS_EMERGENCY_RESTART:
/*
* Some (well, at least mine) BIOSes hang on reboot if
* in vmx root mode.
*/
- printk(KERN_INFO "kvm: exiting hardware virtualization\n");
kvm_rebooting = true;
on_each_cpu(hardware_disable, NULL, 1);
+ break;
+ default:
+ break;
}
return NOTIFY_OK;
}
--
1.6.0
next reply other threads:[~2008-08-25 9:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-25 9:11 Avi Kivity [this message]
2008-08-25 9:15 ` Ingo Molnar
2008-08-25 9:27 ` Avi Kivity
2008-08-25 9:30 ` Ingo Molnar
2008-08-25 10:03 ` Avi Kivity
2008-08-25 10:27 ` Ingo Molnar
2008-08-25 10:36 ` Avi Kivity
2008-08-25 13:12 ` Eric W. Biederman
2008-08-25 13:35 ` Avi Kivity
2008-08-25 13:14 ` Eric W. Biederman
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=1219655506-27418-1-git-send-email-avi@qumranet.com \
--to=avi@qumranet.com \
--cc=ebiederm@xmission.com \
--cc=kvm@vger.kernel.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®