Generic Linux architectural discussions
 help / color / mirror / Atom feed
* [PATCH v1 1/1] x86: Rename __{start,end}_init_task to __{start,end}_init_stack
@ 2024-03-13  6:05 Xin Li (Intel)
  2024-03-13  7:09 ` Jürgen Groß
  0 siblings, 1 reply; 3+ messages in thread
From: Xin Li (Intel) @ 2024-03-13  6:05 UTC (permalink / raw)
  To: linux-kernel, xen-devel, linux-arch
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, jgross, boris.ostrovsky,
	arnd

The stack of a task has been separated from the memory of a task_struct
struture for a long time on x86, as a result __{start,end}_init_task no
longer mark the start and end of the init_task structure, but its stack
only.

Rename __{start,end}_init_task to __{start,end}_init_stack.

Note other architectures are not affected because __{start,end}_init_task
are used on x86 only.

Signed-off-by: Xin Li (Intel) <xin@zytor.com>
---
 arch/x86/include/asm/processor.h  | 4 ++--
 arch/x86/kernel/head_64.S         | 2 +-
 arch/x86/xen/xen-head.S           | 2 +-
 include/asm-generic/vmlinux.lds.h | 8 ++++----
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 811548f131f4..8b3a3f3bb859 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -636,10 +636,10 @@ static __always_inline void prefetchw(const void *x)
 #define KSTK_ESP(task)		(task_pt_regs(task)->sp)
 
 #else
-extern unsigned long __end_init_task[];
+extern unsigned long __end_init_stack[];
 
 #define INIT_THREAD {							\
-	.sp	= (unsigned long)&__end_init_task -			\
+	.sp	= (unsigned long)&__end_init_stack -			\
 		  TOP_OF_KERNEL_STACK_PADDING -				\
 		  sizeof(struct pt_regs),				\
 }
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index d8198fbd70e5..c7babd7ebb0f 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -66,7 +66,7 @@ SYM_CODE_START_NOALIGN(startup_64)
 	mov	%rsi, %r15
 
 	/* Set up the stack for verify_cpu() */
-	leaq	(__end_init_task - TOP_OF_KERNEL_STACK_PADDING - PTREGS_SIZE)(%rip), %rsp
+	leaq	(__end_init_stack - TOP_OF_KERNEL_STACK_PADDING - PTREGS_SIZE)(%rip), %rsp
 
 	/* Setup GSBASE to allow stack canary access for C code */
 	movl	$MSR_GS_BASE, %ecx
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 04101b984f24..43eadf03f46d 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -49,7 +49,7 @@ SYM_CODE_START(startup_xen)
 	ANNOTATE_NOENDBR
 	cld
 
-	leaq	(__end_init_task - TOP_OF_KERNEL_STACK_PADDING - PTREGS_SIZE)(%rip), %rsp
+	leaq	(__end_init_stack - TOP_OF_KERNEL_STACK_PADDING - PTREGS_SIZE)(%rip), %rsp
 
 	/* Set up %gs.
 	 *
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 5dd3a61d673d..a168be99d522 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -399,13 +399,13 @@
 
 #define INIT_TASK_DATA(align)						\
 	. = ALIGN(align);						\
-	__start_init_task = .;						\
+	__start_init_stack = .;						\
 	init_thread_union = .;						\
 	init_stack = .;							\
-	KEEP(*(.data..init_task))					\
+	KEEP(*(.data..init_stack))					\
 	KEEP(*(.data..init_thread_info))				\
-	. = __start_init_task + THREAD_SIZE;				\
-	__end_init_task = .;
+	. = __start_init_stack + THREAD_SIZE;				\
+	__end_init_stack = .;
 
 #define JUMP_TABLE_DATA							\
 	. = ALIGN(8);							\

base-commit: 626856ae97054963e7b8c35335d4418271c8d0c4
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] x86: Rename __{start,end}_init_task to __{start,end}_init_stack
  2024-03-13  6:05 [PATCH v1 1/1] x86: Rename __{start,end}_init_task to __{start,end}_init_stack Xin Li (Intel)
@ 2024-03-13  7:09 ` Jürgen Groß
  2024-03-13 17:45   ` Xin Li
  0 siblings, 1 reply; 3+ messages in thread
From: Jürgen Groß @ 2024-03-13  7:09 UTC (permalink / raw)
  To: Xin Li (Intel), linux-kernel, xen-devel, linux-arch
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, boris.ostrovsky, arnd

On 13.03.24 07:05, Xin Li (Intel) wrote:
> The stack of a task has been separated from the memory of a task_struct
> struture for a long time on x86, as a result __{start,end}_init_task no
> longer mark the start and end of the init_task structure, but its stack
> only.
> 
> Rename __{start,end}_init_task to __{start,end}_init_stack.
> 
> Note other architectures are not affected because __{start,end}_init_task
> are used on x86 only.
> 
> Signed-off-by: Xin Li (Intel) <xin@zytor.com>
> ---
>   arch/x86/include/asm/processor.h  | 4 ++--
>   arch/x86/kernel/head_64.S         | 2 +-
>   arch/x86/xen/xen-head.S           | 2 +-
>   include/asm-generic/vmlinux.lds.h | 8 ++++----
>   4 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> index 811548f131f4..8b3a3f3bb859 100644
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -636,10 +636,10 @@ static __always_inline void prefetchw(const void *x)
>   #define KSTK_ESP(task)		(task_pt_regs(task)->sp)
>   
>   #else
> -extern unsigned long __end_init_task[];
> +extern unsigned long __end_init_stack[];
>   
>   #define INIT_THREAD {							\
> -	.sp	= (unsigned long)&__end_init_task -			\
> +	.sp	= (unsigned long)&__end_init_stack -			\
>   		  TOP_OF_KERNEL_STACK_PADDING -				\
>   		  sizeof(struct pt_regs),				\
>   }
> diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
> index d8198fbd70e5..c7babd7ebb0f 100644
> --- a/arch/x86/kernel/head_64.S
> +++ b/arch/x86/kernel/head_64.S
> @@ -66,7 +66,7 @@ SYM_CODE_START_NOALIGN(startup_64)
>   	mov	%rsi, %r15
>   
>   	/* Set up the stack for verify_cpu() */
> -	leaq	(__end_init_task - TOP_OF_KERNEL_STACK_PADDING - PTREGS_SIZE)(%rip), %rsp
> +	leaq	(__end_init_stack - TOP_OF_KERNEL_STACK_PADDING - PTREGS_SIZE)(%rip), %rsp
>   
>   	/* Setup GSBASE to allow stack canary access for C code */
>   	movl	$MSR_GS_BASE, %ecx
> diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
> index 04101b984f24..43eadf03f46d 100644
> --- a/arch/x86/xen/xen-head.S
> +++ b/arch/x86/xen/xen-head.S
> @@ -49,7 +49,7 @@ SYM_CODE_START(startup_xen)
>   	ANNOTATE_NOENDBR
>   	cld
>   
> -	leaq	(__end_init_task - TOP_OF_KERNEL_STACK_PADDING - PTREGS_SIZE)(%rip), %rsp
> +	leaq	(__end_init_stack - TOP_OF_KERNEL_STACK_PADDING - PTREGS_SIZE)(%rip), %rsp
>   
>   	/* Set up %gs.
>   	 *
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 5dd3a61d673d..a168be99d522 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -399,13 +399,13 @@
>   
>   #define INIT_TASK_DATA(align)						\
>   	. = ALIGN(align);						\
> -	__start_init_task = .;						\
> +	__start_init_stack = .;						\
>   	init_thread_union = .;						\
>   	init_stack = .;							\
> -	KEEP(*(.data..init_task))					\
> +	KEEP(*(.data..init_stack))					\

Is this modification really correct?

>   	KEEP(*(.data..init_thread_info))				\
> -	. = __start_init_task + THREAD_SIZE;				\
> -	__end_init_task = .;
> +	. = __start_init_stack + THREAD_SIZE;				\
> +	__end_init_stack = .;
>   
>   #define JUMP_TABLE_DATA							\
>   	. = ALIGN(8);							\
> 
> base-commit: 626856ae97054963e7b8c35335d4418271c8d0c4


Juergen


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] x86: Rename __{start,end}_init_task to __{start,end}_init_stack
  2024-03-13  7:09 ` Jürgen Groß
@ 2024-03-13 17:45   ` Xin Li
  0 siblings, 0 replies; 3+ messages in thread
From: Xin Li @ 2024-03-13 17:45 UTC (permalink / raw)
  To: Jürgen Groß, linux-kernel, xen-devel, linux-arch
  Cc: tglx, mingo, bp, dave.hansen, x86, hpa, boris.ostrovsky, arnd

On 3/13/2024 12:09 AM, Jürgen Groß wrote:
> On 13.03.24 07:05, Xin Li (Intel) wrote:
>> The stack of a task has been separated from the memory of a task_struct
>> struture for a long time on x86, as a result __{start,end}_init_task no
>> longer mark the start and end of the init_task structure, but its stack
>> only.
>>
>> Rename __{start,end}_init_task to __{start,end}_init_stack.
>>
>> Note other architectures are not affected because __{start,end}_init_task
>> are used on x86 only.
>>

>> diff --git a/include/asm-generic/vmlinux.lds.h 
>> b/include/asm-generic/vmlinux.lds.h
>> index 5dd3a61d673d..a168be99d522 100644
>> --- a/include/asm-generic/vmlinux.lds.h
>> +++ b/include/asm-generic/vmlinux.lds.h
>> @@ -399,13 +399,13 @@
>>   #define INIT_TASK_DATA(align)                        \
>>       . = ALIGN(align);                        \
>> -    __start_init_task = .;                        \
>> +    __start_init_stack = .;                        \
>>       init_thread_union = .;                        \
>>       init_stack = .;                            \
>> -    KEEP(*(.data..init_task))                    \
>> +    KEEP(*(.data..init_stack))                    \
> 
> Is this modification really correct?
> 

Good catch, I should not change it.

Thanks!
     Xin


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-13 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-13  6:05 [PATCH v1 1/1] x86: Rename __{start,end}_init_task to __{start,end}_init_stack Xin Li (Intel)
2024-03-13  7:09 ` Jürgen Groß
2024-03-13 17:45   ` Xin Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox