[Devel] [PATCH RHEL7 COMMIT] ms/KVM: i8254: simplify atomics in kvm_pit_ack_irq
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Dec 9 05:23:23 PST 2016
The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.20.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.36.1.vz7.20.14
------>
commit d5da2d9b01f1cb9cde965690f62f9be935125a2f
Author: Radim KrÄmáŠ<rkrcmar at redhat.com>
Date: Fri Dec 9 17:23:23 2016 +0400
ms/KVM: i8254: simplify atomics in kvm_pit_ack_irq
We already have a helper that does the same thing.
Signed-off-by: Radim KrÄmáŠ<rkrcmar at redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
ms commit f6e0a0c113f78a0e13c69762b2ab342d6c69220d
("KVM: i8254: simplify atomics in kvm_pit_ack_irq")
Fixes https://jira.sw.ru/browse/PSBM-56972
Signed-off-by: Evgeny Yakovlev <eyakovlev at virtuozzo.com>
---
arch/x86/kvm/i8254.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index b0a706d..b1bdc4f 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -235,19 +235,9 @@ static void kvm_pit_ack_irq(struct kvm_irq_ack_notifier *kian)
{
struct kvm_kpit_state *ps = container_of(kian, struct kvm_kpit_state,
irq_ack_notifier);
- int value;
spin_lock(&ps->inject_lock);
- value = atomic_dec_return(&ps->pending);
- if (value < 0)
- /* spurious acks can be generated if, for example, the
- * PIC is being reset. Handle it gracefully here
- */
- atomic_inc(&ps->pending);
- else if (value > 0 && ps->reinject)
- /* in this case, we had multiple outstanding pit interrupts
- * that we needed to inject. Reinject
- */
+ if (atomic_dec_if_positive(&ps->pending) > 0 && ps->reinject)
queue_kthread_work(&ps->pit->worker, &ps->pit->expired);
ps->irq_ack = 1;
spin_unlock(&ps->inject_lock);
More information about the Devel
mailing list