Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1647168rdb; Wed, 31 Jan 2024 05:14:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEO+0j8VjalSREmo6LdHrWwfs7Y1AzjT4qNJc4eVs6p27D3zBlA29wPwQkkdzYeMrZc7WbR X-Received: by 2002:a05:651c:1988:b0:2cf:1586:bd with SMTP id bx8-20020a05651c198800b002cf158600bdmr1385348ljb.14.1706706881769; Wed, 31 Jan 2024 05:14:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706706881; cv=pass; d=google.com; s=arc-20160816; b=Em7Tm+uixQSHb1KMmkndf8vNFD9dQoJPree82gPdNFOUfBHbE+BHNtF7DxzutKa9Di IL1RlYKagq2ridLGFlUg+RCYXtJd02WhZsUCIGKqZ71gppAqLs6NxW6MHFRmhsqiHjRy iZtuDteMbOTm0ueXsI2mKsIxzTGB+FzOe2kZgeNJXwfKP5GskTpTSdVVEpZjbC3Q9wrh 6grVCfTz5Y8wyCdP+8jNTQ5RG07wtI6RUvKz4CYBh2JraHa25+ZCwXTfSs+bnIhdQsTL QHaec6tQ2ElEOZaqqy+HWFeW5KWO/iw0vec0w5HFExuXDoL0UCRMMhxnxW4GaOxDuHo4 TFGA== 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=1IuXRO+lquX6qdHNulDFo/WZqFjkDwc0WTlK1bbrS0I=; fh=tnJfcgKVKH10TMs1EnWUnFtphMMvreuFOGHKxzHKps8=; b=ReSABTlgw8yUTtIGQgteb+dBXGdR/UayLKIaL9oMyFVcho9uViwHd44q12/HtSG1qs 846sK/79veJNrc0sDSeIwGoafmQ9hNsc8ZVugbxXmkA4ff2SwO1KC8ucYu5TPtUDxW9w PV96ns9Pg6XETrkSlHbZYeKMzEp0nns1eHEZwHQntd8ELv50LjSWyfsgNxOWQBphvvIs i50wBAQnvQRicKbfcHp6c1VIWO5Fyil/0mQ866byyNvUp8Rj5ukqE0enCmDSOylSTE5K pk2YHiU9KFMX+hDEpBWEsa9fwxeWc9hmjLQWn6p+nC1K1rGSEpHtunPoS9U3Qvb9XKJV 5sqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fPRJyqkR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46472-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCXaC2edMm+UXfLW8s1b2oD7aCJmDfixTliu3QgQjECA9rC+Oj1DV8SOP/j6Eqy3MIEkSgDhT7YFKKWz2JqBwxledEvK6nuLzHtu73khfA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j23-20020a508a97000000b0055f2866456dsi2328953edj.3.2024.01.31.05.14.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 05:14:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46472-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=@intel.com header.s=Intel header.b=fPRJyqkR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46472-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 786E81F29009 for ; Wed, 31 Jan 2024 13:14:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EA767BAEC; Wed, 31 Jan 2024 13:14:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fPRJyqkR" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 6F8FA79DB6 for ; Wed, 31 Jan 2024 13:14:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706706865; cv=none; b=B2lw14jwd4AkISJPHiG0pEoCRApuPeHGswsAPIMFglZ8ivjnCaGGctEbgTMGGE3UMyx7q04fhIf5QBmOQfR939WnX4xQM2dYm4RxTyXrdt0JW2EAO15j8QXN8wuZmaF+hW6mefWUIj2P2e90r67RQBf8jSVsFhKvmmvJFICKjGs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706706865; c=relaxed/simple; bh=1LIQJ8Y3luSRKHdrTOYwFouqxcWQUeQ9zxuAnECjIhY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mwd3YXBE/N0frU06tbOWY7CX5FhabM8+B4OUqF6gxLTmCcwMVWpEjW0nUiT0NDsawnQULC15jI5kUna7IgLbDX7jratotd0dKZjeo3rj1wZTsnJz+nZyXGHhbS2YxG7KK2sOzLP4H4IDovub0KC8eYBSXPtkPDkZmgMjo7uvc/w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fPRJyqkR; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706706865; x=1738242865; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=1LIQJ8Y3luSRKHdrTOYwFouqxcWQUeQ9zxuAnECjIhY=; b=fPRJyqkRRM/QJgUFH0SVfif/LkP8qqU/gKzH7BXSkdadlPHdOhts9T7j B63V6rPn/VGyKhX2VJMmzI6pyYt9APKaJoFJqd24vLRt7yizbqhvQR+xG JC/JZBLsGueEleEvyimrzRtx8ilOyhu11AzXRi6Addq6lPSYgfgAi5eSb 6M1ge1u9AAGicBorggo2197Ty8/HFRniiEN4Uu6AQf30DStOFVZN7xl4h I2qhVQ5UnqA/iUdj3bm87PwfzbrHnMlLLNIxcasE0kCsFBYFbz2oq3gkr awECszE14ZNkCS15BdIfs4qAWayZ3UncsKaJzmMgyg5AR8KFT0GIK2FBB g==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="10232777" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="10232777" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 05:14:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="931837860" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="931837860" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 31 Jan 2024 05:14:20 -0800 Received: by black.fi.intel.com (Postfix, from userid 1000) id 8E2206E4; Wed, 31 Jan 2024 15:04:03 +0200 (EET) Date: Wed, 31 Jan 2024 15:04:03 +0200 From: "Kirill A. Shutemov" To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen Cc: x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, Andi Kleen , Kai Huang , Sean Christopherson Subject: Re: [PATCHv4] x86/trampoline: Bypass compat mode in trampoline_start64() if not needed Message-ID: <2qfzbafedurgpsnlbrrfcwed4kij5kbz6txaacp3fy73anfk3g@r75kdg6byw4b> References: <20240126100101.689090-1-kirill.shutemov@linux.intel.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=us-ascii Content-Disposition: inline In-Reply-To: <20240126100101.689090-1-kirill.shutemov@linux.intel.com> On Fri, Jan 26, 2024 at 12:01:01PM +0200, Kirill A. Shutemov wrote: > The trampoline_start64() vector is used when a secondary CPU starts in > 64-bit mode. The current implementation directly enters compatibility > mode. It is necessary to disable paging and re-enable it in the correct > paging mode: either 4- or 5-level, depending on the configuration. > > The X86S[1] ISA does not support compatibility mode in ring 0, and > paging cannot be disabled. > > The trampoline_start64() function is reworked to only enter compatibility > mode if it is necessary to change the paging mode. If the CPU is already > in the desired paging mode, it will proceed in long mode. > > This change will allow a secondary CPU to boot on an X86S machine as > long as the CPU is already in the correct paging mode. > > In the future, there will be a mechanism to switch between paging modes > without disabling paging. > > [1] https://www.intel.com/content/www/us/en/developer/articles/technical/envisioning-future-simplified-architecture.html > > Signed-off-by: Kirill A. Shutemov > Reviewed-by: Andi Kleen > Reviewed-by: Kai Huang > Cc: Sean Christopherson Any feedback? -- Kiryl Shutsemau / Kirill A. Shutemov