Including a random architecture specific header which requires global headers just to avoid including that header at the two usage sites is really beyond lazy and tasteless. Including global headers just to get the __percpu macro from linux/compiler_types.h falls into the same category.
Remove the linux/percpu.h and asm/cpumask.h includes from msr.h and smp.h and fix the resulting fallout by a simple forward struct declaration and by including the x86 specific asm/cpumask.h header where it is actually required. Signed-off-by: Thomas Gleixner <[email protected]> --- V1.1: Fix PARAVIRT_XXL fallout.... --- arch/x86/include/asm/cache.h | 1 + arch/x86/include/asm/msr.h | 5 +++-- arch/x86/include/asm/paravirt.h | 3 ++- arch/x86/include/asm/pvclock.h | 1 + arch/x86/include/asm/smp.h | 2 -- arch/x86/include/asm/vdso/gettimeofday.h | 5 ++--- arch/x86/kernel/cpu/mce/core.c | 1 + arch/x86/kernel/nmi.c | 1 + arch/x86/kernel/smpboot.c | 1 + 9 files changed, 12 insertions(+), 8 deletions(-) --- a/arch/x86/include/asm/cache.h +++ b/arch/x86/include/asm/cache.h @@ -2,6 +2,7 @@ #ifndef _ASM_X86_CACHE_H #define _ASM_X86_CACHE_H +#include <vdso/page.h> #include <linux/linkage.h> /* L1 cache line size */ --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h @@ -8,12 +8,11 @@ #include <asm/asm.h> #include <asm/errno.h> -#include <asm/cpumask.h> #include <uapi/asm/msr.h> #include <asm/shared/msr.h> +#include <linux/compiler_types.h> #include <linux/types.h> -#include <linux/percpu.h> struct msr_info { u32 msr_no; @@ -256,6 +255,8 @@ int msr_set_bit(u32 msr, u8 bit); int msr_clear_bit(u32 msr, u8 bit); #ifdef CONFIG_SMP +struct cpumask; + int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); int rdmsrq_on_cpu(unsigned int cpu, u32 msr_no, u64 *q); --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h @@ -16,9 +16,10 @@ #ifndef __ASSEMBLER__ #include <linux/types.h> -#include <linux/cpumask.h> #include <asm/frame.h> +struct cpumask; + /* The paravirtualized I/O functions */ static inline void slow_down_io(void) { --- a/arch/x86/include/asm/pvclock.h +++ b/arch/x86/include/asm/pvclock.h @@ -2,6 +2,7 @@ #ifndef _ASM_X86_PVCLOCK_H #define _ASM_X86_PVCLOCK_H +#include <asm/barrier.h> #include <asm/clocksource.h> #include <asm/pvclock-abi.h> --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h @@ -5,8 +5,6 @@ #include <linux/cpumask.h> #include <linux/thread_info.h> -#include <asm/cpumask.h> - DECLARE_PER_CPU_CACHE_HOT(int, cpu_number); DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_map); --- a/arch/x86/include/asm/vdso/gettimeofday.h +++ b/arch/x86/include/asm/vdso/gettimeofday.h @@ -11,13 +11,12 @@ #define __ASM_VDSO_GETTIMEOFDAY_H #ifndef __ASSEMBLER__ - +#include <clocksource/hyperv_timer.h> #include <uapi/linux/time.h> + #include <asm/vgtod.h> #include <asm/unistd.h> -#include <asm/msr.h> #include <asm/pvclock.h> -#include <clocksource/hyperv_timer.h> #include <asm/vdso/sys_call.h> #define VDSO_HAS_TIME 1 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -48,6 +48,7 @@ #include <linux/vmcore_info.h> #include <asm/fred.h> +#include <asm/cpumask.h> #include <asm/cpu_device_id.h> #include <asm/processor.h> #include <asm/traps.h> --- a/arch/x86/kernel/nmi.c +++ b/arch/x86/kernel/nmi.c @@ -26,6 +26,7 @@ #include <linux/sched/clock.h> #include <linux/kvm_types.h> +#include <asm/cpumask.h> #include <asm/cpu_entry_area.h> #include <asm/traps.h> #include <asm/mach_traps.h> --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -70,6 +70,7 @@ #include <asm/irq.h> #include <asm/realmode.h> #include <asm/cpu.h> +#include <asm/cpumask.h> #include <asm/numa.h> #include <asm/tlbflush.h> #include <asm/mtrr.h>

