Re: [edk2] Question about FaultTolerantWriteDxe and VariableRuntimeDxe

Subject: Re: [edk2] Question about FaultTolerantWriteDxe and VariableRuntimeDxe

From: nicolas <nicolas1968@163.com>

To: edk2-devel@lists.sourceforge.net

Date: 2012-04-01 18:02:26

 hi, Hawk:

"For example, a power failure may just occur after variable storage is erased to FF, but before the defragmented variable data is programmed, during the process of variable reclaim. "

 

In this example, i think letting variable dxe driver continues doing reclaim operation is meaningless in next boot cycle .

Because PEI Phase could not get any useful variables during the next boot cycle, it would cause dxe phase not stable. 

And it could not assure defragmented variables not be damaged during a occasional power failure.

 

best wishes


: Andrew Fish [mailto:afish@apple.com]
:
201241 0:40
:
edk2-devel@lists.sourceforge.net
: Re: [edk2] : Question about FaultTolerantWriteDxe and VariableRuntimeDxe

 

On Mar 31, 2012, at 8:38 AM, Hawk wrote:



Andrew,

 

Thanks for your information.

 

My concern is that FTW driver should be dispatched before variable driver to handle any illegal case. For example, a power failure may just occur after variable storage is erased to FF, but before the defragmented variable data is programmed, during the process of variable reclaim. Then in the next boot circle, the variable driver cant handle this case but simply return error (refer to VariableCommonInitialize() in variable.c). Even FaultTolerant driver just has capability to handle this case, but it may have no chance to run as the dispatching may stopped.

 

Thanks I understand your point now. Yes there is a case where the ready only service of the driver may not work. If I remember we ran into issues of drivers needing read access to the variable store early in the boot process so delaying the entire variable services was not desirable. But you also bring up a good point. 

 

If drivers want the more reliable quality of service for reads (your example case) then that driver should depend on gEfiVariableWriteArchProtocolGuid.This is an interesting point and maybe we should document this in the PI spec. I will bring it up with the spec committee. 

 

Thanks,

 

Andrew



 

Thanks,

Hawk.

 

: Andrew Fish [mailto:afish@apple.com] 
pan lang="EN-US">: 2012331 23:15
: edk2-devel@lists.sourceforge.net
: Re: [edk2] Question about FaultTolerantWriteDxe and VariableRuntimeDxe

 

Hawk,

 

It looks like edk2 Variable driver registers an event called FtwNotificationEvent() so it can detect when the FaultTolerantWrite protocol becomes available. 

 

If you look at the variable driver when it installs it publishes gEfiVariableArchProtocolGuid, and this combined with a dependency expression of TRUE this gives read access to variables early in the DXE phase. When the FTW protocol is available the variable driver publishes  gEfiVariableWriteArchProtocolGuid.

 

This means if your DXE driver needs to write to the variable store it should depend on gEfiVariableWriteArchProtocolGuid.  If your driver only needs read access it should depend on gEfiVariableArchProtocolGuid. This is defined in the latest PI spec. 

 

Andrew Fish

 

On Mar 31, 2012, at 4:33 AM, Hawk wrote:




Hi All,

 

Here is one question about the dispatcher order of FaultTolerantWriteDxe and VariableRuntimeDxe under MdeModulePkg\Universal\Variable\RuntimeDxe.

As you know VariableRuntime driver needs to use the protocol EFI_FAULT_TOLERANT_WRITE_PROTOCOL to reclaim the storage space, which is produced by FaultTolerantWriteDxe, when the variable storage is full. So our understanding is FaultTolerantWriteDxe should be dispatched before VariableRuntimeDxe to recover from illegal state in DXE phase, if there is any unexpected failure occurs in reclaim process. But we observed this requirement is not explicitly defined in dependency of VariableRuntimeDxe. Is there any other consideration about this?

 

BTW, With EDK codebase, we can observed that this is just done in this way.

 

 

Thanks,

Hawk.

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

 

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel