[PATCH 1/2 V3] KVM: x86: reset RVI upon system reset
Thadeu Lima de Souza Cascardo
cascardo at canonical.com
Wed Feb 15 13:20:57 UTC 2017
On Tue, Feb 14, 2017 at 06:50:49AM -0700, Tim Gardner wrote:
> From: Wei Wang <wei.w.wang at intel.com>
>
> BugLink: http://bugs.launchpad.net/bugs/1660519
>
> A bug was reported as follows: when running Windows 7 32-bit guests on qemu-kvm,
> sometimes the guests run into blue screen during reboot. The problem was that a
> guest's RVI was not cleared when it rebooted. This patch has fixed the problem.
>
> Signed-off-by: Wei Wang <wei.w.wang at intel.com>
> Signed-off-by: Yang Zhang <yang.z.zhang at intel.com>
> Tested-by: Rongrong Liu <rongrongx.liu at intel.com>, Da Chun <ngugc at qq.com>
> Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
> (back ported from commit 4114c27d450bef228be9c7b0c40a888e18a3a636)
> Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
>
Why not cherry-pick 963fee1656603ce2e91ebb988cd5a92f2af41369, as
suggested by Stefan Bader? This would have made this both (963fee16 and
4114c27d) clean cherry picks.
Cascardo.
> Conflicts:
> arch/x86/kvm/vmx.c
> ---
>
> v3 - no change from v2
>
> arch/x86/kvm/lapic.c | 3 +++
> arch/x86/kvm/vmx.c | 25 ++++++++++++++++++++++++-
> 2 files changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 701fd95..b805ae4 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1692,6 +1692,9 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu,
> apic->isr_count = kvm_apic_vid_enabled(vcpu->kvm) ?
> 1 : count_vectors(apic->regs + APIC_ISR);
> apic->highest_isr_cache = -1;
> + if (kvm_x86_ops->hwapic_irr_update)
> + kvm_x86_ops->hwapic_irr_update(vcpu,
> + apic_find_highest_irr(apic));
> kvm_x86_ops->hwapic_isr_update(vcpu->kvm, apic_find_highest_isr(apic));
> kvm_make_request(KVM_REQ_EVENT, vcpu);
> kvm_rtc_eoi_tracking_restore_one(vcpu);
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 2b45251..6658c0b 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6919,6 +6919,9 @@ static void vmx_set_rvi(int vector)
> u16 status;
> u8 old;
>
> + if (vector == -1)
> + vector = 0;
> +
> status = vmcs_read16(GUEST_INTR_STATUS);
> old = (u8)status & 0xff;
> if ((u8)vector != old) {
> @@ -6930,10 +6933,30 @@ static void vmx_set_rvi(int vector)
>
> static void vmx_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr)
> {
> + if (!is_guest_mode(vcpu)) {
> + vmx_set_rvi(max_irr);
> + return;
> + }
> +
> if (max_irr == -1)
> return;
>
> - vmx_set_rvi(max_irr);
> + /*
> + * In guest mode. If a vmexit is needed, vmx_check_nested_events
> + * handles it.
> + */
> + if (nested_exit_on_intr(vcpu))
> + return;
> +
> + /*
> + * Else, fall back to pre-APICv interrupt injection since L2
> + * is run without virtual interrupt delivery.
> + */
> + if (!kvm_event_needs_reinjection(vcpu) &&
> + vmx_interrupt_allowed(vcpu)) {
> + kvm_queue_interrupt(vcpu, max_irr, false);
> + vmx_inject_irq(vcpu);
> + }
> }
>
> static void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap)
> --
> 2.7.4
>
>
> --
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
More information about the kernel-team
mailing list