From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web12.5113.1575523478168584358 for ; Wed, 04 Dec 2019 21:24:38 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: ray.ni@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2019 21:24:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,279,1571727600"; d="scan'208";a="243118537" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 04 Dec 2019 21:24:37 -0800 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 4 Dec 2019 21:24:37 -0800 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 4 Dec 2019 21:24:37 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.90]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.72]) with mapi id 14.03.0439.000; Thu, 5 Dec 2019 13:24:35 +0800 From: "Ni, Ray" To: "Dong, Eric" , "devel@edk2.groups.io" CC: Laszlo Ersek Subject: Re: [PATCH v4] UefiCpuPkg/PiSmmCpuDxeSmm: Avoid allocate Token every time Thread-Topic: [PATCH v4] UefiCpuPkg/PiSmmCpuDxeSmm: Avoid allocate Token every time Thread-Index: AQHVqw5f6HPGAC1geEy6SqFBXpTFHKeq/iuQ Date: Thu, 5 Dec 2019 05:24:34 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C39021F@SHSMSX104.ccr.corp.intel.com> References: <20191205015023.607-1-eric.dong@intel.com> In-Reply-To: <20191205015023.607-1-eric.dong@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Some comments. > + // >=20 > + // Not free the buffer, just clear the UsedTokenNum. In order to >=20 > + // avoid triggering allocate action when we need to use the token, >=20 > + // do not free the buffer. 1. Can you reword to below? "Only free the token buffer recorded in the OldTOkenBufList upon exiting SM= I. Current token buffer stays allocated so next SMI doesn't need to re-allocat= e." > + ASSERT_EFI_ERROR (TokenCountPerChunk !=3D 0); 2. This is not right. Should use ASSERT(). > + DEBUG ((DEBUG_INFO, "CpuSmm: SpinLock Size =3D 0x%x, > PreAllocateTokenNum =3D 0x%x\n", SpinLockSize, TokenCountPerChunk)); 3. "PreAllocateTokenNum" -> "PcdTokenCountPerChunk". Please directly use th= e PCD name in debug log. >=20 > + UINT8 *CurrentTokenBuf; >=20 > + UINTN UsedTokenNum; // Only record token= s used in > CurrentTokenBuf. 4. I see a mismatch between types of UsedTokenNum and the PCD. One is UINTN= , the other is UINT32. Better to use UINT32 here. > gUefiCpuPkgTokenSpaceGuid.PcdTokenCountPerChunk|64|UINT32|0x30002002 5. The PCD name is too generic. It's hard to tell when/where the PCD is use= d by reading the name only. Maybe "PcdCpuSmmMpTokenCountPerChunk"? > +#string > STR_gUefiCpuPkgTokenSpaceGuid_PcdTokenCountPerChunk_PROMPT > #language en-US "Specify the size of pre allocated token count per chunk.= \n" 6. "Size of pre allocated token count per chunk" is a bit confusing. How about "Count of pre allocated SMM MP tokens"? Then maybe the PCD name can be "PcdCpuSmmMpPreAllocateTokenCount"? Thanks, Ray