From: Paolo Bonzini <pbonzini@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>
Cc: "Andrey Smetanin" <asmetanin@virtuozzo.com>,
qemu-devel@nongnu.org, kvm@vger.kernel.org,
"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH 9/9] qemu/kvm: kvm hyper-v based guest crash event handling
Date: Wed, 1 Jul 2015 17:07:43 +0200 [thread overview]
Message-ID: <5594023F.70104@redhat.com> (raw)
In-Reply-To: <1435664007-4965-10-git-send-email-den@openvz.org>
On 30/06/2015 13:33, Denis V. Lunev wrote:
>
> +static int kvm_arch_handle_hv_crash(CPUState *cs)
> +{
> + X86CPU *cpu = X86_CPU(cs);
> + CPUX86State *env = &cpu->env;
> +
> + /* Mark that Hyper-v guest crash occurred */
> + env->hv_crash_occurred = 1;
This need not be a hv crash. You can add crash_occurred to CPUState
directly, and set it in qemu_system_guest_panicked:
if (current_cpu) {
current_cpu->crash_occurred = true;
}
Then you would add two subsections: one for crash_occurred in exec.c
(attached to vmstate_cpu_common), one for hyperv crash params in
target-i386/machine.c.
This also gives an idea about splitting the patch: first the
introduction of qemu_system_guest_panicked and crash_occurred, second
the Hyper-V specific bits.
> + if (cpu->hyperv_crash) {
> + c->edx |= HV_X64_GUEST_CRASH_MSR_AVAILABLE;
> + has_msr_hv_crash = true;
You can only set this to true if the kernel also supports the MSRs.
> + }
> +
> c = &cpuid_data.entries[cpuid_i++];
> c->function = HYPERV_CPUID_ENLIGHTMENT_INFO;
> if (cpu->hyperv_relaxed_timing) {
> @@ -761,6 +767,10 @@ void kvm_arch_reset_vcpu(X86CPU *cpu)
> } else {
> env->mp_state = KVM_MP_STATE_RUNNABLE;
> }
> + if (has_msr_hv_crash) {
> + env->msr_hv_crash_ctl = HV_X64_MSR_CRASH_CTL_NOTIFY;
The value is always host-defined, so I think it doesn't need a field in
CPUX86State. On the other hand, this:
+static bool hyperv_crash_enable_needed(void *opaque)
+{
+ X86CPU *cpu = opaque;
+ CPUX86State *env = &cpu->env;
+
+ return (env->msr_hv_crash_ctl & HV_X64_MSR_CRASH_CTL_CONTENTS) ?
+ true : false;
+}
+
can just check if any of the params fields is nonzero.
Thanks,
Paolo
> + env->hv_crash_occurred = 0;
> + }
next prev parent reply other threads:[~2015-07-01 15:07 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 11:33 [Qemu-devel] [PATCH v3 0/9] HyperV equivalent of pvpanic driver Denis V. Lunev
2015-06-30 11:33 ` [Qemu-devel] [PATCH 1/9] kvm/x86: move Hyper-V MSR's/hypercall code into hyperv.c file Denis V. Lunev
2015-07-01 0:11 ` Peter Hornyack
2015-06-30 11:33 ` [Qemu-devel] [PATCH 2/9] kvm: introduce vcpu_debug = kvm_debug + vcpu context Denis V. Lunev
2015-07-01 0:12 ` Peter Hornyack
2015-06-30 11:33 ` [Qemu-devel] [PATCH 3/9] kvm: add hyper-v crash msrs values Denis V. Lunev
2015-07-01 0:14 ` Peter Hornyack
2015-07-01 15:00 ` Paolo Bonzini
2015-07-01 15:53 ` Denis V. Lunev
2015-07-01 16:06 ` Peter Hornyack
2015-07-01 16:48 ` Paolo Bonzini
2015-06-30 11:33 ` [Qemu-devel] [PATCH 4/9] kvm/x86: added hyper-v crash msrs into kvm hyperv context Denis V. Lunev
2015-07-01 0:14 ` Peter Hornyack
2015-06-30 11:33 ` [Qemu-devel] [PATCH 5/9] kvm: added KVM_REQ_HV_CRASH value to notify qemu about hyper-v crash Denis V. Lunev
2015-07-01 0:14 ` Peter Hornyack
2015-06-30 11:33 ` [Qemu-devel] [PATCH 6/9] kvm/x86: mark hyper-v crash msrs as partition wide Denis V. Lunev
2015-07-01 0:15 ` Peter Hornyack
2015-06-30 11:33 ` [Qemu-devel] [PATCH 7/9] kvm/x86: added hyper-v crash data and ctl msr's get/set'ers Denis V. Lunev
2015-07-01 0:15 ` Peter Hornyack
2015-07-01 16:47 ` Paolo Bonzini
2015-06-30 11:33 ` [Qemu-devel] [PATCH 8/9] kvm/x86: add sending hyper-v crash notification to user space Denis V. Lunev
2015-07-01 0:16 ` Peter Hornyack
2015-07-01 15:12 ` Paolo Bonzini
2015-06-30 11:33 ` [Qemu-devel] [PATCH 9/9] qemu/kvm: kvm hyper-v based guest crash event handling Denis V. Lunev
2015-07-01 15:07 ` Paolo Bonzini [this message]
2015-07-02 13:19 ` Andrey Smetanin
2015-07-02 13:30 ` Paolo Bonzini
2015-06-30 12:26 ` [Qemu-devel] [PATCH v3 0/9] HyperV equivalent of pvpanic driver Daniel P. Berrange
2015-06-30 12:38 ` Denis V. Lunev
2015-07-01 14:09 ` Paolo Bonzini
2015-07-01 15:55 ` Denis V. Lunev
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=5594023F.70104@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=asmetanin@virtuozzo.com \
--cc=den@openvz.org \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).