Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2043017rdb; Tue, 20 Feb 2024 15:33:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXz3PI9pXCZou3hyR5u+X9lEipUkznVJfF/s5jnvZPHatnnebrkPaVFyUITiHv/RTO0rQXvdgsQGkmmFUlhcPhyt+1wENxt3Uyiw7gDaw== X-Google-Smtp-Source: AGHT+IH0kW0XtH3dJXaDtPhYNdz6E7Dtbpkgk/kbTuxfBPUIzXO+/8PE5zO+Gx7O6Nr5RqGHebaj X-Received: by 2002:a17:903:8c3:b0:1db:895d:6bfb with SMTP id lk3-20020a17090308c300b001db895d6bfbmr20701790plb.8.1708472011433; Tue, 20 Feb 2024 15:33:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708472011; cv=pass; d=google.com; s=arc-20160816; b=Lzfb4QGeVjMiqimkbrj2ajioUQtnPpY5yn4PnyEJVxFTbT0XIgEgRsxHbRo7zP1hBB 3tiM1I1NaoMWF2K4hf2bhHLmNCj4AAxPpxOfFfpMfoZ9q0r2TAS1q1ybnjXVZGYhHTYg ZcrhFg/zPK0lqMXrfpRyTy/mKZkg79g4SnW8P5+4ifgHTVzo+slAQGraeuMRX+T0lVmg 3+Oq5aIMj6lxJClf13hNNw9cm4RA0qIUUMnRE59Y/T/Cq7+b09bVMDGYi3vHfir+AjYY mt9Xp5gPxTQ8AOTvB9SPusyfMe9+/RPKoe9EFY0jfux0Zifp9aEutypjsL9HzKY9BmiQ v9fQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=WtOpn9r1lrrDe4ql2p1dxzikABjP7legw3ZpPo5rDPw=; fh=oJMXBlcDZdsgHC7zDR3zcD+H+7f+eaykA3R4/AWfsLM=; b=ccjZagcwtCIhkfT36Opqg+lPdAfAz9WtEZlo3opoF+2bmrc1MAbqtKbEi/IAtunIct WWWlBZ/kNX5hr7oG+fVBhFJ+utzfl5553kcHFa+iW0LtlVWSO5O5s7PHsVE4pXPou1Xz qOv/OAdRExxzrNJ1MKbwEETmkvP8gZcZJZkGLnA/lgQpeYJyTxQ84ml7SfSfYbnUYmIK X8rV0NQYOjPntTgfX0evEjvnLlFRTF5owxWIAIGi/KIGBIv1u59oNf6g1PmeTYFEJOXy LmACz0iMio0HyUeVL5atXz+ZkIoLL3psw9QadoOBtpV2L9UBC//JOTYum/o+JtJV/k37 tn4Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jxrhSwxu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-73829-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73829-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 ma3-20020a170903094300b001da0c29382csi5946737plb.401.2024.02.20.15.33.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 15:33:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73829-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=jxrhSwxu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-73829-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73829-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 2B5382837CC for ; Tue, 20 Feb 2024 23:33:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58CC8154C08; Tue, 20 Feb 2024 23:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jxrhSwxu" 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 7CD8814A0B2; Tue, 20 Feb 2024 23:33:24 +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=1708472004; cv=none; b=KvP5lsEE370sU9+08YcJu+oIW8U0g3/65zsX9cQMgOqpUhA47KkxJ+RMHJMq98yBvAaS+wh6Jxs0b5GyK19ataN6u9jBI0r9+O1NRDxDrmQ8w0iXV69Znr9+vAe5Wf+UL+p8Nh9CpuKB2kygLnYeD/1Nsk0sYzRP/s8PeEuAhYk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708472004; c=relaxed/simple; bh=Oh/h2cj0YS4RJY/SZoI+qEFikqUE0enIJADIQGhtwFo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=d9riHinFGdHbqDNn501XOGSgzT3e9dHF9PRtZH/B0S39QvtOMPn2iKJoBY63J+5b/sFhlmt7tHiUvuCEb11Wd0O8V1p4DmKz4Rlsciwz6p8VzxMUnGDBz+Fv+qG3JuJYUZDtfdcf37PBQeK4r0Wv1ydZziUCm9rB/jf1tKrXlxc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jxrhSwxu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AA45C43609; Tue, 20 Feb 2024 23:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708472004; bh=Oh/h2cj0YS4RJY/SZoI+qEFikqUE0enIJADIQGhtwFo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jxrhSwxuVnDXEHxeGI2cKothoQdm2XNc6DspariWSnsqPrHTDXHzP+oO9b6mEh1JP GePHxLj6X8TsqFZV46lkfcbUpQXEwaCUKDL9928VfS02XeJyRLRzLt9AOva30uggrd ViXSfZYX6J+2BtZLWE1xdqUAusxePdeSEmzodfZRoVip4p3vznM96wfOMFkscfqLmp G9t9g5Mx+y2aWSFp+DFezztEDq1zIBkKNjb8egJDlIvXgS2OsF+UOeWgauySxaxE4B XYfSQW5nuP6MtzHxWpnnS4SXeE0Tvgdf1kzm52hrpqC6p6sHGHxykVesI2xMwinlk5 3B/FiaPSKMf1A== Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-512bce554a5so2949571e87.3; Tue, 20 Feb 2024 15:33:24 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUfM61AECOsShP6Mtr5XwsNZhuu8Nj9l02QGy5DAeVXasyMv2OWE3Y6UxPVMk0kdv2JfpBFGfBfxMtsP0HB3auKB6KdP5h5O6Hdzw== X-Gm-Message-State: AOJu0YyQnlPq86dSGP14Lb4LR/tfPTlxr3hkiHJHf76OSw4bWe+kO2Rj B831DSqh+vzcQtrAQioZnQ/X0+CB4ZHERo01foBjeg8o5r63o/5Mh11ZDyjFd9cRMmdRiRw49yE WlUofoFBq/ybAo8CddTsNHStxpFM= X-Received: by 2002:a19:e009:0:b0:512:b340:a624 with SMTP id x9-20020a19e009000000b00512b340a624mr5025522lfg.6.1708472002228; Tue, 20 Feb 2024 15:33:22 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240213124143.1484862-13-ardb+git@google.com> <20240213124143.1484862-17-ardb+git@google.com> <20240220184513.GAZdTzOQN33Nccwkno@fat_crate.local> In-Reply-To: <20240220184513.GAZdTzOQN33Nccwkno@fat_crate.local> From: Ard Biesheuvel Date: Wed, 21 Feb 2024 00:33:08 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 04/11] x86/startup_64: Defer assignment of 5-level paging global variables To: Borislav Petkov Cc: linux-kernel@vger.kernel.org, Kevin Loughlin , Tom Lendacky , Dionna Glaze , Thomas Gleixner , Ingo Molnar , Dave Hansen , Andy Lutomirski , Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Justin Stitt , Kees Cook , Brian Gerst , linux-arch@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 20 Feb 2024 at 19:45, Borislav Petkov wrote: > > On Tue, Feb 13, 2024 at 01:41:48PM +0100, Ard Biesheuvel wrote: > > From: Ard Biesheuvel > > > > Assigning the 5-level paging related global variables from the earliest > > C code using explicit references that use the 1:1 translation of memory > > is unnecessary, as the startup code itself does not rely on them to > > create the initial page tables, and this is all it should be doing. So > > defer these assignments to the primary C entry code that executes via > > the ordinary kernel virtual mapping. > > > > Signed-off-by: Ard Biesheuvel > > --- > > arch/x86/kernel/head64.c | 44 +++++++------------- > > 1 file changed, 14 insertions(+), 30 deletions(-) > > Whoops: > Right, this is the same issue as in #11 - in both cases, the extern declaration of __pgtable_l5_enabled needs to be visible regardless of CONFIG_X86_5LEVEL. I'll fix both cases for v5. > arch/x86/kernel/head64.c: In function =E2=80=98x86_64_start_kernel=E2=80= =99: > arch/x86/kernel/head64.c:442:17: error: =E2=80=98__pgtable_l5_enabled=E2= =80=99 undeclared (first use in this function); did you mean =E2=80=98pgtab= le_l5_enabled=E2=80=99? > 442 | __pgtable_l5_enabled =3D 1; > | ^~~~~~~~~~~~~~~~~~~~ > | pgtable_l5_enabled > arch/x86/kernel/head64.c:442:17: note: each undeclared identifier is repo= rted only once for each function it appears in > make[4]: *** [scripts/Makefile.build:243: arch/x86/kernel/head64.o] Error= 1 > make[3]: *** [scripts/Makefile.build:481: arch/x86/kernel] Error 2 > make[2]: *** [scripts/Makefile.build:481: arch/x86] Error 2 > make[2]: *** Waiting for unfinished jobs.... > make[1]: *** [/mnt/kernel/kernel/2nd/linux/Makefile:1921: .] Error 2 > make: *** [Makefile:240: __sub-make] Error 2 > > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette