From: Glauber Costa <glommer@redhat.com> Date: Tue, 11 Aug 2009 13:32:04 -0400 Subject: [x86] kvmclock smp support Message-id: 1250011926-31633-6-git-send-email-glommer@redhat.com O-Subject: [PATCH v2 5/7] kvmclock smp support Bugzilla: 476075 In order to use smp systems with kvmclock, we need to issue a msr write in kvm clock msr, to register a per-cpu memory area. Since we can't hook functions through smp_ops, we call our registration function directly. Signed-off-by: Glauber Costa <glommer@redhat.com> diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index adf9295..f0ffcb9 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c @@ -56,6 +56,7 @@ #include <mach_apic.h> #include <mach_wakecpu.h> #include <smpboot_hooks.h> +#include <linux/kvm_para.h> /* Set if we find a B stepping CPU */ static int __devinitdata smp_b_stepping; @@ -540,6 +541,11 @@ static void __cpuinit start_secondary(void *unused) smp_callin(); while (!cpu_isset(smp_processor_id(), smp_commenced_mask)) rep_nop(); + +#ifndef CONFIG_XEN + WARN_ON(kvm_register_clock("secondary cpu clock")); +#endif + setup_secondary_APIC_clock(); if (nmi_watchdog == NMI_IO_APIC) { disable_8259A_irq(0); diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index 7c6ced7..bf879df 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c @@ -46,6 +46,7 @@ #include <linux/bootmem.h> #include <linux/thread_info.h> #include <linux/module.h> +#include <linux/kvm_para.h> #include <linux/delay.h> #include <linux/mc146818rtc.h> @@ -543,7 +544,9 @@ void __cpuinit start_secondary(void) /* otherwise gcc will move up the smp_processor_id before the cpu_init */ barrier(); - +#ifndef CONFIG_XEN + WARN_ON(kvm_register_clock("secondary cpu clock")); +#endif Dprintk("cpu %d: setting up apic clock\n", smp_processor_id()); setup_secondary_APIC_clock();