From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web12.32671.1608512285821312998 for ; Sun, 20 Dec 2020 16:58:07 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Mon, 21 Dec 2020 08:58:02 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: "'Tan, Ming'" , Cc: "'Bi, Dandan'" , References: <20201217135859.1677-1-ming.tan@intel.com> <006c01d6d4da$73513830$59f3a890$@byosoft.com.cn> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHY1XSBNZGVNb2R1bGVQa2cvVW5pdmVyc2FsL1N0YXR1c0NvZGVIYW5kbGVyOiBGaXggYSBidWcgYWJvdXQgbG9nIGxvc3Q=?= Date: Mon, 21 Dec 2020 08:58:02 +0800 Message-ID: <011f01d6d734$55c73c40$0155b4c0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQF0vCiA2FoGkk3XFoWjrToDdCaiggJ+47mkAi+sFcOqn3r2IA== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Ming: In fact, UnregisterBootTimeHandlers is not required any more. Each Repor= tWorker() should call mRscHandlerProtocol to unregister itself.=20 If UnregisterBootTimeHandlers is still kept, it may be wrongly used for = the future reportworker extension.=20 Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: Tan, Ming > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2020=E5=B9=B412=E6=9C=8818=E6=97= =A5 9:21 > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io; gaoliming@byosoft.com= .cn > =E6=8A=84=E9=80=81: Bi, Dandan > =E4=B8=BB=E9=A2=98: RE: [edk2-devel] [PATCH v5] > MdeModulePkg/Universal/StatusCodeHandler: Fix a bug about log lost >=20 > Liming: > Yes, in another private driver about status code, there are several ha= ndlers > need to be unregistered, so I create several unregister functions to be = called. > And currently the UnregisterBootTimeHandlers function only has one > handler need to be unregistered, so I call it directly. If we want to hi= ghlight it, I > can change the function name to UnregisterSerialBootTimeHandlers(). >=20 > BR/Tan Ming. >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of gaoliming > Sent: Friday, December 18, 2020 9:10 AM > To: devel@edk2.groups.io; Tan, Ming > Cc: Bi, Dandan > Subject: =E5=9B=9E=E5=A4=8D: [edk2-devel] [PATCH v5] > MdeModulePkg/Universal/StatusCodeHandler: Fix a bug about log lost >=20 > Ming: > This change uses the accurate point to exit boot service. It is a good > enhancement. >=20 > For the patch, I have one comment that SerialStatusCodeReportWorker() > should call mRscHandlerProtocol unregister itself. > If there are more than one Status code handlers to be unregistered at = the > exit boot service, each handler should unregister itself. >=20 > Thanks > Liming > > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > > =E5=8F=91=E4=BB=B6=E4=BA=BA: bounce+27952+69130+4905953+8761045@groups= .io > > =E4=BB=A3=E8=A1=A8 Tan,= Ming > > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2020=E5=B9=B412=E6=9C=8817=E6=97= = =A5 21:59 > > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > > =E6=8A=84=E9=80=81: Dandan Bi ; Liming Gao > > > > =E4=B8=BB=E9=A2=98: [edk2-devel] [PATCH v5] > MdeModulePkg/Universal/StatusCodeHandler: > > Fix a bug about log lost > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3126 > > > > 1. If use PeiDxeDebugLibReportStatusCode as DebugLib, then some logs > > after ExitBootService() will be lost. > > 2. The root cause: > > 2.1 The original code will register an unregister function of > > gEfiEventExitBootServicesGuid, this unregister function will call > > EFI_RSC_HANDLER_PROTOCOL->Unregister and does not support log > through > > serial port. > > 2.2 And some other drivers also register call back funtions of > > gEfiEventExitBootServicesGuid. > > 2.3 Then after the unregister function is called, other call back > > functions can't out log if them use RSC as DebugLib. > > 3. The DxeMain will report status code > EFI_SW_BS_PC_EXIT_BOOT_SERVICES > > after notify all the call back functions of > > gEfiEventExitBootServicesGuid. > > 4. Solution: the StatusCodeHandlerRuntimeDxe.c will not register an > > unregister function of gEfiEventExitBootServicesGuid, but unregister > > it after receive the status code of EFI_SW_BS_PC_EXIT_BOOT_SERVICES. > > > > Cc: Dandan Bi > > Cc: Liming Gao > > Signed-off-by: Ming Tan > > --- > > V5: Fix an unused var bug and compile error using GCC. > > V4: Fix a spell bug in code comment, change 'a' to 'an' before > 'unregister'. > > V3: Fix a spell bug in commit message, change 'a' to 'an' before > 'unregister'. > > V2: Add the REF link in commit message. > > > > .../RuntimeDxe/SerialStatusCodeWorker.c | 10 ++++++++++ > > .../RuntimeDxe/StatusCodeHandlerRuntimeDxe.c | 17 +---------------= - > > .../RuntimeDxe/StatusCodeHandlerRuntimeDxe.h | 11 +++++++++++ > > 3 files changed, 22 insertions(+), 16 deletions(-) > > > > diff --git > > > a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/SerialStatusCo > > deWorker.c > > > b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/SerialStatusCo > > deWorker.c > > index 0b98e7ec63..f7ab71e32a 100644 > > --- > > > a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/SerialStatusCo > > deWorker.c > > +++ > > > b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/SerialStatusCo > > deWorker.c > > @@ -151,6 +151,16 @@ SerialStatusCodeReportWorker ( > > // > > > > SerialPortWrite ((UINT8 *) Buffer, CharCount); > > > > > > > > + // > > > > + // If register an unregister function of > > + gEfiEventExitBootServicesGuid, > > > > + // then some log called in ExitBootServices() will be lost, > > > > + // so unregister the handler after receive the value of exit boot > service. > > > > + // > > > > + if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) =3D=3D > EFI_PROGRESS_CODE > > && > > > > + Value =3D=3D (EFI_SOFTWARE_EFI_BOOT_SERVICE | > > EFI_SW_BS_PC_EXIT_BOOT_SERVICES)) { > > > > + UnregisterBootTimeHandlers(); > > > > + } > > > > + > > > > return EFI_SUCCESS; > > > > } > > > > > > > > diff --git > > > a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHa > > ndlerRuntimeDxe.c > > > b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHa > > ndlerRuntimeDxe.c > > index a8c0fe5b71..2e11c1f4d2 100644 > > --- > > > a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHa > > ndlerRuntimeDxe.c > > +++ > > > b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHa > > ndlerRuntimeDxe.c > > @@ -10,23 +10,17 @@ > > #include "StatusCodeHandlerRuntimeDxe.h" > > > > > > > > EFI_EVENT mVirtualAddressChangeEvent =3D NULL; > > > > -static EFI_EVENT mExitBootServicesEvent =3D NULL; > > > > EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol =3D NULL; > > > > > > > > /** > > > > Unregister status code callback functions only available at boot > > time > from > > > > report status code router when exiting boot services. > > > > > > > > - @param Event Event whose notification function is being > > invoked. > > > > - @param Context Pointer to the notification function's contex= t, > > which is > > > > - always zero in current implementation. > > > > - > > > > **/ > > > > VOID > > > > EFIAPI > > > > UnregisterBootTimeHandlers ( > > > > - IN EFI_EVENT Event, > > > > - IN VOID *Context > > > > + VOID > > > > ) > > > > { > > > > if (PcdGetBool (PcdStatusCodeUseSerial)) { > > > > @@ -178,15 +172,6 @@ StatusCodeHandlerRuntimeDxeEntry ( > > mRscHandlerProtocol->Register > (RtMemoryStatusCodeReportWorker, > > TPL_HIGH_LEVEL); > > > > } > > > > > > > > - Status =3D gBS->CreateEventEx ( > > > > - EVT_NOTIFY_SIGNAL, > > > > - TPL_NOTIFY, > > > > - UnregisterBootTimeHandlers, > > > > - NULL, > > > > - &gEfiEventExitBootServicesGuid, > > > > - &mExitBootServicesEvent > > > > - ); > > > > - > > > > Status =3D gBS->CreateEventEx ( > > > > EVT_NOTIFY_SIGNAL, > > > > TPL_NOTIFY, > > > > diff --git > > > a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHa > > ndlerRuntimeDxe.h > > > b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHa > > ndlerRuntimeDxe.h > > index fd4689c2d7..f1789dc538 100644 > > --- > > > a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHa > > ndlerRuntimeDxe.h > > +++ > > > b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHa > > ndlerRuntimeDxe.h > > @@ -118,4 +118,15 @@ RtMemoryStatusCodeReportWorker ( > > IN EFI_STATUS_CODE_DATA *Data OPTIONAL > > > > ); > > > > > > > > +/** > > > > + Unregister status code callback functions only available at boot > > + time > from > > > > + report status code router when exiting boot services. > > > > + > > > > +**/ > > > > +VOID > > > > +EFIAPI > > > > +UnregisterBootTimeHandlers ( > > > > + VOID > > > > + ); > > > > + > > > > #endif > > > > -- > > 2.24.0.windows.2 > > > > > > > > -=3D-=3D-=3D-=3D-=3D-=3D > > Groups.io Links: You receive all messages sent to this group. > > View/Reply Online (#69130): > > https://edk2.groups.io/g/devel/message/69130 > > Mute This Topic: https://groups.io/mt/79036460/4905953 > > Group Owner: devel+owner@edk2.groups.io > > Unsubscribe: https://edk2.groups.io/g/devel/unsub > > [gaoliming@byosoft.com.cn] > > -=3D-=3D-=3D-=3D-=3D-=3D > > >=20 >=20 >=20 >=20 >=20 >=20 >=20