From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id B2D1F7803CC for ; Wed, 17 Jan 2024 06:22:47 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=cDlnNTaN9GTi79WjG+8tZm93W3JMzCUp4CWS6Jjjr5o=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1705472566; v=1; b=bEjopl8wERzoJKKIAZuuvLZbO038pvHTmxHI5AyP/KXsyOvMuUlPFAUexExb2V6o53VfS7i0 Gt1IsATDONw0MVbRiyh2Tv3JWWjeXyE/kQHbmhRxUHYhAoslgznMiVTyp3YL6D+CUyxm6HQOM/l M1t2Ug2a2vg1n9nzE1EetR7Y= X-Received: by 127.0.0.2 with SMTP id LVc6YY7687511x83aRqP0n9f; Tue, 16 Jan 2024 22:22:46 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.3457.1705472565760372015 for ; Tue, 16 Jan 2024 22:22:45 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10955"; a="464368076" X-IronPort-AV: E=Sophos;i="6.05,200,1701158400"; d="scan'208";a="464368076" X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2024 22:22:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10955"; a="957441720" X-IronPort-AV: E=Sophos;i="6.05,200,1701158400"; d="scan'208";a="957441720" X-Received: from shwdesfp01.ccr.corp.intel.com ([10.239.158.151]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2024 22:22:43 -0800 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Zhiguang Liu , Ray Ni , Laszlo Ersek , Rahul Kumar , Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 2/2] UefiCpuPkg/CpuMpPei: Don't write CR3 in ConvertMemoryPageToNotPresent Date: Wed, 17 Jan 2024 14:22:37 +0800 Message-Id: <20240117062237.644-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: W19FVt7zEUkPXIHJLfov8T1Ux7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=bEjopl8w; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io The purpose of writing CR3 in ConvertMemoryPageToNotPresent is just to flush TLB, because CR3 won't be changed in function ConvertMemoryPageToNotPresent. After ConvertMemoryPageToNotPresent, there is always a flush TLB function. Also, because ConvertMemoryPageToNotPresent in called in a loop, to improve performance, there is no need to flush TLB inside ConvertMemoryPageToNotPresent. Just flushing TLB after the loop is enough. Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Signed-off-by: Zhiguang Liu --- UefiCpuPkg/CpuMpPei/CpuPaging.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/CpuMpPei/CpuPaging.c b/UefiCpuPkg/CpuMpPei/CpuPaging.c index 15c7015fb8..b923d9b502 100644 --- a/UefiCpuPkg/CpuMpPei/CpuPaging.c +++ b/UefiCpuPkg/CpuMpPei/CpuPaging.c @@ -76,7 +76,8 @@ AllocatePageTableMemory ( /** This function modifies the page attributes for the memory region specified - by BaseAddress and Length to not present. + by BaseAddress and Length to not present. This function only change page + table, but not flush TLB. Caller have the responsbility to flush TLB. Caller should make sure BaseAddress and Length is at page boundary. @@ -167,7 +168,6 @@ ConvertMemoryPageToNotPresent ( } ASSERT_EFI_ERROR (Status); - AsmWriteCr3 (PageTable); return Status; } -- 2.31.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113929): https://edk2.groups.io/g/devel/message/113929 Mute This Topic: https://groups.io/mt/103781133/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-