From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Mon, 12 Aug 2019 06:01:57 -0700 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0969A30017A1; Mon, 12 Aug 2019 13:01:57 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-247.ams2.redhat.com [10.36.116.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F3FD67665; Mon, 12 Aug 2019 13:01:56 +0000 (UTC) Subject: Re: [edk2-devel] [Patch 1/4] UefiCpuPkg/RegisterCpuFeaturesLib: Add "detect before set" Micros. To: "Dong, Eric" , "devel@edk2.groups.io" Cc: "Ni, Ray" References: <20190809061159.40248-1-eric.dong@intel.com> <20190809061159.40248-2-eric.dong@intel.com> From: "Laszlo Ersek" Message-ID: Date: Mon, 12 Aug 2019 15:01:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 12 Aug 2019 13:01:57 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 08/12/19 09:46, Dong, Eric wrote: > Hi Laszlo, > >> -----Original Message----- >> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >> Laszlo Ersek >> Sent: Friday, August 9, 2019 11:14 PM >> To: Dong, Eric ; devel@edk2.groups.io >> Cc: Ni, Ray >> Subject: Re: [edk2-devel] [Patch 1/4] UefiCpuPkg/RegisterCpuFeaturesLib: >> Add "detect before set" Micros. >> >> On 08/09/19 08:11, Eric Dong wrote: >>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2040 >>> >>> Add below new micros which test the current value before set the new >>> value. Only set new value when current value not same as new value. >>> CPU_REGISTER_TABLE_TEST_THEN_WRITE32 >>> CPU_REGISTER_TABLE_TEST_THEN_WRITE64 >>> CPU_REGISTER_TABLE_TEST_THEN_WRITE_FIELD >>> >>> Signed-off-by: Eric Dong >>> Cc: Ray Ni >>> Cc: Laszlo Ersek >>> --- >>> UefiCpuPkg/Include/AcpiCpuData.h | 1 + >>> .../Include/Library/RegisterCpuFeaturesLib.h | 77 +++++++++++++++++-- >>> .../RegisterCpuFeaturesLib.c | 14 +++- >>> 3 files changed, 80 insertions(+), 12 deletions(-) >> >> (1) When you format your patch sets, can you please use the following two >> options: >> >> --stat=1000 --stat-graph-width=20 >> >> Otherwise the diffstats are truncated (on the left) and hard to understand. >> > > 1. I use TortoiseGit to create patch, do you know how to enable these setting in TortoiseGit? Sorry, no clue :( > >>> >>> diff --git a/UefiCpuPkg/Include/AcpiCpuData.h >>> b/UefiCpuPkg/Include/AcpiCpuData.h >>> index b963a2f592..c764e209cf 100644 >>> --- a/UefiCpuPkg/Include/AcpiCpuData.h >>> +++ b/UefiCpuPkg/Include/AcpiCpuData.h >>> @@ -81,6 +81,7 @@ typedef struct { >>> UINT16 Reserved; // offset 10 - 11 >>> UINT32 HighIndex; // offset 12-15, only valid for >> MemoryMapped >>> UINT64 Value; // offset 16-23 >>> + UINT8 DetectIt; // 0ffset 24 >>> } CPU_REGISTER_TABLE_ENTRY; >> >> (2) Another quite generic comment -- "DetectIt" does not look helpful. >> Somehow the verb "detect" does not communicate the right action to me. >> >> How about using a more established name, such as: >> >> - CompareAndSwap >> - CompareAndSet >> - TestAndSet >> >> ? >> >> If you agree, then I suggest updating the parameter names, and their >> comments too, below. > > 2. Yes, I change from "TestIt" to "DetectIt" because I think it's better. Seems like this is not a correct change. > I will use "TestThenWrite" as the new name which align our new macro " CPU_REGISTER_TABLE_TEST_THEN_WRITE****". What do you think? Sounds good, thanks. Laszlo