[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <61ad89f2-543a-46ba-881c-baf81299c5b8@suse.com>
Date: Tue, 15 Jul 2025 21:45:16 +0300
From: Nikolay Borisov <nik.borisov@...e.com>
To: Khalid Ali <khaliidcaliy@...il.com>, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com
Cc: x86@...nel.org, hpa@...or.com, ardb@...nel.org, ubizjak@...il.com,
brgerst@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] x86/boot: Avoid writing to cr4 twice in startup_64()
On 15.07.25 г. 21:16 ч., Khalid Ali wrote:
> From: Khalid Ali <khaliidcaliy@...il.com>
>
> When Initializing cr4 bit PSE and PGE, cr4 is written twice for
> each bit. This is redundancy.
>
> Instead, set both bits first and write CR4 once, avoiding redundant
> writes. This makes consistent with cr0 writes, which is set bits and
> write once.
>
> Signed-off-by: Khalid Ali <khaliidcaliy@...il.com>
> ---
> arch/x86/kernel/head_64.S | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
> index 4390a28f7dad..dfb5390e5c9a 100644
> --- a/arch/x86/kernel/head_64.S
> +++ b/arch/x86/kernel/head_64.S
> @@ -222,12 +222,9 @@ SYM_INNER_LABEL(common_startup_64, SYM_L_LOCAL)
>
> /* Even if ignored in long mode, set PSE uniformly on all logical CPUs. */
> btsl $X86_CR4_PSE_BIT, %ecx
> - movq %rcx, %cr4
> -
> - /*
> - * Set CR4.PGE to re-enable global translations.
> - */
> + /* Set CR4.PGE to re-enable global translations. */
> btsl $X86_CR4_PGE_BIT, %ecx
> +
> movq %rcx, %cr4
>
> #ifdef CONFIG_SMP
Reviewed-by: Nikolay Borisov <nik.borisov@...e.com>
Powered by blists - more mailing lists