Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1619472 > unrolled thread

[PATCH 1/2] x86/smp: Refine the code in the case of X86_32_SMP

Started byDou Liyang <douly.fnst@cn.fujitsu.com>
First post2017-04-09 12:50 +0200
Last post2017-04-10 10:10 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] x86/smp: Refine the code in the case of X86_32_SMP Dou Liyang <douly.fnst@cn.fujitsu.com> - 2017-04-09 12:50 +0200
    [PATCH 2/2] x86/smp: Remove the redundant #ifdef CONFIG_SMP directive Dou Liyang <douly.fnst@cn.fujitsu.com> - 2017-04-09 12:50 +0200
    [PATCH 3/3] x86/irq: Remove a redundant #ifdef directive Dou Liyang <douly.fnst@cn.fujitsu.com> - 2017-04-10 10:10 +0200

#1619472 — [PATCH 1/2] x86/smp: Refine the code in the case of X86_32_SMP

FromDou Liyang <douly.fnst@cn.fujitsu.com>
Date2017-04-09 12:50 +0200
Subject[PATCH 1/2] x86/smp: Refine the code in the case of X86_32_SMP
Message-ID<tuizT-1Fl-7@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1619478 — [PATCH 2/2] x86/smp: Remove the redundant #ifdef CONFIG_SMP directive

FromDou Liyang <douly.fnst@cn.fujitsu.com>
Date2017-04-09 12:50 +0200
Subject[PATCH 2/2] x86/smp: Remove the redundant #ifdef CONFIG_SMP directive
Message-ID<tuizU-1Fl-15@gated-at.bofh.it>
In reply to#1619472
According to:
  ...
  config X86_LOCAL_APIC
     def_bool y
     depends on X86_64 || SMP || X86_32_NON_STANDARD ...
  ...
in arch/x86/Kconfig

If X86_LOCAL_APIC is n, the SMP must be n.

So, Remove the redundant #ifdef CONFIG_SMP directive in the case of
!X86_LOCAL_APIC.

Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
---
 arch/x86/include/asm/smp.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index f64aaa7..47103ec 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -188,11 +188,7 @@ static inline int logical_smp_processor_id(void)
 extern int hard_smp_processor_id(void);
 
 #else /* CONFIG_X86_LOCAL_APIC */
-
-# ifndef CONFIG_SMP
-#  define hard_smp_processor_id()	0
-# endif
-
+#define hard_smp_processor_id()	0
 #endif /* CONFIG_X86_LOCAL_APIC */
 
 #ifdef CONFIG_DEBUG_NMI_SELFTEST
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1619701 — [PATCH 3/3] x86/irq: Remove a redundant #ifdef directive

FromDou Liyang <douly.fnst@cn.fujitsu.com>
Date2017-04-10 10:10 +0200
Subject[PATCH 3/3] x86/irq: Remove a redundant #ifdef directive
Message-ID<tuCyB-6zF-1@gated-at.bofh.it>
In reply to#1619472
The declaration of irq_ctx_init in irq.h has already considered with
both X86_32=y and X86_32=n cases.

Put '#ifdef CONFIG_X86_32' here is redundant.

Remove it for cleanup.

Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
---
 arch/x86/kernel/irqinit.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index 1423ab1..7468c69 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -195,7 +195,5 @@ void __init native_init_IRQ(void)
 	if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs())
 		setup_irq(2, &irq2);
 
-#ifdef CONFIG_X86_32
 	irq_ctx_init(smp_processor_id());
-#endif
 }
-- 
2.5.5

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web