public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: zhangyanfei <zhangyanfei@cn.fujitsu.com>
To: avi@redhat.com, mtosatti@redhat.com
Cc: dzickus@redhat.com, luto@mit.edu, kvm@vger.kernel.org,
	joerg.roedel@amd.com, gregkh@suse.de, kexec@lists.infradead.org,
	linux-kernel@vger.kernel.org, paul.gortmaker@windriver.com,
	ludwig.nussel@suse.de, ebiederm@xmission.com
Subject: [PATCH 4/4] kexec: Add crash_save_vmcsinfo to update VMCSINFO
Date: Wed, 11 Apr 2012 09:58:34 +0800	[thread overview]
Message-ID: <4F84E54A.1080903@cn.fujitsu.com> (raw)
In-Reply-To: <4F84E0DF.8040206@cn.fujitsu.com>

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@cn.fujitsu.com>
---
 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

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2012-04-11  1:58 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11  1:39 [PATCH 0/4] Export offsets of VMCS fields as note information for kdump zhangyanfei
2012-04-11  1:49 ` [PATCH 1/4] x86: Add helper variables and functions to hold VMCSINFO zhangyanfei
2012-04-11  1:50 ` [PATCH 2/4] KVM: VMX: Add functions to fill VMCSINFO zhangyanfei
2012-04-11  8:48   ` Avi Kivity
2012-04-11 10:34     ` zhangyanfei
2012-04-11 11:41       ` Avi Kivity
2012-04-11  1:57 ` [PATCH 3/4] ksysfs: export VMCSINFO via sysfs zhangyanfei
2012-04-12 23:00   ` Greg KH
2012-04-17  1:52     ` zhangyanfei
2012-04-17  2:30       ` Greg KH
2012-04-11  1:58 ` zhangyanfei [this message]
2012-04-11  8:56 ` [PATCH 0/4] Export offsets of VMCS fields as note information for kdump Avi Kivity
2012-04-11 10:12   ` zhangyanfei
2012-04-11 11:15     ` Avi Kivity
2012-04-11 10:21 ` Joerg Roedel
2012-04-11 10:49   ` Avi Kivity
2012-04-11 10:59   ` zhangyanfei
2012-04-17  7:44 ` Avi Kivity
2012-04-17 10:51   ` zhangyanfei
2012-04-17 10:59     ` Avi Kivity
2012-04-17 11:25       ` Wen Congyang
2012-04-17 13:04         ` Avi Kivity
2012-04-18  7:30       ` zhangyanfei
2012-04-18  8:24         ` Avi Kivity
2012-04-18  9:49           ` zhangyanfei
2012-04-18 11:56             ` Avi Kivity
2012-04-19 10:36               ` HATAYAMA Daisuke
2012-04-19 10:42                 ` Avi Kivity
2012-04-19 11:27                   ` HATAYAMA Daisuke
2012-04-19 11:31                     ` Avi Kivity
2012-04-19 12:01                       ` HATAYAMA Daisuke
2012-04-19 12:08                         ` Avi Kivity
2012-04-20 10:11                           ` HATAYAMA Daisuke
2012-04-22  9:58                             ` Avi Kivity
2012-04-22 10:33                               ` Gleb Natapov
2012-04-22 10:57                                 ` Avi Kivity
     [not found]   ` <4F8D9F20.9050507@codemonkey.ws>
2012-04-18 12:13     ` Avi Kivity
2012-04-18 13:47       ` Nadav Har'El
2012-04-18 14:06         ` Avi Kivity

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=4F84E54A.1080903@cn.fujitsu.com \
    --to=zhangyanfei@cn.fujitsu.com \
    --cc=avi@redhat.com \
    --cc=dzickus@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@suse.de \
    --cc=joerg.roedel@amd.com \
    --cc=kexec@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludwig.nussel@suse.de \
    --cc=luto@mit.edu \
    --cc=mtosatti@redhat.com \
    --cc=paul.gortmaker@windriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox