public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Tiejun Chen <tiejun.chen@intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] kvm: x86: remove vmx_vm_has_apicv() outside of hwapic_isr_update()
Date: Mon, 01 Dec 2014 12:43:51 +0100	[thread overview]
Message-ID: <547C5477.7030101@redhat.com> (raw)
In-Reply-To: <1417426124-9685-1-git-send-email-tiejun.chen@intel.com>



On 01/12/2014 10:28, Tiejun Chen wrote:
> In most cases calling hwapic_isr_update(), actually we always
> check if kvm_apic_vid_enabled() == 1, and also actually,
> kvm_apic_vid_enabled()
>     -> kvm_x86_ops->vm_has_apicv()
>         -> vmx_vm_has_apicv() or '0' in svm case
> 
> So its unnecessary to recall this inside hwapic_isr_update(), here
> just remove vmx_vm_has_apicv() out and follow others.

If you want to do this, please NULL out the function pointer instead, as
KVM already does for hwapic_irr_update.

Paolo

> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
> ---
>  arch/x86/kvm/lapic.c | 3 ++-
>  arch/x86/kvm/vmx.c   | 3 ---
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index e0e5642..2ddc426 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1739,7 +1739,8 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu,
>  	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));
> +	if (kvm_apic_vid_enabled(vcpu->kvm))
> +	    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 6a951d8..f0c16a9 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -7406,9 +7406,6 @@ static void vmx_hwapic_isr_update(struct kvm *kvm, int isr)
>  	u16 status;
>  	u8 old;
>  
> -	if (!vmx_vm_has_apicv(kvm))
> -		return;
> -
>  	if (isr == -1)
>  		isr = 0;
>  
> 

  reply	other threads:[~2014-12-01 11:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01  9:28 [PATCH] kvm: x86: remove vmx_vm_has_apicv() outside of hwapic_isr_update() Tiejun Chen
2014-12-01 11:43 ` Paolo Bonzini [this message]
2014-12-19  2:32   ` Chen, Tiejun
2014-12-19 11:12     ` Paolo Bonzini
2014-12-22  9:01       ` Chen, Tiejun
2014-12-22  9:33         ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=547C5477.7030101@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=tiejun.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox