KVM: x86: Move TSC offset writes to common code

Also, ensure that the storing of the offset and the reading of the TSC
are never preempted by taking a spinlock.  While the lock is overkill
now, it is useful later in this patch series.

Signed-off-by: Zachary Amsden <zamsden@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Zachary Amsden
2010-08-19 22:07:17 -10:00
committed by Avi Kivity
parent f4e1b3c8bd
commit 99e3e30aee
5 changed files with 33 additions and 9 deletions

View File

@@ -395,6 +395,7 @@ struct kvm_arch {
unsigned long irq_sources_bitmap;
s64 kvmclock_offset;
spinlock_t tsc_write_lock;
struct kvm_xen_hvm_config xen_hvm_config;
@@ -521,6 +522,8 @@ struct kvm_x86_ops {
bool (*has_wbinvd_exit)(void);
void (*write_tsc_offset)(struct kvm_vcpu *vcpu, u64 offset);
const struct trace_print_flags *exit_reasons_str;
};