2023-06-15 20:41:39

by Thomas Gleixner

[permalink] [raw]
Subject: [patch v3 3/7] x86/smp: Remove pointless wmb()s from native_stop_other_cpus()

The wmb()s before sending the IPIs are not synchronizing anything.

If at all then the apic IPI functions have to provide or act as appropriate
barriers.

Remove these cargo cult barriers which have no explanation of what they are
synchronizing.

Signed-off-by: Thomas Gleixner <[email protected]>
---
V3: Remove second instance and reword changelog - PeterZ
---
arch/x86/kernel/smp.c | 6 ------
1 file changed, 6 deletions(-)

--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -184,9 +184,6 @@ static void native_stop_other_cpus(int w
cpumask_clear_cpu(cpu, &cpus_stop_mask);

if (!cpumask_empty(&cpus_stop_mask)) {
- /* sync above data before sending IRQ */
- wmb();
-
apic_send_IPI_allbutself(REBOOT_VECTOR);

/*
@@ -210,9 +207,6 @@ static void native_stop_other_cpus(int w
if (!smp_no_nmi_ipi && !register_stop_handler()) {
u32 dm;

- /* Sync above data before sending IRQ */
- wmb();
-
pr_emerg("Shutting down cpus with NMI\n");

dm = apic->dest_mode_logical ? APIC_DEST_LOGICAL : APIC_DEST_PHYSICAL;



2023-06-20 09:11:59

by Borislav Petkov

[permalink] [raw]
Subject: Re: [patch v3 3/7] x86/smp: Remove pointless wmb()s from native_stop_other_cpus()

On Thu, Jun 15, 2023 at 10:33:54PM +0200, Thomas Gleixner wrote:
> The wmb()s before sending the IPIs are not synchronizing anything.
>
> If at all then the apic IPI functions have to provide or act as appropriate
> barriers.
>
> Remove these cargo cult barriers which have no explanation of what they are
> synchronizing.
>
> Signed-off-by: Thomas Gleixner <[email protected]>
> ---
> V3: Remove second instance and reword changelog - PeterZ
> ---
> arch/x86/kernel/smp.c | 6 ------
> 1 file changed, 6 deletions(-)

Reviewed-by: Borislav Petkov (AMD) <[email protected]>

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Subject: [tip: x86/core] x86/smp: Remove pointless wmb()s from native_stop_other_cpus()

The following commit has been merged into the x86/core branch of tip:

Commit-ID: 2affa6d6db28855e6340b060b809c23477aa546e
Gitweb: https://git.kernel.org/tip/2affa6d6db28855e6340b060b809c23477aa546e
Author: Thomas Gleixner <[email protected]>
AuthorDate: Thu, 15 Jun 2023 22:33:54 +02:00
Committer: Thomas Gleixner <[email protected]>
CommitterDate: Tue, 20 Jun 2023 14:51:46 +02:00

x86/smp: Remove pointless wmb()s from native_stop_other_cpus()

The wmb()s before sending the IPIs are not synchronizing anything.

If at all then the apic IPI functions have to provide or act as appropriate
barriers.

Remove these cargo cult barriers which have no explanation of what they are
synchronizing.

Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Borislav Petkov (AMD) <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]

---
arch/x86/kernel/smp.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 935bc65..d842875 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -184,9 +184,6 @@ static void native_stop_other_cpus(int wait)
cpumask_clear_cpu(cpu, &cpus_stop_mask);

if (!cpumask_empty(&cpus_stop_mask)) {
- /* sync above data before sending IRQ */
- wmb();
-
apic_send_IPI_allbutself(REBOOT_VECTOR);

/*
@@ -208,9 +205,6 @@ static void native_stop_other_cpus(int wait)
* CPUs to stop.
*/
if (!smp_no_nmi_ipi && !register_stop_handler()) {
- /* Sync above data before sending IRQ */
- wmb();
-
pr_emerg("Shutting down cpus with NMI\n");

for_each_cpu(cpu, &cpus_stop_mask)