All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/head_64: move parameter close to call function
@ 2024-03-15  4:14 Wei Yang
  2024-03-15  9:10 ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yang @ 2024-03-15  4:14 UTC (permalink / raw
  To: tglx, mingo, bp
  Cc: x86, linux-kernel, Wei Yang, Joerg Roedel, Michael Roth,
	Brian Gerst, Ard Biesheuvel

startup_64_setup_env is first introduced by 'commit 866b556efa12
("x86/head/64: Install startup GDT")'. Then 'commit 469693d8f622
("x86/head/64: Re-enable stack protection")' insert some code which
leverage %rdi, which is removed by 'commit 8f6be6d870e8 ("x86/smpboot:
Remove initial_gs")'.

This left the parameter of startup_64_setup_env a little far away from
where it is used. Let's move them together for better understanding.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Joerg Roedel <jroedel@suse.de>
CC: Michael Roth <michael.roth@amd.com>
CC: Brian Gerst <brgerst@gmail.com>
CC: Ard Biesheuvel <ardb@kernel.org>
---
 arch/x86/kernel/head_64.S | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 3dbd05f93859..5fb8bb7cdabe 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -69,8 +69,6 @@ SYM_CODE_START_NOALIGN(startup_64)
 	/* Set up the stack for verify_cpu() */
 	leaq	(__end_init_task - TOP_OF_KERNEL_STACK_PADDING - PTREGS_SIZE)(%rip), %rsp
 
-	leaq	_text(%rip), %rdi
-
 	/* Setup GSBASE to allow stack canary access for C code */
 	movl	$MSR_GS_BASE, %ecx
 	leaq	INIT_PER_CPU_VAR(fixed_percpu_data)(%rip), %rdx
@@ -78,6 +76,7 @@ SYM_CODE_START_NOALIGN(startup_64)
 	shrq	$32,  %rdx
 	wrmsr
 
+	leaq	_text(%rip), %rdi
 	call	startup_64_setup_env
 
 	/* Now switch to __KERNEL_CS so IRET works reliably */
-- 
2.34.1


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

* Re: [PATCH] x86/head_64: move parameter close to call function
  2024-03-15  4:14 [PATCH] x86/head_64: move parameter close to call function Wei Yang
@ 2024-03-15  9:10 ` Ard Biesheuvel
  2024-03-16  0:31   ` Wei Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2024-03-15  9:10 UTC (permalink / raw
  To: Wei Yang
  Cc: tglx, mingo, bp, x86, linux-kernel, Joerg Roedel, Michael Roth,
	Brian Gerst

Hello Richard,

On Fri, 15 Mar 2024 at 05:14, Wei Yang <richard.weiyang@gmail.com> wrote:
>
> startup_64_setup_env is first introduced by 'commit 866b556efa12
> ("x86/head/64: Install startup GDT")'. Then 'commit 469693d8f622
> ("x86/head/64: Re-enable stack protection")' insert some code which
> leverage %rdi, which is removed by 'commit 8f6be6d870e8 ("x86/smpboot:
> Remove initial_gs")'.
>
> This left the parameter of startup_64_setup_env a little far away from
> where it is used. Let's move them together for better understanding.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: Joerg Roedel <jroedel@suse.de>
> CC: Michael Roth <michael.roth@amd.com>
> CC: Brian Gerst <brgerst@gmail.com>
> CC: Ard Biesheuvel <ardb@kernel.org>
> ---
>  arch/x86/kernel/head_64.S | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>

The code that you are fixing here no longer exists.

If you are going to send patches in the middle of the merge window,
please make sure that you are at least up to date with Linus's tree at
the time you send the patch.


> diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
> index 3dbd05f93859..5fb8bb7cdabe 100644
> --- a/arch/x86/kernel/head_64.S
> +++ b/arch/x86/kernel/head_64.S
> @@ -69,8 +69,6 @@ SYM_CODE_START_NOALIGN(startup_64)
>         /* Set up the stack for verify_cpu() */
>         leaq    (__end_init_task - TOP_OF_KERNEL_STACK_PADDING - PTREGS_SIZE)(%rip), %rsp
>
> -       leaq    _text(%rip), %rdi
> -
>         /* Setup GSBASE to allow stack canary access for C code */
>         movl    $MSR_GS_BASE, %ecx
>         leaq    INIT_PER_CPU_VAR(fixed_percpu_data)(%rip), %rdx
> @@ -78,6 +76,7 @@ SYM_CODE_START_NOALIGN(startup_64)
>         shrq    $32,  %rdx
>         wrmsr
>
> +       leaq    _text(%rip), %rdi
>         call    startup_64_setup_env
>
>         /* Now switch to __KERNEL_CS so IRET works reliably */
> --
> 2.34.1
>

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

* Re: [PATCH] x86/head_64: move parameter close to call function
  2024-03-15  9:10 ` Ard Biesheuvel
@ 2024-03-16  0:31   ` Wei Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Yang @ 2024-03-16  0:31 UTC (permalink / raw
  To: Ard Biesheuvel
  Cc: Wei Yang, tglx, mingo, bp, x86, linux-kernel, Joerg Roedel,
	Michael Roth, Brian Gerst

On Fri, Mar 15, 2024 at 10:10:06AM +0100, Ard Biesheuvel wrote:
>Hello Richard,
>
>On Fri, 15 Mar 2024 at 05:14, Wei Yang <richard.weiyang@gmail.com> wrote:
>>
>> startup_64_setup_env is first introduced by 'commit 866b556efa12
>> ("x86/head/64: Install startup GDT")'. Then 'commit 469693d8f622
>> ("x86/head/64: Re-enable stack protection")' insert some code which
>> leverage %rdi, which is removed by 'commit 8f6be6d870e8 ("x86/smpboot:
>> Remove initial_gs")'.
>>
>> This left the parameter of startup_64_setup_env a little far away from
>> where it is used. Let's move them together for better understanding.
>>
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> CC: Joerg Roedel <jroedel@suse.de>
>> CC: Michael Roth <michael.roth@amd.com>
>> CC: Brian Gerst <brgerst@gmail.com>
>> CC: Ard Biesheuvel <ardb@kernel.org>
>> ---
>>  arch/x86/kernel/head_64.S | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>
>The code that you are fixing here no longer exists.
>
>If you are going to send patches in the middle of the merge window,
>please make sure that you are at least up to date with Linus's tree at
>the time you send the patch.
>

Thanks, will do it next time.

-- 
Wei Yang
Help you, Help me

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

end of thread, other threads:[~2024-03-16  0:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-15  4:14 [PATCH] x86/head_64: move parameter close to call function Wei Yang
2024-03-15  9:10 ` Ard Biesheuvel
2024-03-16  0:31   ` Wei Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.