From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web11.4066.1573518314546925530 for ; Mon, 11 Nov 2019 16:25:14 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: liming.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Nov 2019 16:25:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,294,1569308400"; d="scan'208";a="404065677" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga005.fm.intel.com with ESMTP; 11 Nov 2019 16:25:14 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 11 Nov 2019 16:25:13 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 11 Nov 2019 16:25:13 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.127]) by shsmsx102.ccr.corp.intel.com ([169.254.2.108]) with mapi id 14.03.0439.000; Tue, 12 Nov 2019 08:25:12 +0800 From: "Liming Gao" To: "Kubacki, Michael A" , "devel@edk2.groups.io" CC: "Kinney, Michael D" , "Wang, Jian J" , "Wu, Hao A" Subject: Re: [edk2-devel] [PATCH V1 1/1] MdeModulePkg/Variable: Fix volatile variable RT cache update logic Thread-Topic: [edk2-devel] [PATCH V1 1/1] MdeModulePkg/Variable: Fix volatile variable RT cache update logic Thread-Index: AQHVmE8xR9YeOpMBmUyU1dFIoHwO4qeFe/awgAAApDCAATHbAA== Date: Tue, 12 Nov 2019 00:25:11 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E53CC7C@SHSMSX104.ccr.corp.intel.com> References: <20191111051620.37748-1-michael.a.kubacki@intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E53C580@SHSMSX104.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Michael: Can the logic be simplified to only check this condition 'Attributes & E= FI_VARIABLE_NON_VOLATILE) !=3D 0'? Thanks Liming >-----Original Message----- >From: Kubacki, Michael A >Sent: Monday, November 11, 2019 2:11 PM >To: Gao, Liming ; devel@edk2.groups.io >Cc: Kinney, Michael D ; Wang, Jian J >; Wu, Hao A >Subject: RE: [edk2-devel] [PATCH V1 1/1] MdeModulePkg/Variable: Fix >volatile variable RT cache update logic > >After a new volatile variable is written successfully, Runtime Services >GetVariable () may return >EFI_NOT_FOUND for that variable. > >Thanks, >Michael > >> -----Original Message----- >> From: Gao, Liming >> Sent: Sunday, November 10, 2019 10:08 PM >> To: devel@edk2.groups.io; Kubacki, Michael A >> >> Cc: Kinney, Michael D ; Wang, Jian J >> ; Wu, Hao A ; Gao, Liming >> >> Subject: RE: [edk2-devel] [PATCH V1 1/1] MdeModulePkg/Variable: Fix >> volatile variable RT cache update logic >> >> Michael: >> What real issue is caused by this issue? >> >> Thanks >> Liming >> >-----Original Message----- >> >From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >> >Kubacki, Michael A >> >Sent: Monday, November 11, 2019 1:16 PM >> >To: devel@edk2.groups.io >> >Cc: Gao, Liming ; Kinney, Michael D >> >; Wang, Jian J ; Wu= , >> >Hao A >> >Subject: [edk2-devel] [PATCH V1 1/1] MdeModulePkg/Variable: Fix >> >volatile variable RT cache update logic >> > >> >REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2333 >> > >> >During a SetVariable () invocation, UpdateVariable () is called. >> >UpdateVariable () contains logic to determine whether a volatile or >> >non-volatile UEFI variable was set so the corresponding runtime cache >> >can be updated to reflect the change. The current logic simply >> >evaluates Variable->Volatile to determine which runtime cache should b= e >> >updated. >> > >> >The problem is Variable->Volatile does not always reflect whether a >> >volatile variable is being set. Variable->Volatile is set to TRUE only >> >in the case a pre-existing variable is found in the volatile variable >> >store. Therefore, the value is FALSE when a new volatile variable is >> >written. >> > >> >This change updates the logic to take this into account. If a new >> >variable is written successfully, the Attributes will accurately >> >reflect whether the variable is non-volatile. If a pre-existing >> >variable is modified, the Volatile field will reflect the type of >> >variable (Attributes are not reliable; e.g. 0x0 indicates deletion). >> > >> >Cc: Liming Gao >> >Cc: Michael D Kinney >> >Cc: Jian J Wang >> >Cc: Hao A Wu >> >Signed-off-by: Michael Kubacki >> >--- >> > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 5 ++--- >> > 1 file changed, 2 insertions(+), 3 deletions(-) >> > >> >diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> >b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> >index 29d6aca993..75d33ff724 100644 >> >--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> >+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> >@@ -2296,9 +2296,8 @@ UpdateVariable ( >> > >> > Done: >> > if (!EFI_ERROR (Status)) { >> >- if (Variable->Volatile) { >> >- VolatileCacheInstance =3D &(mVariableModuleGlobal- >> >>VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeVolatileCa >c >> h >> >e); >> >- } else { >> >+ VolatileCacheInstance =3D &(mVariableModuleGlobal- >> >>VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeVolatileCa >c >> h >> >e); >> >+ if ((Variable->CurrPtr !=3D NULL && !Variable->Volatile) || >> >+ (Attributes & >> >EFI_VARIABLE_NON_VOLATILE) !=3D 0) { >> > VolatileCacheInstance =3D &(mVariableModuleGlobal- >> >>VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeNvCache); >> > } >> > >> >-- >> >2.16.2.windows.1 >> > >> > >> > >> >