Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp305885rdh; Wed, 7 Feb 2024 05:31:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHabx4TfRZ+LZpyzFm4Sd3q6mG/mkXKgP0o8Cv/I//vLnx59z+JksVkbGIxHKG9EF+BfPFX X-Received: by 2002:a05:6a00:300b:b0:6e0:527f:fe6e with SMTP id ay11-20020a056a00300b00b006e0527ffe6emr3526358pfb.0.1707312689757; Wed, 07 Feb 2024 05:31:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707312689; cv=pass; d=google.com; s=arc-20160816; b=JJxSr5cSDWlwN4P25C3fljPJn3GWBuyWU3zXZ0hTMZqvKJiGqgN2Y7/qrv38orqGyY iSVZtLulQOARCGVT8xpLLCsP/vhHeTf3TbFR4zA5PLbnpOaJFXCuoRsgE52Ubd2ErC2M Y2dgv0FcvrldOUZ7T3BAd8fD7WEhidzWkJHve2YmPfBUloHlRZPoGR2K/CVbYEcR0215 6+hJA5ujB37OJ1PGVOH7BrK1PUju+DZFeeH1UpFLq6VgO7wA+G2Yjl1udDo6zeCMcIj8 fRypEyRDkbIbYfn+XO93OdU5hhiy1HFs+zAUkl5GxoKDIapVHrt8pTYV+yWyRCnGrzIx yS1Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cq31hkoyQSWq8+AdjDLIdicd23/yb2pyABjFoySQ434=; fh=fZjPakJxj2nyFgdxvww5omQ7rI3EmOrLPRnHMiz2Ocs=; b=Ro1N8MxKMvZ7rFLeYp8uATq8rWaAXN+cgHvzlyUn67ptJKYzOcYp/ghjDHr+do5WOL xxktAP8uwlGq4gpHw/NyY9e2wxJwGAesm9PhqKYN3NXOnFkmVqTJQffyo0BUW29JpA4c NX+dh3zw3VQ8gKUnvR8bZaDLfyMXR26F93q8llBAHn05Frk+WbySvjFdneyQiOFDjISn xGXBO/srnmEnNdsjDOSA/VsPM6h+PYgsu39+G1i8NsodLoOhlMi1lWpelJQqxiMRBPmP EEET993eoaOP648YkKy4xa6OIybn6xqp1P5QcMtgMj9OEQ8lGjb/G5q5OHKBB56I+jXZ 0yMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=cZxdnFNj; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-56550-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56550-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de X-Forwarded-Encrypted: i=2; AJvYcCVcHWH0wnoh338PgJSyDjA+icURwhwoSr6sanGHqYMoFkgA8LNHoX02VXW6ipm5uRy2rHQGbrdPsBQDkr9bwL4VXKc39qSRpVTPPTVbvw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l190-20020a6325c7000000b005d3fad648d9si1478346pgl.296.2024.02.07.05.31.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 05:31:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56550-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=cZxdnFNj; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-56550-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56550-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de 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 94E3A28407D for ; Wed, 7 Feb 2024 13:30:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF98377622; Wed, 7 Feb 2024 13:29:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="cZxdnFNj" Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 0813776057; Wed, 7 Feb 2024 13:29:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707312593; cv=none; b=V9rLdjMh/Umm/2R5P+2ygE9GMQOulO/WNNGzxSO2XZfyB76//6kEm5wD/QBjusswCeS20Ng0s9aVief2gxDczsRcAQXnCLE/AKqywuHxQfapT07lYDTr9xjd9v109UdFLcfiGV1lcCXqcCVfYwKzULM3jaqGv9KefgAicQj+kWE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707312593; c=relaxed/simple; bh=GOVzmtWSf66S4P82oUwpsGJAlkj0KnTZycg0imHhp4c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MTAiST6W68nvuj1Mts8YxRNnYXixQ1yCgbL12kZUrQlCR+koZq7JCnpb6l46QFHuaP3CjGhVFCs2NR+5Wj461SlTsjZax0V9fefReGU7R5UmY+xH10e3tVxRzGpmMlTe6Z2TTpvLxoS++mHClLdfxEs6Y0UtG1AvICiH1/pOYlU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=cZxdnFNj; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 9250040E016D; Wed, 7 Feb 2024 13:29:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 1JezrvZZ9vpp; Wed, 7 Feb 2024 13:29:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1707312586; bh=cq31hkoyQSWq8+AdjDLIdicd23/yb2pyABjFoySQ434=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cZxdnFNj1RRZ8qo48nykAUGkBFTwZDESkMk3QDKq3It+3g304jQrXfl00+SFTSVmi FDQBOGjKsNb6luVHSPtL1GQjPRjZs7J7lxT23EOXKrmTHO/vOERNtcaqPdWjziL79f hukqyXdUH2PYhu5ObSzQutXPKMzr2SE8yTP7s3SrSrF8jXrhLUvvoI2+j0Ud1AmxRH cQN8ZXAUyuVyyVXyX+/8fLCZ+6Gc9zRjtxfoYUQwv2nCpfO2HfIa8/D1rMU5zMTqzl UrVGjjFP8fhBeo4BAcKnGHc0KsbeRGNe1rvMwceDTn5p4khbEPEWRQKgUgNFVvJa8J S1EqAdQSM14B/5FkIEvfzjIINi+cwla7U0qoWdtCaWWcYa8UxG6u83ob3As3YjsANb +dv5hKUKpnXMvT+xyhP2BK3wNms3birB9r//n40t7jrzImgLICU1d/79VNfOa90I+w +f2IJUo565VMRqz8vl6L7CvsW7+9ile5spDqEoYwzcDQsZmk1ASzNRDswsFGe3GMYs bNC0Pl/B18tkGOjuaLnUTCfR+utkE/z79Syjr1JlhD6gAxhH99EGj3Y67Jzj/Pup4h EIlJ7nm5slsbPM7VVR/JCOK4fSi4qvg4H9M8iriA/B1D3/L0NzPQandrNxaJ9eIebo uOaMR7qrZ/p1m0VqXf2sJMGY= Received: from zn.tnic (pd953021b.dip0.t-ipconnect.de [217.83.2.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 05BF140E0192; Wed, 7 Feb 2024 13:29:27 +0000 (UTC) Date: Wed, 7 Feb 2024 14:29:22 +0100 From: Borislav Petkov To: Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , 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 Subject: Re: [PATCH v3 06/19] x86/startup_64: Drop global variables keeping track of LA57 state Message-ID: <20240207132922.GSZcOFspSGaVluJo92@fat_crate.local> References: <20240129180502.4069817-21-ardb+git@google.com> <20240129180502.4069817-27-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240129180502.4069817-27-ardb+git@google.com> On Mon, Jan 29, 2024 at 07:05:09PM +0100, Ard Biesheuvel wrote: > static inline bool pgtable_l5_enabled(void) > { > return __pgtable_l5_enabled; > } > #else > -#define pgtable_l5_enabled() cpu_feature_enabled(X86_FEATURE_LA57) > +#define pgtable_l5_enabled() !!(native_read_cr4() & X86_CR4_LA57) > #endif /* USE_EARLY_PGTABLE_L5 */ Can we drop this ifdeffery and simply have __pgtable_l5_enabled always present and contain the correct value? So that we don't have an expensive CR4 read hidden in pgtable_l5_enabled()? For the sake of simplicity, pgtable_l5_enabled() can be defined outside of CONFIG_X86_5LEVEL and since both vendors support 5level now, might as well start dropping the CONFIG ifdeffery slowly... Other than that - a nice cleanup! Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette