diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2013-02-23 11:05:29 -0500 |
---|---|---|
committer | Gleb Natapov <gleb@redhat.com> | 2013-02-27 06:19:18 -0500 |
commit | fe1140cc369410a9c206fdb7aaabc644bd213dc2 (patch) | |
tree | 183135861fb402b7aa655be43fb1da080041681c /arch/x86/kernel/kvmclock.c | |
parent | bd31a7f55777a46063ebe3d50e6536cfff51a757 (diff) |
x86: kvmclock: Do not setup kvmclock vsyscall in the absence of that clock
This fixes boot lockups with "no-kvmclock", when the host is not
exposing this particular feature (QEMU: -cpu ...,-kvmclock) or when
the kvmclock initialization failed for whatever reason.
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch/x86/kernel/kvmclock.c')
-rw-r--r-- | arch/x86/kernel/kvmclock.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 5bedbdddf1f2..b730efad6fe9 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -160,8 +160,12 @@ int kvm_register_clock(char *txt) | |||
160 | { | 160 | { |
161 | int cpu = smp_processor_id(); | 161 | int cpu = smp_processor_id(); |
162 | int low, high, ret; | 162 | int low, high, ret; |
163 | struct pvclock_vcpu_time_info *src = &hv_clock[cpu].pvti; | 163 | struct pvclock_vcpu_time_info *src; |
164 | |||
165 | if (!hv_clock) | ||
166 | return 0; | ||
164 | 167 | ||
168 | src = &hv_clock[cpu].pvti; | ||
165 | low = (int)__pa(src) | 1; | 169 | low = (int)__pa(src) | 1; |
166 | high = ((u64)__pa(src) >> 32); | 170 | high = ((u64)__pa(src) >> 32); |
167 | ret = native_write_msr_safe(msr_kvm_system_time, low, high); | 171 | ret = native_write_msr_safe(msr_kvm_system_time, low, high); |
@@ -276,6 +280,9 @@ int __init kvm_setup_vsyscall_timeinfo(void) | |||
276 | struct pvclock_vcpu_time_info *vcpu_time; | 280 | struct pvclock_vcpu_time_info *vcpu_time; |
277 | unsigned int size; | 281 | unsigned int size; |
278 | 282 | ||
283 | if (!hv_clock) | ||
284 | return 0; | ||
285 | |||
279 | size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS); | 286 | size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS); |
280 | 287 | ||
281 | preempt_disable(); | 288 | preempt_disable(); |