public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Wen Congyang <wency-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
To: Avi Kivity <avi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: dzickus-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	luto-3s7WtUTddSA@public.gmane.org,
	gregkh-l3A5Bk7waGM@public.gmane.org,
	kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	joerg.roedel-5C7GfCeVMHo@public.gmane.org,
	mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	kexec-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org,
	zhangyanfei <zhangyanfei-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>,
	ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org,
	ludwig.nussel-l3A5Bk7waGM@public.gmane.org
Subject: Re: [PATCH 0/4] Export offsets of VMCS fields as note information for kdump
Date: Tue, 17 Apr 2012 19:25:00 +0800	[thread overview]
Message-ID: <4F8D530C.3050908@cn.fujitsu.com> (raw)
In-Reply-To: <4F8D4D1C.4010400-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

At 04/17/2012 06:59 PM, Avi Kivity Wrote:
> On 04/17/2012 01:51 PM, zhangyanfei wrote:
>> 于 2012年04月17日 15:44, Avi Kivity 写道:
>>> On 04/11/2012 04:39 AM, zhangyanfei wrote:
>>>> This patch set exports offsets of VMCS fields as note information for
>>>> kdump. We call it VMCSINFO. The purpose of VMCSINFO is to retrieve
>>>> runtime state of guest machine image, such as registers, in host
>>>> machine's crash dump as VMCS format. The problem is that VMCS
>>>> internal is hidden by Intel in its specification. So, we reverse
>>>> engineering it in the way implemented in this patch set. Please note
>>>> that this processing never affects any existing kvm logic. The
>>>> VMCSINFO is exported via sysfs to kexec-tools just like VMCOREINFO.
>>>>
>>>> Here is an example:
>>>> Processor: Intel(R) Core(TM)2 Duo CPU     E7500  @ 2.93GHz
>>>>
>>>> $cat /sys/kernel/vmcsinfo
>>>> 1cba8c0 2000
>>>>
>>>> crash> rd -p 1cba8c0 1000
>>>>          1cba8c0:  0000127b00000009 53434d5600000000   ....{.......VMCS
>>>>          1cba8d0:  000000004f464e49 4e4f495349564552   INFO....REVISION
>>>>          1cba8e0:  49460a643d44495f 5f4e495028444c45   _ID=d.FIELD(PIN_
>>>>          1cba8f0:  4d565f4445534142 4f435f434558455f   BASED_VM_EXEC_CO
>>>>          1cba900:  303d294c4f52544e 0a30383130343831   NTROL)=01840180.
>>>>          1cba910:  504328444c454946 5f44455341425f55   FIELD(CPU_BASED_
>>>>          1cba920:  5f434558455f4d56 294c4f52544e4f43   VM_EXEC_CONTROL)
>>>>          1cba930:  393130343931303d 28444c4549460a30   =01940190.FIELD(
>>>>          1cba940:  5241444e4f434553 4558455f4d565f59   SECONDARY_VM_EXE
>>>>          1cba950:  4f52544e4f435f43 30346566303d294c   C_CONTROL)=0fe40
>>>>          1cba960:  4c4549460a306566 4958455f4d562844   fe0.FIELD(VM_EXI
>>>>          1cba970:  4f52544e4f435f54 346531303d29534c   T_CONTROLS)=01e4
>>>>          1cba980:  4549460a30653130 4e455f4d5628444c   01e0.FIELD(VM_EN
>>>>          1cba990:  544e4f435f595254 33303d29534c4f52   TRY_CONTROLS)=03
>>>>          1cba9a0:  460a303133303431 45554728444c4549   140310.FIELD(GUE
>>>>          1cba9b0:  45535f53455f5453 3d29524f5443454c   ST_ES_SELECTOR)=
>>>>          1cba9c0:  4549460a30303530 545345554728444c   0500.FIELD(GUEST
>>>>          1cba9d0:  454c45535f53435f 35303d29524f5443   _CS_SELECTOR)=05
>>>>          ......
>>>>
>>>> TODO:
>>>>   1. In kexec-tools, get VMCSINFO via sysfs and dump it as note information
>>>>      into vmcore.
>>>>   2. Dump VMCS region of each guest vcpu and VMCSINFO into qemu-process
>>>>      core file. To do this, we will modify kernel core dumper, gdb gcore
>>>>      and crash gcore.
>>>>   3. Dump guest image from the qemu-process core file into a vmcore.
>>>>
>>>
>>> Taking a step back, can you describe the problem scenario you're fixing
>>> here?
>>>
>> Considering two scenarios below:
>> 1. Host panics, guests running on that host will also be dumped into
>>    host's vmcore.
>> 2. Qemu process is core dumped (by gdb gcore or kernel core dumper), and
>>    its coresponding guest will be included in the core file.
>>
>> We want to create the guest machine's crash dump from host machine's vmcore
>> or qemu process's core file. Unfortunately, we cannot get the guest's registers
>> values in both scenarios.
>>
>> For scenario 1, some key registers (CR0, CR3...) of the guest machine are stored
>> in VMCS region. But VMCS internal is hidden by Intel specification. So this
>> patch set aims to get offsets of fields in VMCS region and export it as note
>> information for kdump. 
> 
> Okay.  Do you expect it to help in debugging the crash?  Did you have
> cases where it would help?
> 
>>
>> For scenario 2, we also want the guest's registers values to be dumped into
>> qemu process's core file when qemu process crashes. This is the task of TODO-list 2.
> 
> Why?  If qemu crashed it is because of an internal qemu fault.  If any
> guest registers were involved, they would have been decoded by qemu
> previously and would be present in the stack trace (for example mmio
> address/data).

Hmm, IIRC, if qemu meets some critical error, it will call abort() or assert().
The guest registers are stored in the kernel, and qemu does not call
cpu_synchronize_state() to get guest register. So I donot understand
why the registers woubld be present int the stack trace...

Thanks
Wen Congyang

> 
>> Is this what you want?
>>
> 
> Yes.  I'm trying to understand if the feature would be useful in real life.
> 


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

  parent reply	other threads:[~2012-04-17 11:25 UTC|newest]

Thread overview: 40+ 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
     [not found]   ` <4F84E365.10201-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-04-11  8:48     ` Avi Kivity
     [not found]       ` <4F85454E.6020201-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-11 10:34         ` zhangyanfei
     [not found]           ` <4F855E3C.9010003-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-04-11 11:41             ` Avi Kivity
     [not found] ` <4F84E0DF.8040206-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-04-11  1:57   ` [PATCH 3/4] ksysfs: export VMCSINFO via sysfs zhangyanfei
     [not found]     ` <4F84E50E.2090008-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
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   ` [PATCH 4/4] kexec: Add crash_save_vmcsinfo to update VMCSINFO zhangyanfei
2012-04-11 10:21   ` [PATCH 0/4] Export offsets of VMCS fields as note information for kdump Joerg Roedel
     [not found]     ` <20120411102136.GG2428-5C7GfCeVMHo@public.gmane.org>
2012-04-11 10:49       ` Avi Kivity
2012-04-11 10:59       ` zhangyanfei
2012-04-17  7:44   ` Avi Kivity
     [not found]     ` <4F8D1F46.3090901-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-17 10:51       ` zhangyanfei
     [not found]         ` <4F8D4B4C.8070705-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-04-17 10:59           ` Avi Kivity
     [not found]             ` <4F8D4D1C.4010400-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-17 11:25               ` Wen Congyang [this message]
     [not found]                 ` <4F8D530C.3050908-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-04-17 13:04                   ` Avi Kivity
2012-04-18  7:30               ` zhangyanfei
     [not found]                 ` <4F8E6DA5.8030503-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-04-18  8:24                   ` Avi Kivity
     [not found]                     ` <4F8E7A5B.5030904-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-18  9:49                       ` zhangyanfei
     [not found]                         ` <4F8E8E3D.8040707-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-04-18 11:56                           ` Avi Kivity
     [not found]                             ` <4F8EABF7.805-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-19 10:36                               ` HATAYAMA Daisuke
     [not found]                                 ` <20120419.193640.59653378.d.hatayama-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-04-19 10:42                                   ` Avi Kivity
     [not found]                                     ` <4F8FEC22.400-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-19 11:27                                       ` HATAYAMA Daisuke
     [not found]                                         ` <20120419.202707.276752866.d.hatayama-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-04-19 11:31                                           ` Avi Kivity
     [not found]                                             ` <4F8FF7AC.1060309-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-19 12:01                                               ` HATAYAMA Daisuke
     [not found]                                                 ` <20120419.210119.246504497.d.hatayama-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-04-19 12:08                                                   ` Avi Kivity
     [not found]                                                     ` <4F900020.5010702-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-20 10:11                                                       ` HATAYAMA Daisuke
2012-04-22  9:58                                                         ` Avi Kivity
     [not found]                                                           ` <4F93D64B.50803-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-22 10:33                                                             ` Gleb Natapov
     [not found]                                                               ` <20120422103340.GE12768-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-22 10:57                                                                 ` Avi Kivity
2012-04-17 16:49     ` Anthony Liguori
     [not found]       ` <4F8D9F20.9050507-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2012-04-18 12:13         ` Avi Kivity
2012-04-18 13:47           ` Nadav Har'El
     [not found]             ` <20120418134743.GA25786-QeE623+hzFJ/hwrKWqB9+zWi1Rwp9Q0N+oGz7xIJsNs@public.gmane.org>
2012-04-18 14:06               ` Avi Kivity
2012-04-11  8:56 ` Avi Kivity
     [not found]   ` <4F85472A.4080009-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-04-11 10:12     ` zhangyanfei
2012-04-11 11:15       ` 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=4F8D530C.3050908@cn.fujitsu.com \
    --to=wency-bthxqxjhjhxqfuhtdcdx3a@public.gmane.org \
    --cc=avi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=dzickus-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
    --cc=gregkh-l3A5Bk7waGM@public.gmane.org \
    --cc=joerg.roedel-5C7GfCeVMHo@public.gmane.org \
    --cc=kexec-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ludwig.nussel-l3A5Bk7waGM@public.gmane.org \
    --cc=luto-3s7WtUTddSA@public.gmane.org \
    --cc=mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org \
    --cc=zhangyanfei-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org \
    /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