Message ID | 1365679516-13125-8-git-send-email-yang.z.zhang@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Yang Zhang, Could you please let me know your CPU model or the CPU models which supports apic-v which your patch requires()? So that I could try you patches. Intel Software Developer's Manualm, Volume 3C, System Programming Guide, Part 3. Ch29, APIC VIRTUALIZATION AND VIRTUAL INTERRUPTS Or how can I know whether my hardware support those features listed in the manual above? Thanks, Steven > -----Original Message----- > From: kvm-owner@vger.kernel.org [mailto:kvm-owner@vger.kernel.org] On > Behalf Of Yang Zhang > Sent: Thursday, April 11, 2013 7:25 PM > To: kvm@vger.kernel.org > Cc: gleb@redhat.com; mtosatti@redhat.com; xiantao.zhang@intel.com; > jun.nakajima@intel.com; Yang Zhang > Subject: [PATCH v10 7/7] KVM: VMX: Use posted interrupt to deliver virtual > interrupt > > From: Yang Zhang <yang.z.zhang@Intel.com> > > If posted interrupt is avaliable, then uses it to inject virtual > interrupt to guest. > > Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> > --- > arch/x86/kvm/lapic.c | 30 +++++++++++++++++++----------- > arch/x86/kvm/vmx.c | 2 +- > arch/x86/kvm/x86.c | 1 + > 3 files changed, 21 insertions(+), 12 deletions(-) > > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > index dbf74c9..e29883c 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -353,6 +353,7 @@ static inline int apic_find_highest_irr(struct kvm_lapic > *apic) > if (!apic->irr_pending) > return -1; > > + kvm_x86_ops->sync_pir_to_irr(apic->vcpu); > result = apic_search_irr(apic); > ASSERT(result == -1 || result >= 16); > > @@ -683,18 +684,25 @@ static int __apic_accept_irq(struct kvm_lapic *apic, > int delivery_mode, > if (dest_map) > __set_bit(vcpu->vcpu_id, dest_map); > > - result = !apic_test_and_set_irr(vector, apic); > - trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode, > - trig_mode, vector, !result); > - if (!result) { > - if (trig_mode) > - apic_debug("level trig mode repeatedly for " > - "vector %d", vector); > - break; > - } > + if (kvm_x86_ops->deliver_posted_interrupt) { > + result = 1; > + kvm_x86_ops->deliver_posted_interrupt(vcpu, vector); > + } else { > + result = !apic_test_and_set_irr(vector, apic); > > - kvm_make_request(KVM_REQ_EVENT, vcpu); > - kvm_vcpu_kick(vcpu); > + if (!result) { > + if (trig_mode) > + apic_debug("level trig mode repeatedly " > + "for vector %d", vector); > + goto out; > + } > + > + kvm_make_request(KVM_REQ_EVENT, vcpu); > + kvm_vcpu_kick(vcpu); > + } > +out: > + trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode, > + trig_mode, vector, !result); > break; > > case APIC_DM_REMRD: > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 314b2ed..52b21da 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -84,7 +84,7 @@ module_param(vmm_exclusive, bool, S_IRUGO); > static bool __read_mostly fasteoi = 1; > module_param(fasteoi, bool, S_IRUGO); > > -static bool __read_mostly enable_apicv; > +static bool __read_mostly enable_apicv = 1; > module_param(enable_apicv, bool, S_IRUGO); > > /* > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 6147d24..628582f 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -2685,6 +2685,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) > static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu, > struct kvm_lapic_state *s) > { > + kvm_x86_ops->sync_pir_to_irr(vcpu); > memcpy(s->regs, vcpu->arch.apic->regs, sizeof *s); > > return 0; > -- > 1.7.1 > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
Yangminqiang wrote on 2013-04-26: > Hi Yang Zhang, > > Could you please let me know your CPU model or the CPU models which > supports apic-v which your patch requires()? So that I could try you > patches. > > Intel Software Developer's Manualm, Volume 3C, > System Programming Guide, Part 3. Ch29, > APIC VIRTUALIZATION AND VIRTUAL INTERRUPTS > Or how can I know whether my hardware support those features listed in the > manual above? Ivytown or newer platform supported it. > Thanks, > Steven > > kvm-owner@vger.kernel.org wrote on 2013-04-11: >> Subject: [PATCH v10 7/7] KVM: VMX: Use posted interrupt to deliver virtual >> interrupt >> >> From: Yang Zhang <yang.z.zhang@Intel.com> >> >> If posted interrupt is avaliable, then uses it to inject virtual >> interrupt to guest. >> >> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> >> --- >> arch/x86/kvm/lapic.c | 30 +++++++++++++++++++----------- >> arch/x86/kvm/vmx.c | 2 +- >> arch/x86/kvm/x86.c | 1 + >> 3 files changed, 21 insertions(+), 12 deletions(-) >> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c >> index dbf74c9..e29883c 100644 >> --- a/arch/x86/kvm/lapic.c >> +++ b/arch/x86/kvm/lapic.c >> @@ -353,6 +353,7 @@ static inline int apic_find_highest_irr(struct kvm_lapic >> *apic) >> if (!apic->irr_pending) >> return -1; >> + kvm_x86_ops->sync_pir_to_irr(apic->vcpu); >> result = apic_search_irr(apic); >> ASSERT(result == -1 || result >= 16); >> @@ -683,18 +684,25 @@ static int __apic_accept_irq(struct kvm_lapic *apic, >> int delivery_mode, >> if (dest_map) >> __set_bit(vcpu->vcpu_id, dest_map); >> - result = !apic_test_and_set_irr(vector, apic); >> - trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode, >> - trig_mode, vector, !result); >> - if (!result) { >> - if (trig_mode) >> - apic_debug("level trig mode repeatedly for " >> - "vector %d", vector); >> - break; >> - } >> + if (kvm_x86_ops->deliver_posted_interrupt) { >> + result = 1; >> + kvm_x86_ops->deliver_posted_interrupt(vcpu, vector); >> + } else { >> + result = !apic_test_and_set_irr(vector, apic); >> >> - kvm_make_request(KVM_REQ_EVENT, vcpu); >> - kvm_vcpu_kick(vcpu); >> + if (!result) { >> + if (trig_mode) >> + apic_debug("level trig mode repeatedly " >> + "for vector %d", vector); >> + goto out; >> + } >> + >> + kvm_make_request(KVM_REQ_EVENT, vcpu); >> + kvm_vcpu_kick(vcpu); >> + } >> +out: >> + trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode, >> + trig_mode, vector, !result); >> break; >> >> case APIC_DM_REMRD: >> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c >> index 314b2ed..52b21da 100644 >> --- a/arch/x86/kvm/vmx.c >> +++ b/arch/x86/kvm/vmx.c >> @@ -84,7 +84,7 @@ module_param(vmm_exclusive, bool, S_IRUGO); >> static bool __read_mostly fasteoi = 1; >> module_param(fasteoi, bool, S_IRUGO); >> -static bool __read_mostly enable_apicv; >> +static bool __read_mostly enable_apicv = 1; >> module_param(enable_apicv, bool, S_IRUGO); >> >> /* >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >> index 6147d24..628582f 100644 >> --- a/arch/x86/kvm/x86.c >> +++ b/arch/x86/kvm/x86.c >> @@ -2685,6 +2685,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) >> static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu, >> struct kvm_lapic_state *s) { + kvm_x86_ops->sync_pir_to_irr(vcpu); >> memcpy(s->regs, vcpu->arch.apic->regs, sizeof *s); >> >> return 0; >> -- >> 1.7.1 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe kvm" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html Best regards, Yang
> -----Original Message----- > From: Zhang, Yang Z [mailto:yang.z.zhang@intel.com] > Sent: Friday, April 26, 2013 1:10 PM > To: Yangminqiang; kvm@vger.kernel.org > Cc: gleb@redhat.com; mtosatti@redhat.com; Zhang, Xiantao; Nakajima, Jun; > Luohao (brian); Haofeng > Subject: RE: [PATCH v10 7/7] KVM: VMX: Use posted interrupt to deliver virtual > interrupt > > Yangminqiang wrote on 2013-04-26: > > Hi Yang Zhang, > > > > Could you please let me know your CPU model or the CPU models which > > supports apic-v which your patch requires()? So that I could try you > > patches. > > > > Intel Software Developer's Manualm, Volume 3C, > > System Programming Guide, Part 3. Ch29, > > APIC VIRTUALIZATION AND VIRTUAL INTERRUPTS > > Or how can I know whether my hardware support those features listed in the > > manual above? > Ivytown or newer platform supported it. Ivytown? Do you mean Ivy Bridge? > > > Thanks, > > Steven > > > > kvm-owner@vger.kernel.org wrote on 2013-04-11: > >> Subject: [PATCH v10 7/7] KVM: VMX: Use posted interrupt to deliver virtual > >> interrupt > >> > >> From: Yang Zhang <yang.z.zhang@Intel.com> > >> > >> If posted interrupt is avaliable, then uses it to inject virtual > >> interrupt to guest. > >> > >> Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> > >> --- > >> arch/x86/kvm/lapic.c | 30 +++++++++++++++++++----------- > >> arch/x86/kvm/vmx.c | 2 +- > >> arch/x86/kvm/x86.c | 1 + > >> 3 files changed, 21 insertions(+), 12 deletions(-) > >> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > >> index dbf74c9..e29883c 100644 > >> --- a/arch/x86/kvm/lapic.c > >> +++ b/arch/x86/kvm/lapic.c > >> @@ -353,6 +353,7 @@ static inline int apic_find_highest_irr(struct > kvm_lapic > >> *apic) > >> if (!apic->irr_pending) > >> return -1; > >> + kvm_x86_ops->sync_pir_to_irr(apic->vcpu); > >> result = apic_search_irr(apic); > >> ASSERT(result == -1 || result >= 16); > >> @@ -683,18 +684,25 @@ static int __apic_accept_irq(struct kvm_lapic > *apic, > >> int delivery_mode, > >> if (dest_map) > >> __set_bit(vcpu->vcpu_id, dest_map); > >> - result = !apic_test_and_set_irr(vector, apic); > >> - trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode, > >> - trig_mode, vector, !result); > >> - if (!result) { > >> - if (trig_mode) > >> - apic_debug("level trig mode repeatedly for " > >> - "vector %d", vector); > >> - break; > >> - } > >> + if (kvm_x86_ops->deliver_posted_interrupt) { > >> + result = 1; > >> + kvm_x86_ops->deliver_posted_interrupt(vcpu, vector); > >> + } else { > >> + result = !apic_test_and_set_irr(vector, apic); > >> > >> - kvm_make_request(KVM_REQ_EVENT, vcpu); > >> - kvm_vcpu_kick(vcpu); > >> + if (!result) { > >> + if (trig_mode) > >> + apic_debug("level trig mode repeatedly " > >> + "for vector %d", vector); > >> + goto out; > >> + } > >> + > >> + kvm_make_request(KVM_REQ_EVENT, vcpu); > >> + kvm_vcpu_kick(vcpu); > >> + } > >> +out: > >> + trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode, > >> + trig_mode, vector, !result); > >> break; > >> > >> case APIC_DM_REMRD: > >> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > >> index 314b2ed..52b21da 100644 > >> --- a/arch/x86/kvm/vmx.c > >> +++ b/arch/x86/kvm/vmx.c > >> @@ -84,7 +84,7 @@ module_param(vmm_exclusive, bool, S_IRUGO); > >> static bool __read_mostly fasteoi = 1; > >> module_param(fasteoi, bool, S_IRUGO); > >> -static bool __read_mostly enable_apicv; > >> +static bool __read_mostly enable_apicv = 1; > >> module_param(enable_apicv, bool, S_IRUGO); > >> > >> /* > >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > >> index 6147d24..628582f 100644 > >> --- a/arch/x86/kvm/x86.c > >> +++ b/arch/x86/kvm/x86.c > >> @@ -2685,6 +2685,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) > >> static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu, > > >> struct kvm_lapic_state *s) { + kvm_x86_ops->sync_pir_to_irr(vcpu); > >> memcpy(s->regs, vcpu->arch.apic->regs, sizeof *s); > >> > >> return 0; > >> -- > >> 1.7.1 > >> > >> -- > >> To unsubscribe from this list: send the line "unsubscribe kvm" in > >> the body of a message to majordomo@vger.kernel.org > >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > > Best regards, > Yang >
On Fri, Apr 26, 2013 at 2:29 AM, Yangminqiang <yangminqiang@huawei.com> wrote: > > Ivytown or newer platform supported it. > > Ivytown? Do you mean Ivy Bridge? > Ivy Town is the codename of "Ivy Bridge-based servers". -- Jun Intel Open Source Technology Center -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBOYWthamltYSwgSnVuIFttYWls dG86anVuLm5ha2FqaW1hQGludGVsLmNvbV0NCj4gU2VudDogRnJpZGF5LCBBcHJpbCAyNiwgMjAx MyA5OjQ2IFBNDQo+IFRvOiBZYW5nbWlucWlhbmcNCj4gQ2M6IFpoYW5nLCBZYW5nIFo7IGt2bUB2 Z2VyLmtlcm5lbC5vcmc7IGdsZWJAcmVkaGF0LmNvbTsNCj4gbXRvc2F0dGlAcmVkaGF0LmNvbTsg WmhhbmcsIFhpYW50YW87IEx1b2hhbyAoYnJpYW4pOyBIYW9mZW5nDQo+IFN1YmplY3Q6IFJlOiBb UEFUQ0ggdjEwIDcvN10gS1ZNOiBWTVg6IFVzZSBwb3N0ZWQgaW50ZXJydXB0IHRvIGRlbGl2ZXIg dmlydHVhbA0KPiBpbnRlcnJ1cHQNCj4gDQo+IE9uIEZyaSwgQXByIDI2LCAyMDEzIGF0IDI6Mjkg QU0sIFlhbmdtaW5xaWFuZyA8eWFuZ21pbnFpYW5nQGh1YXdlaS5jb20+DQo+IHdyb3RlOg0KPiAN Cj4gPiA+IEl2eXRvd24gb3IgbmV3ZXIgcGxhdGZvcm0gc3VwcG9ydGVkIGl0Lg0KPiA+DQo+ID4g SXZ5dG93bj8gRG8geW91IG1lYW4gSXZ5IEJyaWRnZT8NCj4gPg0KPiANCj4gSXZ5IFRvd24gaXMg dGhlIGNvZGVuYW1lIG9mICJJdnkgQnJpZGdlLWJhc2VkIHNlcnZlcnMiLg0KDQpPbmUgbW9yZSBx dWVzdGlvbiwgd2hhdCBpcyB0aGUgcmVsYXRpb25zaGlwIGJldHdlZW4geDJBUElDIGFuZCBBUElD IHZpcnR1YWxpemF0aW9uPyANCkFQSUMtdiByZXF1aXJlcyB4MkFQSUMgb3IgQVBJQy12IGluY2x1 ZGVzIHgyQVBJQz8NCg0KUmVnYXJkcywNClN0ZXZlbg0K -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Yangminqiang wrote on 2013-05-03: > Nakajima, Jun wrote on 2013-04-26: >> Subject: Re: [PATCH v10 7/7] KVM: VMX: Use posted interrupt to deliver virtual >> interrupt >> >> On Fri, Apr 26, 2013 at 2:29 AM, Yangminqiang <yangminqiang@huawei.com> >> wrote: >> >>>> Ivytown or newer platform supported it. >>> >>> Ivytown? Do you mean Ivy Bridge? >>> >> >> Ivy Town is the codename of "Ivy Bridge-based servers". > > One more question, what is the relationship between x2APIC and APIC > virtualization? APIC-v requires x2APIC or APIC-v includes x2APIC? If you are using x2apic way(MSR base access)inside guest and want to benefit from apic virtualization technology, then you should set virtual x2apic bit in Secondary Processor-Based VM-Execution Controls. Best regards, Yang
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index dbf74c9..e29883c 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -353,6 +353,7 @@ static inline int apic_find_highest_irr(struct kvm_lapic *apic) if (!apic->irr_pending) return -1; + kvm_x86_ops->sync_pir_to_irr(apic->vcpu); result = apic_search_irr(apic); ASSERT(result == -1 || result >= 16); @@ -683,18 +684,25 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, if (dest_map) __set_bit(vcpu->vcpu_id, dest_map); - result = !apic_test_and_set_irr(vector, apic); - trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode, - trig_mode, vector, !result); - if (!result) { - if (trig_mode) - apic_debug("level trig mode repeatedly for " - "vector %d", vector); - break; - } + if (kvm_x86_ops->deliver_posted_interrupt) { + result = 1; + kvm_x86_ops->deliver_posted_interrupt(vcpu, vector); + } else { + result = !apic_test_and_set_irr(vector, apic); - kvm_make_request(KVM_REQ_EVENT, vcpu); - kvm_vcpu_kick(vcpu); + if (!result) { + if (trig_mode) + apic_debug("level trig mode repeatedly " + "for vector %d", vector); + goto out; + } + + kvm_make_request(KVM_REQ_EVENT, vcpu); + kvm_vcpu_kick(vcpu); + } +out: + trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode, + trig_mode, vector, !result); break; case APIC_DM_REMRD: diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 314b2ed..52b21da 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -84,7 +84,7 @@ module_param(vmm_exclusive, bool, S_IRUGO); static bool __read_mostly fasteoi = 1; module_param(fasteoi, bool, S_IRUGO); -static bool __read_mostly enable_apicv; +static bool __read_mostly enable_apicv = 1; module_param(enable_apicv, bool, S_IRUGO); /* diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 6147d24..628582f 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2685,6 +2685,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s) { + kvm_x86_ops->sync_pir_to_irr(vcpu); memcpy(s->regs, vcpu->arch.apic->regs, sizeof *s); return 0;