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 5C06AD80A38 for ; Tue, 16 Jan 2024 05:03:57 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=kps7Dh6ia8Pw/X0nbcuGXsCYpEHckXfgt6jwN3gW6us=; 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=1705381436; v=1; b=HOpfkVP59bkX1PXSlQUad3vFCSqzV6riKjyKY4N28MdwnijOksKyhgGY7sN7KJS+7W+CnAzB oR+5hNa1JZfsWRVHAQ2+5qI3RD0IOrU1VdDstuLWCcies1Manh4ujBB3iL02tmCiZvXtVxUmCcK s6Tp3bCo/TeDyLOJlZSBjrkU= X-Received: by 127.0.0.2 with SMTP id HnFiYY7687511xRid87enefd; Mon, 15 Jan 2024 21:03:56 -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.web10.89735.1705341435988552769 for ; Mon, 15 Jan 2024 09:57:16 -0800 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-93-yOQrj4P2MDiGbeRK2dPuXQ-1; Mon, 15 Jan 2024 12:57:11 -0500 X-MC-Unique: yOQrj4P2MDiGbeRK2dPuXQ-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 73A813830088; Mon, 15 Jan 2024 17:57:11 +0000 (UTC) X-Received: from [10.39.193.170] (unknown [10.39.193.170]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF6DC2166B31; Mon, 15 Jan 2024 17:57:09 +0000 (UTC) Message-ID: <8771a5cd-45cb-b1cd-c5c1-787e4e019d18@redhat.com> Date: Mon, 15 Jan 2024 18:57:08 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix issue that IsModified is wrongly set in PageTableMap To: "Liu, Zhiguang" , "devel@edk2.groups.io" , "Ni, Ray" Cc: "Kumar, Rahul R" , Gerd Hoffmann , "Lee, Crystal" References: <20240110053828.1473-1-zhiguang.liu@intel.com> <95163437-75ea-9265-a5e1-35cf01f186eb@redhat.com> From: "Laszlo Ersek" In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 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: KBayfk5lAsZ937pfPsuAeSzkx7686176AA= 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=HOpfkVP5; 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/15/24 03:59, Liu, Zhiguang wrote: > Hi Laszlo, >=20 > I don't think it is a good idea to explicitly mask out the Accessed/Dirty= bit. We can't assume Accessed/Dirty bit are only changed by hardware, beca= use the caller also can change the Accessed/Dirty bit. >=20 > For API PageTableMap, the IsModified is already set as False in the begin= ning of the function. > For internal function PageTableLibMapInLevel, we don't set IsModified as = False in the beginning on purpose, because it keeps the global state of whe= ther the PageTable is changed. >=20 > I plan to change the comment as below to explicitly explain the behavior: >=20 > For internal function PageTableLibMapInLevel, the description of IsModifi= ed should be: > @param[in, out] IsModified change IsModified to True if page tabl= e is modified and input parameter Modify is TRUE. >=20 > For API PageTableMap, the description of IsModified should be:=20 > @param[out] IsModified TRUE means page table is modified by softw= are or hardware. FALSE means page table is not modified by software. > If the output IsModified is FALSE, there is possibility that the page tab= le is changed by hardware. It is ok because page table can be changed by ha= rdware anytime, and we don't need to Flush TLB. >=20 > With these comments changed, I don't need to change C code in my patch. OK, sounds reasonable to me. Thanks. >=20 > BTW, I assume IsModified can be used as an indicator whether the caller n= eed to flush TLB. Do you prefer to change the parameter name to IsFlushTlbN= eeded? I am both fine. I think the new description of the parameter suffices (without renaming the parameter). Laszlo -=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 (#113838): https://edk2.groups.io/g/devel/message/113838 Mute This Topic: https://groups.io/mt/103636407/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-