All of lore.kernel.org
 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 related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] x86/smp: Remove the redundant #ifdef CONFIG_SMP directive
  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 ` 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:45 ` [tip:x86/cleanups] x86/smp: Reduce code duplication tip-bot for Dou Liyang
  2 siblings, 1 reply; 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

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

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

* [PATCH 3/3] x86/irq: Remove a redundant #ifdef directive
  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-10  8:05 ` 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
  2 siblings, 1 reply; 6+ messages in thread
From: Dou Liyang @ 2017-04-10  8:05 UTC (permalink / raw)
  To: x86, linux-kernel; +Cc: tglx, mingo, hpa, Dou Liyang

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

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

* [tip:x86/cleanups] x86/smp: Reduce code duplication
  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-10  8:05 ` [PATCH 3/3] x86/irq: Remove a redundant #ifdef directive Dou Liyang
@ 2017-04-14 20:45 ` tip-bot for Dou Liyang
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Dou Liyang @ 2017-04-14 20:45 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: mingo, linux-kernel, tglx, douly.fnst, hpa

Commit-ID:  0f08c3b22996c91cff62c96cf4b3db88902e12a9
Gitweb:     http://git.kernel.org/tip/0f08c3b22996c91cff62c96cf4b3db88902e12a9
Author:     Dou Liyang <douly.fnst@cn.fujitsu.com>
AuthorDate: Sun, 9 Apr 2017 18:46:45 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 14 Apr 2017 22:43:00 +0200

x86/smp: Reduce code duplication

The CONFIG_X86_32_SMP and CONFIG_X86_64_SMP sections in smp.h contain
duplicate defines.

Merge them and only put the difference into an #ifdeff'ed section.

[ tglx: Massaged changelog ]

Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
Cc: jaswinder@infradead.org
Link: http://lkml.kernel.org/r/1491734806-15413-1-git-send-email-douly.fnst@cn.fujitsu.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 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

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

* [tip:x86/cleanups] x86/smp: Remove the redundant #ifdef CONFIG_SMP directive
  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-bot for Dou Liyang
  0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Dou Liyang @ 2017-04-14 20:46 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: mingo, linux-kernel, tglx, douly.fnst, hpa

Commit-ID:  7b6e106276fcc803e397f9b1bd4c272055c7cf5a
Gitweb:     http://git.kernel.org/tip/7b6e106276fcc803e397f9b1bd4c272055c7cf5a
Author:     Dou Liyang <douly.fnst@cn.fujitsu.com>
AuthorDate: Sun, 9 Apr 2017 18:46:46 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 14 Apr 2017 22:43:00 +0200

x86/smp: Remove the redundant #ifdef CONFIG_SMP directive

The !CONFIG_X86_LOCAL_APIC section in smp.h wraps the define of
hard_smp_processor_id() into #ifndef CONFIG_SMP. But Kconfig has:

  config X86_LOCAL_APIC
    def_bool y
    depends on X86_64 || SMP || X86_32_NON_STANDARD ...

Therefore SMP can't be 'y' when X86_LOCAL_APIC == 'n'.

Remove the redundant #ifndef CONFIG_SMP.

[ tglx: Massaged changelog ]

Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
Cc: jaswinder@infradead.org
Link: http://lkml.kernel.org/r/1491734806-15413-2-git-send-email-douly.fnst@cn.fujitsu.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 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

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

* [tip:x86/cleanups] x86/irq: Remove a redundant #ifdef directive
  2017-04-10  8:05 ` [PATCH 3/3] x86/irq: Remove a redundant #ifdef directive Dou Liyang
@ 2017-04-14 20:46   ` tip-bot for Dou Liyang
  0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Dou Liyang @ 2017-04-14 20:46 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: mingo, tglx, linux-kernel, douly.fnst, hpa

Commit-ID:  0ccecd95e797f0c383a43278fcca74d47cd8a785
Gitweb:     http://git.kernel.org/tip/0ccecd95e797f0c383a43278fcca74d47cd8a785
Author:     Dou Liyang <douly.fnst@cn.fujitsu.com>
AuthorDate: Mon, 10 Apr 2017 16:05:00 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 14 Apr 2017 22:43:01 +0200

x86/irq: Remove a redundant #ifdef directive

The call to irq_ctx_init() is wrapped in #ifdef CONFIG_X86_32.

The declaration of irq_ctx_init in irq.h provides already a stub inline for
the X86_32=n case.

Remove the redundant #ifdef in the code.

[ tglx: Massaged changelog ]

Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
Link: http://lkml.kernel.org/r/1491811500-30307-1-git-send-email-douly.fnst@cn.fujitsu.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 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
 }

^ permalink raw reply related	[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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.