aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-02-04 04:49:11 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2011-03-17 12:08:30 -0400
commit038f8c110eace38d7598e271835ae96ad04a3a26 (patch)
tree0b95a2c07fb2331110f4741d9d54ebfcf42283a8 /arch/x86
parent7049467b5383432e178cc4124e53aebd83638916 (diff)
KVM: x86: Convert tsc_write_lock to raw_spinlock
Code under this lock requires non-preemptibility. Ensure this also over -rt by converting it to raw spinlock. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/kvm_host.h2
-rw-r--r--arch/x86/kvm/x86.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index a58aebef5188..37bd730ff852 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -448,7 +448,7 @@ struct kvm_arch {
448 448
449 unsigned long irq_sources_bitmap; 449 unsigned long irq_sources_bitmap;
450 s64 kvmclock_offset; 450 s64 kvmclock_offset;
451 spinlock_t tsc_write_lock; 451 raw_spinlock_t tsc_write_lock;
452 u64 last_tsc_nsec; 452 u64 last_tsc_nsec;
453 u64 last_tsc_offset; 453 u64 last_tsc_offset;
454 u64 last_tsc_write; 454 u64 last_tsc_write;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9000829d06cb..17af71da63ad 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1017,7 +1017,7 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data)
1017 unsigned long flags; 1017 unsigned long flags;
1018 s64 sdiff; 1018 s64 sdiff;
1019 1019
1020 spin_lock_irqsave(&kvm->arch.tsc_write_lock, flags); 1020 raw_spin_lock_irqsave(&kvm->arch.tsc_write_lock, flags);
1021 offset = data - native_read_tsc(); 1021 offset = data - native_read_tsc();
1022 ns = get_kernel_ns(); 1022 ns = get_kernel_ns();
1023 elapsed = ns - kvm->arch.last_tsc_nsec; 1023 elapsed = ns - kvm->arch.last_tsc_nsec;
@@ -1050,7 +1050,7 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data)
1050 kvm->arch.last_tsc_write = data; 1050 kvm->arch.last_tsc_write = data;
1051 kvm->arch.last_tsc_offset = offset; 1051 kvm->arch.last_tsc_offset = offset;
1052 kvm_x86_ops->write_tsc_offset(vcpu, offset); 1052 kvm_x86_ops->write_tsc_offset(vcpu, offset);
1053 spin_unlock_irqrestore(&kvm->arch.tsc_write_lock, flags); 1053 raw_spin_unlock_irqrestore(&kvm->arch.tsc_write_lock, flags);
1054 1054
1055 /* Reset of TSC must disable overshoot protection below */ 1055 /* Reset of TSC must disable overshoot protection below */
1056 vcpu->arch.hv_clock.tsc_timestamp = 0; 1056 vcpu->arch.hv_clock.tsc_timestamp = 0;
@@ -6004,7 +6004,7 @@ int kvm_arch_init_vm(struct kvm *kvm)
6004 /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */ 6004 /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */
6005 set_bit(KVM_USERSPACE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap); 6005 set_bit(KVM_USERSPACE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap);
6006 6006
6007 spin_lock_init(&kvm->arch.tsc_write_lock); 6007 raw_spin_lock_init(&kvm->arch.tsc_write_lock);
6008 6008
6009 return 0; 6009 return 0;
6010} 6010}