[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 10/11] qemu/kvm: kvm hyper-v based guest crash e
From: |
Paolo Bonzini |
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 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
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
- Re: [Qemu-devel] [PATCH 11/11] qemu/kvm: mark in cpu state that hyper-v crash occured, (continued)
- Re: [Qemu-devel] [PATCH 11/11] qemu/kvm: mark in cpu state that hyper-v crash occured, Andreas Färber, 2015/06/22
- Re: [Qemu-devel] [PATCH 11/11] qemu/kvm: mark in cpu state that hyper-v crash occured, Denis V. Lunev, 2015/06/22
- Re: [Qemu-devel] [PATCH 11/11] qemu/kvm: mark in cpu state that hyper-v crash occured, Paolo Bonzini, 2015/06/22
- Re: [Qemu-devel] [PATCH 11/11] qemu/kvm: mark in cpu state that hyper-v crash occured, Andreas Färber, 2015/06/22
- Re: [Qemu-devel] [PATCH 11/11] qemu/kvm: mark in cpu state that hyper-v crash occured, Paolo Bonzini, 2015/06/23
[Qemu-devel] [PATCH 04/11] kvm/x86: added hyper-v crash msrs into kvm hyperv context, Denis V. Lunev, 2015/06/22
[Qemu-devel] [PATCH 08/11] kvm/x86: add sending hyper-v crash notification to user space, Denis V. Lunev, 2015/06/22
[Qemu-devel] [PATCH 02/11] kvm: introduce vcpu_debug = kvm_debug + vcpu context, Denis V. Lunev, 2015/06/22
[Qemu-devel] [PATCH 01/11] kvm/x86: move Hyper-V MSR's/hypercall code into hyperv.c file, Denis V. Lunev, 2015/06/22
[Qemu-devel] [PATCH 10/11] qemu/kvm: kvm hyper-v based guest crash event handling, Denis V. Lunev, 2015/06/22
[Qemu-devel] [PATCH 09/11] kvm/x86: distingiush hyper-v guest crash notification, Denis V. Lunev, 2015/06/22