Re: [PATCH] KVM: x86: reset RVI upon system reset

Paolo Bonzini
2014-12-11T11:35:37Z

On 11/12/2014 09:15, Zhang Haoyu wrote:
>> >> 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 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