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

Thomas Gleixner
2023-03-01T10:18:35Z

On Tue, Feb 28 2023 at 20:43, David Woodhouse wrote:
> On 28 February 2023 20:17:19 GMT, Thomas Gleixner <tglx@linutronix.de> 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