Skip to contentSkip to conversation

powerpc: preempt: Don't touch the idle task's preempt_count during hotplug

PATCH Applied Valentin Schneider 3 participants 3 messages Jul 7, 2021 – Jul 8, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: preempt: Don't touch the idle task's preempt_count during hotplug

Powerpc currently resets a CPU's idle task preempt_count to 0 before said task starts executing the secondary startup routine (and becomes an idle task proper).

This conflicts with commit

f1a0a376ca0c ("sched/core: Initialize the idle task with preemption disabled")

which initializes all of the idle tasks' preempt_count to PREEMPT_DISABLED during smp_init(). Note that this was superfluous before said commit, as back then the hotplug machinery would invoke init_idle() via idle_thread_get(), which would have already reset the CPU's idle task's preempt_count to PREEMPT_ENABLED.

Get rid of this preempt_count write.

Cc Guenter Roeck <[email protected]>
Fixes f1a0a376ca0c ("sched/core: Initialize the idle task with preemption disabled")
---
 arch/powerpc/platforms/cell/smp.c    | 3 ---
 arch/powerpc/platforms/pseries/smp.c | 5 +----
 2 files changed, 1 insertion(+), 7 deletions(-)
arch/powerpc/platforms/cell/smp.c +0 -3
index c855a0aeb49c..d7ab868aab54 100644
@@ -78,9 +78,6 @@ static inline int smp_startup_cpu(unsigned int lcpu)
 
 	pcpu = get_hard_smp_processor_id(lcpu);
 
-	/* Fixup atomic count: it exited inside IRQ handler. */
-	task_thread_info(paca_ptrs[lcpu]->__current)->preempt_count	= 0;
-
 	/*
 	 * If the RTAS start-cpu token does not exist then presume the
 	 * cpu is already spinning.
arch/powerpc/platforms/pseries/smp.c +1 -4
index 096629f54576..7ebf3382816a 100644
@@ -105,10 +105,7 @@ static inline int smp_startup_cpu(unsigned int lcpu)
 		return 1;
 	}
 
-	/* Fixup atomic count: it exited inside IRQ handler. */
-	task_thread_info(paca_ptrs[lcpu]->__current)->preempt_count	= 0;
-
-	/* 
+	/*
 	 * If the RTAS start-cpu token does not exist then presume the
 	 * cpu is already spinning.
 	 */
Signature · 1 line
2.25.1
Tested-by on v1 1/1
#1 lore raw
Quoted 16 lines · Valentin Schneider

Powerpc currently resets a CPU's idle task preempt_count to 0 before said task starts executing the secondary startup routine (and becomes an idle task proper).

This conflicts with commit

f1a0a376ca0c ("sched/core: Initialize the idle task with preemption disabled")

which initializes all of the idle tasks' preempt_count to PREEMPT_DISABLED during smp_init(). Note that this was superfluous before said commit, as back then the hotplug machinery would invoke init_idle() via idle_thread_get(), which would have already reset the CPU's idle task's preempt_count to PREEMPT_ENABLED.

Get rid of this preempt_count write.

Quoted 8 lines
Cc Guenter Roeck <[email protected]>
Fixes f1a0a376ca0c ("sched/core: Initialize the idle task with preemption disabled")
---
 arch/powerpc/platforms/cell/smp.c    | 3 ---
 arch/powerpc/platforms/pseries/smp.c | 5 +----
 2 files changed, 1 insertion(+), 7 deletions(-)

The messages like "BUG: scheduling while atomic: swapper/1/0/0x00000000" for each secondary CPU are no longer seen after this patch on powerpc.

#2 lore raw
In reply to Valentin Schneider
Quoted 9 lines · Valentin Schneider

Powerpc currently resets a CPU's idle task preempt_count to 0 before said task starts executing the secondary startup routine (and becomes an idle task proper).

This conflicts with commit

f1a0a376ca0c ("sched/core: Initialize the idle task with preemption disabled")

[...]

Applied to powerpc/fixes.

[1/1] powerpc: preempt: Don't touch the idle task's preempt_count during hotplug

      https://git.kernel.org/powerpc/c/2c669ef6979c370f98d4b876e54f19613c81e075

cheers