aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMihai Caraman <mihai.caraman@freescale.com>2014-09-01 10:19:56 -0400
committerAlexander Graf <agraf@suse.de>2014-09-22 04:11:34 -0400
commitd02d4d156e72baf9a6628c76eb53019124d3c82f (patch)
tree19cd5ecbd1a2717a5951ddf01607b921488c2245
parent2f699a59f399d65d51df6eb916bf2e0f7c6f8148 (diff)
KVM: PPC: Remove the tasklet used by the hrtimer
Powerpc timer implementation is a copycat version of s390. Now that they removed the tasklet with commit ea74c0ea1b24a6978a6ebc80ba4dbc7b7848b32d follow this optimization. Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com> Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com> Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r--arch/powerpc/include/asm/kvm_host.h1
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h2
-rw-r--r--arch/powerpc/kvm/book3s.c4
-rw-r--r--arch/powerpc/kvm/booke.c4
-rw-r--r--arch/powerpc/kvm/powerpc.c8
5 files changed, 4 insertions, 15 deletions
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index bad3491cc32c..d2432401d301 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -606,7 +606,6 @@ struct kvm_vcpu_arch {
606 u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */ 606 u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */
607 607
608 struct hrtimer dec_timer; 608 struct hrtimer dec_timer;
609 struct tasklet_struct tasklet;
610 u64 dec_jiffies; 609 u64 dec_jiffies;
611 u64 dec_expires; 610 u64 dec_expires;
612 unsigned long pending_exceptions; 611 unsigned long pending_exceptions;
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 05e58b630601..73063ef53694 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -89,7 +89,7 @@ extern int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu);
89extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu); 89extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu);
90extern void kvmppc_emulate_dec(struct kvm_vcpu *vcpu); 90extern void kvmppc_emulate_dec(struct kvm_vcpu *vcpu);
91extern u32 kvmppc_get_dec(struct kvm_vcpu *vcpu, u64 tb); 91extern u32 kvmppc_get_dec(struct kvm_vcpu *vcpu, u64 tb);
92extern void kvmppc_decrementer_func(unsigned long data); 92extern void kvmppc_decrementer_func(struct kvm_vcpu *vcpu);
93extern int kvmppc_sanity_check(struct kvm_vcpu *vcpu); 93extern int kvmppc_sanity_check(struct kvm_vcpu *vcpu);
94extern int kvmppc_subarch_vcpu_init(struct kvm_vcpu *vcpu); 94extern int kvmppc_subarch_vcpu_init(struct kvm_vcpu *vcpu);
95extern void kvmppc_subarch_vcpu_uninit(struct kvm_vcpu *vcpu); 95extern void kvmppc_subarch_vcpu_uninit(struct kvm_vcpu *vcpu);
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 1b5adda2a224..f23b6a553082 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -718,10 +718,8 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
718 return -EINVAL; 718 return -EINVAL;
719} 719}
720 720
721void kvmppc_decrementer_func(unsigned long data) 721void kvmppc_decrementer_func(struct kvm_vcpu *vcpu)
722{ 722{
723 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
724
725 kvmppc_core_queue_dec(vcpu); 723 kvmppc_core_queue_dec(vcpu);
726 kvm_vcpu_kick(vcpu); 724 kvm_vcpu_kick(vcpu);
727} 725}
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index b4e81e6be11a..97ec5b7fce9c 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1822,10 +1822,8 @@ void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits)
1822 update_timer_ints(vcpu); 1822 update_timer_ints(vcpu);
1823} 1823}
1824 1824
1825void kvmppc_decrementer_func(unsigned long data) 1825void kvmppc_decrementer_func(struct kvm_vcpu *vcpu)
1826{ 1826{
1827 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
1828
1829 if (vcpu->arch.tcr & TCR_ARE) { 1827 if (vcpu->arch.tcr & TCR_ARE) {
1830 vcpu->arch.dec = vcpu->arch.decar; 1828 vcpu->arch.dec = vcpu->arch.decar;
1831 kvmppc_emulate_dec(vcpu); 1829 kvmppc_emulate_dec(vcpu);
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 0c7d1917c23d..ecf057551a2f 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -638,7 +638,6 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
638{ 638{
639 /* Make sure we're not using the vcpu anymore */ 639 /* Make sure we're not using the vcpu anymore */
640 hrtimer_cancel(&vcpu->arch.dec_timer); 640 hrtimer_cancel(&vcpu->arch.dec_timer);
641 tasklet_kill(&vcpu->arch.tasklet);
642 641
643 kvmppc_remove_vcpu_debugfs(vcpu); 642 kvmppc_remove_vcpu_debugfs(vcpu);
644 643
@@ -664,16 +663,12 @@ int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
664 return kvmppc_core_pending_dec(vcpu); 663 return kvmppc_core_pending_dec(vcpu);
665} 664}
666 665
667/*
668 * low level hrtimer wake routine. Because this runs in hardirq context
669 * we schedule a tasklet to do the real work.
670 */
671enum hrtimer_restart kvmppc_decrementer_wakeup(struct hrtimer *timer) 666enum hrtimer_restart kvmppc_decrementer_wakeup(struct hrtimer *timer)
672{ 667{
673 struct kvm_vcpu *vcpu; 668 struct kvm_vcpu *vcpu;
674 669
675 vcpu = container_of(timer, struct kvm_vcpu, arch.dec_timer); 670 vcpu = container_of(timer, struct kvm_vcpu, arch.dec_timer);
676 tasklet_schedule(&vcpu->arch.tasklet); 671 kvmppc_decrementer_func(vcpu);
677 672
678 return HRTIMER_NORESTART; 673 return HRTIMER_NORESTART;
679} 674}
@@ -683,7 +678,6 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
683 int ret; 678 int ret;
684 679
685 hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); 680 hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
686 tasklet_init(&vcpu->arch.tasklet, kvmppc_decrementer_func, (ulong)vcpu);
687 vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup; 681 vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup;
688 vcpu->arch.dec_expires = ~(u64)0; 682 vcpu->arch.dec_expires = ~(u64)0;
689 683