Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core)

Linus Torvalds
2016-06-24T17:21:52Z

On Fri, Jun 24, 2016 at 5:25 AM, Brian Gerst <brgerst@gmail.com> wrote:
> *
> * rdi: prev task we switched from
> + * rsi: task we're switching to
> */
> ENTRY(ret_from_fork)
> - LOCK ; btr $TIF_FORK, TI_flags(%r8)
> + LOCK ; btr $TIF_FORK, TI_flags(%rsi) /* rsi: this newly forked task */
>
> call schedule_tail /* rdi: 'prev' task parameter */
>
> I think you forgot GET_THREAD_INFO() here. RSI is the task, not the
> thread_info. FYI, this goes away with my switch_to() rewrite, which
> removes TIF_FORK.

The point of that patch series is to make the thread_info and the
task_struct pointer have the same value on x86 - we hide the
thread_info inside the task_struct itself, and in fact at the
beginning of it.

That allows for the above kinds of simplification - use the task
struct pointer and thread info interchangably in the asm code.

But as mentioned, I must have missed something. There were a number of
places where the code used the task_stack_page() and
task_thread_info() interchangably, which used to work and is no longer
true. There might simply be cases I missed.

Or there might simply be cases I screwed up.

Linus