All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] powerpc: Move arch_cpu_idle_dead() into smp.c
@ 2020-08-19  1:56 Michael Ellerman
  2020-08-19  1:56 ` [PATCH 2/3] powerpc/smp: Fold cpu_die() into its only caller Michael Ellerman
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Michael Ellerman @ 2020-08-19  1:56 UTC (permalink / raw)
  To: linuxppc-dev

arch_cpu_idle_dead() is in idle.c, which makes sense, but it's inside
a CONFIG_HOTPLUG_CPU block.

It would be more at home in smp.c, inside the existing
CONFIG_HOTPLUG_CPU block. Note that CONFIG_HOTPLUG_CPU depends on
CONFIG_SMP so even though smp.c is not built for SMP=n builds, that's
fine.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/idle.c | 8 --------
 arch/powerpc/kernel/smp.c  | 6 ++++++
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index 422e31d2f5a2..ae0e2632393d 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -41,14 +41,6 @@ static int __init powersave_off(char *arg)
 }
 __setup("powersave=off", powersave_off);
 
-#ifdef CONFIG_HOTPLUG_CPU
-void arch_cpu_idle_dead(void)
-{
-	sched_preempt_enable_no_resched();
-	cpu_die();
-}
-#endif
-
 void arch_cpu_idle(void)
 {
 	ppc64_runlatch_off();
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 8261999c7d52..b05d2db13d08 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1429,6 +1429,12 @@ void __cpu_die(unsigned int cpu)
 		smp_ops->cpu_die(cpu);
 }
 
+void arch_cpu_idle_dead(void)
+{
+	sched_preempt_enable_no_resched();
+	cpu_die();
+}
+
 void cpu_die(void)
 {
 	/*
-- 
2.25.1


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

* [PATCH 2/3] powerpc/smp: Fold cpu_die() into its only caller
  2020-08-19  1:56 [PATCH 1/3] powerpc: Move arch_cpu_idle_dead() into smp.c Michael Ellerman
@ 2020-08-19  1:56 ` Michael Ellerman
  2020-08-19  1:56 ` [PATCH 3/3] powerpc/smp: Move ppc_md.cpu_die() to smp_ops.cpu_offline_self() Michael Ellerman
  2020-09-24 12:27 ` [PATCH 1/3] powerpc: Move arch_cpu_idle_dead() into smp.c Michael Ellerman
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2020-08-19  1:56 UTC (permalink / raw)
  To: linuxppc-dev

Avoid the eternal confusion between cpu_die() and __cpu_die() by
removing the former, folding it into its only caller.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/smp.h | 1 -
 arch/powerpc/kernel/smp.c      | 4 ----
 2 files changed, 5 deletions(-)

diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index 49a25e2400f2..a314d2d2d2be 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -29,7 +29,6 @@ extern int boot_cpuid;
 extern int spinning_secondaries;
 extern u32 *cpu_to_phys_id;
 
-extern void cpu_die(void);
 extern int cpu_to_chip_id(int cpu);
 
 #ifdef CONFIG_SMP
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index b05d2db13d08..c616d975bf95 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1432,11 +1432,7 @@ void __cpu_die(unsigned int cpu)
 void arch_cpu_idle_dead(void)
 {
 	sched_preempt_enable_no_resched();
-	cpu_die();
-}
 
-void cpu_die(void)
-{
 	/*
 	 * Disable on the down path. This will be re-enabled by
 	 * start_secondary() via start_secondary_resume() below
-- 
2.25.1


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

* [PATCH 3/3] powerpc/smp: Move ppc_md.cpu_die() to smp_ops.cpu_offline_self()
  2020-08-19  1:56 [PATCH 1/3] powerpc: Move arch_cpu_idle_dead() into smp.c Michael Ellerman
  2020-08-19  1:56 ` [PATCH 2/3] powerpc/smp: Fold cpu_die() into its only caller Michael Ellerman
@ 2020-08-19  1:56 ` Michael Ellerman
  2020-08-19  6:44   ` Christophe Leroy
  2020-09-24 12:27 ` [PATCH 1/3] powerpc: Move arch_cpu_idle_dead() into smp.c Michael Ellerman
  2 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2020-08-19  1:56 UTC (permalink / raw)
  To: linuxppc-dev

We have smp_ops->cpu_die() and ppc_md.cpu_die(). One of them offlines
the current CPU and one offlines another CPU, can you guess which is
which? Also one is in smp_ops and one is in ppc_md?

So rename ppc_md.cpu_die(), to cpu_offline_self(), because that's what
it does. And move it into smp_ops where it belongs.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/machdep.h           | 1 -
 arch/powerpc/include/asm/smp.h               | 3 +++
 arch/powerpc/kernel/smp.c                    | 4 ++--
 arch/powerpc/kernel/sysfs.c                  | 4 +++-
 arch/powerpc/platforms/85xx/smp.c            | 4 ++--
 arch/powerpc/platforms/powermac/pmac.h       | 2 +-
 arch/powerpc/platforms/powermac/sleep.S      | 6 +++---
 arch/powerpc/platforms/powermac/smp.c        | 8 ++++----
 arch/powerpc/platforms/powernv/smp.c         | 4 ++--
 arch/powerpc/platforms/pseries/hotplug-cpu.c | 6 +++---
 10 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index a90b892f0bfe..cc2ec7101520 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -65,7 +65,6 @@ struct machdep_calls {
 	void __noreturn	(*restart)(char *cmd);
 	void __noreturn (*halt)(void);
 	void		(*panic)(char *str);
-	void		(*cpu_die)(void);
 
 	long		(*time_init)(void); /* Optional, may be NULL */
 
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index a314d2d2d2be..0d00faf8f119 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -49,6 +49,9 @@ struct smp_ops_t {
 	int   (*cpu_disable)(void);
 	void  (*cpu_die)(unsigned int nr);
 	int   (*cpu_bootable)(unsigned int nr);
+#ifdef CONFIG_HOTPLUG_CPU
+	void  (*cpu_offline_self)(void);
+#endif
 };
 
 extern int smp_send_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us);
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index c616d975bf95..faba0fdee500 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1439,8 +1439,8 @@ void arch_cpu_idle_dead(void)
 	 */
 	this_cpu_disable_ftrace();
 
-	if (ppc_md.cpu_die)
-		ppc_md.cpu_die();
+	if (smp_ops->cpu_offline_self)
+		smp_ops->cpu_offline_self();
 
 	/* If we return, we re-enter start_secondary */
 	start_secondary_resume();
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 6bebc9a52444..7c4ccc03c2de 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -1161,6 +1161,7 @@ static int __init topology_init(void)
 	for_each_possible_cpu(cpu) {
 		struct cpu *c = &per_cpu(cpu_devices, cpu);
 
+#ifdef CONFIG_HOTPLUG_CPU
 		/*
 		 * For now, we just see if the system supports making
 		 * the RTAS calls for CPU hotplug.  But, there may be a
@@ -1168,8 +1169,9 @@ static int __init topology_init(void)
 		 * CPU.  For instance, the boot cpu might never be valid
 		 * for hotplugging.
 		 */
-		if (ppc_md.cpu_die)
+		if (smp_ops->cpu_offline_self)
 			c->hotpluggable = 1;
+#endif
 
 		if (cpu_online(cpu) || c->hotpluggable) {
 			register_cpu(c, cpu);
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index fda108bae95f..c6df294054fe 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -112,7 +112,7 @@ static void mpc85xx_take_timebase(void)
 	local_irq_restore(flags);
 }
 
-static void smp_85xx_mach_cpu_die(void)
+static void smp_85xx_cpu_offline_self(void)
 {
 	unsigned int cpu = smp_processor_id();
 
@@ -506,7 +506,7 @@ void __init mpc85xx_smp_init(void)
 	if (qoriq_pm_ops) {
 		smp_85xx_ops.give_timebase = mpc85xx_give_timebase;
 		smp_85xx_ops.take_timebase = mpc85xx_take_timebase;
-		ppc_md.cpu_die = smp_85xx_mach_cpu_die;
+		smp_85xx_ops.cpu_offline_self = smp_85xx_cpu_offline_self;
 		smp_85xx_ops.cpu_die = qoriq_cpu_kill;
 	}
 #endif
diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
index 16a52afdb76e..0d715db434dc 100644
--- a/arch/powerpc/platforms/powermac/pmac.h
+++ b/arch/powerpc/platforms/powermac/pmac.h
@@ -34,7 +34,7 @@ extern void pmac_check_ht_link(void);
 
 extern void pmac_setup_smp(void);
 extern int psurge_secondary_virq;
-extern void low_cpu_die(void) __attribute__((noreturn));
+extern void low_cpu_offline_self(void) __attribute__((noreturn));
 
 extern int pmac_nvram_init(void);
 extern void pmac_pic_init(void);
diff --git a/arch/powerpc/platforms/powermac/sleep.S b/arch/powerpc/platforms/powermac/sleep.S
index f9a680fdd9c4..c51bb63c9417 100644
--- a/arch/powerpc/platforms/powermac/sleep.S
+++ b/arch/powerpc/platforms/powermac/sleep.S
@@ -201,8 +201,8 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS)
 	addi r3,r3,sleep_storage@l
 	stw r5,0(r3)
 
-	.globl	low_cpu_die
-low_cpu_die:
+	.globl	low_cpu_offline_self
+low_cpu_offline_self:
 	/* Flush & disable all caches */
 	bl	flush_disable_caches
 
@@ -244,7 +244,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_SPEC7450)
 	mtmsr	r2
 	isync
 	b	1b
-_ASM_NOKPROBE_SYMBOL(low_cpu_die)
+_ASM_NOKPROBE_SYMBOL(low_cpu_offline_self)
 /*
  * Here is the resume code.
  */
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index eb23264910e1..a6fedcfb714f 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -920,7 +920,7 @@ static int smp_core99_cpu_disable(void)
 
 #ifdef CONFIG_PPC32
 
-static void pmac_cpu_die(void)
+static void pmac_cpu_offline_self(void)
 {
 	int cpu = smp_processor_id();
 
@@ -930,12 +930,12 @@ static void pmac_cpu_die(void)
 	generic_set_cpu_dead(cpu);
 	smp_wmb();
 	mb();
-	low_cpu_die();
+	low_cpu_offline_self();
 }
 
 #else /* CONFIG_PPC32 */
 
-static void pmac_cpu_die(void)
+static void pmac_cpu_offline_self(void)
 {
 	int cpu = smp_processor_id();
 
@@ -1020,7 +1020,7 @@ void __init pmac_setup_smp(void)
 #endif /* CONFIG_PPC_PMAC32_PSURGE */
 
 #ifdef CONFIG_HOTPLUG_CPU
-	ppc_md.cpu_die = pmac_cpu_die;
+	smp_ops->cpu_offline_self = pmac_cpu_offline_self;
 #endif
 }
 
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index bbf361f23ae8..54c4ba45c7ce 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -158,7 +158,7 @@ static void pnv_flush_interrupts(void)
 	}
 }
 
-static void pnv_smp_cpu_kill_self(void)
+static void pnv_cpu_offline_self(void)
 {
 	unsigned long srr1, unexpected_mask, wmask;
 	unsigned int cpu;
@@ -417,6 +417,7 @@ static struct smp_ops_t pnv_smp_ops = {
 #ifdef CONFIG_HOTPLUG_CPU
 	.cpu_disable	= pnv_smp_cpu_disable,
 	.cpu_die	= generic_cpu_die,
+	.cpu_offline_self = pnv_cpu_offline_self,
 #endif /* CONFIG_HOTPLUG_CPU */
 };
 
@@ -430,7 +431,6 @@ void __init pnv_smp_init(void)
 	smp_ops = &pnv_smp_ops;
 
 #ifdef CONFIG_HOTPLUG_CPU
-	ppc_md.cpu_die	= pnv_smp_cpu_kill_self;
 #ifdef CONFIG_KEXEC_CORE
 	crash_wake_offline = 1;
 #endif
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index c6e0d8abf75e..43b020a30072 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -55,7 +55,7 @@ static void rtas_stop_self(void)
 	panic("Alas, I survived.\n");
 }
 
-static void pseries_mach_cpu_die(void)
+static void pseries_cpu_offline_self(void)
 {
 	unsigned int hwcpu = hard_smp_processor_id();
 
@@ -102,7 +102,7 @@ static int pseries_cpu_disable(void)
  * to self-destroy so that the cpu-offline thread can send the CPU_DEAD
  * notifications.
  *
- * OTOH, pseries_mach_cpu_die() is called by the @cpu when it wants to
+ * OTOH, pseries_cpu_offline_self() is called by the @cpu when it wants to
  * self-destruct.
  */
 static void pseries_cpu_die(unsigned int cpu)
@@ -895,7 +895,7 @@ static int __init pseries_cpu_hotplug_init(void)
 		return 0;
 	}
 
-	ppc_md.cpu_die = pseries_mach_cpu_die;
+	smp_ops->cpu_offline_self = pseries_cpu_offline_self;
 	smp_ops->cpu_disable = pseries_cpu_disable;
 	smp_ops->cpu_die = pseries_cpu_die;
 
-- 
2.25.1


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

* Re: [PATCH 3/3] powerpc/smp: Move ppc_md.cpu_die() to smp_ops.cpu_offline_self()
  2020-08-19  1:56 ` [PATCH 3/3] powerpc/smp: Move ppc_md.cpu_die() to smp_ops.cpu_offline_self() Michael Ellerman
@ 2020-08-19  6:44   ` Christophe Leroy
  0 siblings, 0 replies; 5+ messages in thread
From: Christophe Leroy @ 2020-08-19  6:44 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev



Le 19/08/2020 à 03:56, Michael Ellerman a écrit :
> We have smp_ops->cpu_die() and ppc_md.cpu_die(). One of them offlines
> the current CPU and one offlines another CPU, can you guess which is
> which? Also one is in smp_ops and one is in ppc_md?
> 
> So rename ppc_md.cpu_die(), to cpu_offline_self(), because that's what
> it does. And move it into smp_ops where it belongs.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>   arch/powerpc/include/asm/machdep.h           | 1 -
>   arch/powerpc/include/asm/smp.h               | 3 +++
>   arch/powerpc/kernel/smp.c                    | 4 ++--
>   arch/powerpc/kernel/sysfs.c                  | 4 +++-
>   arch/powerpc/platforms/85xx/smp.c            | 4 ++--
>   arch/powerpc/platforms/powermac/pmac.h       | 2 +-
>   arch/powerpc/platforms/powermac/sleep.S      | 6 +++---
>   arch/powerpc/platforms/powermac/smp.c        | 8 ++++----
>   arch/powerpc/platforms/powernv/smp.c         | 4 ++--
>   arch/powerpc/platforms/pseries/hotplug-cpu.c | 6 +++---
>   10 files changed, 23 insertions(+), 19 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
> index a90b892f0bfe..cc2ec7101520 100644
> --- a/arch/powerpc/include/asm/machdep.h
> +++ b/arch/powerpc/include/asm/machdep.h
> @@ -65,7 +65,6 @@ struct machdep_calls {
>   	void __noreturn	(*restart)(char *cmd);
>   	void __noreturn (*halt)(void);
>   	void		(*panic)(char *str);
> -	void		(*cpu_die)(void);
>   
>   	long		(*time_init)(void); /* Optional, may be NULL */
>   
> diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
> index a314d2d2d2be..0d00faf8f119 100644
> --- a/arch/powerpc/include/asm/smp.h
> +++ b/arch/powerpc/include/asm/smp.h
> @@ -49,6 +49,9 @@ struct smp_ops_t {
>   	int   (*cpu_disable)(void);
>   	void  (*cpu_die)(unsigned int nr);
>   	int   (*cpu_bootable)(unsigned int nr);
> +#ifdef CONFIG_HOTPLUG_CPU

Is that a performance issue to have that member all the time in smp_ops_t ?
Otherwise we could avoid the #ifdef here and in arch/powerpc/kernel/sysfs.c

Christophe

> +	void  (*cpu_offline_self)(void);
> +#endif
>   };
>   
>   extern int smp_send_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us);
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index c616d975bf95..faba0fdee500 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -1439,8 +1439,8 @@ void arch_cpu_idle_dead(void)
>   	 */
>   	this_cpu_disable_ftrace();
>   
> -	if (ppc_md.cpu_die)
> -		ppc_md.cpu_die();
> +	if (smp_ops->cpu_offline_self)
> +		smp_ops->cpu_offline_self();
>   
>   	/* If we return, we re-enter start_secondary */
>   	start_secondary_resume();
> diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
> index 6bebc9a52444..7c4ccc03c2de 100644
> --- a/arch/powerpc/kernel/sysfs.c
> +++ b/arch/powerpc/kernel/sysfs.c
> @@ -1161,6 +1161,7 @@ static int __init topology_init(void)
>   	for_each_possible_cpu(cpu) {
>   		struct cpu *c = &per_cpu(cpu_devices, cpu);
>   
> +#ifdef CONFIG_HOTPLUG_CPU
>   		/*
>   		 * For now, we just see if the system supports making
>   		 * the RTAS calls for CPU hotplug.  But, there may be a
> @@ -1168,8 +1169,9 @@ static int __init topology_init(void)
>   		 * CPU.  For instance, the boot cpu might never be valid
>   		 * for hotplugging.
>   		 */
> -		if (ppc_md.cpu_die)
> +		if (smp_ops->cpu_offline_self)
>   			c->hotpluggable = 1;
> +#endif
>   
>   		if (cpu_online(cpu) || c->hotpluggable) {
>   			register_cpu(c, cpu);
> diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
> index fda108bae95f..c6df294054fe 100644
> --- a/arch/powerpc/platforms/85xx/smp.c
> +++ b/arch/powerpc/platforms/85xx/smp.c
> @@ -112,7 +112,7 @@ static void mpc85xx_take_timebase(void)
>   	local_irq_restore(flags);
>   }
>   
> -static void smp_85xx_mach_cpu_die(void)
> +static void smp_85xx_cpu_offline_self(void)
>   {
>   	unsigned int cpu = smp_processor_id();
>   
> @@ -506,7 +506,7 @@ void __init mpc85xx_smp_init(void)
>   	if (qoriq_pm_ops) {
>   		smp_85xx_ops.give_timebase = mpc85xx_give_timebase;
>   		smp_85xx_ops.take_timebase = mpc85xx_take_timebase;
> -		ppc_md.cpu_die = smp_85xx_mach_cpu_die;
> +		smp_85xx_ops.cpu_offline_self = smp_85xx_cpu_offline_self;
>   		smp_85xx_ops.cpu_die = qoriq_cpu_kill;
>   	}
>   #endif
> diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
> index 16a52afdb76e..0d715db434dc 100644
> --- a/arch/powerpc/platforms/powermac/pmac.h
> +++ b/arch/powerpc/platforms/powermac/pmac.h
> @@ -34,7 +34,7 @@ extern void pmac_check_ht_link(void);
>   
>   extern void pmac_setup_smp(void);
>   extern int psurge_secondary_virq;
> -extern void low_cpu_die(void) __attribute__((noreturn));
> +extern void low_cpu_offline_self(void) __attribute__((noreturn));
>   
>   extern int pmac_nvram_init(void);
>   extern void pmac_pic_init(void);
> diff --git a/arch/powerpc/platforms/powermac/sleep.S b/arch/powerpc/platforms/powermac/sleep.S
> index f9a680fdd9c4..c51bb63c9417 100644
> --- a/arch/powerpc/platforms/powermac/sleep.S
> +++ b/arch/powerpc/platforms/powermac/sleep.S
> @@ -201,8 +201,8 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS)
>   	addi r3,r3,sleep_storage@l
>   	stw r5,0(r3)
>   
> -	.globl	low_cpu_die
> -low_cpu_die:
> +	.globl	low_cpu_offline_self
> +low_cpu_offline_self:
>   	/* Flush & disable all caches */
>   	bl	flush_disable_caches
>   
> @@ -244,7 +244,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_SPEC7450)
>   	mtmsr	r2
>   	isync
>   	b	1b
> -_ASM_NOKPROBE_SYMBOL(low_cpu_die)
> +_ASM_NOKPROBE_SYMBOL(low_cpu_offline_self)
>   /*
>    * Here is the resume code.
>    */
> diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
> index eb23264910e1..a6fedcfb714f 100644
> --- a/arch/powerpc/platforms/powermac/smp.c
> +++ b/arch/powerpc/platforms/powermac/smp.c
> @@ -920,7 +920,7 @@ static int smp_core99_cpu_disable(void)
>   
>   #ifdef CONFIG_PPC32
>   
> -static void pmac_cpu_die(void)
> +static void pmac_cpu_offline_self(void)
>   {
>   	int cpu = smp_processor_id();
>   
> @@ -930,12 +930,12 @@ static void pmac_cpu_die(void)
>   	generic_set_cpu_dead(cpu);
>   	smp_wmb();
>   	mb();
> -	low_cpu_die();
> +	low_cpu_offline_self();
>   }
>   
>   #else /* CONFIG_PPC32 */
>   
> -static void pmac_cpu_die(void)
> +static void pmac_cpu_offline_self(void)
>   {
>   	int cpu = smp_processor_id();
>   
> @@ -1020,7 +1020,7 @@ void __init pmac_setup_smp(void)
>   #endif /* CONFIG_PPC_PMAC32_PSURGE */
>   
>   #ifdef CONFIG_HOTPLUG_CPU
> -	ppc_md.cpu_die = pmac_cpu_die;
> +	smp_ops->cpu_offline_self = pmac_cpu_offline_self;
>   #endif
>   }
>   
> diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
> index bbf361f23ae8..54c4ba45c7ce 100644
> --- a/arch/powerpc/platforms/powernv/smp.c
> +++ b/arch/powerpc/platforms/powernv/smp.c
> @@ -158,7 +158,7 @@ static void pnv_flush_interrupts(void)
>   	}
>   }
>   
> -static void pnv_smp_cpu_kill_self(void)
> +static void pnv_cpu_offline_self(void)
>   {
>   	unsigned long srr1, unexpected_mask, wmask;
>   	unsigned int cpu;
> @@ -417,6 +417,7 @@ static struct smp_ops_t pnv_smp_ops = {
>   #ifdef CONFIG_HOTPLUG_CPU
>   	.cpu_disable	= pnv_smp_cpu_disable,
>   	.cpu_die	= generic_cpu_die,
> +	.cpu_offline_self = pnv_cpu_offline_self,
>   #endif /* CONFIG_HOTPLUG_CPU */
>   };
>   
> @@ -430,7 +431,6 @@ void __init pnv_smp_init(void)
>   	smp_ops = &pnv_smp_ops;
>   
>   #ifdef CONFIG_HOTPLUG_CPU
> -	ppc_md.cpu_die	= pnv_smp_cpu_kill_self;
>   #ifdef CONFIG_KEXEC_CORE
>   	crash_wake_offline = 1;
>   #endif
> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> index c6e0d8abf75e..43b020a30072 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> @@ -55,7 +55,7 @@ static void rtas_stop_self(void)
>   	panic("Alas, I survived.\n");
>   }
>   
> -static void pseries_mach_cpu_die(void)
> +static void pseries_cpu_offline_self(void)
>   {
>   	unsigned int hwcpu = hard_smp_processor_id();
>   
> @@ -102,7 +102,7 @@ static int pseries_cpu_disable(void)
>    * to self-destroy so that the cpu-offline thread can send the CPU_DEAD
>    * notifications.
>    *
> - * OTOH, pseries_mach_cpu_die() is called by the @cpu when it wants to
> + * OTOH, pseries_cpu_offline_self() is called by the @cpu when it wants to
>    * self-destruct.
>    */
>   static void pseries_cpu_die(unsigned int cpu)
> @@ -895,7 +895,7 @@ static int __init pseries_cpu_hotplug_init(void)
>   		return 0;
>   	}
>   
> -	ppc_md.cpu_die = pseries_mach_cpu_die;
> +	smp_ops->cpu_offline_self = pseries_cpu_offline_self;
>   	smp_ops->cpu_disable = pseries_cpu_disable;
>   	smp_ops->cpu_die = pseries_cpu_die;
>   
> 

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

* Re: [PATCH 1/3] powerpc: Move arch_cpu_idle_dead() into smp.c
  2020-08-19  1:56 [PATCH 1/3] powerpc: Move arch_cpu_idle_dead() into smp.c Michael Ellerman
  2020-08-19  1:56 ` [PATCH 2/3] powerpc/smp: Fold cpu_die() into its only caller Michael Ellerman
  2020-08-19  1:56 ` [PATCH 3/3] powerpc/smp: Move ppc_md.cpu_die() to smp_ops.cpu_offline_self() Michael Ellerman
@ 2020-09-24 12:27 ` Michael Ellerman
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2020-09-24 12:27 UTC (permalink / raw)
  To: linuxppc-dev, Michael Ellerman

On Wed, 19 Aug 2020 11:56:32 +1000, Michael Ellerman wrote:
> arch_cpu_idle_dead() is in idle.c, which makes sense, but it's inside
> a CONFIG_HOTPLUG_CPU block.
> 
> It would be more at home in smp.c, inside the existing
> CONFIG_HOTPLUG_CPU block. Note that CONFIG_HOTPLUG_CPU depends on
> CONFIG_SMP so even though smp.c is not built for SMP=n builds, that's
> fine.

Applied to powerpc/next.

[1/3] powerpc: Move arch_cpu_idle_dead() into smp.c
      https://git.kernel.org/powerpc/c/1ea21ba231f248034e8c794aa675869ca2b97d42
[2/3] powerpc/smp: Fold cpu_die() into its only caller
      https://git.kernel.org/powerpc/c/bf3c1464db883a953ad7bbed64924480b8b2b244
[3/3] powerpc/smp: Move ppc_md.cpu_die() to smp_ops.cpu_offline_self()
      https://git.kernel.org/powerpc/c/39f87561454dc33efb2a3d8354d066207acac8a6

cheers

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

end of thread, other threads:[~2020-09-24 12:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19  1:56 [PATCH 1/3] powerpc: Move arch_cpu_idle_dead() into smp.c Michael Ellerman
2020-08-19  1:56 ` [PATCH 2/3] powerpc/smp: Fold cpu_die() into its only caller Michael Ellerman
2020-08-19  1:56 ` [PATCH 3/3] powerpc/smp: Move ppc_md.cpu_die() to smp_ops.cpu_offline_self() Michael Ellerman
2020-08-19  6:44   ` Christophe Leroy
2020-09-24 12:27 ` [PATCH 1/3] powerpc: Move arch_cpu_idle_dead() into smp.c Michael Ellerman

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.