Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp395367lqp; Wed, 12 Jun 2024 05:10:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5s9W4HmVRAXiWRUea0R6ndZX0aajNSljasaBb8dxk9xjFO4By5ItVjbuQTqZ6Ti6+WzcqoQG9K1FoCJ+wOAfpt45LYMvjsfWPQFxj3Q== X-Google-Smtp-Source: AGHT+IFDtBgZAnW0/g298hIF1gAV7MrzXYNGHYA80cVpsZj5Sfl4rHoPE+HaVAUOUMntuD86Iejp X-Received: by 2002:a17:907:7248:b0:a6f:d1d:b523 with SMTP id a640c23a62f3a-a6f47d56b15mr129741666b.36.1718194233260; Wed, 12 Jun 2024 05:10:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718194233; cv=pass; d=google.com; s=arc-20160816; b=cWoZiQz3PtyJHAuT/WsKTkZVbYKnsFxjGLc5TjAW7VnvfRPhOezyzkV6RzwrBJN8sI vmhSnR/Pv0AIi+SN9rXYwrTaW9zMV2s8nEBujwDZqUg1M2rcm2RzGNEJZxZ1pPYsSROc S0dmeRo5ATn88HdVzNdDH+PqwYzGE7cRFWKJ2bvhtI6a63fLQ+9MbYx8RmDl9K8Mqrj6 ZJWmI4UebFxYdIsKbehayNRZwstpJXv9SI7LtxckBg2T4PLFgtxO9fofN+Qiy3+VvKOr WGTUTVN9AzR4ca0tC3uh115Uxjfsrq2CN9wjDjrmEHNnckf1Zb5d4WvEggJ/mwcHkaYi 8XGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Wl1E6gKaYfsGolM4dsZnb6DX/G/+das4ShQn/qg2O/U=; fh=aFWAOZIRLyRKiGlfiwIvAqjFlf4tJaNSi3rlZUeRhyU=; b=HQQXHmVXSppoj6cXF4jpmPMR5Gn1iy94vPAufIEH31Pfw64ZnudAr0javiJBqma6Wd vSN0lOnWf1T/zYBfJWHo0LWKxXA3DQhhDvcEDpC/Ap0pllhe6wbZxqEGF1Wx2m+7Yc+/ dUVELc58t1Oubvda8NP71Z6weFaaKLHr78Ept5eTWxibXPkm0oFcMs+zHDSr+b1rNPbb fvS/diXpgfUTZWCZTHZOzAThZ+XEGtojjOCTf0jgIDbzcLLZg54y+tyjWZvu1zNwn5fH T9qd5q29i58pqmQhOuzDDYBByzMCEVTmQXIrwl4EIZe6xwbsin978EMFhai31q3RUneW WJ/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=c+5bzZ15; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-211469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f30a7d1c6si214913166b.379.2024.06.12.05.10.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 05:10:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=c+5bzZ15; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-211469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.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 am.mirrors.kernel.org (Postfix) with ESMTPS id ECF411F23266 for ; Wed, 12 Jun 2024 12:10:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EB2616F821; Wed, 12 Jun 2024 12:10:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="c+5bzZ15" Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23654152DF1 for ; Wed, 12 Jun 2024 12:10:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718194228; cv=none; b=RzAllrRLY6ah1PUBedQ+/+C7OfzZpP8Ds3HrfwaBpGlK5TGPkRV2VQJ6UjunzbMBgGcxoyofh/7q3ENq3dlT9eyXz0aiHyUsf4t8JSFr5C51/qcoeSdZ4pZK3spJlRjZiCzfvTcJhq6vc00oRui+bWzn18evo/R7dLejRoyD08s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718194228; c=relaxed/simple; bh=nE4553TxyitFOBDLcCTTvnCeXYTTa0XYRR7Q8BQg9JI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MfTwYcMCJPUwLfnVoB3I1hWW5Fm11j4dZgN+g2Ygu1YgJQZ7paMeF8M+mN0l/Wr/xgaN2FyTFXKzTrgcLm6x8oXSyZ0k5zCpEKSPCN7tVDE2matjz+RdFmb8X/rWm+Ie6IhFNzoEYDJ7ydY/mgEXrXKleyK81fdmounjl2LJfmU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=c+5bzZ15; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4217c7eb6b4so33881725e9.2 for ; Wed, 12 Jun 2024 05:10:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1718194224; x=1718799024; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Wl1E6gKaYfsGolM4dsZnb6DX/G/+das4ShQn/qg2O/U=; b=c+5bzZ15T9c1mP1Pu+xaPmRsDxIJFIGXOsC+ntY3wUu3H9s66nlEv7hn48vwvKL9PA R0dKMPsy3BeQCoMvhDyEqd5Aa/aV+zHWPE8o0zUCYIOW6BaORGlHrqx72FpwiVsxHPdN 42y0Obi3sydW+FYUakWbrZBbrW3vFy0OR8jgmCM5dfkub9RsOB2/LlumN3Yzfv5hqbrJ SJwwYqyCbceid4pV5Axea4OE6OBYeacClRFjCVGx1cRgRFcRUBgta2zYoobkwlbboBlO anWA9rYn14M0hUA5YnqbsHGUovWEgeQQS6UByuP1gLf+hZ1lJaP4YmxrK8q15PZrj9a/ 3I0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718194224; x=1718799024; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Wl1E6gKaYfsGolM4dsZnb6DX/G/+das4ShQn/qg2O/U=; b=kEDbMrH7wTtXRrjc8StrLBv9LnebZm8czh20EbBsGwER1O9Jwx7SvGEZBch4BtErnI sCHEnSi/GkgS0OEd3tX+rnHAVpgChptuYAsQu55MGwWy3adLMW1kDJa/mV2wsKnKlmtO Pt+51q8WP73xBat/4cQvuM5xlPiccgBjPYQOn0GRrXJKXapsIEX6mJBCs7l8SABqAdO8 TqRrJJkkx+5ipAFGrYJzk113LTegIax1LDiqwi0b5amh7fb4badNraZ6FsL68K4SH5xr tdWJeJTlmOFBxg4c6ceEkFFygDBSaS/eTLD6NogeKqNs7Cd13GbA39SAAAnYq2ajNphO zykw== X-Forwarded-Encrypted: i=1; AJvYcCUuGEMF0OS2noXzrPxGS8JwnAmrQYxCRfUQW8AhyXZun3Us2xoe68UDggdfrF5J51zCBEV6GHMLxN7MHvat6qIFpwjtaHpYN6dIHHsN X-Gm-Message-State: AOJu0YwA+PkbFYWOzmQQ7sOVF2ShEGQtluNG5UQ2ZHodl97R/wxhF6cm QnYDRMc3lO34rG/NvevDRYX3kTW7SWcnxAl8Qowuv1VCbtHoS+WyM+ssUHVlxTI= X-Received: by 2002:a05:600c:3108:b0:421:7f23:8c5c with SMTP id 5b1f17b1804b1-422866c0c13mr16496455e9.28.1718194224388; Wed, 12 Jun 2024 05:10:24 -0700 (PDT) Received: from ?IPV6:2a10:bac0:b000:7579:7285:c2ff:fedd:7e3a? ([2a10:bac0:b000:7579:7285:c2ff:fedd:7e3a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35f0c8f5373sm13444819f8f.6.2024.06.12.05.10.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jun 2024 05:10:24 -0700 (PDT) Message-ID: <6eb5c1b2-64d2-42fd-81c9-97c1ae65713f@suse.com> Date: Wed, 12 Jun 2024 15:10:21 +0300 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: "H. Peter Anvin" , "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> <5d7dca1e-5889-4440-b3a0-48610f11200e@zytor.com> From: Nikolay Borisov Content-Language: en-US In-Reply-To: <5d7dca1e-5889-4440-b3a0-48610f11200e@zytor.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 3.06.24 г. 17:43 ч., H. Peter Anvin wrote: > 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". The preceding move to CR4 is itself a serializing instruction, no? > >     -hpa