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 4F059D811AF for ; Wed, 17 Jan 2024 10:24:13 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=5BMSh59wbs1OS+ArIjCrqm4cnI+vjEpIt2bSE+/FGEw=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1705487052; v=1; b=wg3BEr/Ar2C5KOjdEMh0lgwVvVg8gqgB87nwI4INMjsG/IUWtNu1QPF1yF9bPdrvt9wwUpHP cdOVHAb9Y4m3Tsr36SKTeyBr9Ci+r1D1hjMxhVB48GH5HmTHlYvy6J3C8sB64T5szs+hn1lTNbS HjcDgMqc4/khQGdpBPHmUduE= X-Received: by 127.0.0.2 with SMTP id X831YY7687511xsgHFP4aYId; Wed, 17 Jan 2024 02:24:12 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.6608.1705487051435573982 for ; Wed, 17 Jan 2024 02:24:11 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-171-OcTB1GEXMB6q8Eb4mAhH_g-1; Wed, 17 Jan 2024 05:24:08 -0500 X-MC-Unique: OcTB1GEXMB6q8Eb4mAhH_g-1 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D44F71071CE1; Wed, 17 Jan 2024 10:24:07 +0000 (UTC) X-Received: from [10.39.192.21] (unknown [10.39.192.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 13E162026D6F; Wed, 17 Jan 2024 10:24:06 +0000 (UTC) Message-ID: <952df63f-203a-c967-1c4e-e63c032d6434@redhat.com> Date: Wed, 17 Jan 2024 11:24:06 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v2 2/2] UefiCpuPkg/CpuMpPei: Don't write CR3 in ConvertMemoryPageToNotPresent To: devel@edk2.groups.io, zhiguang.liu@intel.com Cc: Ray Ni , Rahul Kumar , Gerd Hoffmann References: <20240117062237.644-1-zhiguang.liu@intel.com> From: "Laszlo Ersek" In-Reply-To: <20240117062237.644-1-zhiguang.liu@intel.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: IYaOB5w9D29sAvBqytFyUOjBx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="wg3BEr/A"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none) On 1/17/24 07:22, Zhiguang Liu wrote: > 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. >=20 > 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(-) >=20 > diff --git a/UefiCpuPkg/CpuMpPei/CpuPaging.c b/UefiCpuPkg/CpuMpPei/CpuPag= ing.c > index 15c7015fb8..b923d9b502 100644 > --- a/UefiCpuPkg/CpuMpPei/CpuPaging.c > +++ b/UefiCpuPkg/CpuMpPei/CpuPaging.c > @@ -76,7 +76,8 @@ AllocatePageTableMemory ( > =20 > /** > This function modifies the page attributes for the memory region speci= fied > - by BaseAddress and Length to not present. > + by BaseAddress and Length to not present. This function only change pa= ge > + table, but not flush TLB. Caller have the responsbility to flush TLB. > =20 > Caller should make sure BaseAddress and Length is at page boundary. > =20 > @@ -167,7 +168,6 @@ ConvertMemoryPageToNotPresent ( > } > =20 > ASSERT_EFI_ERROR (Status); > - AsmWriteCr3 (PageTable); > return Status; > } > =20 Reviewed-by: Laszlo Ersek -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113946): https://edk2.groups.io/g/devel/message/113946 Mute This Topic: https://groups.io/mt/103781133/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-