Re: [PATCH v12 06/11] x86/smpboot: Remove initial_stack on 64-bit

From: Thomas Gleixner
Date: Wed Mar 01 2023 - 05:18:35 EST


On Tue, Feb 28 2023 at 20:43, David Woodhouse wrote:
> On 28 February 2023 20:17:19 GMT, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>>> + * Make the resuming CPU use the temporary stack at startup
>>> + * by setting current->thread.sp to point to that. The true
>>> + * %rsp will be restored with the rest of the CPU context,
>>> + * by do_suspend_lowlevel().
>>
>>Right, but what restores current->thread.sp? thread.sp is used by
>>unwinders...
>
> Unwinding a thread that is actually *on* the CPU?

No.

> By the time it's taken off, won't ->thread.sp have been written out
> again? I figured it was just a dead variable while the actual %rsp was
> in use?

Yes. It's not used when the thread is on the CPU. And you are right,
it's saved and restored in switch_to(). Can you please add a comment to
that effect?

Thanks,

tglx