Skip to content

Commit 3305e7f

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: smp: remove stack from secondary_data
When we boot a secondary CPU, we pass it a task and a stack to use. As the stack is always the task's stack, which can be derived from the task, let's have the secondary CPU derive this itself and avoid passing redundant information. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Marc Zyngier <maz@kernel.org> Cc: Suzuki Poulose <suzuki.poulose@arm.com> Cc: Will Deacon <will@kernel.org> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20210520115031.18509-5-mark.rutland@arm.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 98c7a16 commit 3305e7f

4 files changed

Lines changed: 4 additions & 8 deletions

File tree

arch/arm64/include/asm/smp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,10 @@ asmlinkage void secondary_start_kernel(void);
7373

7474
/*
7575
* Initial data for bringing up a secondary CPU.
76-
* @stack - sp for the secondary CPU
7776
* @status - Result passed back from the secondary CPU to
7877
* indicate failure.
7978
*/
8079
struct secondary_data {
81-
void *stack;
8280
struct task_struct *task;
8381
long status;
8482
};

arch/arm64/kernel/asm-offsets.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ int main(void)
9999
DEFINE(SOFTIRQ_SHIFT, SOFTIRQ_SHIFT);
100100
DEFINE(IRQ_CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending));
101101
BLANK();
102-
DEFINE(CPU_BOOT_STACK, offsetof(struct secondary_data, stack));
103102
DEFINE(CPU_BOOT_TASK, offsetof(struct secondary_data, task));
104103
BLANK();
105104
DEFINE(FTR_OVR_VAL_OFFSET, offsetof(struct arm64_ftr_override, val));

arch/arm64/kernel/head.S

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,11 +645,12 @@ SYM_FUNC_START_LOCAL(__secondary_switched)
645645
isb
646646

647647
adr_l x0, secondary_data
648-
ldr x1, [x0, #CPU_BOOT_STACK] // get secondary_data.stack
649-
cbz x1, __secondary_too_slow
650-
mov sp, x1
651648
ldr x2, [x0, #CPU_BOOT_TASK]
652649
cbz x2, __secondary_too_slow
650+
651+
ldr x1, [x2, #TSK_STACK]
652+
add sp, x1, #THREAD_SIZE
653+
653654
msr sp_el0, x2
654655
scs_load x2, x3
655656
setup_final_frame

arch/arm64/kernel/smp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
120120
* page tables.
121121
*/
122122
secondary_data.task = idle;
123-
secondary_data.stack = task_stack_page(idle) + THREAD_SIZE;
124123
update_cpu_boot_status(CPU_MMU_OFF);
125124

126125
/* Now bring the CPU into our world */
@@ -141,7 +140,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
141140

142141
pr_crit("CPU%u: failed to come online\n", cpu);
143142
secondary_data.task = NULL;
144-
secondary_data.stack = NULL;
145143
status = READ_ONCE(secondary_data.status);
146144
if (status == CPU_MMU_OFF)
147145
status = READ_ONCE(__early_cpu_boot_status);

0 commit comments

Comments
 (0)