mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/smp: Refine the code in the case of X86_32_SMP
@ 2017-04-09 10:46 Dou Liyang
  2017-04-09 10:46 ` [PATCH 2/2] x86/smp: Remove the redundant #ifdef CONFIG_SMP directive Dou Liyang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dou Liyang @ 2017-04-09 10:46 UTC (permalink / raw)
  To: x86, linux-kernel; +Cc: tglx, mingo, hpa, jaswinder, Dou Liyang

Current code in CONFIG_X86_32_SMP is redundant.

Merge the raw_smp_processor_id() macro and refine the #if directive.

Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
---
BTW, what's the purpose of 

commit 96b89dc6598a ("x86: smp.h move safe_smp_processor_id declartion to cpu.h")?

Reduce the impact of SMP on the common class? 
---
 arch/x86/include/asm/smp.h | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 026ea82..f64aaa7 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -149,6 +149,19 @@ void smp_store_cpu_info(int id);
 #define cpu_physical_id(cpu)	per_cpu(x86_cpu_to_apicid, cpu)
 #define cpu_acpi_id(cpu)	per_cpu(x86_cpu_to_acpiid, cpu)
 
+/*
+ * This function is needed by all SMP systems. It must _always_ be valid
+ * from the initial startup. We map APIC_BASE very early in page_setup(),
+ * so this is correct in the x86 case.
+ */
+#define raw_smp_processor_id() (this_cpu_read(cpu_number))
+
+#ifdef CONFIG_X86_32
+extern int safe_smp_processor_id(void);
+#else
+# define safe_smp_processor_id()	smp_processor_id()
+#endif
+
 #else /* !CONFIG_SMP */
 #define wbinvd_on_cpu(cpu)     wbinvd()
 static inline int wbinvd_on_all_cpus(void)
@@ -161,22 +174,6 @@ static inline int wbinvd_on_all_cpus(void)
 
 extern unsigned disabled_cpus;
 
-#ifdef CONFIG_X86_32_SMP
-/*
- * This function is needed by all SMP systems. It must _always_ be valid
- * from the initial startup. We map APIC_BASE very early in page_setup(),
- * so this is correct in the x86 case.
- */
-#define raw_smp_processor_id() (this_cpu_read(cpu_number))
-extern int safe_smp_processor_id(void);
-
-#elif defined(CONFIG_X86_64_SMP)
-#define raw_smp_processor_id() (this_cpu_read(cpu_number))
-
-#define safe_smp_processor_id()		smp_processor_id()
-
-#endif
-
 #ifdef CONFIG_X86_LOCAL_APIC
 
 #ifndef CONFIG_X86_64
-- 
2.5.5

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-14 20:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-09 10:46 [PATCH 1/2] x86/smp: Refine the code in the case of X86_32_SMP Dou Liyang
2017-04-09 10:46 ` [PATCH 2/2] x86/smp: Remove the redundant #ifdef CONFIG_SMP directive Dou Liyang
2017-04-14 20:46   ` [tip:x86/cleanups] " tip-bot for Dou Liyang
2017-04-10  8:05 ` [PATCH 3/3] x86/irq: Remove a redundant #ifdef directive Dou Liyang
2017-04-14 20:46   ` [tip:x86/cleanups] " tip-bot for Dou Liyang
2017-04-14 20:45 ` [tip:x86/cleanups] x86/smp: Reduce code duplication tip-bot for Dou Liyang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome