- Subject: [PATCH 4/4] kexec: Add crash_save_vmcsinfo to update VMCSINFO
- From: zhangyanfei <zhangyanfei@xxxxxxxxxxxxxx>
- Date: Wed, 11 Apr 2012 09:58:34 +0800
- Cc: ebiederm@xxxxxxxxxxxx, luto@xxxxxxx, joerg.roedel@xxxxxxx, dzickus@xxxxxxxxxx, paul.gortmaker@xxxxxxxxxxxxx, gregkh@xxxxxxx, ludwig.nussel@xxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, kexec@xxxxxxxxxxxxxxxxxxx
- In-reply-to: <4F84E0DF.8040206@cn.fujitsu.com>
- References: <4F84E0DF.8040206@cn.fujitsu.com>
- User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100413 Fedora/3.0.4-2.fc13 Thunderbird/3.0.4
crash_save_vmcsinfo updates the VMCSINFO when kernel crashes.
If no VMCSINFO has been saved before, this function will do nothing.
Signed-off-by: zhangyanfei <zhangyanfei@xxxxxxxxxxxxxx>
---
include/linux/kexec.h | 1 +
kernel/kexec.c | 14 ++++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 0d7d6a1..6e8ff13 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -145,6 +145,7 @@ void arch_crash_save_vmcoreinfo(void);
__printf(1, 2)
void vmcoreinfo_append_str(const char *fmt, ...);
unsigned long paddr_vmcoreinfo_note(void);
+void crash_save_vmcsinfo(void);
#define VMCOREINFO_OSRELEASE(value) \
vmcoreinfo_append_str("OSRELEASE=%s\n", value)
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 4e2e472..19843ef 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -38,6 +38,7 @@
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/sections.h>
+#include <asm/vmcsinfo.h>
/* Per cpu memory for storing cpu states in case of system crash. */
note_buf_t __percpu *crash_notes;
@@ -1094,6 +1095,7 @@ void crash_kexec(struct pt_regs *regs)
crash_setup_regs(&fixed_regs, regs);
crash_save_vmcoreinfo();
+ crash_save_vmcsinfo();
machine_crash_shutdown(&fixed_regs);
machine_kexec(kexec_crash_image);
}
@@ -1458,6 +1460,18 @@ unsigned long __attribute__ ((weak)) paddr_vmcoreinfo_note(void)
return __pa((unsigned long)(char *)&vmcoreinfo_note);
}
+#ifdef CONFIG_X86
+void crash_save_vmcsinfo(void)
+{
+ if (!vmcsinfo_size)
+ return;
+ vmcsinfo_append_str("CRASHTIME=%ld", get_seconds());
+ update_vmcsinfo_note();
+}
+#else
+void crash_save_vmcsinfo(void) {}
+#endif /* CONFIG_X86 */
+
static int __init crash_save_vmcoreinfo_init(void)
{
VMCOREINFO_OSRELEASE(init_uts_ns.name.release);
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[KVM ARM]
[KVM ia64]
[KVM ppc]
[Spice Development]
[Libvirt]
[Libvirt Users]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Linux Kernel]
[Linux SCSI]
[XFree86]