From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: x86: reset RVI upon system reset Date: Thu, 11 Dec 2014 12:35:19 +0100 Message-ID: <54898177.905@redhat.com> References: <1415156023-1349-1-git-send-email-wei.w.wang@intel.com>, <5459C020.20103@intel.com>, <286AC319A985734F985F78AFA26841F77F3FCD@shsmsx102.ccr.corp.intel.com>, <5459DA93.6060104@intel.com>, <286AC319A985734F985F78AFA26841F77F404A@shsmsx102.ccr.corp.intel.com>, <5459E794.6020500@intel.com>, <5459F5AB.1050302@redhat.com>, <201412111615355608149@sangfor.com> Mime-Version: 1.0 Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit To: Zhang Haoyu , "Zhang, Yang Z" , "Chen, Tiejun" , "Wang, Wei W" , "kvm@vger.kernel.org" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:38642 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932200AbaLKLfh (ORCPT ); Thu, 11 Dec 2014 06:35:37 -0500 In-Reply-To: <201412111615355608149@sangfor.com> Sender: kvm-owner@vger.kernel.org List-ID: 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