From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 3E3B4150994; Thu, 11 Jul 2024 08:12:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720685543; cv=none; b=F4AcqgCRp9SDkTqlvsjWfTquuAT+FXlIlfQYlLfKJBcq97f0A82FPb7/nj8Ar5VsMfHVV8FSY8d/vwQp+tcUK2YPAAwV3BGEQLf12/fC4QkVvhS7yIRcyMM9D7suDKFksjK0IhhnRoSgpuYzmYpsbvkRFKA6+S8o8hxaOrzoIbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720685543; c=relaxed/simple; bh=1nT1IezppDSi24B0NzwviS1DRq7kWiD9jugdZ6hlJdo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=B1Dz4hbOqv7MjpjiHDpKQgU54PcXYrjxnupGu4qJ0552gfMLW0VLKTYBfK4wZTPFhOJV6x+HcEcQfJiWPcU5gFt5CCfuG1m/C8snAUfTakWBqukKFHt2DTChbj3yQDy6P3Np/Q0/n2UUeFqVzsKCkFCAWWBgLBEDh46zvFJvS9E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=ESjpgPYL; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ESjpgPYL" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=QgbGXn9FcDdYcZ5NyHNWtaAcV8SlcNpiqGwWfmhxx6I=; b=ESjpgPYLgh8JR5ParmeJx2srzX QIsjgvC3x/eYTU0bf6aHYbM0kMMHxnZD0wnhfW+ZCkWsc3aMY912EXd4SkaJiAPgECLo5T81SEn/Y pJdhSHNRkBh6OZXsxpj4cqXneinqeB/EmdA6UHZqgMQ+ADDceMHINTaT5me4JjU1Q9UTfkBodQXU1 XiRarY2vhYKVWCXdj+ck5vK9yg+qfcRHAyQw8dMO40h7EHzw6cSNhz/OhKt/SK453366ZLMfEr8G2 zq6hu2l3NsLoluEwhc8+kzsjyWuaCRDKw63A+ArA+Tt//1iLo8y78KNpwV35gZWsIpATWEwZGK3Av 1oxth9Qw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRou9-0000000Ait2-3IvY; Thu, 11 Jul 2024 08:11:53 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 6CB4930050D; Thu, 11 Jul 2024 10:11:53 +0200 (CEST) Date: Thu, 11 Jul 2024 10:11:53 +0200 From: Peter Zijlstra To: Alexander Shishkin Cc: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Ard Biesheuvel , "Paul E. McKenney" , Josh Poimboeuf , Xiongwei Song , Xin Li , "Mike Rapoport (IBM)" , Brijesh Singh , Michael Roth , Tony Luck , "Kirill A. Shutemov" , Alexey Kardashevskiy , Jonathan Corbet , Sohil Mehta , Ingo Molnar , Pawan Gupta , Daniel Sneddon , Kai Huang , Sandipan Das , Breno Leitao , Rick Edgecombe , Yian Chen , Alexei Starovoitov , Hou Tao , Juergen Gross , Vegard Nossum , Kees Cook , Eric Biggers , Jason Gunthorpe , "Masami Hiramatsu (Google)" , Andrew Morton , Luis Chamberlain , Yuntao Wang , Rasmus Villemoes , Christophe Leroy , Tejun Heo , Changbin Du , Huang Shijie , Geert Uytterhoeven , Namhyung Kim , Arnaldo Carvalho de Melo , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org Subject: Re: [PATCH v4 07/16] x86/cpu: Defer CR pinning setup until after EFI initialization Message-ID: <20240711081153.GC4587@noisy.programming.kicks-ass.net> References: <20240710160655.3402786-1-alexander.shishkin@linux.intel.com> <20240710160655.3402786-8-alexander.shishkin@linux.intel.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240710160655.3402786-8-alexander.shishkin@linux.intel.com> On Wed, Jul 10, 2024 at 07:06:43PM +0300, Alexander Shishkin wrote: > In order to map the EFI runtime services, set_virtual_address_map > needs to be called, which resides in the lower half of the address > space. This means that LASS needs to be temporarily disabled around > this call. This can only be done before the CR pinning is set up. > > Move CR pinning setup behind the EFI initialization. > > Signed-off-by: Alexander Shishkin > Suggested-by: Kirill A. Shutemov So the previous patch makes us not boot, and this fixes it up? Perhaps order things differently? > --- > arch/x86/kernel/cpu/common.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > index 8aa621dc7d30..c93c59a27dfa 100644 > --- a/arch/x86/kernel/cpu/common.c > +++ b/arch/x86/kernel/cpu/common.c > @@ -1948,7 +1948,6 @@ static __init void identify_boot_cpu(void) > enable_sep_cpu(); > #endif > cpu_detect_tlb(&boot_cpu_data); > - setup_cr_pinning(); > > tsx_init(); > tdx_init(); > @@ -2367,10 +2366,16 @@ void __init arch_cpu_finalize_init(void) > > /* > * This needs to follow the FPU initializtion, since EFI depends on it. > + * It also needs to precede the CR pinning setup, because we need to be > + * able to temporarily clear the CR4.LASS bit in order to execute the > + * set_virtual_address_map call, which resides in lower addresses and > + * would trip LASS if enabled. > */ > if (efi_enabled(EFI_RUNTIME_SERVICES)) > efi_enter_virtual_mode(); > > + setup_cr_pinning(); > + > /* > * Ensure that access to the per CPU representation has the initial > * boot CPU configuration. > -- > 2.43.0 >