Commit 2f4dfe20 authored by Fernando Luis Vazquez Cao's avatar Fernando Luis Vazquez Cao Committed by Linus Torvalds

Remove hardcoding of hard_smp_processor_id on UP systems

With the advent of kdump, the assumption that the boot CPU when booting an UP
kernel is always the CPU with a particular hardware ID (often 0) (usually
referred to as BSP on some architectures) is not valid anymore.  The reason
being that the dump capture kernel boots on the crashed CPU (the CPU that
invoked crash_kexec), which may be or may not be that particular CPU.

Move definition of hard_smp_processor_id for the UP case to
architecture-specific code ("asm/smp.h") where it belongs, so that each
architecture can provide its own implementation.
Signed-off-by: default avatarFernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
Cc: "Luck, Tony" <tony.luck@intel.com>
Acked-by: default avatarAndi Kleen <ak@suse.de>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent dd2a345f
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kdebug.h> #include <linux/kdebug.h>
#include <asm/smp.h>
#include <asm/delay.h> #include <asm/delay.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
......
...@@ -51,6 +51,7 @@ int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, in ...@@ -51,6 +51,7 @@ int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, in
#else /* CONFIG_SMP */ #else /* CONFIG_SMP */
#define hard_smp_processor_id() 0
#define smp_call_function_on_cpu(func,info,retry,wait,cpu) ({ 0; }) #define smp_call_function_on_cpu(func,info,retry,wait,cpu) ({ 0; })
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
......
...@@ -147,12 +147,13 @@ extern unsigned int num_processors; ...@@ -147,12 +147,13 @@ extern unsigned int num_processors;
#else /* CONFIG_SMP */ #else /* CONFIG_SMP */
#define hard_smp_processor_id() 0
#define safe_smp_processor_id() 0 #define safe_smp_processor_id() 0
#define cpu_physical_id(cpu) boot_cpu_physical_apicid #define cpu_physical_id(cpu) boot_cpu_physical_apicid
#define NO_PROC_ID 0xFF /* No processor magic marker */ #define NO_PROC_ID 0xFF /* No processor magic marker */
#endif #endif /* CONFIG_SMP */
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
...@@ -128,8 +128,9 @@ extern void unlock_ipi_calllock(void); ...@@ -128,8 +128,9 @@ extern void unlock_ipi_calllock(void);
extern void identify_siblings (struct cpuinfo_ia64 *); extern void identify_siblings (struct cpuinfo_ia64 *);
extern int is_multithreading_enabled(void); extern int is_multithreading_enabled(void);
#else #else /* CONFIG_SMP */
#define hard_smp_processor_id() 0
#define cpu_logical_id(i) 0 #define cpu_logical_id(i) 0
#define cpu_physical_id(i) ia64_get_lid() #define cpu_physical_id(i) ia64_get_lid()
......
...@@ -108,6 +108,10 @@ extern unsigned long send_IPI_mask_phys(cpumask_t, int, int); ...@@ -108,6 +108,10 @@ extern unsigned long send_IPI_mask_phys(cpumask_t, int, int);
#define IPI_SHIFT (0) #define IPI_SHIFT (0)
#define NR_IPIS (8) #define NR_IPIS (8)
#endif /* CONFIG_SMP */ #else /* CONFIG_SMP */
#define hard_smp_processor_id() 0
#endif /* CONFIG_SMP */
#endif /* _ASM_M32R_SMP_H */ #endif /* _ASM_M32R_SMP_H */
...@@ -83,6 +83,7 @@ extern void __cpu_die(unsigned int cpu); ...@@ -83,6 +83,7 @@ extern void __cpu_die(unsigned int cpu);
#else #else
/* for UP */ /* for UP */
#define hard_smp_processor_id() 0
#define smp_setup_cpu_maps() #define smp_setup_cpu_maps()
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
......
...@@ -110,6 +110,7 @@ static inline void smp_send_stop(void) ...@@ -110,6 +110,7 @@ static inline void smp_send_stop(void)
__load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK); __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK);
} }
#define hard_smp_processor_id() 0
#define smp_cpu_not_running(cpu) 1 #define smp_cpu_not_running(cpu) 1
#define smp_setup_cpu_possible_map() do { } while (0) #define smp_setup_cpu_possible_map() do { } while (0)
#endif #endif
......
...@@ -165,6 +165,7 @@ void smp_setup_cpu_possible_map(void); ...@@ -165,6 +165,7 @@ void smp_setup_cpu_possible_map(void);
#else /* SMP */ #else /* SMP */
#define hard_smp_processor_id() 0
#define smp_setup_cpu_possible_map() do { } while (0) #define smp_setup_cpu_possible_map() do { } while (0)
#endif /* !(SMP) */ #endif /* !(SMP) */
......
...@@ -48,6 +48,7 @@ extern unsigned char boot_cpu_id; ...@@ -48,6 +48,7 @@ extern unsigned char boot_cpu_id;
#else #else
#define hard_smp_processor_id() 0
#define smp_setup_cpu_possible_map() do { } while (0) #define smp_setup_cpu_possible_map() do { } while (0)
#define boot_cpu_id (0) #define boot_cpu_id (0)
......
...@@ -24,6 +24,10 @@ extern inline void smp_cpus_done(unsigned int maxcpus) ...@@ -24,6 +24,10 @@ extern inline void smp_cpus_done(unsigned int maxcpus)
extern struct task_struct *idle_threads[NR_CPUS]; extern struct task_struct *idle_threads[NR_CPUS];
#else
#define hard_smp_processor_id() 0
#endif #endif
#endif #endif
...@@ -71,7 +71,9 @@ extern unsigned __cpuinitdata disabled_cpus; ...@@ -71,7 +71,9 @@ extern unsigned __cpuinitdata disabled_cpus;
#define NO_PROC_ID 0xFF /* No processor magic marker */ #define NO_PROC_ID 0xFF /* No processor magic marker */
#endif #else /* CONFIG_SMP */
#define hard_smp_processor_id() 0
#endif /* CONFIG_SMP */
/* /*
* Some lowlevel functions might want to know about * Some lowlevel functions might want to know about
......
...@@ -83,7 +83,6 @@ void smp_prepare_boot_cpu(void); ...@@ -83,7 +83,6 @@ void smp_prepare_boot_cpu(void);
* These macros fold the SMP functionality into a single CPU system * These macros fold the SMP functionality into a single CPU system
*/ */
#define raw_smp_processor_id() 0 #define raw_smp_processor_id() 0
#define hard_smp_processor_id() 0
static inline int up_smp_call_function(void) static inline int up_smp_call_function(void)
{ {
return 0; return 0;
......
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