Michael:
  Can the logic be simplified to only check this condition 'Attributes & 
EFI_VARIABLE_NON_VOLATILE) != 0'?

Thanks
Liming
>-----Original Message-----
>From: Kubacki, Michael A
>Sent: Monday, November 11, 2019 2:11 PM
>To: Gao, Liming <[email protected]>; [email protected]
>Cc: Kinney, Michael D <[email protected]>; Wang, Jian J
><[email protected]>; Wu, Hao A <[email protected]>
>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 <[email protected]>
>> Sent: Sunday, November 10, 2019 10:08 PM
>> To: [email protected]; Kubacki, Michael A
>> <[email protected]>
>> Cc: Kinney, Michael D <[email protected]>; Wang, Jian J
>> <[email protected]>; Wu, Hao A <[email protected]>; Gao, Liming
>> <[email protected]>
>> 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: [email protected] [mailto:[email protected]] On Behalf Of
>> >Kubacki, Michael A
>> >Sent: Monday, November 11, 2019 1:16 PM
>> >To: [email protected]
>> >Cc: Gao, Liming <[email protected]>; Kinney, Michael D
>> ><[email protected]>; Wang, Jian J <[email protected]>; Wu,
>> >Hao A <[email protected]>
>> >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=2333
>> >
>> >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 be
>> >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 <[email protected]>
>> >Cc: Michael D Kinney <[email protected]>
>> >Cc: Jian J Wang <[email protected]>
>> >Cc: Hao A Wu <[email protected]>
>> >Signed-off-by: Michael Kubacki <[email protected]>
>> >---
>> > 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 = &(mVariableModuleGlobal-
>> >>VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeVolatileCa
>c
>> h
>> >e);
>> >-    } else {
>> >+    VolatileCacheInstance = &(mVariableModuleGlobal-
>> >>VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeVolatileCa
>c
>> h
>> >e);
>> >+    if ((Variable->CurrPtr != NULL && !Variable->Volatile) ||
>> >+ (Attributes &
>> >EFI_VARIABLE_NON_VOLATILE) != 0) {
>> >       VolatileCacheInstance = &(mVariableModuleGlobal-
>> >>VariableGlobal.VariableRuntimeCacheContext.VariableRuntimeNvCache);
>> >     }
>> >
>> >--
>> >2.16.2.windows.1
>> >
>> >
>> >
>>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#50390): https://edk2.groups.io/g/devel/message/50390
Mute This Topic: https://groups.io/mt/52162397/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to