]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
arm64: smp: remove stack from secondary_data
authorMark Rutland <mark.rutland@arm.com>
Thu, 20 May 2021 11:50:29 +0000 (12:50 +0100)
committerWill Deacon <will@kernel.org>
Wed, 26 May 2021 21:45:46 +0000 (22:45 +0100)
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>
arch/arm64/include/asm/smp.h
arch/arm64/kernel/asm-offsets.c
arch/arm64/kernel/head.S
arch/arm64/kernel/smp.c

index 0e357757c0ccaa997cd061df3847a3f18c319d0c..fc55f5a57a06ef63e3b0321b426a6ffeeaedb549 100644 (file)
@@ -73,12 +73,10 @@ asmlinkage void secondary_start_kernel(void);
 
 /*
  * Initial data for bringing up a secondary CPU.
- * @stack  - sp for the secondary CPU
  * @status - Result passed back from the secondary CPU to
  *           indicate failure.
  */
 struct secondary_data {
-       void *stack;
        struct task_struct *task;
        long status;
 };
index 0cb34ccb6e7330757118d727a230d934ce050d36..4a5e204c33af70757dc35df898d5311851727a33 100644 (file)
@@ -99,7 +99,6 @@ int main(void)
   DEFINE(SOFTIRQ_SHIFT, SOFTIRQ_SHIFT);
   DEFINE(IRQ_CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending));
   BLANK();
-  DEFINE(CPU_BOOT_STACK,       offsetof(struct secondary_data, stack));
   DEFINE(CPU_BOOT_TASK,                offsetof(struct secondary_data, task));
   BLANK();
   DEFINE(FTR_OVR_VAL_OFFSET,   offsetof(struct arm64_ftr_override, val));
index cc2d45d54838f8b57be4bd5f1ef1b2e5c5db57e5..9be95e11367d6f823c72d74110063d1116d96a35 100644 (file)
@@ -645,11 +645,12 @@ SYM_FUNC_START_LOCAL(__secondary_switched)
        isb
 
        adr_l   x0, secondary_data
-       ldr     x1, [x0, #CPU_BOOT_STACK]       // get secondary_data.stack
-       cbz     x1, __secondary_too_slow
-       mov     sp, x1
        ldr     x2, [x0, #CPU_BOOT_TASK]
        cbz     x2, __secondary_too_slow
+
+       ldr     x1, [x2, #TSK_STACK]
+       add     sp, x1, #THREAD_SIZE
+
        msr     sp_el0, x2
        scs_load x2, x3
        setup_final_frame
index 92e83e8bac948f27524b76b21ec93a4448a89047..73625cc39574b1b36e5f40299b5d86a85b0f9cd9 100644 (file)
@@ -120,7 +120,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
         * page tables.
         */
        secondary_data.task = idle;
-       secondary_data.stack = task_stack_page(idle) + THREAD_SIZE;
        update_cpu_boot_status(CPU_MMU_OFF);
 
        /* Now bring the CPU into our world */
@@ -141,7 +140,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
 
        pr_crit("CPU%u: failed to come online\n", cpu);
        secondary_data.task = NULL;
-       secondary_data.stack = NULL;
        status = READ_ONCE(secondary_data.status);
        if (status == CPU_MMU_OFF)
                status = READ_ONCE(__early_cpu_boot_status);