From 22f7bb0329a506f2fd61c14ce3c8bc632e08c732 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Fri, 16 Feb 2007 08:44:43 +0100 Subject: [CPUFREQ] Revert default on deprecated config X86_SPEEDSTEP_CENTRINO_ACPI Revert default on deprecated config X86_SPEEDSTEP_CENTRINO_ACPI Signed-off-by: Thomas Renninger Signed-off-by: Dave Jones arch/i386/kernel/cpu/cpufreq/Kconfig | 1 - arch/x86_64/kernel/cpufreq/Kconfig | 1 - 2 files changed, 2 deletions(-) --- arch/x86_64/kernel/cpufreq/Kconfig | 1 - 1 file changed, 1 deletion(-) (limited to 'arch/x86_64') diff --git a/arch/x86_64/kernel/cpufreq/Kconfig b/arch/x86_64/kernel/cpufreq/Kconfig index 45a6a1fd14ac..ced15d06f0f3 100644 --- a/arch/x86_64/kernel/cpufreq/Kconfig +++ b/arch/x86_64/kernel/cpufreq/Kconfig @@ -45,7 +45,6 @@ config X86_SPEEDSTEP_CENTRINO config X86_SPEEDSTEP_CENTRINO_ACPI bool depends on X86_SPEEDSTEP_CENTRINO - default y config X86_ACPI_CPUFREQ tristate "ACPI Processor P-States driver" -- cgit v1.2.3-59-g8ed1b From b077ffb3b767c3efb44d00b998385a9cb127255c Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Fri, 16 Feb 2007 01:48:11 -0800 Subject: rdmsr_on_cpu, wrmsr_on_cpu There was OpenVZ specific bug rendering some cpufreq drivers unusable on SMP. In short, when cpufreq code thinks it confined itself to needed cpu by means of set_cpus_allowed() to execute rdmsr, some "virtual cpu" feature can migrate process to anywhere. This triggers bugons and does wrong things in general. This got fixed by introducing rdmsr_on_cpu and wrmsr_on_cpu executing rdmsr and wrmsr on given physical cpu by means of smp_call_function_single(). Dave Jones mentioned cpufreq might be not only user of rdmsr_on_cpu() and wrmsr_on_cpu(), so I'm putting them into arch/{i386,x86_64}/lib/ . Signed-off-by: Alexey Dobriyan Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Dave Jones --- arch/i386/lib/Makefile | 2 ++ arch/i386/lib/msr-on-cpu.c | 70 ++++++++++++++++++++++++++++++++++++++++++++ arch/x86_64/lib/Makefile | 2 +- arch/x86_64/lib/msr-on-cpu.c | 1 + include/asm-i386/msr.h | 3 ++ include/asm-x86_64/msr.h | 2 ++ 6 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 arch/i386/lib/msr-on-cpu.c create mode 100644 arch/x86_64/lib/msr-on-cpu.c (limited to 'arch/x86_64') diff --git a/arch/i386/lib/Makefile b/arch/i386/lib/Makefile index d86a548b8d54..0d41223472c2 100644 --- a/arch/i386/lib/Makefile +++ b/arch/i386/lib/Makefile @@ -7,3 +7,5 @@ lib-y = checksum.o delay.o usercopy.o getuser.o putuser.o memcpy.o strstr.o \ bitops.o semaphore.o lib-$(CONFIG_X86_USE_3DNOW) += mmx.o + +obj-y = msr-on-cpu.o diff --git a/arch/i386/lib/msr-on-cpu.c b/arch/i386/lib/msr-on-cpu.c new file mode 100644 index 000000000000..2092ea15ba85 --- /dev/null +++ b/arch/i386/lib/msr-on-cpu.c @@ -0,0 +1,70 @@ +#include +#include +#include +#include + +#ifdef CONFIG_SMP +struct msr_info { + u32 msr_no; + u32 l, h; +}; + +static void __rdmsr_on_cpu(void *info) +{ + struct msr_info *rv = info; + + rdmsr(rv->msr_no, rv->l, rv->h); +} + +void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) +{ + preempt_disable(); + if (smp_processor_id() == cpu) + rdmsr(msr_no, *l, *h); + else { + struct msr_info rv; + + rv.msr_no = msr_no; + smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 0, 1); + *l = rv.l; + *h = rv.h; + } + preempt_enable(); +} + +static void __wrmsr_on_cpu(void *info) +{ + struct msr_info *rv = info; + + wrmsr(rv->msr_no, rv->l, rv->h); +} + +void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) +{ + preempt_disable(); + if (smp_processor_id() == cpu) + wrmsr(msr_no, l, h); + else { + struct msr_info rv; + + rv.msr_no = msr_no; + rv.l = l; + rv.h = h; + smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 0, 1); + } + preempt_enable(); +} +#else +void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) +{ + rdmsr(msr_no, *l, *h); +} + +void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) +{ + wrmsr(msr_no, l, h); +} +#endif + +EXPORT_SYMBOL(rdmsr_on_cpu); +EXPORT_SYMBOL(wrmsr_on_cpu); diff --git a/arch/x86_64/lib/Makefile b/arch/x86_64/lib/Makefile index b78d4170fce2..0a43f07b0290 100644 --- a/arch/x86_64/lib/Makefile +++ b/arch/x86_64/lib/Makefile @@ -4,7 +4,7 @@ CFLAGS_csum-partial.o := -funroll-loops -obj-y := io.o iomap_copy.o +obj-y := io.o iomap_copy.o msr-on-cpu.o lib-y := csum-partial.o csum-copy.o csum-wrappers.o delay.o \ usercopy.o getuser.o putuser.o \ diff --git a/arch/x86_64/lib/msr-on-cpu.c b/arch/x86_64/lib/msr-on-cpu.c new file mode 100644 index 000000000000..47e0ec47c376 --- /dev/null +++ b/arch/x86_64/lib/msr-on-cpu.c @@ -0,0 +1 @@ +#include "../../i386/lib/msr-on-cpu.c" diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h index 609a3899475c..3516a1fb38e0 100644 --- a/include/asm-i386/msr.h +++ b/include/asm-i386/msr.h @@ -83,6 +83,9 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val) : "c" (counter)) #endif /* !CONFIG_PARAVIRT */ +void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); +void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); + /* symbolic names for some interesting MSRs */ /* Intel defined MSRs. */ #define MSR_IA32_P5_MC_ADDR 0 diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h index 3227bc93d69b..995a2b5fb26b 100644 --- a/include/asm-x86_64/msr.h +++ b/include/asm-x86_64/msr.h @@ -160,6 +160,8 @@ static inline unsigned int cpuid_edx(unsigned int op) #define MSR_IA32_UCODE_WRITE 0x79 #define MSR_IA32_UCODE_REV 0x8b +void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); +void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); #endif -- cgit v1.2.3-59-g8ed1b From b44755cfaa72e7ed3d831a946bb4e7dfe7548966 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 20 Feb 2007 01:07:13 +0100 Subject: {rd,wr}msr_on_cpu SMP=n optimization Let's save a few bytes in the CONFIG_SMP=n case. Signed-off-by: Adrian Bunk Signed-off-by: Dave Jones --- arch/i386/lib/Makefile | 2 +- arch/i386/lib/msr-on-cpu.c | 12 ------------ arch/x86_64/lib/Makefile | 3 ++- include/asm-i386/msr.h | 11 +++++++++++ include/asm-x86_64/msr.h | 11 +++++++++++ 5 files changed, 25 insertions(+), 14 deletions(-) (limited to 'arch/x86_64') diff --git a/arch/i386/lib/Makefile b/arch/i386/lib/Makefile index 0d41223472c2..22d8ac5815f0 100644 --- a/arch/i386/lib/Makefile +++ b/arch/i386/lib/Makefile @@ -8,4 +8,4 @@ lib-y = checksum.o delay.o usercopy.o getuser.o putuser.o memcpy.o strstr.o \ lib-$(CONFIG_X86_USE_3DNOW) += mmx.o -obj-y = msr-on-cpu.o +obj-$(CONFIG_SMP) += msr-on-cpu.o diff --git a/arch/i386/lib/msr-on-cpu.c b/arch/i386/lib/msr-on-cpu.c index 2092ea15ba85..1c46bda409ff 100644 --- a/arch/i386/lib/msr-on-cpu.c +++ b/arch/i386/lib/msr-on-cpu.c @@ -3,7 +3,6 @@ #include #include -#ifdef CONFIG_SMP struct msr_info { u32 msr_no; u32 l, h; @@ -54,17 +53,6 @@ void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) } preempt_enable(); } -#else -void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) -{ - rdmsr(msr_no, *l, *h); -} - -void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) -{ - wrmsr(msr_no, l, h); -} -#endif EXPORT_SYMBOL(rdmsr_on_cpu); EXPORT_SYMBOL(wrmsr_on_cpu); diff --git a/arch/x86_64/lib/Makefile b/arch/x86_64/lib/Makefile index 0a43f07b0290..43d051ff1fb4 100644 --- a/arch/x86_64/lib/Makefile +++ b/arch/x86_64/lib/Makefile @@ -4,7 +4,8 @@ CFLAGS_csum-partial.o := -funroll-loops -obj-y := io.o iomap_copy.o msr-on-cpu.o +obj-y := io.o iomap_copy.o +obj-$(CONFIG_SMP) += msr-on-cpu.o lib-y := csum-partial.o csum-copy.o csum-wrappers.o delay.o \ usercopy.o getuser.o putuser.o \ diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h index 3516a1fb38e0..8c35f3d90a89 100644 --- a/include/asm-i386/msr.h +++ b/include/asm-i386/msr.h @@ -83,8 +83,19 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val) : "c" (counter)) #endif /* !CONFIG_PARAVIRT */ +#ifdef CONFIG_SMP void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); +#else /* CONFIG_SMP */ +static inline void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) +{ + rdmsr(msr_no, *l, *h); +} +static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) +{ + wrmsr(msr_no, l, h); +} +#endif /* CONFIG_SMP */ /* symbolic names for some interesting MSRs */ /* Intel defined MSRs. */ diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h index 995a2b5fb26b..902f9a58617e 100644 --- a/include/asm-x86_64/msr.h +++ b/include/asm-x86_64/msr.h @@ -160,8 +160,19 @@ static inline unsigned int cpuid_edx(unsigned int op) #define MSR_IA32_UCODE_WRITE 0x79 #define MSR_IA32_UCODE_REV 0x8b +#ifdef CONFIG_SMP void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); +#else /* CONFIG_SMP */ +static inline void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) +{ + rdmsr(msr_no, *l, *h); +} +static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) +{ + wrmsr(msr_no, l, h); +} +#endif /* CONFIG_SMP */ #endif -- cgit v1.2.3-59-g8ed1b