* Re: [PATCH 1/3] kvm: x86: check kvm_apic_sw_enabled() is enough [not found] <20190401021723.5682-1-richardw.yang@linux.intel.com> @ 2019-06-04 3:11 ` Wei Yang [not found] ` <20190401021723.5682-2-richardw.yang@linux.intel.com> 1 sibling, 0 replies; 3+ messages in thread From: Wei Yang @ 2019-06-04 3:11 UTC (permalink / raw) To: Wei Yang; +Cc: kvm, x86, pbonzini, rkrcmar Ping... On Mon, Apr 01, 2019 at 10:17:21AM +0800, Wei Yang wrote: >On delivering irq to apic, we iterate on vcpu and do the check like >this: > > kvm_apic_present(vcpu) > kvm_lapic_enabled(vpu) > kvm_apic_present(vcpu) && kvm_apic_sw_enabled(vcpu->arch.apic) > >Since we have already checked kvm_apic_present(), it is reasonable to >replace kvm_lapic_enabled() with kvm_apic_sw_enabled(). > >Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> >--- > arch/x86/kvm/irq_comm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c >index 3cc3b2d130a0..188beb301cc5 100644 >--- a/arch/x86/kvm/irq_comm.c >+++ b/arch/x86/kvm/irq_comm.c >@@ -86,7 +86,7 @@ int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src, > if (r < 0) > r = 0; > r += kvm_apic_set_irq(vcpu, irq, dest_map); >- } else if (kvm_lapic_enabled(vcpu)) { >+ } else if (kvm_apic_sw_enabled(vcpu->arch.apic)) { > if (!kvm_vector_hashing_enabled()) { > if (!lowest) > lowest = vcpu; >-- >2.19.1 -- Wei Yang Help you, Help me ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <20190401021723.5682-2-richardw.yang@linux.intel.com>]
* Re: [PATCH 2/3] kvm: x86: use same convention to name apic_clear_vector() [not found] ` <20190401021723.5682-2-richardw.yang@linux.intel.com> @ 2019-06-06 12:07 ` Paolo Bonzini 2019-06-06 15:43 ` Wei Yang 0 siblings, 1 reply; 3+ messages in thread From: Paolo Bonzini @ 2019-06-06 12:07 UTC (permalink / raw) To: Wei Yang, kvm, x86; +Cc: rkrcmar On 01/04/19 04:17, Wei Yang wrote: > apic_clear_vector() is the counterpart of kvm_lapic_clear_vector(), > while they have different naming convention. > > Rename it and move together to arch/x86/kvm/lapic.h. Also fix one typo > in comment by hand. You mean "of kvm_lapic_set_vector()". Queued all three with only this change to the commit log, sorry for the delay. Paolo > Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> > --- > arch/x86/kvm/lapic.c | 17 +++++++---------- > arch/x86/kvm/lapic.h | 5 +++++ > 2 files changed, 12 insertions(+), 10 deletions(-) > > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > index c4533d05c214..d8b3cbba8e29 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -88,11 +88,6 @@ bool kvm_apic_pending_eoi(struct kvm_vcpu *vcpu, int vector) > apic_test_vector(vector, apic->regs + APIC_IRR); > } > > -static inline void apic_clear_vector(int vec, void *bitmap) > -{ > - clear_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); > -} > - > static inline int __apic_test_and_set_vector(int vec, void *bitmap) > { > return __test_and_set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); > @@ -445,12 +440,12 @@ static inline void apic_clear_irr(int vec, struct kvm_lapic *apic) > > if (unlikely(vcpu->arch.apicv_active)) { > /* need to update RVI */ > - apic_clear_vector(vec, apic->regs + APIC_IRR); > + kvm_lapic_clear_vector(vec, apic->regs + APIC_IRR); > kvm_x86_ops->hwapic_irr_update(vcpu, > apic_find_highest_irr(apic)); > } else { > apic->irr_pending = false; > - apic_clear_vector(vec, apic->regs + APIC_IRR); > + kvm_lapic_clear_vector(vec, apic->regs + APIC_IRR); > if (apic_search_irr(apic) != -1) > apic->irr_pending = true; > } > @@ -1053,9 +1048,11 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, > > if (apic_test_vector(vector, apic->regs + APIC_TMR) != !!trig_mode) { > if (trig_mode) > - kvm_lapic_set_vector(vector, apic->regs + APIC_TMR); > + kvm_lapic_set_vector(vector, > + apic->regs + APIC_TMR); > else > - apic_clear_vector(vector, apic->regs + APIC_TMR); > + kvm_lapic_clear_vector(vector, > + apic->regs + APIC_TMR); > } > > if (vcpu->arch.apicv_active) > @@ -2278,7 +2275,7 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu) > > /* > * APIC is created enabled. This will prevent kvm_lapic_set_base from > - * thinking that APIC satet has changed. > + * thinking that APIC state has changed. > */ > vcpu->arch.apic_base = MSR_IA32_APICBASE_ENABLE; > static_key_slow_inc(&apic_sw_disabled.key); /* sw disabled at reset */ > diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h > index ff6ef9c3d760..339ee029be6e 100644 > --- a/arch/x86/kvm/lapic.h > +++ b/arch/x86/kvm/lapic.h > @@ -127,6 +127,11 @@ void kvm_lapic_exit(void); > #define VEC_POS(v) ((v) & (32 - 1)) > #define REG_POS(v) (((v) >> 5) << 4) > > +static inline void kvm_lapic_clear_vector(int vec, void *bitmap) > +{ > + clear_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); > +} > + > static inline void kvm_lapic_set_vector(int vec, void *bitmap) > { > set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/3] kvm: x86: use same convention to name apic_clear_vector() 2019-06-06 12:07 ` [PATCH 2/3] kvm: x86: use same convention to name apic_clear_vector() Paolo Bonzini @ 2019-06-06 15:43 ` Wei Yang 0 siblings, 0 replies; 3+ messages in thread From: Wei Yang @ 2019-06-06 15:43 UTC (permalink / raw) To: Paolo Bonzini; +Cc: Wei Yang, kvm, x86, rkrcmar On Thu, Jun 06, 2019 at 02:07:39PM +0200, Paolo Bonzini wrote: >On 01/04/19 04:17, Wei Yang wrote: >> apic_clear_vector() is the counterpart of kvm_lapic_clear_vector(), >> while they have different naming convention. >> >> Rename it and move together to arch/x86/kvm/lapic.h. Also fix one typo >> in comment by hand. > >You mean "of kvm_lapic_set_vector()". Queued all three with only this >change to the commit log, sorry for the delay. > Thanks :-) >Paolo > >> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> >> --- >> arch/x86/kvm/lapic.c | 17 +++++++---------- >> arch/x86/kvm/lapic.h | 5 +++++ >> 2 files changed, 12 insertions(+), 10 deletions(-) >> >> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c >> index c4533d05c214..d8b3cbba8e29 100644 >> --- a/arch/x86/kvm/lapic.c >> +++ b/arch/x86/kvm/lapic.c >> @@ -88,11 +88,6 @@ bool kvm_apic_pending_eoi(struct kvm_vcpu *vcpu, int vector) >> apic_test_vector(vector, apic->regs + APIC_IRR); >> } >> >> -static inline void apic_clear_vector(int vec, void *bitmap) >> -{ >> - clear_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); >> -} >> - >> static inline int __apic_test_and_set_vector(int vec, void *bitmap) >> { >> return __test_and_set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); >> @@ -445,12 +440,12 @@ static inline void apic_clear_irr(int vec, struct kvm_lapic *apic) >> >> if (unlikely(vcpu->arch.apicv_active)) { >> /* need to update RVI */ >> - apic_clear_vector(vec, apic->regs + APIC_IRR); >> + kvm_lapic_clear_vector(vec, apic->regs + APIC_IRR); >> kvm_x86_ops->hwapic_irr_update(vcpu, >> apic_find_highest_irr(apic)); >> } else { >> apic->irr_pending = false; >> - apic_clear_vector(vec, apic->regs + APIC_IRR); >> + kvm_lapic_clear_vector(vec, apic->regs + APIC_IRR); >> if (apic_search_irr(apic) != -1) >> apic->irr_pending = true; >> } >> @@ -1053,9 +1048,11 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, >> >> if (apic_test_vector(vector, apic->regs + APIC_TMR) != !!trig_mode) { >> if (trig_mode) >> - kvm_lapic_set_vector(vector, apic->regs + APIC_TMR); >> + kvm_lapic_set_vector(vector, >> + apic->regs + APIC_TMR); >> else >> - apic_clear_vector(vector, apic->regs + APIC_TMR); >> + kvm_lapic_clear_vector(vector, >> + apic->regs + APIC_TMR); >> } >> >> if (vcpu->arch.apicv_active) >> @@ -2278,7 +2275,7 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu) >> >> /* >> * APIC is created enabled. This will prevent kvm_lapic_set_base from >> - * thinking that APIC satet has changed. >> + * thinking that APIC state has changed. >> */ >> vcpu->arch.apic_base = MSR_IA32_APICBASE_ENABLE; >> static_key_slow_inc(&apic_sw_disabled.key); /* sw disabled at reset */ >> diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h >> index ff6ef9c3d760..339ee029be6e 100644 >> --- a/arch/x86/kvm/lapic.h >> +++ b/arch/x86/kvm/lapic.h >> @@ -127,6 +127,11 @@ void kvm_lapic_exit(void); >> #define VEC_POS(v) ((v) & (32 - 1)) >> #define REG_POS(v) (((v) >> 5) << 4) >> >> +static inline void kvm_lapic_clear_vector(int vec, void *bitmap) >> +{ >> + clear_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); >> +} >> + >> static inline void kvm_lapic_set_vector(int vec, void *bitmap) >> { >> set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); >> -- Wei Yang Help you, Help me ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-06 15:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190401021723.5682-1-richardw.yang@linux.intel.com>
2019-06-04 3:11 ` [PATCH 1/3] kvm: x86: check kvm_apic_sw_enabled() is enough Wei Yang
[not found] ` <20190401021723.5682-2-richardw.yang@linux.intel.com>
2019-06-06 12:07 ` [PATCH 2/3] kvm: x86: use same convention to name apic_clear_vector() Paolo Bonzini
2019-06-06 15:43 ` Wei Yang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox