KVM: x86: reset RVI upon system reset
PATCH 1/1 KVM: x86: reset RVI upon system reset
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.
--- arch/x86/kvm/lapic.c | 3 +++ arch/x86/kvm/vmx.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-)
arch/x86/kvm/lapic.c +3 -0
@@ -1712,6 +1712,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);
arch/x86/kvm/vmx.c +6 -6
@@ -7292,19 +7292,19 @@ static void vmx_set_rvi(int vector)static void vmx_hwapic_irr_update (struct kvm_vcpu *vcpu,int max_irr) {if (max_irr ==-1 ) + max_irr =0 ; + +if (!is_guest_mode (vcpu)) { +vmx_set_rvi (max_irr);return ; + }/* * If a vmexit is needed, vmx_check_nested_events handles it. */ -if (is_guest_mode (vcpu) &&nested_exit_on_intr (vcpu)) +if ((is_guest_mode (vcpu) &&nested_exit_on_intr (vcpu)) || max_irr ==0 )return ; -if (!is_guest_mode (vcpu)) { -vmx_set_rvi (max_irr); -return ; - } -/* * Fall back to pre-APICv interrupt injection since L2 * is run without virtual interrupt delivery.
Signature · 1 line
1.7.1
Quoted 17 lines · Wei Wang
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 <[email protected]>Signed-off-by Yang Zhang <[email protected]>--- arch/x86/kvm/lapic.c | 3 +++ arch/x86/kvm/vmx.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-)arch/x86/kvm/lapic.c +0
-0
arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu, · line 1717
Quoted 6 lines
arch/x86/kvm/lapic.c +3
-0@@ -1712,6 +1712,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));
Could we pass 0 directly? Because looks we just need to clear RVI.
kvm_x86_ops->hwapic_irr_update(vcpu, 0);
I think this already makes sense based on your description.
Thanks
Tiejun
Quoted 34 lines
arch/x86/kvm/lapic.c +0
-0kvm_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);arch/x86/kvm/vmx.c +6
-6@@ -7292,19 +7292,19 @@ static void vmx_set_rvi(int vector)static void vmx_hwapic_irr_update (struct kvm_vcpu *vcpu,int max_irr) {if (max_irr ==-1 ) + max_irr =0 ; + +if (!is_guest_mode (vcpu)) { +vmx_set_rvi (max_irr);return ; + }/* * If a vmexit is needed, vmx_check_nested_events handles it. */ -if (is_guest_mode (vcpu) &&nested_exit_on_intr (vcpu)) +if ((is_guest_mode (vcpu) &&nested_exit_on_intr (vcpu)) || max_irr ==0 )return ; -if (!is_guest_mode (vcpu)) { -vmx_set_rvi (max_irr); -return ; - } -/* * Fall back to pre-APICv interrupt injection since L2 * is run without virtual interrupt delivery.
Quoted 29 lines · Tiejun Chen
Quoted 3 lines
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.
arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct
Quoted 15 lines
Signed-off-by Wei Wang <[email protected]>Signed-off-by Yang Zhang <[email protected]>--- arch/x86/kvm/lapic.c | 3 +++ arch/x86/kvm/vmx.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-)arch/x86/kvm/lapic.c index renamed from arch/x86/kvm/lapic.c +0
-066dd173..6942742 100644
arch/x86/kvm/lapic.c +0
-0@@ -1712,6 +1712,9 @@ void kvm_apic_post_state_restore(struct
kvm_vcpu*vcpu,arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu, · line 1717
Quoted 6 lines
arch/x86/kvm/lapic.c +3
-0apic->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));Could we pass 0 directly? Because looks we just need to clear RVI.
Quoted 6 lines
kvm_x86_ops->hwapic_irr_update(vcpu, 0);I think this already makes sense based on your description.
Thanks
Tiejun
No. This is a restore function, and we cannot assume that the callers always need to reset to the initial state.
Wei
Quoted 38 lines
arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct · line 1718
Quoted 2 lines
arch/x86/kvm/lapic.c +0
-0kvm_x86_ops->hwapic_isr_update(vcpu->kvm,
apic_find_highest_isr(apic));Quoted 12 lines
arch/x86/kvm/lapic.c +0
-0kvm_make_request (KVM_REQ_EVENT , vcpu);kvm_rtc_eoi_tracking_restore_one (vcpu);arch/x86/kvm/vmx.c index renamed from arch/x86/kvm/vmx.c +0
-0fe4d2f4..d632548 100644
arch/x86/kvm/vmx.c +2
-0@@ -7292,19 +7292,19 @@ static void vmx_set_rvi(int vector)static void vmx_hwapic_irr_update (struct kvm_vcpu *vcpu,int max_irr) {if (max_irr ==-1 ) + max_irr =0 ; +arch/x86/kvm/vmx.c static void vmx_set_rvi(int vector) · line 7305
Quoted 10 lines
arch/x86/kvm/vmx.c +4
-1+if (!is_guest_mode (vcpu)) { +vmx_set_rvi (max_irr);return ; + }/* * If a vmexit is needed, vmx_check_nested_events handles it. */ -if (is_guest_mode (vcpu) &&nested_exit_on_intr (vcpu)) + if ((is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) || max_irr==
Quoted 12 lines
arch/x86/kvm/vmx.c +1
-5+0)return ; -if (!is_guest_mode (vcpu)) { -vmx_set_rvi (max_irr); -return ; - } -/* * Fall back to pre-APICv interrupt injection since L2 * is run without virtual interrupt delivery.
Quoted 30 lines · Wei W
Quoted 29 lines · Tiejun Chen
Quoted 3 lines
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.
arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct
Quoted 15 lines
Signed-off-by Wei Wang <[email protected]>Signed-off-by Yang Zhang <[email protected]>--- arch/x86/kvm/lapic.c | 3 +++ arch/x86/kvm/vmx.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-)arch/x86/kvm/lapic.c index renamed from arch/x86/kvm/lapic.c +0
-066dd173..6942742 100644
arch/x86/kvm/lapic.c +0
-0@@ -1712,6 +1712,9 @@ void kvm_apic_post_state_restore(struct
kvm_vcpu*vcpu,arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct · line 1717
Quoted 6 lines
arch/x86/kvm/lapic.c +3
-0apic->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));Could we pass 0 directly? Because looks we just need to clear RVI.
Quoted 8 lines
Quoted 6 lines
kvm_x86_ops->hwapic_irr_update(vcpu, 0);I think this already makes sense based on your description.
Thanks
TiejunNo. This is a restore function, and we cannot assume that the callers always need to reset to the initial state.
Okay. Maybe I'm confused by the following change.
Quoted 29 lines
Wei
Quoted 27 lines
arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct · line 1718
Quoted 2 lines
arch/x86/kvm/lapic.c +0
-0kvm_x86_ops->hwapic_isr_update(vcpu->kvm,
apic_find_highest_isr(apic));Quoted 12 lines
arch/x86/kvm/lapic.c +0
-0kvm_make_request (KVM_REQ_EVENT , vcpu);kvm_rtc_eoi_tracking_restore_one (vcpu);arch/x86/kvm/vmx.c index renamed from arch/x86/kvm/vmx.c +0
-0fe4d2f4..d632548 100644
arch/x86/kvm/vmx.c +2
-0@@ -7292,19 +7292,19 @@ static void vmx_set_rvi(int vector)static void vmx_hwapic_irr_update (struct kvm_vcpu *vcpu,int max_irr) {if (max_irr ==-1 ) + max_irr =0 ; +arch/x86/kvm/vmx.c static void vmx_set_rvi(int vector) · line 7305
Quoted 10 lines
arch/x86/kvm/vmx.c +4
-1+if (!is_guest_mode (vcpu)) { +vmx_set_rvi (max_irr);return ; + }/* * If a vmexit is needed, vmx_check_nested_events handles it. */ -if (is_guest_mode (vcpu) &&nested_exit_on_intr (vcpu)) + if ((is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) || max_irr==
Quoted 1 line
arch/x86/kvm/vmx.c +1
-0+0)
Its really not readable to modify max_irr as 0 and check that here, and especially when you read the original comment.
So what about this?
arch/x86/kvm/vmx.c +6 -3
@@ -7280,6 +7280,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) {
@@ -7291,9 +7294,6 @@ static void vmx_set_rvi(int vector)static void vmx_hwapic_irr_update (struct kvm_vcpu *vcpu,int max_irr) { -if (max_irr ==-1 ) -return ; -/* * If a vmexit is needed, vmx_check_nested_events handles it. */
@@ -7305,6 +7305,9 @@ static void vmx_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr)return ; } +if (max_irr ==-1 ) +return ; +/* * Fall back to pre-APICv interrupt injection since L2 * is run without virtual interrupt delivery.
Thanks
Tiejun
Quoted 13 lines
Quoted 11 lines
Quoted 11 lines
arch/x86/kvm/vmx.c +0
-5return ; -if (!is_guest_mode (vcpu)) { -vmx_set_rvi (max_irr); -return ; - } -/* * Fall back to pre-APICv interrupt injection since L2 * is run without virtual interrupt delivery.
Quoted 70 lines · Tiejun Chen
Quoted 30 lines
Quoted 30 lines
Quoted 4 lines
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.
arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct
Quoted 15 lines
Signed-off-by Wei Wang <[email protected]>Signed-off-by Yang Zhang <[email protected]>--- arch/x86/kvm/lapic.c | 3 +++ arch/x86/kvm/vmx.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-)arch/x86/kvm/lapic.c index renamed from arch/x86/kvm/lapic.c +0
-066dd173..6942742 100644
arch/x86/kvm/lapic.c +0
-0@@ -1712,6 +1712,9 @@ void kvm_apic_post_state_restore(struct
kvm_vcpu*vcpu,arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct · line 1717
Quoted 6 lines
arch/x86/kvm/lapic.c +3
-0apic->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));Could we pass 0 directly? Because looks we just need to clear RVI.
Quoted 8 lines
Quoted 6 lines
kvm_x86_ops->hwapic_irr_update(vcpu, 0);I think this already makes sense based on your description.
Thanks
TiejunNo. This is a restore function, and we cannot assume that the callers
always need to reset to the initial state.
Okay. Maybe I'm confused by the following change.
Quoted 28 lines
Wei
Quoted 26 lines
arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct · line 1718
Quoted 2 lines
arch/x86/kvm/lapic.c +0
-0kvm_x86_ops->hwapic_isr_update(vcpu->kvm,
apic_find_highest_isr(apic));Quoted 12 lines
arch/x86/kvm/lapic.c +0
-0kvm_make_request (KVM_REQ_EVENT , vcpu);kvm_rtc_eoi_tracking_restore_one (vcpu);arch/x86/kvm/vmx.c index renamed from arch/x86/kvm/vmx.c +0
-0fe4d2f4..d632548 100644
arch/x86/kvm/vmx.c +2
-0@@ -7292,19 +7292,19 @@ static void vmx_set_rvi(int vector)static void vmx_hwapic_irr_update (struct kvm_vcpu *vcpu,int max_irr) {if (max_irr ==-1 ) + max_irr =0 ; +arch/x86/kvm/vmx.c static void vmx_set_rvi(int vector) · line 7305
Quoted 10 lines
arch/x86/kvm/vmx.c +4
-1+if (!is_guest_mode (vcpu)) { +vmx_set_rvi (max_irr);return ; + }/* * If a vmexit is needed, vmx_check_nested_events handles it. */ -if (is_guest_mode (vcpu) &&nested_exit_on_intr (vcpu)) + if ((is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) || max_irr==
Quoted 6 lines
Quoted 1 line
Quoted 1 line
arch/x86/kvm/vmx.c static void vmx_set_rvi(int vector) · line 7306
Quoted 1 line
arch/x86/kvm/vmx.c +1
-0+0)Its really not readable to modify
max_irras 0 and check that here, and especially when you read the original comment.So what about this?
I think both are ok.
If we zero max_irr in vmx_set_rvi(), we still need this check:
if ((is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) || max_irr == -1)
Let's see if Paolo has any comments, then send out a second version.
Wei
Quoted 54 lines
arch/x86/kvm/vmx.c index renamed from arch/x86/kvm/vmx.c +0
-00cd99d8..bc4558b 100644
arch/x86/kvm/vmx.c +6
-3@@ -7280,6 +7280,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) {@@ -7291,9 +7294,6 @@ static void vmx_set_rvi(int vector)static void vmx_hwapic_irr_update (struct kvm_vcpu *vcpu,int max_irr) { -if (max_irr ==-1 ) -return ; -/* * If a vmexit is needed, vmx_check_nested_events handles it. */ @@ -7305,6 +7305,9 @@ static void vmx_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr) return; } +if (max_irr ==-1 ) +return ; +/* * Fall back to pre-APICv interrupt injection since L2 * is run without virtual interrupt delivery.
Thanks
TiejunQuoted 13 lines
Quoted 11 lines
Quoted 11 lines
arch/x86/kvm/vmx.c +0
-5return ; -if (!is_guest_mode (vcpu)) { -vmx_set_rvi (max_irr); -return ; - } -/* * Fall back to pre-APICv interrupt injection since L2 * is run without virtual interrupt delivery.
Quoted 76 lines · Wei W
Quoted 75 lines · Tiejun Chen
Quoted 30 lines
Quoted 30 lines
Quoted 4 lines
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.
arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct
Quoted 15 lines
Signed-off-by Wei Wang <[email protected]>Signed-off-by Yang Zhang <[email protected]>--- arch/x86/kvm/lapic.c | 3 +++ arch/x86/kvm/vmx.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-)arch/x86/kvm/lapic.c index renamed from arch/x86/kvm/lapic.c +0
-066dd173..6942742 100644
arch/x86/kvm/lapic.c +0
-0@@ -1712,6 +1712,9 @@ void kvm_apic_post_state_restore(struct
kvm_vcpu*vcpu,arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct · line 1717
Quoted 6 lines
arch/x86/kvm/lapic.c +3
-0apic->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));Could we pass 0 directly? Because looks we just need to clear RVI.
Quoted 8 lines
Quoted 6 lines
kvm_x86_ops->hwapic_irr_update(vcpu, 0);I think this already makes sense based on your description.
Thanks
TiejunNo. This is a restore function, and we cannot assume that the callers
always need to reset to the initial state.
Okay. Maybe I'm confused by the following change.
Quoted 29 lines
Wei
Quoted 27 lines
arch/x86/kvm/lapic.c void kvm_apic_post_state_restore(struct · line 1718
Quoted 2 lines
arch/x86/kvm/lapic.c +0
-0kvm_x86_ops->hwapic_isr_update(vcpu->kvm,
apic_find_highest_isr(apic));Quoted 12 lines
arch/x86/kvm/lapic.c +0
-0kvm_make_request (KVM_REQ_EVENT , vcpu);kvm_rtc_eoi_tracking_restore_one (vcpu);arch/x86/kvm/vmx.c index renamed from arch/x86/kvm/vmx.c +0
-0fe4d2f4..d632548 100644
arch/x86/kvm/vmx.c +2
-0@@ -7292,19 +7292,19 @@ static void vmx_set_rvi(int vector)static void vmx_hwapic_irr_update (struct kvm_vcpu *vcpu,int max_irr) {if (max_irr ==-1 ) + max_irr =0 ; +arch/x86/kvm/vmx.c static void vmx_set_rvi(int vector) · line 7305
Quoted 10 lines
arch/x86/kvm/vmx.c +4
-1+if (!is_guest_mode (vcpu)) { +vmx_set_rvi (max_irr);return ; + }/* * If a vmexit is needed, vmx_check_nested_events handles it. */ -if (is_guest_mode (vcpu) &&nested_exit_on_intr (vcpu)) + if ((is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) || max_irr==
Quoted 1 line
arch/x86/kvm/vmx.c +1
-0+0)Its really not readable to modify
max_irras 0 and check that here, and especially when you read the original comment.
Quoted 6 lines
Quoted 1 line
So what about this?
I think both are ok.
If we zeromax_irrinvmx_set_rvi(), we still need this check:
if ((is_guest_mode(vcpu)&&nested_exit_on_intr(vcpu)) ||max_irr== -1)
No, I don't think we need to add this.
Quoted 34 lines
Let's see if Paolo has any comments, then send out a second version.
Wei
Quoted 30 lines
arch/x86/kvm/vmx.c index renamed from arch/x86/kvm/vmx.c +0
-00cd99d8..bc4558b 100644
arch/x86/kvm/vmx.c +3
-3@@ -7280,6 +7280,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) {@@ -7291,9 +7294,6 @@ static void vmx_set_rvi(int vector)static void vmx_hwapic_irr_update (struct kvm_vcpu *vcpu,int max_irr) { -if (max_irr ==-1 ) -return ; -/* * If a vmexit is needed, vmx_check_nested_events handles it. */ @@ -7305,6 +7305,9 @@ static void vmx_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr) return; }
Quoted 3 lines
arch/x86/kvm/vmx.c static void vmx_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr) · line 7310
Quoted 3 lines
arch/x86/kvm/vmx.c +3
-0+if (max_irr ==-1 ) +return ; +
Did you see this?
Tiejun
Quoted 23 lines
Quoted 21 lines
arch/x86/kvm/vmx.c +0
-0/* * Fall back to pre-APICv interrupt injection since L2 * is run without virtual interrupt delivery.
Thanks
TiejunQuoted 13 lines
Quoted 11 lines
Quoted 11 lines
arch/x86/kvm/vmx.c +0
-5return ; -if (!is_guest_mode (vcpu)) { -vmx_set_rvi (max_irr); -return ; - } -/* * Fall back to pre-APICv interrupt injection since L2 * is run without virtual interrupt delivery.
Paolo Bonzini
maintainerQuoted 5 lines · Tiejun
Quoted 3 lines
I think both are ok.
If we zeromax_irrinvmx_set_rvi(), we still need this check:
if ((is_guest_mode(vcpu)&&nested_exit_on_intr(vcpu)) ||max_irr== -1)No, I don't think we need to add this.
You don't, because the code will look like:
if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu))
return;
if (!is_guest_mode(vcpu)) {
vmx_set_rvi(max_irr);
return;
}
if (max_irr == -1)
return;and thus vmx_set_rvi() is never reached if is_guest_mode(vcpu) && !nested_exit_on_intr(vcpu).
I applied the lapic.c part of Wei's patch, and the vmx.c part of Tiejun's patch.
Paolo
Paolo Bonzini wrote on 2014-11-05:
Quoted 22 lines · Tiejun
Quoted 7 lines
Quoted 5 lines
I think both are ok.
If we zeromax_irrinvmx_set_rvi(), we still need this check:
if ((is_guest_mode(vcpu)&&nested_exit_on_intr(vcpu)) ||max_irr==
-1)No, I don't think we need to add this.
You don't, because the code will look like:
if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) return; if (!is_guest_mode(vcpu)) { vmx_set_rvi(max_irr); return; } if (max_irr == -1) return;
Quoted 2 lines
and thus
vmx_set_rvi()is never reached ifis_guest_mode(vcpu)&& !nested_exit_on_intr(vcpu).
I don't think the above code is perfect. Since hwapic_irr_update() is a hot point, it's better to move the first check after the second check. In this case, Wei's patch looks more reasonable.
Quoted 4 lines
I applied the
lapic.cpart of Wei's patch, and thevmx.cpart of Tiejun's patch.Paolo
Best regards,
Yang
Then?
Quoted 32 lines
Quoted 20 lines · Tiejun
Quoted 7 lines
Quoted 5 lines
I think both are ok.
If we zeromax_irrinvmx_set_rvi(), we still need this check:
if ((is_guest_mode(vcpu)&&nested_exit_on_intr(vcpu)) ||max_irr==
-1)No, I don't think we need to add this.
You don't, because the code will look like:
if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) return; if (!is_guest_mode(vcpu)) { vmx_set_rvi(max_irr); return; } if (max_irr == -1) return;Quoted 2 lines
and thus
vmx_set_rvi()is never reached ifis_guest_mode(vcpu)&& !nested_exit_on_intr(vcpu).I don't think the above code is perfect. Since
hwapic_irr_update()is a hot point, it's better to move the first check after the second check. In this case, Wei's patch looks more reasonable.Quoted 4 lines
I applied the
lapic.cpart of Wei's patch, and thevmx.cpart of Tiejun's patch.Paolo
Best regards,
Zhang, Yang Z
Tested-by Rongrong LiuZhang Haoyu wrote on 2014-12-11:
Quoted 1 line
Then?
It's already in upstream KVM
commit 4114c27d450bef228be9c7b0c40a888e18a3a636
Author: Wei Wang <[email protected]> Date: Wed Nov 5 10:53:43 2014 +0800
KVM: x86: reset RVI upon system reset
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.
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines · Tiejun
Quoted 7 lines
Quoted 5 lines
I think both are ok.
If we zeromax_irrinvmx_set_rvi(), we still need this check:
if ((is_guest_mode(vcpu)&&nested_exit_on_intr(vcpu)) ||max_irr==
-1)No, I don't think we need to add this.
You don't, because the code will look like:
if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) return; if (!is_guest_mode(vcpu)) { vmx_set_rvi(max_irr); return; } if (max_irr == -1) return;and thus
vmx_set_rvi()is never reached ifis_guest_mode(vcpu)&& !nested_exit_on_intr(vcpu).
Quoted 12 lines
Quoted 2 lines
I don't think the above code is perfect. Since
hwapic_irr_update()is a hot point,it's better to move the first check after the second check. In this case, Wei's patch looks more reasonable.
Quoted 8 lines
Quoted 5 lines
I applied the
lapic.cpart of Wei's patch, and thevmx.cpart of Tiejun's patch.Paolo
Best regards,
Best regards,
Yang
Quoted 5 lines · Yang Z
Zhang Haoyu wrote on 2014-12-11:
Quoted 1 line
Then?
It's already in upstream KVM
Strange, I didn't find this commit in https://git.kernel.org/cgit/virt/kvm/kvm.git/log/
but found it from the repository downloaded by git clone git://git.kernel.org/pub/scm/virt/kvm/kvm.git
Thanks,
Zhang Haoyu
Quoted 54 lines
commit
4114c27d450bef228be9c7b0c40a888e18a3a636Author: Wei Wang <[email protected]> Date: Wed Nov 5 10:53:43 2014 +0800KVM: x86: reset RVI upon system reset
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 <[email protected]>Signed-off-by Yang Zhang <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>Quoted 22 lines
Quoted 22 lines
Quoted 21 lines · Tiejun
Quoted 7 lines
Quoted 5 lines
I think both are ok.
If we zeromax_irrinvmx_set_rvi(), we still need this check:
if ((is_guest_mode(vcpu)&&nested_exit_on_intr(vcpu)) ||max_irr==
-1)No, I don't think we need to add this.
You don't, because the code will look like:
if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) return; if (!is_guest_mode(vcpu)) { vmx_set_rvi(max_irr); return; } if (max_irr == -1) return;and thus
vmx_set_rvi()is never reached ifis_guest_mode(vcpu)&& !nested_exit_on_intr(vcpu).Quoted 12 lines
Quoted 2 lines
I don't think the above code is perfect. Since
hwapic_irr_update()is a hot point,it's better to move the first check after the second check. In this case, Wei's patch looks more reasonable.
Quoted 8 lines
Quoted 5 lines
I applied the
lapic.cpart of Wei's patch, and thevmx.cpart of Tiejun's patch.Paolo
Best regards,
Best regards,
Yang
Paolo Bonzini
maintainerQuoted 2 lines · Zhang Haoyu
Strange, I didn't find this commit in https://git.kernel.org/cgit/virt/kvm/kvm.git/log/
but found it from the repository downloaded by git clonegit://git.kernel.org/pub/scm/virt/kvm/kvm.git
It's here:
https://git.kernel.org/cgit/virt/kvm/kvm.git/log/?h=next
(on the second page)
Paolo
Quoted 12 lines · Paolo Bonzini
Quoted 2 lines · Zhang Haoyu
Strange, I didn't find this commit in https://git.kernel.org/cgit/virt/kvm/kvm.git/log/
but found it from the repository downloaded by git clonegit://git.kernel.org/pub/scm/virt/kvm/kvm.gitIt's here:
https://git.kernel.org/cgit/virt/kvm/kvm.git/log/?h=next
(on the second page)
Yes, I find it,
but what's the relationship between https://git.kernel.org/cgit/virt/kvm/kvm.git/log/?h=next
and
https://git.kernel.org/cgit/virt/kvm/kvm.git/log/ ?
e.g.,
https://git.kernel.org/cgit/virt/kvm/kvm.git/log/?h=next&ofs=50
https://git.kernel.org/cgit/virt/kvm/kvm.git/log/?ofs=50
Thanks,
Zhang Haoyu
Quoted 1 line
Paolo
Paolo Bonzini
maintainerQuoted 2 lines · Zhang Haoyu
Yes, I find it,
but what's the relationship between https://git.kernel.org/cgit/virt/kvm/kvm.git/log/?h=next
This is branch "next".
Quoted 2 lines
This is branch "master".
Paolo
Paolo Bonzini
maintainerQuoted 7 lines · Zhang Haoyu
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) return; if (!is_guest_mode(vcpu)) { vmx_set_rvi(max_irr); return; }
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
if (max_irr == -1) return;and thus
vmx_set_rvi()is never reached ifis_guest_mode(vcpu)&& !nested_exit_on_intr(vcpu).I don't think the above code is perfect. Since
hwapic_irr_update()is a hot point, it's better to move the first check after the second check. In this case, Wei's patch looks more
The behavior for max_irr == -1 is different for is_guest_mode(vcpu) (write 0 to RVI) and !is_guest_mode(vcpu) (do nothing). So you have to check is_guest_mode first, as in the patch that was applied.
Paolo