From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from rn-mailsvcp-ppex-lapp35.apple.com (rn-mailsvcp-ppex-lapp35.apple.com [17.179.253.44]) by mx.groups.io with SMTP id smtpd.web11.5700.1631758401589548164 for ; Wed, 15 Sep 2021 19:13:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@apple.com header.s=20180706 header.b=MSBlrLSU; spf=pass (domain: apple.com, ip: 17.179.253.44, mailfrom: afish@apple.com) Received: from pps.filterd (rn-mailsvcp-ppex-lapp35.rno.apple.com [127.0.0.1]) by rn-mailsvcp-ppex-lapp35.rno.apple.com (8.16.1.2/8.16.1.2) with SMTP id 18G2CJOb011024; Wed, 15 Sep 2021 19:13:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=from : message-id : content-type : mime-version : subject : date : in-reply-to : cc : to : references; s=20180706; bh=ttt+20uUtlfNTn9ddKISKiohTr1K9uk1WoJdi9V5/lg=; b=MSBlrLSUM0srdQEQrpeR5/mBw0EVF4xO/HPvyarfbkss0yB6NIpBktjG7FptFYoES+xj +7MGAyIIQue739HLVP1a4FsG33oUMa6HL49Tkkivy0ksnudf+NSME6awEzNueLHqoizN VG0FxvXC8XfoQCSHr0Y0kIr4R+TASggpkmKLMT035LMXI1CKsI4zOCSOO2eEabNZj433 bIUwWtoKpYcKAfGCH3RZ+4YgBz5NoVdnIsFqfwpGcUjCHFgmInVPka8cUpOWdJFmirry WV4ePWSPQqQd//dJ8KX2H+LSedmu/yXrtsH+Yg4h/7MjrVK1XK4tTiu2j9LuynMA1Uw3 qw== Received: from rn-mailsvcp-mta-lapp02.rno.apple.com (rn-mailsvcp-mta-lapp02.rno.apple.com [10.225.203.150]) by rn-mailsvcp-ppex-lapp35.rno.apple.com with ESMTP id 3b0r07qsa8-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Wed, 15 Sep 2021 19:13:17 -0700 Received: from rn-mailsvcp-mmp-lapp04.rno.apple.com (rn-mailsvcp-mmp-lapp04.rno.apple.com [17.179.253.17]) by rn-mailsvcp-mta-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.9.20210415 64bit (built Apr 15 2021)) with ESMTPS id <0QZI00HQO8U5ILF0@rn-mailsvcp-mta-lapp02.rno.apple.com>; Wed, 15 Sep 2021 19:13:17 -0700 (PDT) Received: from process_milters-daemon.rn-mailsvcp-mmp-lapp04.rno.apple.com by rn-mailsvcp-mmp-lapp04.rno.apple.com (Oracle Communications Messaging Server 8.1.0.9.20210415 64bit (built Apr 15 2021)) id <0QZI005008H3ZD00@rn-mailsvcp-mmp-lapp04.rno.apple.com>; Wed, 15 Sep 2021 19:13:17 -0700 (PDT) X-Va-A: X-Va-T-CD: bf1972b335e987633d0c645ebb4a159c X-Va-E-CD: 0b111977e899567ebb647b1e4a3d4dfc X-Va-R-CD: ebe1d81e8be23a9aa10b4eaf858210a4 X-Va-CD: 0 X-Va-ID: c4156003-2f1a-419c-b61d-8668efdb88e6 X-V-A: X-V-T-CD: bf1972b335e987633d0c645ebb4a159c X-V-E-CD: 0b111977e899567ebb647b1e4a3d4dfc X-V-R-CD: ebe1d81e8be23a9aa10b4eaf858210a4 X-V-CD: 0 X-V-ID: e0d2b35a-ac07-489b-b45c-adfde760d4c5 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-09-15_07:2021-09-15,2021-09-15 signatures=0 Received: from [17.235.47.8] (unknown [17.235.47.8]) by rn-mailsvcp-mmp-lapp04.rno.apple.com (Oracle Communications Messaging Server 8.1.0.9.20210415 64bit (built Apr 15 2021)) with ESMTPSA id <0QZI011G58U4OO00@rn-mailsvcp-mmp-lapp04.rno.apple.com>; Wed, 15 Sep 2021 19:13:17 -0700 (PDT) From: "Andrew Fish" Message-id: MIME-version: 1.0 (Mac OS X Mail 14.0 \(3654.20.0.2.1\)) Subject: Re: [edk2-devel] RFC: Add BaseLib/QuickSort in MdePkg Date: Wed, 15 Sep 2021 19:13:15 -0700 In-reply-to: <001a01d7aa99$d744af80$85ce0e80$@byosoft.com.cn> Cc: "Ni, Ray" , Mike Kinney , "Gao, Liming" , "Liu, Zhiguang" , "Wang, Jian J" , "Gao, Zhichao" , "Chan, Amy" To: edk2-devel-groups-io , Liming Gao References: <001a01d7aa99$d744af80$85ce0e80$@byosoft.com.cn> X-Mailer: Apple Mail (2.3654.20.0.2.1) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-09-15_07:2021-09-15,2021-09-15 signatures=0 Content-type: multipart/alternative; boundary="Apple-Mail=_C594DA98-B00B-4142-A6B4-00A10C61E0BB" --Apple-Mail=_C594DA98-B00B-4142-A6B4-00A10C61E0BB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Sep 15, 2021, at 6:26 PM, gaoliming wrote: >=20 > Ray: > SortLib has been added since 2015. I would suggest to still keep this li= brary class. To resolve the package dependency, my proposal is to move the = library class header file SortLib.h from MdeModulePkg to MdePkg, and still = keep the library instance in MdeModulePkg. This proposal has no impact on t= he existing platform.=20 > =20 If we add QuickSort() API to the BaseLib can we not just port the existing = MdeModulePkg/SortLib to use QuickSort() in the implementation? Or is there = some other way to add the new thing in a backward compatible way. Thanks, Andrew Fish > Thanks > Liming > =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > =E4=BB=A3=E8=A1= =A8 Ni, Ray > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2021=E5=B9=B49=E6=9C=8814=E6=97=A5 = 14:15 > =E6=94=B6=E4=BB=B6=E4=BA=BA: Kinney, Michael D >; Gao, Liming >; Liu, Zhiguang >; Wang, Jian J >; Gao, Zhichao > > =E6=8A=84=E9=80=81: devel@edk2.groups.io ; C= han, Amy > > =E4=B8=BB=E9=A2=98: [edk2-devel] RFC: Add BaseLib/QuickSort in MdePkg > =20 > Hi package maintainers of MdePkg, MdeModulePkg and ShellPkg, community, > =20 > A commit (UefiCpuPkg/CpuCacheInfoLib: Sort CpuCacheInfo array ) t= o UefiCpuPkg let > UefiCpuPkg depend on MdeModulePkg because the SortLib class and instances= are all in MdeModulePkg. > =20 > UefiCpuPkg depending on MdeModulePkg breaks the rule that =E2=80=9CUefiCp= uPkg should ONLY depend on MdePkg=E2=80=9D. > =20 > To address this issue, there are two approaches: > Duplicate the sort logic in UefiCpuPkg to not depend on MdeModulePkg/Sort= Lib > Add QuickSort() API to BaseLib in MdePkg. > =20 > Approach #2 (MdePkg/BaseLib/QuickSort) makes more sense because quick sor= t is a standard algorithm. > We encourage consumers to update their code to use the quick sort in MdeP= kg and gradually deprecate today=E2=80=99s MdeModulePkg/SortLib. > =20 > If you don=E2=80=99t have concerns, I plan to: > =E2=80=9CAdd QuickSort() to BaseLib=E2=80=9D and update all existing cons= umers to use this API instead. > VOID > EFIAPI > QuickSort ( > IN OUT VOID *BufferToSort, > IN CONST UINTN Count, > IN CONST UINTN ElementSize, > IN SORT_COMPARE CompareFunction > ); > =20 > =E2=80=9CAdd new ShellPkg/SortCompareLib=E2=80=9D > Background: ShellPkg requires to sort devicepath/string so 3 APIs in Uefi= SortLib (DevicePathCompare, StringNoCaseCompare, StringCompare) are provide= d for Shell usage. we can move the 3 APIs to the SortCompareLib and update = Shell code to use BaseLib/QuickSort directly, with the sort compare functio= n from SortCompareLib. > =20 > Any concerns? > =20 > Thanks, > Ray >=20 --Apple-Mail=_C594DA98-B00B-4142-A6B4-00A10C61E0BB Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Sep 15, 20= 21, at 6:26 PM, gaoliming <gaoliming@byosoft.com.cn> wrote:

Ray:
 SortLib has been added since 2015. I wou= ld suggest to still keep this library class. To resolve the package depende= ncy, my proposal is to move the library class header file SortLib.h from Md= eModulePkg to MdePkg, and still keep the library instance in MdeModulePkg. = This proposal has no impact on the existing platform. 
 

If we add QuickSort() API t= o the BaseLib can we not just port the existing MdeModulePkg/SortLib t= o use QuickSort() in the implementation? Or is there some other way to add = the new thing in a backward compatible way.

=
Thanks,

Andrew Fish

Thanks
Liming
<= div style=3D"border-style: solid none none; border-top-width: 1pt; border-t= op-color: rgb(225, 225, 225); padding: 3pt 0cm 0cm;" class=3D"">
=E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io <devel@edk2= .groups.io> = =E4=BB=A3=E8=A1=A8 Ni, Ray
=E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4:
 2021=E5=B9=B49=E6=9C= =8814=E6=97=A5 14:15
=E6=94=B6=E4=BB=B6=E4=BA=BA: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <<= a href=3D"mailto:liming.gao@intel.com" style=3D"color: rgb(5, 99, 193); tex= t-decoration: underline;" class=3D"">liming.gao@intel.com>; Liu, Zhi= guang <zhiguang.liu@intel.com>; Wang, Jian J <jian.j.wang@= intel.com>; Gao, Zhichao <= zhichao.gao@intel.com>
=E6=8A=84= =E9=80=81: devel@edk2.groups.io; Chan, Amy <amy.chan@intel.com>
=E4=B8=BB=E9=A2=98:<= span lang=3D"EN-US" class=3D""> = [edk2-devel] RFC: Add BaseLib/QuickSort in MdePkg
 
Hi package maintainers of MdePkg, MdeModulePkg and Sh= ellPkg, community,
 
A commit (UefiCpuPkg= /CpuCacheInfoLib: Sort CpuCacheInfo array) to UefiCpuPkg let
UefiCpuPkg depend on MdeModulePkg because the SortLib class and insta= nces are all in MdeModulePkg.
 
UefiCpuPkg depending on = MdeModulePkg breaks the rule that =E2=80=9CUefiCpuPkg should ONLY depend on= MdePkg=E2=80=9D.
 
To address this issue, there are two = approaches:
  1. Duplicate the sort logic in Uefi= CpuPkg to not depend on MdeModulePkg/SortLib
  2. Add QuickS= ort() API to BaseLib in MdePkg.
 
Approach #2 (MdePkg/= BaseLib/QuickSort) makes more sense because quick sort is a standard algori= thm.
We encourage consumers to update their code to use the quick sor= t in MdePkg and gradually deprecate today=E2=80=99s MdeModulePkg/SortLib.
 
If you don=E2=80=99t have concerns, I plan to:
  1. =E2=80=9CAdd QuickSort() to BaseLib=E2=80=9D and upda= te all existing consumers to use this API instead.
VOID
EFIAPI
Quick= Sort (
  IN OUT VOID      =             &nb= sp;*BufferToSort,
  IN&nbs= p;CONST UINTN         &nb= sp;      Count,
  IN CONST UINTN     = ;           <= span lang=3D"EN-US" style=3D"font-size: 10.5pt; font-family: Consolas; colo= r: rgb(156, 220, 254);" class=3D"">ElementSize,
  IN   &= nbsp;   SORT_COMPARE      &nbs= p;  CompareFunction
  );
 
  1. =E2=80=9CAdd new ShellPkg/SortComp= areLib=E2=80=9D
Background: ShellPkg requires to sor= t devicepath/string so 3 APIs in UefiSortLib (DevicePathCompare, StringNoCa= seCompare, StringCompare) are provided for Shell usage. we can move the 3 A= PIs to the SortCompareLib and update Shell code to use BaseLib/QuickSort di= rectly, with the sort compare function from SortCompareLib.=
 
Any concerns?
 
Thanks,=
Ray


--Apple-Mail=_C594DA98-B00B-4142-A6B4-00A10C61E0BB--