Commit 19b6a85b authored by Arjan Koers's avatar Arjan Koers Committed by Avi Kivity

KVM guest: Move a printk that's using the clock before it's ready

Fix a hang during SMP kernel boot on KVM that showed up
after commit 489fb490
(2.6.35) and 59aab522
(2.6.34.1). The problem only occurs when
CONFIG_PRINTK_TIME is set.

KVM-Stable-Tag.
Signed-off-by: default avatarArjan Koers <0h61vkll2ly8@xutrox.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent c285545f
...@@ -128,13 +128,15 @@ static struct clocksource kvm_clock = { ...@@ -128,13 +128,15 @@ static struct clocksource kvm_clock = {
static int kvm_register_clock(char *txt) static int kvm_register_clock(char *txt)
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
int low, high; int low, high, ret;
low = (int)__pa(&per_cpu(hv_clock, cpu)) | 1; low = (int)__pa(&per_cpu(hv_clock, cpu)) | 1;
high = ((u64)__pa(&per_cpu(hv_clock, cpu)) >> 32); high = ((u64)__pa(&per_cpu(hv_clock, cpu)) >> 32);
ret = native_write_msr_safe(msr_kvm_system_time, low, high);
printk(KERN_INFO "kvm-clock: cpu %d, msr %x:%x, %s\n", printk(KERN_INFO "kvm-clock: cpu %d, msr %x:%x, %s\n",
cpu, high, low, txt); cpu, high, low, txt);
return native_write_msr_safe(msr_kvm_system_time, low, high); return ret;
} }
#ifdef CONFIG_X86_LOCAL_APIC #ifdef CONFIG_X86_LOCAL_APIC
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment