From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web12.2719.1571212610613189618 for ; Wed, 16 Oct 2019 00:56:50 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: hao.a.wu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2019 00:56:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,303,1566889200"; d="scan'208";a="347348468" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 16 Oct 2019 00:56:48 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 16 Oct 2019 00:56:44 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 16 Oct 2019 00:56:44 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.166]) by shsmsx102.ccr.corp.intel.com ([169.254.2.176]) with mapi id 14.03.0439.000; Wed, 16 Oct 2019 15:56:41 +0800 From: "Wu, Hao A" To: "Kubacki, Michael A" , "devel@edk2.groups.io" CC: "Bi, Dandan" , Ard Biesheuvel , "Dong, Eric" , Laszlo Ersek , "Gao, Liming" , "Kinney, Michael D" , "Ni, Ray" , "Wang, Jian J" , "Yao, Jiewen" Subject: Re: [PATCH V4 06/10] MdeModulePkg VariableInfo: Always consider RT DXE and SMM stats Thread-Topic: [PATCH V4 06/10] MdeModulePkg VariableInfo: Always consider RT DXE and SMM stats Thread-Index: AQHVgudjtZO0l0NjFkGpDfAkOwnTtKdc6JIA Date: Wed, 16 Oct 2019 07:56:41 +0000 Message-ID: References: <20191014233001.33024-1-michael.a.kubacki@intel.com> <20191014233001.33024-7-michael.a.kubacki@intel.com> In-Reply-To: <20191014233001.33024-7-michael.a.kubacki@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Kubacki, Michael A > Sent: Tuesday, October 15, 2019 7:30 AM > To: devel@edk2.groups.io > Cc: Bi, Dandan; Ard Biesheuvel; Dong, Eric; Laszlo Ersek; Gao, Liming; Ki= nney, > Michael D; Ni, Ray; Wang, Jian J; Wu, Hao A; Yao, Jiewen > Subject: [PATCH V4 06/10] MdeModulePkg VariableInfo: Always consider RT > DXE and SMM stats >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2220 >=20 > The current VariableInfo application only checks for variable > statistics from SMM if the variable information entries are > not present in the UEFI System Configuration table as published > by the DXE UEFI variable driver (VariableRuntimeDxe). >=20 > This change first checks for variable information entries in the > UEFI System Configuration but always checks for entries in SMM > as well. If the SMM variable driver is not present, an instance of > EFI_SMM_VARIABLE_PROTOCOL will not be found and the search for > SMM variable statistics will be aborted (an SW SMI to get variable > statistics will not be triggered). >=20 > In the case variable statistics are provided by both a Runtime DXE > driver (e.g. VariableSmmRuntimeDxe) and a SMM driver (VariableSmm), > this change will clearly identify statistics from each respective > driver. You can keep my previous ACK tag in V2 series. Best Regards, Hao Wu >=20 > Cc: Dandan Bi > Cc: Ard Biesheuvel > Cc: Eric Dong > Cc: Laszlo Ersek > Cc: Liming Gao > Cc: Michael D Kinney > Cc: Ray Ni > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Jiewen Yao > Signed-off-by: Michael Kubacki > --- > MdeModulePkg/Application/VariableInfo/VariableInfo.c | 37 ++++++++++-- > -------- > 1 file changed, 18 insertions(+), 19 deletions(-) >=20 > diff --git a/MdeModulePkg/Application/VariableInfo/VariableInfo.c > b/MdeModulePkg/Application/VariableInfo/VariableInfo.c > index f213471e9a..c04ba18213 100644 > --- a/MdeModulePkg/Application/VariableInfo/VariableInfo.c > +++ b/MdeModulePkg/Application/VariableInfo/VariableInfo.c > @@ -3,7 +3,7 @@ > this utility will print out the statistics information. You can use co= nsole > redirection to capture the data. >=20 > - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
> + Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -126,7 +126,7 @@ PrintInfoFromSmm ( > ASSERT (CommBuffer !=3D NULL); > ZeroMem (CommBuffer, RealCommSize); >=20 > - Print (L"Non-Volatile SMM Variables:\n"); > + Print (L"SMM Driver Non-Volatile Variables:\n"); > do { > CommSize =3D RealCommSize; > Status =3D GetVariableStatisticsData (CommBuffer, &CommSize); > @@ -155,7 +155,7 @@ PrintInfoFromSmm ( > } > } while (TRUE); >=20 > - Print (L"Volatile SMM Variables:\n"); > + Print (L"SMM Driver Volatile Variables:\n"); > ZeroMem (CommBuffer, RealCommSize); > do { > CommSize =3D RealCommSize; > @@ -207,24 +207,18 @@ UefiMain ( > IN EFI_SYSTEM_TABLE *SystemTable > ) > { > - EFI_STATUS Status; > + EFI_STATUS RuntimeDxeStatus; > + EFI_STATUS SmmStatus; > VARIABLE_INFO_ENTRY *VariableInfo; > VARIABLE_INFO_ENTRY *Entry; >=20 > - Status =3D EfiGetSystemConfigurationTable (&gEfiVariableGuid, (VOID > **)&Entry); > - if (EFI_ERROR (Status) || (Entry =3D=3D NULL)) { > - Status =3D EfiGetSystemConfigurationTable > (&gEfiAuthenticatedVariableGuid, (VOID **)&Entry); > + RuntimeDxeStatus =3D EfiGetSystemConfigurationTable (&gEfiVariableGuid= , > (VOID **) &Entry); > + if (EFI_ERROR (RuntimeDxeStatus) || (Entry =3D=3D NULL)) { > + RuntimeDxeStatus =3D EfiGetSystemConfigurationTable > (&gEfiAuthenticatedVariableGuid, (VOID **) &Entry); > } >=20 > - if (EFI_ERROR (Status) || (Entry =3D=3D NULL)) { > - Status =3D PrintInfoFromSmm (); > - if (!EFI_ERROR (Status)) { > - return Status; > - } > - } > - > - if (!EFI_ERROR (Status) && (Entry !=3D NULL)) { > - Print (L"Non-Volatile EFI Variables:\n"); > + if (!EFI_ERROR (RuntimeDxeStatus) && (Entry !=3D NULL)) { > + Print (L"Runtime DXE Driver Non-Volatile EFI Variables:\n"); > VariableInfo =3D Entry; > do { > if (!VariableInfo->Volatile) { > @@ -242,7 +236,7 @@ UefiMain ( > VariableInfo =3D VariableInfo->Next; > } while (VariableInfo !=3D NULL); >=20 > - Print (L"Volatile EFI Variables:\n"); > + Print (L"Runtime DXE Driver Volatile EFI Variables:\n"); > VariableInfo =3D Entry; > do { > if (VariableInfo->Volatile) { > @@ -258,14 +252,19 @@ UefiMain ( > } > VariableInfo =3D VariableInfo->Next; > } while (VariableInfo !=3D NULL); > + } >=20 > - } else { > + SmmStatus =3D PrintInfoFromSmm (); > + > + if (EFI_ERROR (RuntimeDxeStatus) && EFI_ERROR (SmmStatus)) { > Print (L"Warning: Variable Dxe/Smm driver doesn't enable the feature= of > statistical information!\n"); > Print (L"If you want to see this info, please:\n"); > Print (L" 1. Set PcdVariableCollectStatistics as TRUE\n"); > Print (L" 2. Rebuild Variable Dxe/Smm driver\n"); > Print (L" 3. Run \"VariableInfo\" cmd again\n"); > + > + return EFI_NOT_FOUND; > } >=20 > - return Status; > + return EFI_SUCCESS; > } > -- > 2.16.2.windows.1