From: "Ni, Ray" <ray.ni@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Ni, Ray" <ray.ni@intel.com>,
"Kinney, Michael D" <michael.d.kinney@intel.com>,
gaoliming <gaoliming@byosoft.com.cn>,
"Liu, Zhiguang" <zhiguang.liu@intel.com>,
"Wang, Jian J" <jian.j.wang@intel.com>,
"Gao, Zhichao" <zhichao.gao@intel.com>
Cc: "Chan, Amy" <amy.chan@intel.com>
Subject: Re: RFC: Add BaseLib/QuickSort in MdePkg
Date: Tue, 14 Sep 2021 06:56:02 +0000 [thread overview]
Message-ID: <CO1PR11MB4930CD650C085CF1C77D4FB08CDA9@CO1PR11MB4930.namprd11.prod.outlook.com> (raw)
In-Reply-To: <16A49BAD7CBC4A70.25300@groups.io>
[-- Attachment #1: Type: text/plain, Size: 2107 bytes --]
resend using Liming's new email address.
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ni, Ray
Sent: Tuesday, September 14, 2021 2:15 PM
To: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com>; Liu, Zhiguang <zhiguang.liu@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
Cc: devel@edk2.groups.io; Chan, Amy <amy.chan@intel.com>
Subject: [edk2-devel] RFC: Add BaseLib/QuickSort in MdePkg
Hi package maintainers of MdePkg, MdeModulePkg and ShellPkg, community,
A commit (UefiCpuPkg/CpuCacheInfoLib: Sort CpuCacheInfo array<https://github.com/tianocore/edk2/commit/4de77ae9890d241271f543e9195ab3516f3abec6>) to UefiCpuPkg let
UefiCpuPkg depend on MdeModulePkg because the SortLib class and instances are all in MdeModulePkg.
UefiCpuPkg depending on MdeModulePkg breaks the rule that "UefiCpuPkg should ONLY depend on MdePkg".
To address this issue, there are two approaches:
1. Duplicate the sort logic in UefiCpuPkg to not depend on MdeModulePkg/SortLib
2. Add QuickSort() API to BaseLib in MdePkg.
Approach #2 (MdePkg/BaseLib/QuickSort) makes more sense because quick sort is a standard algorithm.
We encourage consumers to update their code to use the quick sort in MdePkg and gradually deprecate today's MdeModulePkg/SortLib.
If you don't have concerns, I plan to:
1. "Add QuickSort() to BaseLib" and update all existing consumers to use this API instead.
VOID
EFIAPI
QuickSort (
IN OUT VOID *BufferToSort,
IN CONST UINTN Count,
IN CONST UINTN ElementSize,
IN SORT_COMPARE CompareFunction
);
1. "Add new ShellPkg/SortCompareLib"
Background: ShellPkg requires to sort devicepath/string so 3 APIs in UefiSortLib (DevicePathCompare, StringNoCaseCompare, StringCompare) are provided 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 function from SortCompareLib.
Any concerns?
Thanks,
Ray
[-- Attachment #2: Type: text/html, Size: 11529 bytes --]
next parent reply other threads:[~2021-09-14 6:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <16A49BAD7CBC4A70.25300@groups.io>
2021-09-14 6:56 ` Ni, Ray [this message]
2021-09-14 6:15 RFC: Add BaseLib/QuickSort in MdePkg Ni, Ray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CO1PR11MB4930CD650C085CF1C77D4FB08CDA9@CO1PR11MB4930.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox