From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 B49D618872D for ; Thu, 23 Jan 2025 17:24:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737653087; cv=none; b=oBOQhYCRbh5q2fSkXW8b6KsiI0k+GbM0A7T4C+7DZLtNPqFIIFPdvq0VXupbLu1yzrGmtIxQwf/oRzfZckqxZGkfGfqsjnVmdXS16GQ4sdsAVPDYkUOUdURXZbrK5PEOcLA52za1NRGv8EXaEs+dZM+tOwM57K5Mi7CGfKwDTtc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737653087; c=relaxed/simple; bh=0lQ63iAvosgngV6ILC8lj+bkXoqljE/VYHDKTkLKAH4=; h=Subject:To:Cc:From:Date:References:In-Reply-To:Message-Id; b=aoCRpK8QawruA7hwUZOqA1Vrya7x+xVQz8PqrTLoqbcGmENnA2dxcWrQxJEpfUBxEdi8KDhceMWZMTive1cnAMmlYvYqkK51wffdksmofeJZAT5SttMZHPXQ1ueUQG+qFG+cILVrVgLRpKqCq0jVCZmBBOTbLLs1I/7IQ3dwGAY= 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=OTvA8uTp; arc=none smtp.client-ip=192.198.163.10 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OTvA8uTp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737653086; x=1769189086; h=subject:to:cc:from:date:references:in-reply-to: message-id; bh=0lQ63iAvosgngV6ILC8lj+bkXoqljE/VYHDKTkLKAH4=; b=OTvA8uTpAwxDCEyDCE9dy8y2n23NUn+JqeVaCnuicX5uWnCAax2Ro91V i5yXPAuux1oKi+YhrtJOxbtqOU97YoiaH2lu+Uv15k48/FaT6ga0Q2YT5 WaBOEmQxU57IeKaFg+Lt7ixvm8eYQ+GQh24f6K454TzRO7gG5bvClmgfg 4dUchEcUKrTesbTsRJI/ODqPobeib9AWRJGTT1EI+WkCCkITvFjuZdNV8 9pMF9va2MH7X2V7BstSLkrbWZ+Xr/BSdrzR5MNcMzagDyZvYbvSIGnDMy F0gKyEz45RafQiwaevBA0qfCn++rjPnd713ZdBshdKw6l4+bR3gbeuIa0 A==; X-CSE-ConnectionGUID: WUj7Jw4bQgqI+eUX7JenPQ== X-CSE-MsgGUID: h32z1q8LRFyus0kA7ZkkLg== X-IronPort-AV: E=McAfee;i="6700,10204,11314"; a="49583882" X-IronPort-AV: E=Sophos;i="6.12,310,1728975600"; d="scan'208";a="49583882" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jan 2025 09:24:37 -0800 X-CSE-ConnectionGUID: WpIV2rXCR4WbycUl0CL+nw== X-CSE-MsgGUID: zRbPM6SiSQeawCEdELgBUQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,229,1732608000"; d="scan'208";a="107649996" Received: from davehans-spike.ostc.intel.com (HELO localhost.localdomain) ([10.165.164.11]) by fmviesa008.fm.intel.com with ESMTP; 23 Jan 2025 09:24:37 -0800 Subject: [RFC][PATCH 5/8] x86/mm: Fix up comments around PMD preallocation To: linux-kernel@vger.kernel.org Cc: x86@kernel.org,tglx@linutronix.de,bp@alien8.de,joro@8bytes.org,luto@kernel.org,peterz@infradead.org,kirill.shutemov@linux.intel.com,rick.p.edgecombe@intel.com,jgross@suse.com,Dave Hansen From: Dave Hansen Date: Thu, 23 Jan 2025 09:24:36 -0800 References: <20250123172428.D6D8C8D9@davehans-spike.ostc.intel.com> In-Reply-To: <20250123172428.D6D8C8D9@davehans-spike.ostc.intel.com> Message-Id: <20250123172436.A367153A@davehans-spike.ostc.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Dave Hansen The "paravirt environment" is no longer in the tree. Axe that part of the comment. Also add a blurb to remind readers that "USER_PMDS" refer to the PTI user *copy* of the page tables, not the user *portion*. Signed-off-by: Dave Hansen --- b/arch/x86/mm/pgtable.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff -puN arch/x86/mm/pgtable.c~simplify-PREALLOCATED_PMDS-2 arch/x86/mm/pgtable.c --- a/arch/x86/mm/pgtable.c~simplify-PREALLOCATED_PMDS-2 2025-01-23 09:20:52.098399043 -0800 +++ b/arch/x86/mm/pgtable.c 2025-01-23 09:20:52.102399187 -0800 @@ -160,16 +160,17 @@ static void pgd_dtor(pgd_t *pgd) * processor notices the update. Since this is expensive, and * all 4 top-level entries are used almost immediately in a * new process's life, we just pre-populate them here. - * - * Also, if we're in a paravirt environment where the kernel pmd is - * not shared between pagetables (!SHARED_KERNEL_PMDS), we allocate - * and initialize the kernel pmds here. */ #define PREALLOCATED_PMDS (static_cpu_has(X86_FEATURE_PTI) ? \ PTRS_PER_PGD : KERNEL_PGD_BOUNDARY) #define MAX_PREALLOCATED_PMDS PTRS_PER_PGD /* + * "USER_PMDS" are the PMDs for the user copy of the page tables when + * PTI is enabled. They do not exist when PTI is disabled. Note that + * this is distinct from the user _portion_ of the kernel page tables + * which always exists. + * * We allocate separate PMDs for the kernel part of the user page-table * when PTI is enabled. We need them to map the per-process LDT into the * user-space page-table. _