All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: "Zhang, Yang Z" <yang.z.zhang@intel.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"mtosatti@redhat.com" <mtosatti@redhat.com>,
	"Zhang, Xiantao" <xiantao.zhang@intel.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>
Subject: Re: [PATCH v7 4/7] KVM: Call common update function when ioapic entry changed.
Date: Sun, 7 Apr 2013 17:05:45 +0300	[thread overview]
Message-ID: <20130407140545.GA11918@redhat.com> (raw)
In-Reply-To: <A9667DDFB95DB7438FA9D7D576C3D87E09A02392@SHSMSX101.ccr.corp.intel.com>

On Sun, Apr 07, 2013 at 02:00:04PM +0000, Zhang, Yang Z wrote:
> Gleb Natapov wrote on 2013-04-07:
> > On Mon, Apr 01, 2013 at 11:32:32AM +0800, Yang Zhang wrote:
> >> From: Yang Zhang <yang.z.zhang@Intel.com>
> >> 
> >> Both TMR and EOI exit bitmap need to be updated when ioapic changed
> >> or vcpu's id/ldr/dfr changed. So use common function instead eoi exit
> >> bitmap specific function.
> >> 
> >> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
> >> ---
> >>  arch/ia64/kvm/lapic.h    |    6 ------
> >>  arch/x86/kvm/lapic.c     |    2 +-
> >>  arch/x86/kvm/vmx.c       |    3 +++
> >>  arch/x86/kvm/x86.c       |   11 +++++++----
> >>  include/linux/kvm_host.h |    4 ++--
> >>  virt/kvm/ioapic.c        |   26 +++++++++++++++-----------
> >>  virt/kvm/ioapic.h        |    7 +++----
> >>  virt/kvm/irq_comm.c      |    4 ++--
> >>  virt/kvm/kvm_main.c      |    4 ++--
> >>  9 files changed, 35 insertions(+), 32 deletions(-)
> >> diff --git a/arch/ia64/kvm/lapic.h b/arch/ia64/kvm/lapic.h
> >> index c3e2935..c5f92a9 100644
> >> --- a/arch/ia64/kvm/lapic.h
> >> +++ b/arch/ia64/kvm/lapic.h
> >> @@ -27,10 +27,4 @@ int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct
> > kvm_lapic_irq *irq);
> >>  #define kvm_apic_present(x) (true)
> >>  #define kvm_lapic_enabled(x) (true)
> >> -static inline bool kvm_apic_vid_enabled(void)
> >> -{
> >> -	/* IA64 has no apicv supporting, do nothing here */
> >> -	return false;
> >> -}
> >> -
> >>  #endif
> >> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> >> index e227474..ce8d6f6 100644
> >> --- a/arch/x86/kvm/lapic.c
> >> +++ b/arch/x86/kvm/lapic.c
> >> @@ -209,7 +209,7 @@ out:
> >>  	if (old)
> >>  		kfree_rcu(old, rcu);
> >> -	kvm_ioapic_make_eoibitmap_request(kvm);
> >> +	kvm_vcpu_scan_ioapic(kvm);
> >>  }
> >>  
> >>  static inline void kvm_apic_set_id(struct kvm_lapic *apic, u8 id)
> >> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index
> >> b2e95bc..edfc87a 100644 --- a/arch/x86/kvm/vmx.c +++
> >> b/arch/x86/kvm/vmx.c @@ -6420,6 +6420,9 @@ static void
> >> vmx_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr)
> >> 
> >>  static void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64
> >>  *eoi_exit_bitmap) {
> >> +	if (!vmx_vm_has_apicv(vcpu->kvm))
> >> +		return;
> >> +
> >>  	vmcs_write64(EOI_EXIT_BITMAP0, eoi_exit_bitmap[0]);
> >>  	vmcs_write64(EOI_EXIT_BITMAP1, eoi_exit_bitmap[1]);
> >>  	vmcs_write64(EOI_EXIT_BITMAP2, eoi_exit_bitmap[2]);
> >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> >> index 4d42fe1..64241b6 100644
> >> --- a/arch/x86/kvm/x86.c
> >> +++ b/arch/x86/kvm/x86.c
> >> @@ -5647,13 +5647,16 @@ static void kvm_gen_update_masterclock(struct
> > kvm *kvm)
> >>  #endif
> >>  }
> >> -static void update_eoi_exitmap(struct kvm_vcpu *vcpu)
> >> +static void vcpu_scan_ioapic(struct kvm_vcpu *vcpu)
> >>  {
> >>  	u64 eoi_exit_bitmap[4];
> >> +	if (!kvm_lapic_enabled(vcpu))
> >> +		return;
> >> +
> > Why is this needed here?
> We don't need to calculate eoi_exit_bitmap and TMR if lapic is not enabled. Also, ioapic is meaningless for the vcpu that doesn't enable the lapic.
> 
OK, but then let's use apic_enabled() since kvm_lapic_enabled() also
checks for in kernel apic and we should not be here if apic is not
emulated in kernel. Also please make sure that we rescan ioapic on all
apic state changes.

--
			Gleb.

  reply	other threads:[~2013-04-07 14:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01  3:32 [PATCH v7 0/7] KVM: VMX: Add Posted Interrupt supporting Yang Zhang
2013-04-01  3:32 ` [PATCH v7 1/7] KVM: VMX: Enable acknowledge interupt on vmexit Yang Zhang
2013-04-01  3:32 ` [PATCH v7 2/7] KVM: VMX: Register a new IPI for posted interrupt Yang Zhang
2013-04-01  3:32 ` [PATCH v7 3/7] KVM: VMX: Check the posted interrupt capability Yang Zhang
2013-04-07 14:14   ` Gleb Natapov
2013-04-08  2:57     ` Zhang, Yang Z
2013-04-01  3:32 ` [PATCH v7 4/7] KVM: Call common update function when ioapic entry changed Yang Zhang
2013-04-07 13:33   ` Gleb Natapov
2013-04-07 14:00     ` Zhang, Yang Z
2013-04-07 14:05       ` Gleb Natapov [this message]
2013-04-08  4:10         ` Zhang, Yang Z
2013-04-01  3:32 ` [PATCH v7 5/7] KVM: Set TMR when programming ioapic entry Yang Zhang
2013-04-07 14:10   ` Gleb Natapov
2013-04-01  3:32 ` [PATCH v7 6/7] KVM: VMX: Add the algorithm of deliver posted interrupt Yang Zhang
2013-04-07 14:55   ` Gleb Natapov
2013-04-08  5:38     ` Zhang, Yang Z
2013-04-01  3:32 ` [PATCH v7 7/7] KVM: VMX: Use posted interrupt to deliver virtual interrupt Yang Zhang

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=20130407140545.GA11918@redhat.com \
    --to=gleb@redhat.com \
    --cc=jun.nakajima@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=xiantao.zhang@intel.com \
    --cc=yang.z.zhang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.