From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web12.31014.1634522255428433949 for ; Sun, 17 Oct 2021 18:57:35 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=b8qRDL/4; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: ianx.kuo@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10140"; a="225611806" X-IronPort-AV: E=Sophos;i="5.85,380,1624345200"; d="scan'208";a="225611806" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2021 18:57:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,380,1624345200"; d="scan'208";a="493392138" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga008.jf.intel.com with ESMTP; 17 Oct 2021 18:57:34 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Sun, 17 Oct 2021 18:57:34 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Sun, 17 Oct 2021 18:57:33 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Sun, 17 Oct 2021 18:57:33 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.168) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Sun, 17 Oct 2021 18:57:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WoBKCBpA8OJJrSOnq1fHI4Dh1ECASr4WF3DKLGV6IMW6pplsZHEYvMVmSKFv6+E3nZqejfsPhw7VpSxxYkNuciI/rUWEkjEK6QnUMoaK7Tnuizb6BMICqM5TxHwKib7mlxqz+uwxwJjGxRTVSZmZO+Od6Kk8pIpmNX9k5Fh8zxDF+2bRBiBqam81QQpzk7LU/9SayLtQe1XjH3HUqtu/CzDhF2YUCaCe/rrLh8Jf7u6McBQd7u4fv+DYhxummXKwAgbUWnnM/1xjH4SeVgGK2yu7TVuKrExv/nmgX9AIjYqeh6XprpFATqJaFTKsZv/f+KMDss/iO9RgTQf6+X51IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0HkxAGT3RGeRgXlciI2oBVNz3idTfr6me8N+kJ7RZ6g=; b=IWNr+C4Pt6IKVT2/rGkyELeH5DgsPaZLtApRwUZmdQOgobI/i5wVFwZR7IU8t6UvxXKc4M03MHtjtWWCnOdisKQq0cC79bLnWCTQgDIGXwj2tACKIOnhgnhWkk84e435QZ93dDl43oGOWxT9TsUn72XhcMY95Uy/vQywP0zrB5yd9tonMHZFRVX+GHC9+ZCBfbXIknt4JApxRggxEtCtJzf9sbgyz+wCWCsDgO2+2BBGWgg0kd9byQTrr3HgtF90R6sXp0JlO5bQH3rtJBjdY3S6egzZQa3Miw3gbMrdcjkvIJDqraq5Sm2+ndh3NwisnsBiI43FjhR98Amfy9Vdpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0HkxAGT3RGeRgXlciI2oBVNz3idTfr6me8N+kJ7RZ6g=; b=b8qRDL/4/AQz6w8Qg4Jja4OgCvW+FIpUEHQsf7OerHCaYNrIZ622DapfIoWh39EZ/P7ZFfeMD4hVhzranGD/pzK27HfWsfpQaOX8d0t0mVGqi/k+wItnvOQ54liMp6iybJvjcXtgV/VSX+TqL0CGRWEw6K/ajT8gmotwGGhyR3c= Received: from PH0PR11MB5174.namprd11.prod.outlook.com (2603:10b6:510:3b::12) by PH0PR11MB5110.namprd11.prod.outlook.com (2603:10b6:510:3f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Mon, 18 Oct 2021 01:57:24 +0000 Received: from PH0PR11MB5174.namprd11.prod.outlook.com ([fe80::4435:90ac:24fe:b6a6]) by PH0PR11MB5174.namprd11.prod.outlook.com ([fe80::4435:90ac:24fe:b6a6%6]) with mapi id 15.20.4608.018; Mon, 18 Oct 2021 01:57:24 +0000 From: "IanX Kuo" To: "devel@edk2.groups.io" , "Ni, Ray" , "Dong, Eric" , "Kumar, Rahul1" CC: "Chan, Amy" Subject: Re: [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib Thread-Topic: [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib Thread-Index: AQHXwt37hwsj4GxIUEWanESZzXNRoKvYANsA Date: Mon, 18 Oct 2021 01:57:24 +0000 Message-ID: References: <20211016223406.935-1-ianx.kuo@intel.com> <20211016223406.935-4-ianx.kuo@intel.com> In-Reply-To: <20211016223406.935-4-ianx.kuo@intel.com> Accept-Language: en-AS, zh-TW, en-US X-Mentions: ray.ni@intel.com,eric.dong@intel.com,rahul1.kumar@intel.com X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 245ea5c3-0e5e-4582-0e37-08d991daa182 x-ms-traffictypediagnostic: PH0PR11MB5110: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:207; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0izPteECfOVriMgw2n0i6Q9xD4HVyFXQ2k63h1JZh6ECG2ydinUIPrSm+rXVk91TmSrlwCoZ3lEs2h8zVK8HU2orpgXiEnOGQDeSkH+qDhjMgHi0olEP51cH1CunY1TuvEUs7rojUKxRQvmfoWxyNkNaoz7xg9X1RCZIozJBeQgibxF8fN7z1U1Fv585RCD80oxWHfZm+a5Qf4FCyfAGm0TMWUezZOtsGLs4U7zL6u8dmZKTbU4i5kIVbB3ypu3C3F7XS7wpFFWGMwpuYnJNtl+969TA3OI4YXKlP5emlI6Pg9taZJa0CP5bEUA6+N0xKSNEXlkmcGr2pv/8jRyinERGvqou0/c3QJwqm+45OFfhOfiNnx/MQp7fs3DdC7FzYBiXPeHtXK38mJtZ+Bj0W6fKUStn3EIdDnfKq7/IjhqUhTl4r4VrfMjLxFlbq9ZaVt6saOqalwKuBx14PuxxMKZQJQmC0IgCpkegkaWqiurUTtJqdkQrNdA/OPok6Ei4nx4VyQaBfUngijAzBmiykBEDQ8hDfza/cQKoTMEx36N2/JxTUPsjfYnmBddaLzrXAZBSGZYIehWDb25evsd14Y+wYISHStmDyYJ7OHJt3e8PCfjmspUH6RcTFZARkoBWUNC/3XHPFO19kKTNiq/kaMszIxZUKihP44SidCSqQwAhcfQh7LiKJhDXUJiHk7xMTOjHgs+I1SvsbE0FAaE6SknAoIL2SnwhDLPUAP9/2quOfaApcLCRxLObEW6iXGbFUOO2fnj8BsGKl7BTd8kZEQXfTULizLfsPUVyBCp3k6c= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5174.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(6636002)(2906002)(38070700005)(66946007)(66556008)(66446008)(33656002)(64756008)(52536014)(966005)(110136005)(19627235002)(82960400001)(316002)(5660300002)(4326008)(7696005)(107886003)(76116006)(83380400001)(53546011)(86362001)(8936002)(38100700002)(6506007)(26005)(71200400001)(55016002)(8676002)(508600001)(186003)(9686003)(66476007)(122000001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?AOtc2s8iGuv917Mc+Q5Y2rabJk4Z8MqB1M7FSp09+UI9AwuqLxMNq6S1BFzp?= =?us-ascii?Q?bI8BLZqNHrLWnq2fAMK2KcxWpGLN4QGBT0o2n4StGSo3bDq88QVN1H4kq193?= =?us-ascii?Q?r7Vf3fssOEnXlYQ2pkpxYqstlY6OPQ4Zt1RLk0qHI/0muQhDnrfS0NMOgvyF?= =?us-ascii?Q?ciECwM6veZTnZKB0K8GCHmaA5B17UmxiJadBCB153WHCEzSWcw00Vt65Jmvk?= =?us-ascii?Q?hWH+eYoT0ngJ6rzlbgLmNc/YL8DzkRCT5GRDwP4EYBImWQPCkjodRznuJ/Wh?= =?us-ascii?Q?qdeShUGNUP5K8xs/2Bp3kigZRG/cb21rQPJ5lXa6mJ4sO7eGw9RCi5CVjkD7?= =?us-ascii?Q?xuGDWGRzmOXTsB/y9GY2xDAd7U9fiqZghsYI/KvEH4TcsoLteVID4vbUxhEO?= =?us-ascii?Q?OemtHh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hME7+wb9aPIG6+87VxhIwf0wpvM?= =?us-ascii?Q?1Eu99wEkad+tsneArSJqA84K?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5174.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 245ea5c3-0e5e-4582-0e37-08d991daa182 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2021 01:57:24.6904 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: e+QatyrX1ak8lR7Yrubz//+jX79eNS4qldJ+8aSrVSlK0KQF5NjjyKD0Gp+YuDeMCrjALizDJws0APgwHcg1vg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5110 Return-Path: ianx.kuo@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable @Dong, Eric, @Ni, Ray or @Kumar, Rahul1 Sorry to bother you. May I get one of your approval for this patch ?=20 Thanks, Ian Kuo -----Original Message----- From: Kuo, IanX =20 Sent: Sunday, October 17, 2021 6:34 AM To: devel@edk2.groups.io Cc: Chan, Amy ; Ni, Ray ; Kuo, IanX <= ianx.kuo@intel.com>; Dong, Eric ; Kumar, Rahul1 Subject: [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function = on BaseLib From: IanX Kuo REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3675 Remove MdeModulePkg dependency Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Signed-off-by: IanX Kuo --- UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c | 8 +++++++- UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf | 2 -- .../Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h | 1 - UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf | 2 -- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c b/UefiCpu= Pkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c index c0077d6770..c7c72f68eb 100644 --- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c +++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c @@ -282,6 +282,7 @@ CpuCacheInfoCollectCpuCacheInfoData ( UINTN LocalCacheInfoCount; UINTN Index; UINTN NextIndex; + VOID *QuickSortBuffer; =20 // // Get number of Packages and Package ID. @@ -369,7 +370,12 @@ CpuCacheInfoCollectCpuCacheInfoData ( // // Sort LocalCacheInfo array by CPU package ID, core type, cache level= and cache type. // - PerformQuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalC= acheInfo), (SORT_COMPARE) CpuCacheInfoCompare); + QuickSortBuffer =3D AllocateZeroPool (sizeof (*LocalCacheInfo)); + if (QuickSortBuffer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInf= o), CpuCacheInfoCompare, QuickSortBuffer); CopyMem (CacheInfo, LocalCacheInfo, sizeof (*CacheInfo) * LocalCacheIn= foCount); DEBUG_CODE ( CpuCacheInfoPrintCpuCacheInfoTable (CacheInfo, LocalCacheInfoCount); diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf b/Ue= fiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf index c3d3f1e799..fdd79970f9 100644 --- a/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf +++ b/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf @@ -25,7 +25,6 @@ =20 [Packages] MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec UefiCpuPkg/UefiCpuPkg.dec =20 [LibraryClasses] @@ -34,7 +33,6 @@ BaseMemoryLib MemoryAllocationLib UefiBootServicesTableLib - SortLib =20 [Protocols] gEfiMpServiceProtocolGuid diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h b= /UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h index 26e1f46516..829a9f43ce 100644 --- a/UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h +++ b/UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h @@ -17,7 +17,6 @@ #include #include #include -#include #include =20 typedef union { diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf b/Ue= fiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf index 0864497849..c643fc89be 100644 --- a/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf +++ b/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf @@ -25,7 +25,6 @@ =20 [Packages] MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec UefiCpuPkg/UefiCpuPkg.dec =20 [LibraryClasses] @@ -34,7 +33,6 @@ BaseMemoryLib MemoryAllocationLib PeiServicesTablePointerLib - SortLib =20 [Ppis] gEdkiiPeiMpServices2PpiGuid --=20 2.30.0.windows.1