From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.31590.1634528540152865716 for ; Sun, 17 Oct 2021 20:42:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=EMOU++E4; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: ray.ni@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10140"; a="314359429" X-IronPort-AV: E=Sophos;i="5.85,381,1624345200"; d="scan'208";a="314359429" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2021 20:42:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,381,1624345200"; d="scan'208";a="489264407" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga007.fm.intel.com with ESMTP; 17 Oct 2021 20:42:18 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX604.amr.corp.intel.com (10.22.229.17) 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 20:42:18 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) 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 20:42:17 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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 via Frontend Transport; Sun, 17 Oct 2021 20:42:17 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.174) 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 20:42:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V+RaYZGLlaZWUq5Tr/COrc/WqgCgjrazEfm0SDPy0INncQ71zhJDoIwD+dbXNdIgXUBGmj4gfedoWbxOAulGZlSd1wE3i0AjciarT/tcKskjA5mMyqhGKnuGsSOddkektkb09ThmzuIbm7TTzTb5mZYvz0JdJMSGkRJmPmhghmn9e5rWOdZ/wxYfpAON89mYL4GPebyVmPuW0tCsNxB0n5hRmThM2V65ZzSo5tz7ranFAoxai+OTmp9rQ94evT3uVKP2sNacMGMVHIX0TKBivZ3/ve604LLzkq9MRnl3j83e3rbVqNydHO54VJeHD2uaWzPObrCf+dPeoTeV1536mQ== 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=wv4WmhJhfpRMvu7Cej1qJRzvQBqbHmtaYY2giHBn4Ok=; b=fjFcQn+UJkj5KuLz7OOMQmZ167mB4xMYv75RR7dUruFKGELPcCYX6Q7F3/ow6hK/R8waK5fWwW7osx0xsme/1Oh83jqMKdFarAYG+nj/GhKmFQfWcIRcdJpHNSSh3WNYtWH4P+l22pqmz7KvD3Wt2exYEfyXp6A4fhquCSZcIdIwn0WZPSaeNQ89esYfD4whqGdrrTGOaiEDHeDRigO8msu01bTTnExaX/a2/nzjw0bqIOnnDZRXN8WVv3DyHQvxb/R8JVDceTLe6uiICc0boXwQ/2+zLnsaYMy2F/ZmNk2LJufYnvYnyci8Hy9hyuMsySyf5rxqU5g5whRl5OuS/w== 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=wv4WmhJhfpRMvu7Cej1qJRzvQBqbHmtaYY2giHBn4Ok=; b=EMOU++E4LPANyEz3iYxEEmeMngZRPBgSFbj4Y4+3NK4W8IPBy0LBZuu1bolWrKEDZCuuWhqYtf3eqKzZGPCFXpTIGQvu6jsCFSZmXpJK2P8dlqJ5vOjCQqR/ESIfBmm2twEe8GXiQTjhZlL1Eha368MZm7/F8a7imhhULBtD3kA= Received: from BN0PR11MB5696.namprd11.prod.outlook.com (2603:10b6:408:14b::11) by BN7PR11MB2788.namprd11.prod.outlook.com (2603:10b6:406:b2::30) 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 03:42:16 +0000 Received: from BN0PR11MB5696.namprd11.prod.outlook.com ([fe80::317e:de35:e920:7778]) by BN0PR11MB5696.namprd11.prod.outlook.com ([fe80::317e:de35:e920:7778%3]) with mapi id 15.20.4608.018; Mon, 18 Oct 2021 03:42:16 +0000 From: "Ni, Ray" To: "Kuo, IanX" , "devel@edk2.groups.io" CC: "Chan, Amy" , "Dong, Eric" , "Kumar, Rahul1" 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: AQHXwt37qlwcZT+et0GUxRKio/EtnavYHSUw Date: Mon, 18 Oct 2021 03:42:16 +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-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9a967bf7-dd89-4058-740a-08d991e947c5 x-ms-traffictypediagnostic: BN7PR11MB2788: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: mM7HDCaaWj47oOBa4Gg8ZYVvfeCwXisHLd1Nbz+OsagCRpOJ9gkB9ps7RTXpKIVxttfnba0hmoVsA91gDI/h3lN8HGaodPa3KCFZTgrxktTv0QnBiZGow6DWrY/fROj/ik6DVSS+MIqg6bRdzMYOiMGCdcYPdXdp5hUOm6a1q49L+1qa6O8XwzOfhRDJ0FqPluL73+MfyR2FEA5gI7OzIc4pcQlqVMKufqVe3DYW2UAdmaC2vsyLql3G4ZnF8PaB/KqwQml9HFVtaosVtMkkqzSyVp8MJoFpDZmFW93jumbRWumiMTh5olkU8M+ZHBK7wWXWxnB5iIJ7Cxz68e7TKFbSwTuaqmjB8Wi8oXB2nMGdDdLsSkXX/ftpN6tXYVRWQ3T50qWINxBFyJe95jGyUG6JTFjEwpdKLo+Yfqo3LEuPzqxrckteF/EklDbPcpixDgo0dUzkf7FD8nynZlo/H80G2E54yaOzX508BcRiHZCnDWDGkYnvOCOWUbASCFQ/hfqoL87mJAdiCWkc/wZuYz1+bbWlHpIR3G72+lEh0Y7DTDTxVbje5ocDsvVjgFna2DRU4vNf0D95LizM+IZSQZjF99oa/7X8JvBa2LxERQhIdZfXj/+nLtYjV9uTvKq9NyNbTOkaNocM3Zkb+7mwVRicQBM+d9x3zY8qQdNqotRwI8IzpIyoLfjZGEB9C9VOROkYbcqLXOHk7JQNbbHjeQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN0PR11MB5696.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(66946007)(54906003)(76116006)(38100700002)(508600001)(7696005)(66446008)(8676002)(4744005)(66556008)(8936002)(107886003)(9686003)(71200400001)(2906002)(4326008)(186003)(316002)(110136005)(122000001)(6506007)(26005)(38070700005)(86362001)(82960400001)(66476007)(55016002)(5660300002)(33656002)(52536014)(64756008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?VxC8F4DF0v/IvlHYb9HoFUeC5wvOckUdfusSuUbq+YgLpr7xv4LQEZ3kh7C6?= =?us-ascii?Q?LBDfLdF/eFJCgeYaUdGQc4k+ElmIwqaOOKQky2Br3TUvGKmkd3STz/po9/6d?= =?us-ascii?Q?tA72Ecj34njYVE00u+Ze0fnz2NgBG1XijXzs1ilscEDr272v9FNebRpUV2i4?= =?us-ascii?Q?mWtIxi/nI7Qq8lik2R8Mr1MyFyxFZJEs5LIurFsbux2++Eoj6lRL46TvDqQs?= =?us-ascii?Q?njlSXN1uSppS6Vtf+LesgCXA6FRQ6P6SqTy5sQbYhEs2SUOCCQcO4B3biZ0l?= =?us-ascii?Q?8V449JpTkLo9a8+0Wpu3sbCMqQmGPjfzuz13OfsM/wmWxoBtnHmrYTRYEEFz?= =?us-ascii?Q?wN6YviodET3RzdzggWWT3dAfth+gShX6LTpAggcXleznHeUyYJakcyrSW/Is?= =?us-ascii?Q?4n1wwF9e/t30Dvk2uZ1PvMr7q++XdEYrfbXcJq101k4atpl09GHIzApq+OL1?= =?us-ascii?Q?98z5dVts1/TSYQf7R62wy1xCFnECtZG9wFd8Dg6+VGDe3gZFmLOHftw+zrUY?= =?us-ascii?Q?ubnGsfJr0UuuJtZhTtCL2yV3JsitJ96wWGBsDKhB5DR7VF6PhWVgODXhQFAh?= =?us-ascii?Q?V6nT8egfkwt4oDcatTHe397SP6A0kzx8RE2kzpkw335MO6iZBLvect3m/dtv?= =?us-ascii?Q?w8Wpe6LELZOjO4GyvjYVEgeksm6o6Fw9iVrfuV6gf1R3iDzY81N0VmiAh1h5?= =?us-ascii?Q?TOtUKiOdYF5k5DaAdPbeCEkZkUg+CoxFgThevjLX3gMpyaaK13TgcOSo5CDI?= =?us-ascii?Q?ewv0B+lAPQORvHLb1Q2bQ3HuDGKa3mOkgGtnbJcVEq5dnTHhbWpZJoQHU/XU?= =?us-ascii?Q?CmvFRcC3+kAXQ2xIrhM4TJt4Wx8WEvvbuDe/kD7NZLfVPlfZLv7OgPedJ0t/?= =?us-ascii?Q?H8NNPfGvGUCl1bvco69YdpW4fa7qR6g4QkgUl5X49cr7qeNq8yOlkbMnL6Lj?= =?us-ascii?Q?qXPdJDpl1ZJShMRng+vsmdXaVpeHR/PbgzUpU9AkSaXba/m9jOP3V1j00xZ2?= =?us-ascii?Q?dIUpeYmvxifrlAhDzy/OSgxbthRtr4Y6CzotDrDHAvidSaKjEAryOmCIbZPQ?= =?us-ascii?Q?v6VKUBm6IOzT5eaCFHup6RYGxduI6ph+TVM2B+SG72IOgyl934BS5dLWYouN?= =?us-ascii?Q?QAIAi+oR0kH2QgEqPnLKQ1+YqQJ4hNneLi0JJnKYAUVPhD4FhdKa8tDGUzr8?= =?us-ascii?Q?mYuysjg6rwKGkvGccV9nc416bvfNTonWlZbM+9IySonuSoct8U7z4SMB+slu?= =?us-ascii?Q?iCZlhWglLSNxNvquKwr7PvdlJqETW9Gmpqg1vBCN3ILFpeZrY5BUCST7WaXF?= =?us-ascii?Q?19/E86WCvKjwyLUpxIUI2XHn?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN0PR11MB5696.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a967bf7-dd89-4058-740a-08d991e947c5 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2021 03:42:16.6309 (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: fhLFdrk7SRkxsbv46gb7H2c3lDJ/WQhKfJRkvPbPt4091sciXJ+wAzWf9k185LCW6VsuaMRcJqBmAFCOFpYU5A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR11MB2788 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ian, Thanks for cleaning up the code to remove MdeModulePkg dependency. Minor comments below: UINTN NextIndex; + VOID *QuickSortBuffer; 1. Can you use local variable? "CPU_CACHE_INFO SortBuffer". - PerformQuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalC= acheInfo), (SORT_COMPARE) CpuCacheInfoCompare); + QuickSortBuffer =3D AllocateZeroPool (sizeof (*LocalCacheInfo)); + if (QuickSortBuffer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } 2. With #1 change, you can avoid "calling AllocateZeroPool() and checking p= ointer". + QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInf= o), CpuCacheInfoCompare, QuickSortBuffer); 3. Just pass "&SortBuffer" as the last parameter.