Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp642566lqb; Fri, 15 Mar 2024 02:10:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVoAVs37+MsQmzYIaw6wsD/kMpBjxKw/o3D9Jx3jXL1CgJVGQqytEMzjVhrMazIV6QVrsHtteOArv26br+R9zujimYeYEmlTNsAHXINkA== X-Google-Smtp-Source: AGHT+IGc1+wo3oSZK1ArvvLm82q3X7MVY6UlO2g1Epl5Y9DoWgdvmi2CLD06s2uzn1DCoSQ7I8qO X-Received: by 2002:a05:6870:8304:b0:220:65ba:ca3a with SMTP id p4-20020a056870830400b0022065baca3amr4640030oae.14.1710493826804; Fri, 15 Mar 2024 02:10:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710493826; cv=pass; d=google.com; s=arc-20160816; b=YBea7qXTlyscrvJsIBtQBI8OBvNNvT4FOWNhKQwIF1YcMgbgCLoWLO3GWu08G4cRzW 929ByNh8QF9/q8kzzNAb2+8dCQxjE3HJyc5ppgpOeZt4BVVZZRV335CWYtOgnjYfS6O4 rHw1ronOhuXpPeeHiktHNAqFPgpnqm/g/8KSCwBsAYvo7XvaPVcRoX/se85/Rzv2CaA4 dtHZsPai3MLrLmyU3ehOHG7PlzuRijWsM3vsfNDRZu1JPtWs20iMN8cnnFRsEo+rcO2d ryt6fM56FpRmxy/Sb75MvxI0mhlqwmpddu+ijuO3oVo38Oi/61mM52OJnqqgDu5qaAZV jjUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=krIMCtiXpAJfOE0Q7sNphXbVy09Y8TFidqlkZX+Ex64=; fh=UmTXfKBrTIC+O80Rc7/XR6SWOSpO71IKVyRfOkZgL2E=; b=e8F0dLQEH3Cex7JMVBAb29waGi9HTD4MuyRMYwthMtODEF0XdwW6dDUalfcdPUgoQJ lZ9xjFRyVQ6HRCkCfzdzR1C8R2JvevF1JQqAfihjkYJIdw0U27yXS4bgIsfGpchZojan +T9C4eqfkANWR3qol0jmKiyy53KVffnnF8DOoex4ax27W45lLV8geZQRcAbDfS0ulpLk pAIDjqk00XNzxD+uboNpsRcs7Nx/i0jWDCjW5jiO+Y75GXCEvqfnb0K05YzaphKJsztg 0jXqNQAquL9ghaGyW6KUoDkIEicGrBcp23Pa5e8pAkXt6ZyoGVRZN1gigfVNPGaOrVq4 E2Hw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BwOdPTHY; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-104188-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104188-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id jw16-20020a056a00929000b006e6a3c94feesi3318216pfb.374.2024.03.15.02.10.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 02:10:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104188-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BwOdPTHY; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-104188-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104188-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 51F1F281AE5 for ; Fri, 15 Mar 2024 09:10:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35AF917BBD; Fri, 15 Mar 2024 09:10:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BwOdPTHY" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4C07817BA3 for ; Fri, 15 Mar 2024 09:10:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710493820; cv=none; b=FSzm3s209GSAwF1CJhu7g4V0R1Clvf95K/MK8VYFuaO87U3gbrvPiYTUhqhymVLy8V0Xyx5LbVspMdCdtce4Lpaia9IRRzajB57MNTpsq1ZTnYFuOoYbCGAEEVV1zlmkg2QvWuBgquvSxKpo7L/9SQjxi0NVt4Fgad+PND8/fio= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710493820; c=relaxed/simple; bh=3M7cvPH1k3x9ftE/ZOvgbDHT7rA//Ug1G4bN+Ml+v+w=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=YrrlIuFHsEi+2YsMURcNbgqFSbtBsDWnIH6s+JrzAhs4Krz1BxmBYDbI++3Qd5CX2Q/TcrUwzD9kzYvRWO3jK0Gi4vH+/uTKAtCAdEfSL2ukzL9aTsjXRQEapNKIC8jze2wvemSNye6GRXbrwXQVfV8CsqTP6x2xXG69iSlvPpw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BwOdPTHY; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF63BC433F1 for ; Fri, 15 Mar 2024 09:10:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710493819; bh=3M7cvPH1k3x9ftE/ZOvgbDHT7rA//Ug1G4bN+Ml+v+w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=BwOdPTHYPOJ33HSPsxBh7Hp6bmO+KIhdCGO6jMFGIDzWinwP4WjgdlDPB0HtMHatc rd3gqo3A+PSlG7YwrpMyMYuuU4lEcYyCwU6lmwE90iLjLjqQdKoVSP3fzXsRlBTwdW D+mfwFzMaGhh/wiW1UBJs2qAqhr6pTcPhtAq06R9FsHDYzKwwEJAzstU7o5mrGrrzT MGeObGBWRjzOk5AXz9iCwBwAvH84Atq8rhFzH3n2UJ3tIMDc36ZkdABU+H0NIqofuD GE++7MmBNT6ANJWJCIpLuhQGE1LLRowaGwrwfqGrX0fTfYia6vP5UjyAg8R5NZC+qM QEIgqvPIb8gMw== Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2d2509c66daso25331361fa.3 for ; Fri, 15 Mar 2024 02:10:19 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCV2McRgWOHIDETkw3/LMEkagrWNezMeVfajbU0+PtlcVh0716ZXfCpzTTvsD6GWTmr9SRqTLSqfOpfpiltOMMn948Mt2WdnSRNV1vzx X-Gm-Message-State: AOJu0YwQn2XIgaAZhLzoSqjKVYV7fgtw7R/TqaB2RRFS42E9VkB+jEoJ SRrhnZwSX6fTic8A+c6hAISsMQvQTWnsJuOAa5I7x/+AI7UDOI270Haw288VzCrQMhYuwbIEOz5 i/jODYBtqb1CNhV+o53zuChcn80M= X-Received: by 2002:a2e:95c8:0:b0:2d4:d50:2358 with SMTP id y8-20020a2e95c8000000b002d40d502358mr2741236ljh.18.1710493818205; Fri, 15 Mar 2024 02:10:18 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240315041420.12802-1-richard.weiyang@gmail.com> In-Reply-To: <20240315041420.12802-1-richard.weiyang@gmail.com> From: Ard Biesheuvel Date: Fri, 15 Mar 2024 10:10:06 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86/head_64: move parameter close to call function To: Wei Yang Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, linux-kernel@vger.kernel.org, Joerg Roedel , Michael Roth , Brian Gerst Content-Type: text/plain; charset="UTF-8" Hello Richard, On Fri, 15 Mar 2024 at 05:14, Wei Yang 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 > CC: Joerg Roedel > CC: Michael Roth > CC: Brian Gerst > CC: Ard Biesheuvel > --- > 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 >