Message ID | 1550827970-9355-1-git-send-email-julien.thierry@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: Rename get_thread_info() | expand |
On Fri, Feb 22, 2019 at 09:32:50AM +0000, Julien Thierry wrote: > The assembly macro get_thread_info() actually returns a task_struct and is > analogous to the current/get_current macro/function. > > While it could be argued that thread_info sits at the start of > task_struct and the intention could have been to return a thread_info, > instances of loads from/stores to the address obtained from > get_thread_info() use offsets that are generated with > offsetof(struct task_struct, [...]). > > Rename get_thread_info() to state it returns a task_struct. > > Signed-off-by: Julien Thierry <julien.thierry@arm.com> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: Will Deacon <will.deacon@arm.com> I should have done this along with the TI_* -> TSK_TI_* renaming. FWIW: Acked-by: Mark Rutland <mark.rutland@arm.com> Thanks, Mark. > --- > arch/arm64/include/asm/asm-uaccess.h | 2 +- > arch/arm64/include/asm/assembler.h | 6 +++--- > arch/arm64/kernel/entry.S | 4 ++-- > 3 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/include/asm/asm-uaccess.h b/arch/arm64/include/asm/asm-uaccess.h > index 4128bec..f74909b 100644 > --- a/arch/arm64/include/asm/asm-uaccess.h > +++ b/arch/arm64/include/asm/asm-uaccess.h > @@ -24,7 +24,7 @@ > .endm > > .macro __uaccess_ttbr0_enable, tmp1, tmp2 > - get_thread_info \tmp1 > + get_current_task \tmp1 > ldr \tmp1, [\tmp1, #TSK_TI_TTBR0] // load saved TTBR0_EL1 > mrs \tmp2, ttbr1_el1 > extr \tmp2, \tmp2, \tmp1, #48 > diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h > index 7acf243..9c5c876 100644 > --- a/arch/arm64/include/asm/assembler.h > +++ b/arch/arm64/include/asm/assembler.h > @@ -528,9 +528,9 @@ > .endm > > /* > - * Return the current thread_info. > + * Return the current task_struct. > */ > - .macro get_thread_info, rd > + .macro get_current_task, rd > mrs \rd, sp_el0 > .endm > > @@ -713,7 +713,7 @@ > > .macro if_will_cond_yield_neon > #ifdef CONFIG_PREEMPT > - get_thread_info x0 > + get_current_task x0 > ldr x0, [x0, #TSK_TI_PREEMPT] > sub x0, x0, #PREEMPT_DISABLE_OFFSET > cbz x0, .Lyield_\@ > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > index 6bf7e12..c50a7a7 100644 > --- a/arch/arm64/kernel/entry.S > +++ b/arch/arm64/kernel/entry.S > @@ -185,7 +185,7 @@ alternative_cb_end > > .else > add x21, sp, #S_FRAME_SIZE > - get_thread_info tsk > + get_current_task tsk > /* Save the task's original addr_limit and set USER_DS */ > ldr x20, [tsk, #TSK_TI_ADDR_LIMIT] > str x20, [sp, #S_ORIG_ADDR_LIMIT] > @@ -1104,7 +1104,7 @@ ENTRY(ret_from_fork) > cbz x19, 1f // not a kernel thread > mov x0, x20 > blr x19 > -1: get_thread_info tsk > +1: get_current_task tsk > b ret_to_user > ENDPROC(ret_from_fork) > NOKPROBE(ret_from_fork) > -- > 1.9.1
On Fri, Feb 22, 2019 at 09:32:50AM +0000, Julien Thierry wrote: > The assembly macro get_thread_info() actually returns a task_struct and is > analogous to the current/get_current macro/function. > > While it could be argued that thread_info sits at the start of > task_struct and the intention could have been to return a thread_info, > instances of loads from/stores to the address obtained from > get_thread_info() use offsets that are generated with > offsetof(struct task_struct, [...]). > > Rename get_thread_info() to state it returns a task_struct. > > Signed-off-by: Julien Thierry <julien.thierry@arm.com> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: Will Deacon <will.deacon@arm.com> Queued for 5.1. Thanks.
diff --git a/arch/arm64/include/asm/asm-uaccess.h b/arch/arm64/include/asm/asm-uaccess.h index 4128bec..f74909b 100644 --- a/arch/arm64/include/asm/asm-uaccess.h +++ b/arch/arm64/include/asm/asm-uaccess.h @@ -24,7 +24,7 @@ .endm .macro __uaccess_ttbr0_enable, tmp1, tmp2 - get_thread_info \tmp1 + get_current_task \tmp1 ldr \tmp1, [\tmp1, #TSK_TI_TTBR0] // load saved TTBR0_EL1 mrs \tmp2, ttbr1_el1 extr \tmp2, \tmp2, \tmp1, #48 diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 7acf243..9c5c876 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -528,9 +528,9 @@ .endm /* - * Return the current thread_info. + * Return the current task_struct. */ - .macro get_thread_info, rd + .macro get_current_task, rd mrs \rd, sp_el0 .endm @@ -713,7 +713,7 @@ .macro if_will_cond_yield_neon #ifdef CONFIG_PREEMPT - get_thread_info x0 + get_current_task x0 ldr x0, [x0, #TSK_TI_PREEMPT] sub x0, x0, #PREEMPT_DISABLE_OFFSET cbz x0, .Lyield_\@ diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 6bf7e12..c50a7a7 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -185,7 +185,7 @@ alternative_cb_end .else add x21, sp, #S_FRAME_SIZE - get_thread_info tsk + get_current_task tsk /* Save the task's original addr_limit and set USER_DS */ ldr x20, [tsk, #TSK_TI_ADDR_LIMIT] str x20, [sp, #S_ORIG_ADDR_LIMIT] @@ -1104,7 +1104,7 @@ ENTRY(ret_from_fork) cbz x19, 1f // not a kernel thread mov x0, x20 blr x19 -1: get_thread_info tsk +1: get_current_task tsk b ret_to_user ENDPROC(ret_from_fork) NOKPROBE(ret_from_fork)
The assembly macro get_thread_info() actually returns a task_struct and is analogous to the current/get_current macro/function. While it could be argued that thread_info sits at the start of task_struct and the intention could have been to return a thread_info, instances of loads from/stores to the address obtained from get_thread_info() use offsets that are generated with offsetof(struct task_struct, [...]). Rename get_thread_info() to state it returns a task_struct. Signed-off-by: Julien Thierry <julien.thierry@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> --- arch/arm64/include/asm/asm-uaccess.h | 2 +- arch/arm64/include/asm/assembler.h | 6 +++--- arch/arm64/kernel/entry.S | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) -- 1.9.1