riscv: Cleanup unnecessary define in asm-offset.c
Subsystems (2)
[email protected]
maintainerPATCH 1/1 riscv: Cleanup unnecessary define in asm-offset.c
From: Guo Ren <[email protected]>
- TASK_THREAD_SP is duplicated define
- TASK_STACK is no use at all
- Don't worry about thread_info's offset in task_struct, have a look on comment in include/linux/sched.h:
struct task_struct {
/*
* For reasons of header soup (see current_thread_info()), this
* must be the first element of task_struct.
*/
struct thread_info thread_info;Signed-off-by Guo Ren <[email protected]>
--- arch/riscv/kernel/asm-offsets.c | 3 --- arch/riscv/kernel/entry.S | 5 ----- 2 files changed, 8 deletions(-)
arch/riscv/kernel/asm-offsets.c +0 -3
@@ -27,9 +27,6 @@ void asm_offsets(void)OFFSET (TASK_THREAD_S9 , task_struct, thread.s[9 ]);OFFSET (TASK_THREAD_S10 , task_struct, thread.s[10 ]);OFFSET (TASK_THREAD_S11 , task_struct, thread.s[11 ]); -OFFSET (TASK_THREAD_SP , task_struct, thread.sp); -OFFSET (TASK_STACK , task_struct, stack); -OFFSET (TASK_TI , task_struct, thread_info);OFFSET (TASK_TI_FLAGS , task_struct, thread_info.flags);OFFSET (TASK_TI_PREEMPT_COUNT , task_struct, thread_info.preempt_count);OFFSET (TASK_TI_KERNEL_SP , task_struct, thread_info.kernel_sp);
arch/riscv/kernel/entry.S +0 -5
@@ -389,12 +389,7 @@ ENTRY(__switch_to) lw a4, TASK_TI_CPU(a1) sw a3, TASK_TI_CPU(a1) sw a4, TASK_TI_CPU(a0) -#if TASK_TI != 0 -#error "TASK_TI != 0: tp will contain a 'struct thread_info', not a 'struct task_struct' so get_current() won't work." - addi tp, a1, TASK_TI -#else move tp, a1 -#endif ret ENDPROC(__switch_to)
Signature · 1 line
2.7.4
Quoted 39 lines · On Sun, 12 Jul 2020 06:41:49 PDT (-0700), [email protected] wrote:
From: Guo Ren <[email protected]>
-
TASK_THREAD_SPis duplicated define
-TASK_STACKis no use at all
- Don't worry about thread_info's offset intask_struct, have a look on comment ininclude/linux/sched.h:struct task_struct { /* * For reasons of header soup (see current_thread_info()), this * must be the first element of task_struct. */ struct thread_info thread_info;Signed-off-by Guo Ren <[email protected]>--- arch/riscv/kernel/asm-offsets.c | 3 --- arch/riscv/kernel/entry.S | 5 ----- 2 files changed, 8 deletions(-)arch/riscv/kernel/asm-offsets.c +0
-3@@ -27,9 +27,6 @@ void asm_offsets(void)OFFSET (TASK_THREAD_S9 , task_struct, thread.s[9 ]);OFFSET (TASK_THREAD_S10 , task_struct, thread.s[10 ]);OFFSET (TASK_THREAD_S11 , task_struct, thread.s[11 ]); -OFFSET (TASK_THREAD_SP , task_struct, thread.sp); -OFFSET (TASK_STACK , task_struct, stack); -OFFSET (TASK_TI , task_struct, thread_info);OFFSET (TASK_TI_FLAGS , task_struct, thread_info.flags);OFFSET (TASK_TI_PREEMPT_COUNT , task_struct, thread_info.preempt_count);OFFSET (TASK_TI_KERNEL_SP , task_struct, thread_info.kernel_sp);arch/riscv/kernel/entry.S +0
-0
arch/riscv/kernel/entry.S ENTRY(__switch_to) · line 397
Quoted 9 lines
arch/riscv/kernel/entry.S +0
-5@@ -389,12 +389,7 @@ ENTRY(__switch_to) lw a4, TASK_TI_CPU(a1) sw a3, TASK_TI_CPU(a1) sw a4, TASK_TI_CPU(a0) -#if TASK_TI != 0 -#error "TASK_TI != 0: tp will contain a 'struct thread_info', not a 'struct task_struct' so get_current() won't work." - addi tp, a1, TASK_TI -#else move tp, a1 -#endif
Seems reasonable. That was really there to save anyone who got bit by the conversion to to THREAD_INFO_IN_TASK.
I've added a comment and put this on for-next.
Thanks!
arch/riscv/kernel/entry.S ENTRY(__switch_to) · line 394
Quoted 2 lines
arch/riscv/kernel/entry.S +0
-0ret ENDPROC(__switch_to)
Reviewed-by Palmer Dabbelt <[email protected]>