[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d7dca1e-5889-4440-b3a0-48610f11200e@zytor.com>
Date: Mon, 3 Jun 2024 07:43:06 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Nikolay Borisov <nik.borisov@...e.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>,
Elena Reshetova <elena.reshetova@...el.com>,
Jun Nakajima <jun.nakajima@...el.com>,
Rick Edgecombe <rick.p.edgecombe@...el.com>,
Tom Lendacky <thomas.lendacky@....com>,
"Kalra, Ashish"
<ashish.kalra@....com>,
Sean Christopherson <seanjc@...gle.com>,
"Huang, Kai" <kai.huang@...el.com>, Ard Biesheuvel <ardb@...nel.org>,
Baoquan He <bhe@...hat.com>, "K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>, kexec@...ts.infradead.org,
linux-hyperv@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-coco@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv11 05/19] x86/relocate_kernel: Use named labels for less
confusion
On 5/29/24 03:47, Nikolay Borisov wrote:
>>
>> diff --git a/arch/x86/kernel/relocate_kernel_64.S
>> b/arch/x86/kernel/relocate_kernel_64.S
>> index 56cab1bb25f5..085eef5c3904 100644
>> --- a/arch/x86/kernel/relocate_kernel_64.S
>> +++ b/arch/x86/kernel/relocate_kernel_64.S
>> @@ -148,9 +148,10 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
>> */
>> movl $X86_CR4_PAE, %eax
>> testq $X86_CR4_LA57, %r13
>> - jz 1f
>> + jz .Lno_la57
>> orl $X86_CR4_LA57, %eax
>> -1:
>> +.Lno_la57:
>> +
>> movq %rax, %cr4
>> jmp 1f
>
> That jmp 1f becomes redundant now as it simply jumps 1 line below.
>
Uh... am I the only person to notice that ALL that is needed here is:
andl $(X86_CR4_PAE|X86_CR4_LA57), %r13d
movq %r13, %rax
... since %r13 is dead afterwards, and PAE *will* have been set in %r13
already?
I don't believe that this specific jmp is actually needed -- there are
several more synchronizing jumps later -- but it doesn't hurt.
However, if the effort is for improving the readability, it might be
worthwhile to encapsulate the "jmp 1f; 1:" as a macro, e.g. "SYNC_CODE".
-hpa
Powered by blists - more mailing lists