From: "Kubacki, Michael A" <michael.a.kubacki@intel.com>
To: "Wu, Hao A" <hao.a.wu@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Bi, Dandan" <dandan.bi@intel.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
"Dong, Eric" <eric.dong@intel.com>,
Laszlo Ersek <lersek@redhat.com>,
"Gao, Liming" <liming.gao@intel.com>,
"Kinney, Michael D" <michael.d.kinney@intel.com>,
"Ni, Ray" <ray.ni@intel.com>,
"Wang, Jian J" <jian.j.wang@intel.com>,
"Yao, Jiewen" <jiewen.yao@intel.com>
Subject: Re: [PATCH V2 3/9] MdeModulePkg/Variable: Parameterize VARIABLE_INFO_ENTRY buffer
Date: Thu, 3 Oct 2019 18:05:57 +0000 [thread overview]
Message-ID: <DM6PR11MB3834A6C5A0709B846D8005AAB59F0@DM6PR11MB3834.namprd11.prod.outlook.com> (raw)
In-Reply-To: <B80AF82E9BFB8E4FBD8C89DA810C6A093C940D40@SHSMSX104.ccr.corp.intel.com>
Your understanding is correct.
Thanks,
Michael
> -----Original Message-----
> From: Wu, Hao A <hao.a.wu@intel.com>
> Sent: Thursday, October 3, 2019 1:04 AM
> To: Kubacki, Michael A <michael.a.kubacki@intel.com>;
> devel@edk2.groups.io
> Cc: Bi, Dandan <dandan.bi@intel.com>; Ard Biesheuvel
> <ard.biesheuvel@linaro.org>; Dong, Eric <eric.dong@intel.com>; Laszlo Ersek
> <lersek@redhat.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael
> D <michael.d.kinney@intel.com>; Ni, Ray <ray.ni@intel.com>; Wang, Jian J
> <jian.j.wang@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: RE: [PATCH V2 3/9] MdeModulePkg/Variable: Parameterize
> VARIABLE_INFO_ENTRY buffer
>
> > -----Original Message-----
> > From: Kubacki, Michael A
> > Sent: Saturday, September 28, 2019 9:47 AM
> > To: devel@edk2.groups.io
> > Cc: Bi, Dandan; Ard Biesheuvel; Dong, Eric; Laszlo Ersek; Gao, Liming;
> > Kinney, Michael D; Ni, Ray; Wang, Jian J; Wu, Hao A; Yao, Jiewen
> > Subject: [PATCH V2 3/9] MdeModulePkg/Variable: Parameterize
> > VARIABLE_INFO_ENTRY buffer
> >
> > UpdateVariableInfo () currently accepts parameters regarding updates
> > to be made to a global variable of type VARIABLE_INFO_ENTRY. This
> > change passes the structure by pointer to UpdateVariableInfo () so
> > structures can be updated outside the fixed global variable.
>
>
> For:
> "... so structures can be updated outside the fixed global variable "
>
> Do you mean:
>
> VARIABLE_INFO_ENTRY structure pointers other than "&gVariableInfo" can
> be passed to UpdateVariableInfo().
>
> Is my understanding correct? If so,
> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
>
> Best Regards,
> Hao Wu
>
>
> >
> > Cc: Dandan Bi <dandan.bi@intel.com>
> > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > Cc: Eric Dong <eric.dong@intel.com>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Jian J Wang <jian.j.wang@intel.com>
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com>
> > ---
> > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h | 18
> > +++++----
> > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 14 +++---
> -
> > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c | 41
> > +++++++++++---------
> > 3 files changed, 39 insertions(+), 34 deletions(-)
> >
> > diff --git
> > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h
> > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h
> > index 0d231511ea..6f2000f3ee 100644
> > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h
> > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h
> > @@ -286,13 +286,14 @@ GetNextVariableEx (
> > the transaction. Data is allocated by this routine, but never
> > freed.
> >
> > - @param[in] VariableName Name of the Variable to track.
> > - @param[in] VendorGuid Guid of the Variable to track.
> > - @param[in] Volatile TRUE if volatile FALSE if non-volatile.
> > - @param[in] Read TRUE if GetVariable() was called.
> > - @param[in] Write TRUE if SetVariable() was called.
> > - @param[in] Delete TRUE if deleted via SetVariable().
> > - @param[in] Cache TRUE for a cache hit.
> > + @param[in] VariableName Name of the Variable to track.
> > + @param[in] VendorGuid Guid of the Variable to track.
> > + @param[in] Volatile TRUE if volatile FALSE if non-volatile.
> > + @param[in] Read TRUE if GetVariable() was called.
> > + @param[in] Write TRUE if SetVariable() was called.
> > + @param[in] Delete TRUE if deleted via SetVariable().
> > + @param[in] Cache TRUE for a cache hit.
> > + @param[in,out] VariableInfo Pointer to a pointer of
> > VARIABLE_INFO_ENTRY structures.
> >
> > **/
> > VOID
> > @@ -303,7 +304,8 @@ UpdateVariableInfo (
> > IN BOOLEAN Read,
> > IN BOOLEAN Write,
> > IN BOOLEAN Delete,
> > - IN BOOLEAN Cache
> > + IN BOOLEAN Cache,
> > + IN OUT VARIABLE_INFO_ENTRY **VariableInfo
> > );
> >
> > #endif
> > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
> > b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
> > index 816e8f7b8f..1a57d7e1ba 100644
> > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
> > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
> > @@ -1641,7 +1641,7 @@ UpdateVariable (
> > // go to delete this variable in variable HOB and
> > // try to flush other variables from HOB to flash.
> > //
> > - UpdateVariableInfo (VariableName, VendorGuid, FALSE, FALSE,
> FALSE,
> > TRUE, FALSE);
> > + UpdateVariableInfo (VariableName, VendorGuid, FALSE, FALSE,
> > + FALSE,
> > TRUE, FALSE, &gVariableInfo);
> > FlushHobVariableToFlash (VariableName, VendorGuid);
> > return EFI_SUCCESS;
> > }
> > @@ -1758,7 +1758,7 @@ UpdateVariable (
> > &State
> > );
> > if (!EFI_ERROR (Status)) {
> > - UpdateVariableInfo (VariableName, VendorGuid, Variable->Volatile,
> > FALSE, FALSE, TRUE, FALSE);
> > + UpdateVariableInfo (VariableName, VendorGuid,
> > + Variable->Volatile,
> > FALSE, FALSE, TRUE, FALSE, &gVariableInfo);
> > if (!Variable->Volatile) {
> > CacheVariable->CurrPtr->State = State;
> > FlushHobVariableToFlash (VariableName, VendorGuid); @@
> > -1777,7 +1777,7 @@ UpdateVariable (
> > //
> > // Variable content unchanged and no need to update timestamp,
> > just return.
> > //
> > - UpdateVariableInfo (VariableName, VendorGuid, Variable->Volatile,
> > FALSE, TRUE, FALSE, FALSE);
> > + UpdateVariableInfo (VariableName, VendorGuid,
> > + Variable->Volatile,
> > FALSE, TRUE, FALSE, FALSE, &gVariableInfo);
> > Status = EFI_SUCCESS;
> > goto Done;
> > } else if ((CacheVariable->CurrPtr->State == VAR_ADDED) || @@
> > -2006,7 +2006,7 @@ UpdateVariable (
> > CacheVariable->CurrPtr = (VARIABLE_HEADER *)((UINTN)
> > CacheVariable->StartPtr + ((UINTN) Variable->CurrPtr - (UINTN)
> > CacheVariable->Variable-
> > >StartPtr));
> > CacheVariable->InDeletedTransitionPtr = NULL;
> > }
> > - UpdateVariableInfo (VariableName, VendorGuid, FALSE, FALSE, TRUE,
> > FALSE, FALSE);
> > + UpdateVariableInfo (VariableName, VendorGuid, FALSE, FALSE,
> > + TRUE,
> > FALSE, FALSE, &gVariableInfo);
> > FlushHobVariableToFlash (VariableName, VendorGuid);
> > } else {
> > if (IsCommonUserVariable && ((VarSize +
> > mVariableModuleGlobal-
> > >CommonUserVariableTotalSize) > mVariableModuleGlobal-
> > >CommonMaxUserVariableSpace)) {
> > @@ -2156,7 +2156,7 @@ UpdateVariable (
> > CacheVariable->CurrPtr = (VARIABLE_HEADER *)((UINTN)
> > CacheVariable->StartPtr + ((UINTN) Variable->CurrPtr - (UINTN)
> > CacheVariable->Variable-
> > >StartPtr));
> > CacheVariable->InDeletedTransitionPtr = NULL;
> > }
> > - UpdateVariableInfo (VariableName, VendorGuid, TRUE, FALSE, TRUE,
> > FALSE, FALSE);
> > + UpdateVariableInfo (VariableName, VendorGuid, TRUE, FALSE,
> > + TRUE,
> > FALSE, FALSE, &gVariableInfo);
> > }
> > goto Done;
> > }
> > @@ -2227,7 +2227,7 @@ UpdateVariable (
> > }
> >
> > if (!EFI_ERROR (Status)) {
> > - UpdateVariableInfo (VariableName, VendorGuid, Volatile, FALSE, TRUE,
> > FALSE, FALSE);
> > + UpdateVariableInfo (VariableName, VendorGuid, Volatile, FALSE,
> > + TRUE,
> > FALSE, FALSE, &gVariableInfo);
> > if (!Volatile) {
> > FlushHobVariableToFlash (VariableName, VendorGuid);
> > }
> > @@ -2306,7 +2306,7 @@ VariableServiceGetVariable (
> > }
> >
> > *DataSize = VarDataSize;
> > - UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile,
> TRUE,
> > FALSE, FALSE, FALSE);
> > + UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile,
> > + TRUE,
> > FALSE, FALSE, FALSE, &gVariableInfo);
> >
> > Status = EFI_SUCCESS;
> > goto Done;
> > diff --git
> > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c
> > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c
> > index 9bc5369a90..394195342d 100644
> > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c
> > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c
> > @@ -660,13 +660,14 @@ Done:
> > the transaction. Data is allocated by this routine, but never
> > freed.
> >
> > - @param[in] VariableName Name of the Variable to track.
> > - @param[in] VendorGuid Guid of the Variable to track.
> > - @param[in] Volatile TRUE if volatile FALSE if non-volatile.
> > - @param[in] Read TRUE if GetVariable() was called.
> > - @param[in] Write TRUE if SetVariable() was called.
> > - @param[in] Delete TRUE if deleted via SetVariable().
> > - @param[in] Cache TRUE for a cache hit.
> > + @param[in] VariableName Name of the Variable to track.
> > + @param[in] VendorGuid Guid of the Variable to track.
> > + @param[in] Volatile TRUE if volatile FALSE if non-volatile.
> > + @param[in] Read TRUE if GetVariable() was called.
> > + @param[in] Write TRUE if SetVariable() was called.
> > + @param[in] Delete TRUE if deleted via SetVariable().
> > + @param[in] Cache TRUE for a cache hit.
> > + @param[in,out] VariableInfo Pointer to a pointer of
> > VARIABLE_INFO_ENTRY structures.
> >
> > **/
> > VOID
> > @@ -677,35 +678,38 @@ UpdateVariableInfo (
> > IN BOOLEAN Read,
> > IN BOOLEAN Write,
> > IN BOOLEAN Delete,
> > - IN BOOLEAN Cache
> > + IN BOOLEAN Cache,
> > + IN OUT VARIABLE_INFO_ENTRY **VariableInfo
> > )
> > {
> > VARIABLE_INFO_ENTRY *Entry;
> >
> > if (FeaturePcdGet (PcdVariableCollectStatistics)) {
> > -
> > + if (VariableName == NULL || VendorGuid == NULL || VariableInfo ==
> > NULL) {
> > + return;
> > + }
> > if (AtRuntime ()) {
> > // Don't collect statistics at runtime.
> > return;
> > }
> >
> > - if (gVariableInfo == NULL) {
> > + if (*VariableInfo == NULL) {
> > //
> > // On the first call allocate a entry and place a pointer to it in
> > // the EFI System Table.
> > //
> > - gVariableInfo = AllocateZeroPool (sizeof (VARIABLE_INFO_ENTRY));
> > - ASSERT (gVariableInfo != NULL);
> > + *VariableInfo = AllocateZeroPool (sizeof (VARIABLE_INFO_ENTRY));
> > + ASSERT (*VariableInfo != NULL);
> >
> > - CopyGuid (&gVariableInfo->VendorGuid, VendorGuid);
> > - gVariableInfo->Name = AllocateZeroPool (StrSize (VariableName));
> > - ASSERT (gVariableInfo->Name != NULL);
> > - StrCpyS (gVariableInfo->Name, StrSize(VariableName)/sizeof(CHAR16),
> > VariableName);
> > - gVariableInfo->Volatile = Volatile;
> > + CopyGuid (&(*VariableInfo)->VendorGuid, VendorGuid);
> > + (*VariableInfo)->Name = AllocateZeroPool (StrSize (VariableName));
> > + ASSERT ((*VariableInfo)->Name != NULL);
> > + StrCpyS ((*VariableInfo)->Name,
> > + StrSize(VariableName)/sizeof(CHAR16),
> > VariableName);
> > + (*VariableInfo)->Volatile = Volatile;
> > }
> >
> >
> > - for (Entry = gVariableInfo; Entry != NULL; Entry = Entry->Next) {
> > + for (Entry = (*VariableInfo); Entry != NULL; Entry = Entry->Next)
> > + {
> > if (CompareGuid (VendorGuid, &Entry->VendorGuid)) {
> > if (StrCmp (VariableName, Entry->Name) == 0) {
> > if (Read) {
> > @@ -739,7 +743,6 @@ UpdateVariableInfo (
> > StrCpyS (Entry->Next->Name,
> > StrSize(VariableName)/sizeof(CHAR16),
> > VariableName);
> > Entry->Next->Volatile = Volatile;
> > }
> > -
> > }
> > }
> > }
> > --
> > 2.16.2.windows.1
>
next prev parent reply other threads:[~2019-10-03 18:07 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-28 1:47 [PATCH V2 0/9] UEFI Variable SMI Reduction Kubacki, Michael A
2019-09-28 1:47 ` [PATCH V2 1/9] MdeModulePkg/Variable: Consolidate common parsing functions Kubacki, Michael A
2019-10-03 8:03 ` Wu, Hao A
2019-10-03 17:35 ` Kubacki, Michael A
2019-10-08 2:11 ` Wu, Hao A
2019-10-08 21:53 ` Kubacki, Michael A
2019-10-08 6:07 ` Wang, Jian J
2019-10-08 22:00 ` Kubacki, Michael A
2019-09-28 1:47 ` [PATCH V2 2/9] MdeModulePkg/Variable: Parameterize GetNextVariableEx() store list Kubacki, Michael A
2019-10-03 8:03 ` Wu, Hao A
2019-10-03 18:04 ` Kubacki, Michael A
2019-09-28 1:47 ` [PATCH V2 3/9] MdeModulePkg/Variable: Parameterize VARIABLE_INFO_ENTRY buffer Kubacki, Michael A
2019-10-03 8:03 ` Wu, Hao A
2019-10-03 18:05 ` Kubacki, Michael A [this message]
2019-10-08 2:11 ` [edk2-devel] " Wu, Hao A
2019-10-08 21:49 ` Kubacki, Michael A
2019-09-28 1:47 ` [PATCH V2 4/9] MdeModulePkg/Variable: Add local auth status in VariableParsing Kubacki, Michael A
2019-10-03 8:04 ` [edk2-devel] " Wu, Hao A
2019-10-03 18:35 ` Kubacki, Michael A
2019-10-16 7:55 ` Wu, Hao A
2019-10-16 16:37 ` Kubacki, Michael A
2019-10-17 1:00 ` Wu, Hao A
2019-09-28 1:47 ` [PATCH V2 5/9] MdeModulePkg/Variable: Add a file for NV variable functions Kubacki, Michael A
2019-10-03 8:04 ` Wu, Hao A
2019-10-03 18:43 ` Kubacki, Michael A
2019-09-28 1:47 ` [PATCH V2 6/9] MdeModulePkg VariableInfo: Always consider RT DXE and SMM stats Kubacki, Michael A
2019-10-03 8:04 ` Wu, Hao A
2019-09-28 1:47 ` [PATCH V2 7/9] MdeModulePkg/Variable: Add RT GetVariable() cache support Kubacki, Michael A
2019-10-03 8:04 ` Wu, Hao A
2019-10-03 11:00 ` Laszlo Ersek
2019-10-03 20:53 ` Kubacki, Michael A
2019-10-03 21:53 ` Kubacki, Michael A
2019-10-03 22:01 ` Michael D Kinney
2019-10-03 23:31 ` Kubacki, Michael A
2019-10-04 6:50 ` Laszlo Ersek
2019-10-04 16:48 ` Kubacki, Michael A
2019-10-04 6:38 ` Laszlo Ersek
2019-10-04 16:48 ` Kubacki, Michael A
2019-10-08 2:12 ` Wu, Hao A
2019-09-28 1:47 ` [PATCH V2 8/9] MdeModulePkg/Variable: Add RT GetNextVariableName() " Kubacki, Michael A
2019-10-03 8:04 ` Wu, Hao A
2019-10-03 18:52 ` Kubacki, Michael A
2019-10-03 18:59 ` [edk2-devel] " Andrew Fish
2019-10-03 20:12 ` Kubacki, Michael A
2019-09-28 1:47 ` [PATCH V2 9/9] MdeModulePkg/VariableSmm: Remove unused SMI handler functions Kubacki, Michael A
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM6PR11MB3834A6C5A0709B846D8005AAB59F0@DM6PR11MB3834.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox