diff options
author | Alexander Graf <agraf@suse.de> | 2009-11-02 07:02:31 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-11-05 00:51:05 -0500 |
commit | 544c6761bb05a1dd19a39cb9bed096273f9bdb36 (patch) | |
tree | 66fde2d24a61c3be4712ac2701263aca04f26ebb /arch/powerpc/kvm/powerpc.c | |
parent | c8240bd6f0b4b1b21ffd36dd44114d05c7afe0c0 (diff) |
Use hrtimers for the decrementer
Following S390's good example we should use hrtimers for the decrementer too!
This patch converts the timer from the old mechanism to hrtimers.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kvm/powerpc.c')
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index a06ecc3401fd..692c3709011e 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/kvm_host.h> | 23 | #include <linux/kvm_host.h> |
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/vmalloc.h> | 25 | #include <linux/vmalloc.h> |
26 | #include <linux/hrtimer.h> | ||
26 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
27 | #include <asm/cputable.h> | 28 | #include <asm/cputable.h> |
28 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
@@ -208,10 +209,25 @@ static void kvmppc_decrementer_func(unsigned long data) | |||
208 | } | 209 | } |
209 | } | 210 | } |
210 | 211 | ||
212 | /* | ||
213 | * low level hrtimer wake routine. Because this runs in hardirq context | ||
214 | * we schedule a tasklet to do the real work. | ||
215 | */ | ||
216 | enum hrtimer_restart kvmppc_decrementer_wakeup(struct hrtimer *timer) | ||
217 | { | ||
218 | struct kvm_vcpu *vcpu; | ||
219 | |||
220 | vcpu = container_of(timer, struct kvm_vcpu, arch.dec_timer); | ||
221 | tasklet_schedule(&vcpu->arch.tasklet); | ||
222 | |||
223 | return HRTIMER_NORESTART; | ||
224 | } | ||
225 | |||
211 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | 226 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) |
212 | { | 227 | { |
213 | setup_timer(&vcpu->arch.dec_timer, kvmppc_decrementer_func, | 228 | hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); |
214 | (unsigned long)vcpu); | 229 | tasklet_init(&vcpu->arch.tasklet, kvmppc_decrementer_func, (ulong)vcpu); |
230 | vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup; | ||
215 | 231 | ||
216 | return 0; | 232 | return 0; |
217 | } | 233 | } |