* [PATCH 1/2] KVM: x86: Simplify __apic_accept_irq
@ 2013-07-25 7:58 Jan Kiszka
2013-07-25 7:59 ` [PATCH 2/2] KVM: x86: Drop some unused functions from lapic Jan Kiszka
2013-07-25 10:44 ` [PATCH 1/2] KVM: x86: Simplify __apic_accept_irq Gleb Natapov
0 siblings, 2 replies; 3+ messages in thread
From: Jan Kiszka @ 2013-07-25 7:58 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm
If posted interrupts are enabled, we can no longer track if an IRQ was
coalesced based on IRR. So drop this logic also from the classic
software path and simplify apic_test_and_set_irr to apic_set_irr.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/kvm/lapic.c | 23 ++++++++---------------
1 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index afc1124..9dc3650 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -331,10 +331,10 @@ void kvm_apic_update_irr(struct kvm_vcpu *vcpu, u32 *pir)
}
EXPORT_SYMBOL_GPL(kvm_apic_update_irr);
-static inline int apic_test_and_set_irr(int vec, struct kvm_lapic *apic)
+static inline void apic_set_irr(int vec, struct kvm_lapic *apic)
{
apic->irr_pending = true;
- return apic_test_and_set_vector(vec, apic->regs + APIC_IRR);
+ apic_set_vector(vec, apic->regs + APIC_IRR);
}
static inline int apic_search_irr(struct kvm_lapic *apic)
@@ -681,28 +681,21 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
if (unlikely(!apic_enabled(apic)))
break;
+ result = 1;
+
if (dest_map)
__set_bit(vcpu->vcpu_id, dest_map);
- if (kvm_x86_ops->deliver_posted_interrupt) {
- result = 1;
+ if (kvm_x86_ops->deliver_posted_interrupt)
kvm_x86_ops->deliver_posted_interrupt(vcpu, vector);
- } else {
- result = !apic_test_and_set_irr(vector, apic);
-
- if (!result) {
- if (trig_mode)
- apic_debug("level trig mode repeatedly "
- "for vector %d", vector);
- goto out;
- }
+ else {
+ apic_set_irr(vector, apic);
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);
+ trig_mode, vector, false);
break;
case APIC_DM_REMRD:
--
1.7.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] KVM: x86: Drop some unused functions from lapic
2013-07-25 7:58 [PATCH 1/2] KVM: x86: Simplify __apic_accept_irq Jan Kiszka
@ 2013-07-25 7:59 ` Jan Kiszka
2013-07-25 10:44 ` [PATCH 1/2] KVM: x86: Simplify __apic_accept_irq Gleb Natapov
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2013-07-25 7:59 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm
Both have no users anymore.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/kvm/lapic.c | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 9dc3650..c98f054 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -79,16 +79,6 @@ static inline void apic_set_reg(struct kvm_lapic *apic, int reg_off, u32 val)
*((u32 *) (apic->regs + reg_off)) = val;
}
-static inline int apic_test_and_set_vector(int vec, void *bitmap)
-{
- return test_and_set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec));
-}
-
-static inline int apic_test_and_clear_vector(int vec, void *bitmap)
-{
- return test_and_clear_bit(VEC_POS(vec), (bitmap) + REG_POS(vec));
-}
-
static inline int apic_test_vector(int vec, void *bitmap)
{
return test_bit(VEC_POS(vec), (bitmap) + REG_POS(vec));
--
1.7.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 1/2] KVM: x86: Simplify __apic_accept_irq
2013-07-25 7:58 [PATCH 1/2] KVM: x86: Simplify __apic_accept_irq Jan Kiszka
2013-07-25 7:59 ` [PATCH 2/2] KVM: x86: Drop some unused functions from lapic Jan Kiszka
@ 2013-07-25 10:44 ` Gleb Natapov
1 sibling, 0 replies; 3+ messages in thread
From: Gleb Natapov @ 2013-07-25 10:44 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Paolo Bonzini, kvm
On Thu, Jul 25, 2013 at 09:58:45AM +0200, Jan Kiszka wrote:
> If posted interrupts are enabled, we can no longer track if an IRQ was
> coalesced based on IRR. So drop this logic also from the classic
> software path and simplify apic_test_and_set_irr to apic_set_irr.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Applied both, thanks.
> ---
> arch/x86/kvm/lapic.c | 23 ++++++++---------------
> 1 files changed, 8 insertions(+), 15 deletions(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index afc1124..9dc3650 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -331,10 +331,10 @@ void kvm_apic_update_irr(struct kvm_vcpu *vcpu, u32 *pir)
> }
> EXPORT_SYMBOL_GPL(kvm_apic_update_irr);
>
> -static inline int apic_test_and_set_irr(int vec, struct kvm_lapic *apic)
> +static inline void apic_set_irr(int vec, struct kvm_lapic *apic)
> {
> apic->irr_pending = true;
> - return apic_test_and_set_vector(vec, apic->regs + APIC_IRR);
> + apic_set_vector(vec, apic->regs + APIC_IRR);
> }
>
> static inline int apic_search_irr(struct kvm_lapic *apic)
> @@ -681,28 +681,21 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
> if (unlikely(!apic_enabled(apic)))
> break;
>
> + result = 1;
> +
> if (dest_map)
> __set_bit(vcpu->vcpu_id, dest_map);
>
> - if (kvm_x86_ops->deliver_posted_interrupt) {
> - result = 1;
> + if (kvm_x86_ops->deliver_posted_interrupt)
> kvm_x86_ops->deliver_posted_interrupt(vcpu, vector);
> - } else {
> - result = !apic_test_and_set_irr(vector, apic);
> -
> - if (!result) {
> - if (trig_mode)
> - apic_debug("level trig mode repeatedly "
> - "for vector %d", vector);
> - goto out;
> - }
> + else {
> + apic_set_irr(vector, apic);
>
> 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);
> + trig_mode, vector, false);
> break;
>
> case APIC_DM_REMRD:
> --
> 1.7.3.4
--
Gleb.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-25 10:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-25 7:58 [PATCH 1/2] KVM: x86: Simplify __apic_accept_irq Jan Kiszka
2013-07-25 7:59 ` [PATCH 2/2] KVM: x86: Drop some unused functions from lapic Jan Kiszka
2013-07-25 10:44 ` [PATCH 1/2] KVM: x86: Simplify __apic_accept_irq Gleb Natapov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox