Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1282214lqj; Mon, 3 Jun 2024 16:49:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXidheyzehHAikKTC3mRja3dCXyj2CfPR8G1d1bGfOaqEq5z3GhtfoDcGgIyP/Z5EsKnV2u+WOKIssty0KMaghAl9QyNHBDVW/+PmFi4g== X-Google-Smtp-Source: AGHT+IHE882VWbbS+BuSwO6wkKG3uMs6F451r7mYRlVDVCKS56tJPm20Tsf5hp1226EMfgyaloea X-Received: by 2002:a17:90b:1644:b0:2c2:1db5:a2c5 with SMTP id 98e67ed59e1d1-2c21db5a3fcmr5304153a91.14.1717458578923; Mon, 03 Jun 2024 16:49:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717458578; cv=pass; d=google.com; s=arc-20160816; b=aN9aj9tZPPBgZ0CSH9VntQ83eSoPIguo1If27amKjHJrgQ6ugqtHgwaazBOVsu7b4L qdzNxHIwQbW+BRwY7fMXYRhoKfy16xhZ8IFQptSe4okrz016141ETR4P122HjFfR+Ds/ nNyGGVDt4lAiiwGQH8lO7GECmCx9Jw9ZGp16KkIRbnzwfu3bxaKuBETssYRff3/DoKDO HQuBW9wG1MLKkGYwZBWKxVK1H00/7/d+/tboguHuroP+afw5O73QrEYRbP5q9WHTVlOV 1+cHkkfknJeNjULif/BFGpIE4cFC2FLnFIthq7ZM9XOdhNqlfBEhXpoewabONAvyoxdR RM0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature :dkim-filter; bh=sOv2pml39rCUmYtq263pd0Mke6ArsY5AX7diMAElB7o=; fh=1KzsxvQ9xT2ekUUAlY3Qu9u+cP1ICA3yRGr3KDK7qow=; b=0sYQ4RskoICvcEPy6mXImaZSkMBOS8fvFPZSYrHiHzwR3v+jUYuT4YjpQ7LvbK9Wxg zTU7vzySH77aoY0S0nYV6a0MpMCt9pij+e2Pmq6azdjRS9ske7tbvnjIHZtn4c17Exsd cmupJWRo9fzAFFIFxmrAzZc1u9YXI/hwOHaCcgg0S3FD6f4oApn3I5w53aVTTHyMTExd 7HCMdiJNbz1Z8yN91KEFV5S+Gm3O2lRFv0gYE7JetZ/Vb8m4e6tP2YqyZb6eYFePeF1k 1tAORXRzYlXYXR0oTnTv4QR7jyWk7mVHxfvTSLI0iM6iW4/LEProGfxv2VqnTxC1xzuh QlIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zytor.com header.s=2024051501 header.b=F6kPfk5m; arc=pass (i=1 spf=pass spfdomain=zytor.com dkim=pass dkdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-199845-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199845-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c224eb83e7si3433940a91.83.2024.06.03.16.49.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 16:49:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199845-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2024051501 header.b=F6kPfk5m; arc=pass (i=1 spf=pass spfdomain=zytor.com dkim=pass dkdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-199845-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199845-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 97FE3B2297B for ; Mon, 3 Jun 2024 23:47:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB14513CF9A; Mon, 3 Jun 2024 23:47:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="F6kPfk5m" Received: from terminus.zytor.com (terminus.zytor.com [198.137.202.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 950788061F; Mon, 3 Jun 2024 23:47:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717458454; cv=none; b=VokH/e3Z9hqU+3tQqTD9rzsF3LcBamZUMZ7XY+xryxnKR40FOxEZh+9+xRf2SBv2FfV3CaCxU7Ulj1DWakLUjU7YDCGiD4Fv2RmBLdZyD+TjKgbdSwLq4/g/ecgKI7fyDvsAX2JdvRew2pnQCeVNGBKx60tDKoI6xuHl5XDzj/Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717458454; c=relaxed/simple; bh=6bEpQgcxUVGW2oHLoP+LTHY1R7E8TDG7aTpirGPEYG4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=inshmYfGXCBcBmM3d1In0pqcIl85d6R1mOS+ML8aYVM5rvRFzFF26L0jPIgI/IuveUuS72sY9uAPG5HbvvYJEztX5O15OiDR3Eh+5RlGZevtArJ8TX6HXYRMNETrIvnE3prrgYtJQjhfmAbUvqO6ed3LePuGB8uQzWw2jJJYY9s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=F6kPfk5m; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Received: from [IPV6:2601:646:8002:4641:eb14:ad94:2806:1c1a] ([IPv6:2601:646:8002:4641:eb14:ad94:2806:1c1a]) (authenticated bits=0) by mail.zytor.com (8.17.2/8.17.1) with ESMTPSA id 453EhCwn3610090 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 3 Jun 2024 07:43:12 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 453EhCwn3610090 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2024051501; t=1717425794; bh=sOv2pml39rCUmYtq263pd0Mke6ArsY5AX7diMAElB7o=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=F6kPfk5mkSk5h0hAkB5UJ45Gs5fwkaIkIuhFTy8KR1NFWRKyqxjf62B+INqAcQtYS 1K1lC+HHZJuFQJH2hrVwQHOc06tWtoXdTqdjxCtihWqxWYG502lPDyIQ4rkBMhLEhX K5hZO67HdOTy/G6fEJulnDhrID0NSaitVzskOa4cHmaexkEmC7pQImZo+W84PK6HAo bnuJkaQAPQoM+KjEcz2CDmaFd2wNeI3Zuz5LkufhuWzQsKUTxlzUbNf3l2hZnESq6D qE+/LWd5MSggxOHt2HBe0b+7WMwUp6U2gtRzKKnfqNHrh1XhfRO17fyfW7MrCcVKLc kcU1XkhpOZnLg== Message-ID: <5d7dca1e-5889-4440-b3a0-48610f11200e@zytor.com> Date: Mon, 3 Jun 2024 07:43:06 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHv11 05/19] x86/relocate_kernel: Use named labels for less confusion To: Nikolay Borisov , "Kirill A. Shutemov" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: "Rafael J. Wysocki" , Peter Zijlstra , Adrian Hunter , Kuppuswamy Sathyanarayanan , Elena Reshetova , Jun Nakajima , Rick Edgecombe , Tom Lendacky , "Kalra, Ashish" , Sean Christopherson , "Huang, Kai" , Ard Biesheuvel , Baoquan He , "K. Y. Srinivasan" , Haiyang Zhang , kexec@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-acpi@vger.kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org References: <20240528095522.509667-1-kirill.shutemov@linux.intel.com> <20240528095522.509667-6-kirill.shutemov@linux.intel.com> <1e1d1aea-7346-4022-9f5f-402d171adfda@suse.com> Content-Language: en-US From: "H. Peter Anvin" In-Reply-To: <1e1d1aea-7346-4022-9f5f-402d171adfda@suse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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