Skip to contentSkip to conversation

KVM: pit: Do not check pending pit timer in vcpu thread

PATCH Applied Jason Wang 4 participants 5 messages Aug 27, 2010 – Aug 31, 2010

Subsystems (3)
lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/1 KVM: pit: Do not check pending pit timer in vcpu thread

Pit interrupt injection was done by workqueue, so no need to check pending pit timer in vcpu thread which could lead unnecessary unblocking of vcpu.

---
 arch/x86/kvm/i8254.c |    9 ---------
 arch/x86/kvm/irq.c   |    7 +------
 2 files changed, 1 insertions(+), 15 deletions(-)
arch/x86/kvm/i8254.c +0 -9
index ddeb231..2ad40a4 100644
@@ -232,15 +232,6 @@ static void pit_latch_status(struct kvm *kvm, int channel)
 	}
 }
 
-int pit_has_pending_timer(struct kvm_vcpu *vcpu)
-{
-	struct kvm_pit *pit = vcpu->kvm->arch.vpit;
-
-	if (pit && kvm_vcpu_is_bsp(vcpu) && pit->pit_state.irq_ack)
-		return atomic_read(&pit->pit_state.pit_timer.pending);
-	return 0;
-}
-
 static void kvm_pit_ack_irq(struct kvm_irq_ack_notifier *kian)
 {
 	struct kvm_kpit_state *ps = container_of(kian, struct kvm_kpit_state,
arch/x86/kvm/irq.c +1 -6
index 2095a04..f994da4 100644
@@ -33,12 +33,7 @@
  */
 int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
 {
-	int ret;
-
-	ret = pit_has_pending_timer(vcpu);
-	ret |= apic_has_pending_timer(vcpu);
-
-	return ret;
+	return apic_has_pending_timer(vcpu);
 }
 EXPORT_SYMBOL(kvm_cpu_has_pending_timer);
 
#1 lore raw
Quoted 5 lines · Jason Wang

Pit interrupt injection was done by workqueue, so no need to check pending pit timer in vcpu thread which could lead unnecessary unblocking of vcpu.

Looks good to me.

Applied
#2 lore raw
In reply to Jason Wang
Quoted 3 lines · Jason Wang

Pit interrupt injection was done by workqueue, so no need to check pending pit timer in vcpu thread which could lead unnecessary unblocking of vcpu.

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function
#3 lore raw
In reply to Jason Wang
Quoted 4 lines · Jason Wang

Pit interrupt injection was done by workqueue, so no need to check pending pit timer in vcpu thread which could lead unnecessary unblocking of vcpu.

Is this actually correct? There were a bunch of workarounds and fixes put into this code over time. Please check with Chris Lalancette, I think he was the last to touch this code.

Quoted 50 lines
---
  arch/x86/kvm/i8254.c |    9 ---------
  arch/x86/kvm/irq.c   |    7 +------
  2 files changed, 1 insertions(+), 15 deletions(-)
arch/x86/kvm/i8254.c +0 -9
index ddeb231..2ad40a4 100644
@@ -232,15 +232,6 @@ static void pit_latch_status(struct kvm *kvm, int channel)
  	}
  }
 
-int pit_has_pending_timer(struct kvm_vcpu *vcpu)
-{
-	struct kvm_pit *pit = vcpu->kvm->arch.vpit;
-
-	if (pit&&  kvm_vcpu_is_bsp(vcpu)&&  pit->pit_state.irq_ack)
-		return atomic_read(&pit->pit_state.pit_timer.pending);
-	return 0;
-}
-
  static void kvm_pit_ack_irq(struct kvm_irq_ack_notifier *kian)
  {
  	struct kvm_kpit_state *ps = container_of(kian, struct kvm_kpit_state,
arch/x86/kvm/irq.c +1 -7
index 2095a04..f994da4 100644
@@ -33,12 +33,7 @@
   */
  int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
  {
-	int ret;
-
-	ret = pit_has_pending_timer(vcpu);
-	ret |= apic_has_pending_timer(vcpu);
-
-	return ret;
+	return apic_has_pending_timer(vcpu);
  }
  EXPORT_SYMBOL(kvm_cpu_has_pending_timer);
 
 
--

To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 6 lines · Zachary Amsden
Quoted 3 lines · Jason Wang

Pit interrupt injection was done by workqueue, so no need to check pending pit timer in vcpu thread which could lead unnecessary unblocking of vcpu.

Is this actually correct? There were a bunch of workarounds and fixes put into this code over time. Please check with Chris Lalancette, I think he was the last to touch this code.

Once upon a time we injected PIT interrupts from the vcpu thread (even though the PIT is external to any vcpu) which let to a lot of complications in the implementation. This patch removes one of them.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.