* [edk2-devel] [PATCH v1 0/1] MdeModulePkg: Warn if out of flash space when writing variables @ 2024-03-04 15:18 Oliver Steffen 2024-03-04 15:18 ` [edk2-devel] [PATCH v1 1/1] " Oliver Steffen 0 siblings, 1 reply; 7+ messages in thread From: Oliver Steffen @ 2024-03-04 15:18 UTC (permalink / raw) To: devel Cc: Oliver Steffen, Bob Feng, Liming Gao, Rebecca Cran, Yuwei Chen, Gerd Hoffmann, Laszlo Ersek Emit a DEBUG_WARN message if there is not enough flash space left to write/update a variable. This condition is currently not logged appropriately in all cases, given that full variable store can easily render the system unbootable. This new message helps identifying this condition quickly. Launching OVMF with a full variable store then looks like this (Debug Output): [...] CommonVariableSpace = 0x3FF9C - CommonVariableTotalSize = 0x3FF60 UpdateVariable failed: Out of flash space Select Item: 0xE Select Item: 0x19 RecordVarErrorFlag (0xEF) Timeout:8BE4DF61-93CA-11D2-AA0D-00E098032B8C - 0x00000007 - 0x4E CommonVariableSpace = 0x3FF9C - CommonVariableTotalSize = 0x3FF60 UpdateVariable failed: Out of flash space PlatformBootManagerBeforeConsole: SetVariable(Timeout, 3): Out of Resources RecordVarErrorFlag (0xEF) BootOrder:8BE4DF61-93CA-11D2-AA0D-00E098032B8C - 0x00000007 - 0x52 CommonVariableSpace = 0x3FF9C - CommonVariableTotalSize = 0x3FF60 UpdateVariable failed: Out of flash space ASSERT_EFI_ERROR (Status = Out of Resources) ASSERT /home/osteffen/work/firmware/edk2/edk2/edk2/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c(361): !(((INTN)(RETURN_STATUS)(Status)) < 0) PR: https://github.com/tianocore/edk2/pull/5435 Cc: Bob Feng <bob.c.feng@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Oliver Steffen (1): MdeModulePkg: Warn if out of flash space when writing variables MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.44.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116322): https://edk2.groups.io/g/devel/message/116322 Mute This Topic: https://groups.io/mt/104723951/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 7+ messages in thread
* [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Warn if out of flash space when writing variables 2024-03-04 15:18 [edk2-devel] [PATCH v1 0/1] MdeModulePkg: Warn if out of flash space when writing variables Oliver Steffen @ 2024-03-04 15:18 ` Oliver Steffen 2024-03-04 17:26 ` Laszlo Ersek 2024-03-05 0:40 ` 回复: " gaoliming via groups.io 0 siblings, 2 replies; 7+ messages in thread From: Oliver Steffen @ 2024-03-04 15:18 UTC (permalink / raw) To: devel Cc: Oliver Steffen, Bob Feng, Liming Gao, Rebecca Cran, Yuwei Chen, Gerd Hoffmann, Laszlo Ersek Emit a DEBUG_WARN message if there is not enough flash space left to write/update a variable. This condition is currently not logged appropriately in all cases, given that full variable store can easily render the system unbootable. This new message helps identifying this condition. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c index d394d237a53f..1c7659031dc5 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -2364,6 +2364,8 @@ UpdateVariable ( ); ASSERT_EFI_ERROR (Status); } + } else if (Status == EFI_OUT_OF_RESOURCES) { + DEBUG ((DEBUG_WARN, "UpdateVariable failed: Out of flash space\n")); } return Status; -- 2.44.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116321): https://edk2.groups.io/g/devel/message/116321 Mute This Topic: https://groups.io/mt/104723945/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Warn if out of flash space when writing variables 2024-03-04 15:18 ` [edk2-devel] [PATCH v1 1/1] " Oliver Steffen @ 2024-03-04 17:26 ` Laszlo Ersek 2024-03-05 0:40 ` 回复: " gaoliming via groups.io 1 sibling, 0 replies; 7+ messages in thread From: Laszlo Ersek @ 2024-03-04 17:26 UTC (permalink / raw) To: Oliver Steffen, devel Cc: Bob Feng, Liming Gao, Rebecca Cran, Yuwei Chen, Gerd Hoffmann On 3/4/24 16:18, Oliver Steffen wrote: > Emit a DEBUG_WARN message if there is not enough flash space left to > write/update a variable. This condition is currently not logged > appropriately in all cases, given that full variable store can easily > render the system unbootable. > This new message helps identifying this condition. > > Cc: Bob Feng <bob.c.feng@intel.com> > Cc: Gerd Hoffmann <kraxel@redhat.com> > Cc: Laszlo Ersek <lersek@redhat.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Rebecca Cran <rebecca@bsdio.com> > Cc: Yuwei Chen <yuwei.chen@intel.com> > > Signed-off-by: Oliver Steffen <osteffen@redhat.com> > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > index d394d237a53f..1c7659031dc5 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > @@ -2364,6 +2364,8 @@ UpdateVariable ( > ); > ASSERT_EFI_ERROR (Status); > } > + } else if (Status == EFI_OUT_OF_RESOURCES) { > + DEBUG ((DEBUG_WARN, "UpdateVariable failed: Out of flash space\n")); > } > > return Status; - I think DEBUG_ERROR is justified here, too. - Not sure if "flash" is a term that's appropriate for this driver. The function-top comment refers to "Variable region". But these are just superficial observations. Reviewed-by: Laszlo Ersek <lersek@redhat.com> Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116333): https://edk2.groups.io/g/devel/message/116333 Mute This Topic: https://groups.io/mt/104723945/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 7+ messages in thread
* 回复: [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Warn if out of flash space when writing variables 2024-03-04 15:18 ` [edk2-devel] [PATCH v1 1/1] " Oliver Steffen 2024-03-04 17:26 ` Laszlo Ersek @ 2024-03-05 0:40 ` gaoliming via groups.io 2024-03-05 7:33 ` Laszlo Ersek 1 sibling, 1 reply; 7+ messages in thread From: gaoliming via groups.io @ 2024-03-05 0:40 UTC (permalink / raw) To: devel, osteffen Cc: 'Bob Feng', 'Rebecca Cran', 'Yuwei Chen', 'Gerd Hoffmann', 'Laszlo Ersek' Oliver: If there is no enough space, Variable driver will reclaim flash and reserve the enough space at boot time. At the runtime, reclaim will not be trigged. The space may be out of resource. The warning message may be reported. Is this your case? Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Oliver Steffen > 发送时间: 2024年3月4日 23:18 > 收件人: devel@edk2.groups.io > 抄送: Oliver Steffen <osteffen@redhat.com>; Bob Feng > <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Rebecca > Cran <rebecca@bsdio.com>; Yuwei Chen <yuwei.chen@intel.com>; Gerd > Hoffmann <kraxel@redhat.com>; Laszlo Ersek <lersek@redhat.com> > 主题: [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Warn if out of flash space > when writing variables > > Emit a DEBUG_WARN message if there is not enough flash space left to > write/update a variable. This condition is currently not logged > appropriately in all cases, given that full variable store can easily > render the system unbootable. > This new message helps identifying this condition. > > Cc: Bob Feng <bob.c.feng@intel.com> > Cc: Gerd Hoffmann <kraxel@redhat.com> > Cc: Laszlo Ersek <lersek@redhat.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Rebecca Cran <rebecca@bsdio.com> > Cc: Yuwei Chen <yuwei.chen@intel.com> > > Signed-off-by: Oliver Steffen <osteffen@redhat.com> > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > index d394d237a53f..1c7659031dc5 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > @@ -2364,6 +2364,8 @@ UpdateVariable ( > ); > > ASSERT_EFI_ERROR (Status); > > } > > + } else if (Status == EFI_OUT_OF_RESOURCES) { > > + DEBUG ((DEBUG_WARN, "UpdateVariable failed: Out of flash > space\n")); > > } > > > > return Status; > > -- > 2.44.0 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116348): https://edk2.groups.io/g/devel/message/116348 Mute This Topic: https://groups.io/mt/104735640/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 回复: [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Warn if out of flash space when writing variables 2024-03-05 0:40 ` 回复: " gaoliming via groups.io @ 2024-03-05 7:33 ` Laszlo Ersek 2024-03-05 12:44 ` Oliver Steffen 0 siblings, 1 reply; 7+ messages in thread From: Laszlo Ersek @ 2024-03-05 7:33 UTC (permalink / raw) To: devel, gaoliming, osteffen Cc: 'Bob Feng', 'Rebecca Cran', 'Yuwei Chen', 'Gerd Hoffmann' On 3/5/24 01:40, gaoliming via groups.io wrote: > Oliver: > If there is no enough space, Variable driver will reclaim flash and > reserve the enough space at boot time. What if the flash is genuinely fully occupied by *live* non-volatile variables? Laszlo > At the runtime, reclaim will not be trigged. The space may be out of > resource. The warning message may be reported. Is this your case? > > Thanks > Liming >> -----邮件原件----- >> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Oliver Steffen >> 发送时间: 2024年3月4日 23:18 >> 收件人: devel@edk2.groups.io >> 抄送: Oliver Steffen <osteffen@redhat.com>; Bob Feng >> <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Rebecca >> Cran <rebecca@bsdio.com>; Yuwei Chen <yuwei.chen@intel.com>; Gerd >> Hoffmann <kraxel@redhat.com>; Laszlo Ersek <lersek@redhat.com> >> 主题: [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Warn if out of flash space >> when writing variables >> >> Emit a DEBUG_WARN message if there is not enough flash space left to >> write/update a variable. This condition is currently not logged >> appropriately in all cases, given that full variable store can easily >> render the system unbootable. >> This new message helps identifying this condition. >> >> Cc: Bob Feng <bob.c.feng@intel.com> >> Cc: Gerd Hoffmann <kraxel@redhat.com> >> Cc: Laszlo Ersek <lersek@redhat.com> >> Cc: Liming Gao <gaoliming@byosoft.com.cn> >> Cc: Rebecca Cran <rebecca@bsdio.com> >> Cc: Yuwei Chen <yuwei.chen@intel.com> >> >> Signed-off-by: Oliver Steffen <osteffen@redhat.com> >> --- >> MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> index d394d237a53f..1c7659031dc5 100644 >> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >> @@ -2364,6 +2364,8 @@ UpdateVariable ( >> ); >> >> ASSERT_EFI_ERROR (Status); >> >> } >> >> + } else if (Status == EFI_OUT_OF_RESOURCES) { >> >> + DEBUG ((DEBUG_WARN, "UpdateVariable failed: Out of flash >> space\n")); >> >> } >> >> >> >> return Status; >> >> -- >> 2.44.0 >> >> >> >> >> > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116354): https://edk2.groups.io/g/devel/message/116354 Mute This Topic: https://groups.io/mt/104735640/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 回复: [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Warn if out of flash space when writing variables 2024-03-05 7:33 ` Laszlo Ersek @ 2024-03-05 12:44 ` Oliver Steffen 2024-03-05 14:34 ` Laszlo Ersek 0 siblings, 1 reply; 7+ messages in thread From: Oliver Steffen @ 2024-03-05 12:44 UTC (permalink / raw) To: Laszlo Ersek, devel, gaoliming Cc: Bob Feng, Rebecca Cran, Yuwei Chen, Gerd Hoffmann Quoting Laszlo Ersek (2024-03-05 08:33:57) > On 3/5/24 01:40, gaoliming via groups.io wrote: > > Oliver: > > If there is no enough space, Variable driver will reclaim flash and > > reserve the enough space at boot time. > > What if the flash is genuinely fully occupied by *live* non-volatile > variables? > > Laszlo > > > At the runtime, reclaim will not be trigged. The space may be out of > > resource. The warning message may be reported. Is this your case? > > Not exactly. It is like Laszlo describes in his question above. Background: We had the case where an OVMF based VM ran out of flash space after a large number of reboots and hardware configuration changes. The MAC address of the NIC was changing a lot over the life time of the VM. The variable store was consumed entirely by networking related non-volatile variables, written for each network card/MAC address present during boot. Almost all of those were obsolete, of course, but the error that presented itself at first was a VM that failed to boot the firmware and ended up in an rather cryptic ASSERT message. The hope is that this new message makes it easier for non-experts to diagnose the situation. The root cause is of course not addressed by this, but it might also be hard to solve. One would have to identify obsolete network/hardware settings somehow, but there is no way to tell if a certain NIC/MAC might come back at a later point or not. Thanks, Oliver > > Thanks > > Liming > >> -----\u90ae\u4ef6\u539f\u4ef6----- > >> \u53d1\u4ef6\u4eba: devel@edk2.groups.io <devel@edk2.groups.io> \u4ee3\u8868 Oliver Steffen > >> \u53d1\u9001\u65f6\u95f4: 2024\u5e743\u67084\u65e5 23:18 > >> \u6536\u4ef6\u4eba: devel@edk2.groups.io > >> \u6284\u9001: Oliver Steffen <osteffen@redhat.com>; Bob Feng > >> <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Rebecca > >> Cran <rebecca@bsdio.com>; Yuwei Chen <yuwei.chen@intel.com>; Gerd > >> Hoffmann <kraxel@redhat.com>; Laszlo Ersek <lersek@redhat.com> > >> \u4e3b\u9898: [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Warn if out of flash space > >> when writing variables > >> > >> Emit a DEBUG_WARN message if there is not enough flash space left to > >> write/update a variable. This condition is currently not logged > >> appropriately in all cases, given that full variable store can easily > >> render the system unbootable. > >> This new message helps identifying this condition. > >> > >> Cc: Bob Feng <bob.c.feng@intel.com> > >> Cc: Gerd Hoffmann <kraxel@redhat.com> > >> Cc: Laszlo Ersek <lersek@redhat.com> > >> Cc: Liming Gao <gaoliming@byosoft.com.cn> > >> Cc: Rebecca Cran <rebecca@bsdio.com> > >> Cc: Yuwei Chen <yuwei.chen@intel.com> > >> > >> Signed-off-by: Oliver Steffen <osteffen@redhat.com> > >> --- > >> MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 2 ++ > >> 1 file changed, 2 insertions(+) > >> > >> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > >> b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > >> index d394d237a53f..1c7659031dc5 100644 > >> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > >> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > >> @@ -2364,6 +2364,8 @@ UpdateVariable ( > >> ); > >> > >> ASSERT_EFI_ERROR (Status); > >> > >> } > >> > >> + } else if (Status == EFI_OUT_OF_RESOURCES) { > >> > >> + DEBUG ((DEBUG_WARN, "UpdateVariable failed: Out of flash > >> space\n")); > >> > >> } > >> > >> > >> > >> return Status; > >> > >> -- > >> 2.44.0 > >> > >> > >> > >> > >> > > > > > > > > > > > > > > > > > -- 🎩Oliver Steffen (he/him) - Software Engineer, Virtualization Red Hat GmbH <https://www.redhat.com/de/global/dach>, Registered seat: Werner-von-Siemens-Ring 12, D-85630 Grasbrunn, Germany Commercial register: Amtsgericht München/Munich, HRB 153243, Managing Directors: Ryan Barnhart, Charles Cachera, Michael O'Neill, Amy Ross Everyone has different working hours… Please do not feel obligated to reply outside of your normal work schedule. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116386): https://edk2.groups.io/g/devel/message/116386 Mute This Topic: https://groups.io/mt/104735640/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 回复: [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Warn if out of flash space when writing variables 2024-03-05 12:44 ` Oliver Steffen @ 2024-03-05 14:34 ` Laszlo Ersek 0 siblings, 0 replies; 7+ messages in thread From: Laszlo Ersek @ 2024-03-05 14:34 UTC (permalink / raw) To: Oliver Steffen, devel, gaoliming Cc: Bob Feng, Rebecca Cran, Yuwei Chen, Gerd Hoffmann On 3/5/24 13:44, Oliver Steffen wrote: > The root cause is of course not addressed by this, but it might also be > hard to solve. One would have to identify obsolete network/hardware > settings somehow, but there is no way to tell if a certain NIC/MAC > might come back at a later point or not. Tricky because, even if you could identify a non-volatile variable named after a MAC that matched *no* NIC in the system, you still might not want to remove that variable. What if the user unplugged the NIC only temporarily, and "wanted their settings back" upon re-plugging the NIC? Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116395): https://edk2.groups.io/g/devel/message/116395 Mute This Topic: https://groups.io/mt/104735640/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-03-05 14:34 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-03-04 15:18 [edk2-devel] [PATCH v1 0/1] MdeModulePkg: Warn if out of flash space when writing variables Oliver Steffen 2024-03-04 15:18 ` [edk2-devel] [PATCH v1 1/1] " Oliver Steffen 2024-03-04 17:26 ` Laszlo Ersek 2024-03-05 0:40 ` 回复: " gaoliming via groups.io 2024-03-05 7:33 ` Laszlo Ersek 2024-03-05 12:44 ` Oliver Steffen 2024-03-05 14:34 ` Laszlo Ersek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox