diff options
author | Christian Borntraeger <borntraeger@de.ibm.com> | 2009-05-12 11:21:49 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-06-10 04:48:55 -0400 |
commit | ca8723023f25c9a70d76cbd6101f8fb4ffec2fa0 (patch) | |
tree | ef753d244a55271279b5b2cf29b28db5b35b454c /arch/s390/kvm/kvm-s390.c | |
parent | 2668dab794272f0898491acaf1e77e9a005abc0f (diff) |
KVM: s390: use hrtimer for clock wakeup from idle - v2
This patch reworks the s390 clock comparator wakeup to hrtimer. The clock
comparator is a per-cpu value that is compared against the TOD clock. If
ckc <= TOD an external interrupt 1004 is triggered. Since the clock comparator
and the TOD clock have a much higher resolution than jiffies we should use
hrtimers to trigger the wakeup. This speeds up guest nanosleep for small
values.
Since hrtimers callbacks run in hard-irq context, I added a tasklet to do
the actual work with enabled interrupts.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Christian Ehrhardt <ehrhardt@de.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/s390/kvm/kvm-s390.c')
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 86567e174fd7..dc3d06811fd8 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/compiler.h> | 15 | #include <linux/compiler.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/hrtimer.h> | ||
18 | #include <linux/init.h> | 19 | #include <linux/init.h> |
19 | #include <linux/kvm.h> | 20 | #include <linux/kvm.h> |
20 | #include <linux/kvm_host.h> | 21 | #include <linux/kvm_host.h> |
@@ -283,8 +284,10 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) | |||
283 | vcpu->arch.sie_block->gmsor = vcpu->kvm->arch.guest_origin; | 284 | vcpu->arch.sie_block->gmsor = vcpu->kvm->arch.guest_origin; |
284 | vcpu->arch.sie_block->ecb = 2; | 285 | vcpu->arch.sie_block->ecb = 2; |
285 | vcpu->arch.sie_block->eca = 0xC1002001U; | 286 | vcpu->arch.sie_block->eca = 0xC1002001U; |
286 | setup_timer(&vcpu->arch.ckc_timer, kvm_s390_idle_wakeup, | 287 | hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); |
287 | (unsigned long) vcpu); | 288 | tasklet_init(&vcpu->arch.tasklet, kvm_s390_tasklet, |
289 | (unsigned long) vcpu); | ||
290 | vcpu->arch.ckc_timer.function = kvm_s390_idle_wakeup; | ||
288 | get_cpu_id(&vcpu->arch.cpu_id); | 291 | get_cpu_id(&vcpu->arch.cpu_id); |
289 | vcpu->arch.cpu_id.version = 0xff; | 292 | vcpu->arch.cpu_id.version = 0xff; |
290 | return 0; | 293 | return 0; |