All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>
Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org,
	"Andrey Smetanin" <asmetanin@virtuozzo.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [PATCH 10/11] qemu/kvm: kvm hyper-v based guest crash event handling
Date: Mon, 22 Jun 2015 18:15:05 +0200	[thread overview]
Message-ID: <55883489.8010209@redhat.com> (raw)
In-Reply-To: <1434989108-20924-11-git-send-email-den@openvz.org>



On 22/06/2015 18:05, Denis V. Lunev wrote:
> +void qemu_system_guest_panicked(void)
> +{
> +    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort);
> +    vm_stop(RUN_STATE_GUEST_PANICKED);
> +}
> +

Please call this in pvpanic.c and target-s390x/kvm.c (replacing the
guest_panicked function in that file there) as well.

> @@ -2540,6 +2573,53 @@ static bool host_supports_vmx(void)
>      return ecx & CPUID_EXT_VMX;
>  }
>  
> +int kvm_arch_handle_hv_crash(CPUState *cs)
> +{
> +    X86CPU *cpu = X86_CPU(cs);
> +    CPUX86State *env = &cpu->env;
> +    struct {
> +        struct kvm_msrs info;
> +        struct kvm_msr_entry entries[HV_X64_MSR_CRASH_PARAMS + 1];
> +    } msr_data;
> +    struct kvm_msr_entry *msrs = msr_data.entries;
> +    int ret, n, i;
> +
> +    if (!has_msr_hv_crash) {
> +        return -EINVAL;
> +    }
> +
> +    for (n = 0; n < HV_X64_MSR_CRASH_PARAMS; n++) {
> +        msrs[n].index = HV_X64_MSR_CRASH_P0 + n;
> +    }
> +
> +    msrs[n++].index = HV_X64_MSR_CRASH_CTL;
> +    msr_data.info = (struct kvm_msrs) {
> +        .nmsrs = n,
> +    };
> +
> +    ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_MSRS, &msr_data);
> +    if (ret < 0) {
> +        return ret;
> +    }
> +
> +    for (i = 0; i < ret; i++) {
> +        uint32_t index = msrs[i].index;
> +
> +        switch (index) {
> +        case HV_X64_MSR_CRASH_P0 ... HV_X64_MSR_CRASH_P4:
> +            env->msr_hv_crash_prm[index - HV_X64_MSR_CRASH_P0] = msrs[i].data;
> +            break;
> +        case HV_X64_MSR_CRASH_CTL:
> +            env->msr_hv_crash_ctl = msrs[i].data;
> +            break;
> +        default:
> +            break;
> +        }
> +    }
> +
> +    return 0;
> +}
> +

Is this necessary?  The call to cpu_synchronize_all_states in
qemu_savevm_state_complete should be enough.  If necessary, you can call
it from qemu_system_guest_panicked instead of special casing the crash
MSRs here.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in

WARNING: multiple messages have this Message-ID (diff)
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 10/11] qemu/kvm: kvm hyper-v based guest crash event handling
Date: Mon, 22 Jun 2015 18:15:05 +0200	[thread overview]
Message-ID: <55883489.8010209@redhat.com> (raw)
In-Reply-To: <1434989108-20924-11-git-send-email-den@openvz.org>



On 22/06/2015 18:05, Denis V. Lunev wrote:
> +void qemu_system_guest_panicked(void)
> +{
> +    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort);
> +    vm_stop(RUN_STATE_GUEST_PANICKED);
> +}
> +

Please call this in pvpanic.c and target-s390x/kvm.c (replacing the
guest_panicked function in that file there) as well.

> @@ -2540,6 +2573,53 @@ static bool host_supports_vmx(void)
>      return ecx & CPUID_EXT_VMX;
>  }
>  
> +int kvm_arch_handle_hv_crash(CPUState *cs)
> +{
> +    X86CPU *cpu = X86_CPU(cs);
> +    CPUX86State *env = &cpu->env;
> +    struct {
> +        struct kvm_msrs info;
> +        struct kvm_msr_entry entries[HV_X64_MSR_CRASH_PARAMS + 1];
> +    } msr_data;
> +    struct kvm_msr_entry *msrs = msr_data.entries;
> +    int ret, n, i;
> +
> +    if (!has_msr_hv_crash) {
> +        return -EINVAL;
> +    }
> +
> +    for (n = 0; n < HV_X64_MSR_CRASH_PARAMS; n++) {
> +        msrs[n].index = HV_X64_MSR_CRASH_P0 + n;
> +    }
> +
> +    msrs[n++].index = HV_X64_MSR_CRASH_CTL;
> +    msr_data.info = (struct kvm_msrs) {
> +        .nmsrs = n,
> +    };
> +
> +    ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_MSRS, &msr_data);
> +    if (ret < 0) {
> +        return ret;
> +    }
> +
> +    for (i = 0; i < ret; i++) {
> +        uint32_t index = msrs[i].index;
> +
> +        switch (index) {
> +        case HV_X64_MSR_CRASH_P0 ... HV_X64_MSR_CRASH_P4:
> +            env->msr_hv_crash_prm[index - HV_X64_MSR_CRASH_P0] = msrs[i].data;
> +            break;
> +        case HV_X64_MSR_CRASH_CTL:
> +            env->msr_hv_crash_ctl = msrs[i].data;
> +            break;
> +        default:
> +            break;
> +        }
> +    }
> +
> +    return 0;
> +}
> +

Is this necessary?  The call to cpu_synchronize_all_states in
qemu_savevm_state_complete should be enough.  If necessary, you can call
it from qemu_system_guest_panicked instead of special casing the crash
MSRs here.

Paolo

  reply	other threads:[~2015-06-22 16:15 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22 16:04 [PATCH v2 0/11] HyperV equivalent of pvpanic driver Denis V. Lunev
2015-06-22 16:04 ` [Qemu-devel] " Denis V. Lunev
2015-06-22 16:04 ` [PATCH 01/11] kvm/x86: move Hyper-V MSR's/hypercall code into hyperv.c file Denis V. Lunev
2015-06-22 16:04   ` [Qemu-devel] " Denis V. Lunev
2015-06-25 10:25   ` Denis V. Lunev
2015-06-25 10:25     ` [Qemu-devel] " Denis V. Lunev
2015-06-25 10:26     ` Paolo Bonzini
2015-06-25 10:26       ` [Qemu-devel] " Paolo Bonzini
2015-06-22 16:04 ` [PATCH 02/11] kvm: introduce vcpu_debug = kvm_debug + vcpu context Denis V. Lunev
2015-06-22 16:04   ` [Qemu-devel] " Denis V. Lunev
2015-06-22 16:05 ` [PATCH 03/11] kvm: add hyper-v crash msrs constants Denis V. Lunev
2015-06-22 16:05   ` [Qemu-devel] " Denis V. Lunev
2015-06-22 16:05 ` [PATCH 04/11] kvm/x86: added hyper-v crash msrs into kvm hyperv context Denis V. Lunev
2015-06-22 16:05   ` [Qemu-devel] " Denis V. Lunev
2015-06-22 16:05 ` [PATCH 05/11] kvm: added KVM_REQ_HV_CRASH value to notify qemu about Hyper-V crash Denis V. Lunev
2015-06-22 16:05   ` [Qemu-devel] " Denis V. Lunev
2015-06-22 16:05 ` [PATCH 06/11] kvm/x86: mark hyper-v crash msrs as partition wide Denis V. Lunev
2015-06-22 16:05   ` [Qemu-devel] " Denis V. Lunev
2015-06-22 16:05 ` [PATCH 07/11] kvm/x86: added hyper-v crash data and ctl msr's get/set'ers Denis V. Lunev
2015-06-22 16:05   ` [Qemu-devel] " Denis V. Lunev
2015-06-22 23:52   ` Peter Hornyack
2015-06-22 23:52     ` [Qemu-devel] " Peter Hornyack
2015-06-23  9:47     ` Denis V. Lunev
2015-06-23  9:47       ` [Qemu-devel] " Denis V. Lunev
2015-06-23  9:51       ` Paolo Bonzini
2015-06-23  9:51         ` [Qemu-devel] " Paolo Bonzini
2015-06-23 10:08         ` Denis V. Lunev
2015-06-23 10:08           ` [Qemu-devel] " Denis V. Lunev
2015-06-23 10:30           ` Paolo Bonzini
2015-06-23 10:30             ` [Qemu-devel] " Paolo Bonzini
2015-06-22 16:05 ` [PATCH 08/11] kvm/x86: add sending hyper-v crash notification to user space Denis V. Lunev
2015-06-22 16:05   ` [Qemu-devel] " Denis V. Lunev
2015-06-22 16:05 ` [PATCH 09/11] kvm/x86: distingiush hyper-v guest crash notification Denis V. Lunev
2015-06-22 16:05   ` [Qemu-devel] " Denis V. Lunev
2015-06-22 16:09   ` Paolo Bonzini
2015-06-22 16:09     ` [Qemu-devel] " Paolo Bonzini
2015-06-22 23:55   ` Peter Hornyack
2015-06-22 23:55     ` [Qemu-devel] " Peter Hornyack
2015-06-23  9:52     ` Paolo Bonzini
2015-06-23  9:52       ` [Qemu-devel] " Paolo Bonzini
2015-06-22 16:05 ` [PATCH 10/11] qemu/kvm: kvm hyper-v based guest crash event handling Denis V. Lunev
2015-06-22 16:05   ` [Qemu-devel] " Denis V. Lunev
2015-06-22 16:15   ` Paolo Bonzini [this message]
2015-06-22 16:15     ` Paolo Bonzini
2015-06-22 16:17   ` Paolo Bonzini
2015-06-22 16:17     ` [Qemu-devel] " Paolo Bonzini
2015-06-22 16:05 ` [PATCH 11/11] qemu/kvm: mark in cpu state that hyper-v crash occured Denis V. Lunev
2015-06-22 16:05   ` [Qemu-devel] " Denis V. Lunev
2015-06-22 16:23   ` Andreas Färber
2015-06-22 16:23     ` [Qemu-devel] " Andreas Färber
2015-06-22 16:27     ` Paolo Bonzini
2015-06-22 16:27       ` [Qemu-devel] " Paolo Bonzini
2015-06-22 16:33       ` Andreas Färber
2015-06-22 16:33         ` [Qemu-devel] " Andreas Färber
2015-06-22 16:35         ` Denis V. Lunev
2015-06-22 16:35           ` [Qemu-devel] " Denis V. Lunev
2015-06-22 16:36         ` Paolo Bonzini
2015-06-22 16:36           ` [Qemu-devel] " Paolo Bonzini
2015-06-22 17:46           ` Andreas Färber
2015-06-22 17:46             ` [Qemu-devel] " Andreas Färber
2015-06-23  9:53             ` Paolo Bonzini
2015-06-23  9:53               ` [Qemu-devel] " Paolo Bonzini

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=55883489.8010209@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.