From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.36254.1608535070779485410 for ; Sun, 20 Dec 2020 23:17:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=QqWxYCv7; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: ming.tan@intel.com) IronPort-SDR: 6G/e32z49he4d+2S8sJhfU4/yiqKQy6rRcm+lrJfEpad+y3ZTOpcdPVpX9G/8foLkv8D3an/Rk zqMqCj1WgliA== X-IronPort-AV: E=McAfee;i="6000,8403,9841"; a="239775692" X-IronPort-AV: E=Sophos;i="5.78,436,1599548400"; d="scan'208";a="239775692" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2020 23:17:47 -0800 IronPort-SDR: ccrh9aProVXHr/WnA+GCwsIxlg3xR9BLnvfjIjkYJUm1SjCQC1NfKTWytL76U0RYj0VBNNKiCX OdjDEL5Armvg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,436,1599548400"; d="scan'208";a="491412678" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga004.jf.intel.com with ESMTP; 20 Dec 2020 23:17:46 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 20 Dec 2020 23:17:45 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 20 Dec 2020 23:17:45 -0800 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.40) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Sun, 20 Dec 2020 23:17:45 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GwQv0gHkv6ViLaBMXT6G6Gm8qn5IB+vl8Jdb1KOW4GIXdJH9IKhNnV8JZIo+OUva4gcSsmJLzJL3l6kFAEBgvLRGEMACJDHd4JqNazo6SLHybSmPlbj0aWz68qustXPWbI8R3h9CrPl7kdj76h3kSY71KG24tiRZw2r9a0b+DzTJoeqiPs8dE1Wwvt9blvRzQ59y7v1CTBlGPw3MfvTCl1EjRS56Mhqo6Rb6BsKWwFjqlhlJIeBOjYVYBztMXZ75P/7f+goWDvo+stQ1KitTUwBG6el2jRx31UPjar/WvQR82imiwRwHpBvf30Cb5CXrU4gdfF9+N12kuVmPPu4d4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JAtnyZcGqis8sE7X3INNz4ZwVVaFO5BTHl1KPBBJQ4o=; b=MH5Kn+Wq4Duu+rociqGKtbroyr8DJigYly72U/IFTVxB6VWVxdyaOlgiTG8tNWlkdN7lLkothQ7+m08H/U7aTUEg5siBcKxVJ7QbSMQqp/Y/v5D8oyoW8P4Ad02r5a2oIPoZooghsAqoyStsy7C1fk1/xiPoLJRThzRYqlUxkfXSzQxrihgu6BY5IH3iHpROMlanKGf5KZKlg5+hLUG3E+bDNcpdJ0YJdUWxMg2QqY3EiWd1exHHKcGp5HZN2C0/+fy7I0QZo0KCfVstkBXauv0PuGkQx/u54LVxioC3PQsFkNk4QCr58F4TorZes8bXDx02YJBxkodfcOIloQUC5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JAtnyZcGqis8sE7X3INNz4ZwVVaFO5BTHl1KPBBJQ4o=; b=QqWxYCv7hm/Dg1roJE6MpEgt8Fn1wMy2iT9DUubXdE/yc1tfV54XYtpnwddhBZD1Wdds11VorgxbtG0DT7jdyKJ5+giILDckQ26rxnDX1rtk7w1w68Qq+zHEVsFWoaJ8v7P7d32XHM0nAS7pXi2lJibCterLL4afnGNIh5NODBM= Received: from MWHPR11MB1983.namprd11.prod.outlook.com (2603:10b6:300:112::15) by MW3PR11MB4602.namprd11.prod.outlook.com (2603:10b6:303:52::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.30; Mon, 21 Dec 2020 07:17:44 +0000 Received: from MWHPR11MB1983.namprd11.prod.outlook.com ([fe80::79b1:d241:c3b6:c839]) by MWHPR11MB1983.namprd11.prod.outlook.com ([fe80::79b1:d241:c3b6:c839%3]) with mapi id 15.20.3676.033; Mon, 21 Dec 2020 07:17:44 +0000 From: "Tan, Ming" To: "Bi, Dandan" , Liming Gao CC: "devel@edk2.groups.io" Subject: Re: [edk2-devel] [PATCH v6] MdeModulePkg/Universal/StatusCodeHandler: Fix a bug about log lost Thread-Topic: [edk2-devel] [PATCH v6] MdeModulePkg/Universal/StatusCodeHandler: Fix a bug about log lost Thread-Index: AQHW1Pl1TttuI5T61UGqpSP55BoE3aoBKHOQ Date: Mon, 21 Dec 2020 07:17:43 +0000 Message-ID: References: <1651B662B221A676.25767@groups.io> In-Reply-To: <1651B662B221A676.25767@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.207] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 077e1792-2e77-4731-4e64-08d8a58082be x-ms-traffictypediagnostic: MW3PR11MB4602: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: QqSfQ4UDBg7Z3LwFbcAN4MoCQrbZjPwz2BEhHE5klU1V+tklFTK5/T9CWaXM9HPbxwZG6pqGjhtFWVso3LdoPOKsNoZVpEQzTC0S2O8QEweH/TP0hlE8HXMdy+hPqJY4/kJFaMqL/c1JgYtBDpFRRoso45MZ48KgEm218lW4q8dOSv7b9ujGW/a6LtTwoolU4Efe2326kHA0X9n3Q5X//lvqIbMzh2vRYHhq3ONTjkYXJ1qRoiLn946U07SMV7wWC+WhRmdnmY4RWEUpXEDEWOCf6UAxtBsAchZzAwOAqSDS4Cd3JU8Do2IMxdFI3XCDPFqDiQKDh1j1qT9HIm6h4FwKRx4IzxxQY8aSdrA4sG7eN1IpiTCQv1EKC9gwJZ6nWOPxxV0RU0kHkNU8m+5POu8GoADedT6uYL+SlaDRJCfBJqKAl+hiVOYd5ZM37t7VSnw/Ax8z4ANEd7bJQEH4Ww== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1983.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(376002)(346002)(366004)(136003)(39860400002)(66946007)(66446008)(9686003)(7696005)(33656002)(76116006)(55016002)(66556008)(64756008)(316002)(83380400001)(110136005)(66476007)(66574015)(52536014)(2906002)(71200400001)(8676002)(8936002)(53546011)(186003)(478600001)(966005)(86362001)(4326008)(26005)(5660300002)(6506007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?DrQM1MnM8rzEFUUN0m2TczjfoSehwlrL/b6zeIqehXj5y396lewwv3RDSNY1?= =?us-ascii?Q?CxK9vqsHeRTBuv7//sDjKHoLe51bnO0Fys6NbIXsbV5EdJJHA4V7qpKpP7w0?= =?us-ascii?Q?+SkL4KFed59GpiIQatp0xuhvB8SVZw+Neu65NNwove2W7rUANbyNhTH94Umt?= =?us-ascii?Q?2Z9eAVkLJoaeNYPj8FdT1YyX/yk9DU7urNm9JAEoDc8Hyv/riiBieu8tHv4D?= =?us-ascii?Q?djLte8PCZni/Co2bE11j4i0RGC792qHOInh0q8y5hW3KstlvAOSJ18oPwmQO?= =?us-ascii?Q?fUW29uXovjtkQ9cm0mL2jPmW6Gkmx9aBeBjGI2l3oELbkmYdZpv6tztx2rUN?= =?us-ascii?Q?xruTtsidMVHiXp/D9zfLOV4nK1EOO8jTXEcrhmiIoshNp7BvJGGTH1408gKn?= =?us-ascii?Q?VpKL3ZKi32CEqNypdNipldIpSSoKd0a0SbFyldIQ1z3YW04YeZki8P0Od+R6?= =?us-ascii?Q?zNAWL+FYId/QCZV7HPiMZJkgGFUHwt7zO0g/NUQFE6MN87+8uzRfDOVxy1/I?= =?us-ascii?Q?lagmLy12U+R5UjfzzLiuJ6qOGyzN3eex/hBFgFYij/b9Kb0Co2B9VJR4/ayZ?= =?us-ascii?Q?q/xm3utsFRy6DykuVhjGUHuZapr60U+4IDXd5I8Cvi6nhZ4ROKEyXP9CMEen?= =?us-ascii?Q?ifnRDFroYBpzvEKM4Y11WXK0fHdfMdAci5j5ayviDPVZzVYUOl4BhsZLBoEv?= =?us-ascii?Q?8/ehqYmf7U2y31duZxFwXz0hEtWgdq2ib4X6iG4ueML8CaiIHYg2xZm3jSkk?= =?us-ascii?Q?Kf0jjfsk+3i5Mg1sqUOXZcQqNr1aK+mPYFTiECoDdpEf/ATeGHeW0+AN32hu?= =?us-ascii?Q?9KotNc71rO+9RpN+yDAJbDsIsgrO0bqLPMhleWwpjyGMBc6APn5EMUZpWofs?= =?us-ascii?Q?PlA5HHxdGyaTEpmLMBCAMGA4HDd9ejC/MaiQiewb8PkLKW72f2rLMNUcq02c?= =?us-ascii?Q?jle3UaVFK4SvR+AaB+K7v5Jz1UzQxMVgbkB81ydGNcU=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1983.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 077e1792-2e77-4731-4e64-08d8a58082be X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Dec 2020 07:17:43.9902 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5zatJXrhekY67fTGoAXC6ilVntPFwWCVEMe9U5JC9ayog31x1PK/YFlQYTQSW+oVOU48nUxgApgdR3h7pHr/6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4602 Return-Path: ming.tan@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Liming: I already submit a new patch for it, is there any new concern for it? Thank you. Tan Ming. -----Original Message----- From: devel@edk2.groups.io On Behalf Of Tan, Ming Sent: Friday, December 18, 2020 12:51 PM To: devel@edk2.groups.io Cc: Bi, Dandan ; Liming Gao Subject: [edk2-devel] [PATCH v6] 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 gEfiEventExit= BootServicesGuid, this unregister function will call EFI_RSC_HANDLER_PROTOC= OL->Unregister and does not support log through serial port. 2.2 And some other drivers also register call back funtions of gEfiEventExi= tBootServicesGuid. 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 afte= r notify all the call back functions of gEfiEventExitBootServicesGuid. 4. Solution: the StatusCodeHandlerRuntimeDxe.c will not register an unregis= ter function of gEfiEventExitBootServicesGuid, but unregister it after rece= ive the status code of EFI_SW_BS_PC_EXIT_BOOT_SERVICES. Cc: Dandan Bi Cc: Liming Gao Signed-off-by: Ming Tan --- V6: Change the funcname of UnregisterBootTimeHandlers to UnregisterSerialBo= otTimeHandlers. 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 'unregiste= r'. V2: Add the REF link in commit message. .../RuntimeDxe/SerialStatusCodeWorker.c | 10 ++++++++++ .../RuntimeDxe/StatusCodeHandlerRuntimeDxe.c | 19 ++----------------- ..= ./RuntimeDxe/StatusCodeHandlerRuntimeDxe.h | 11 +++++++++++ 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/SerialStat= usCodeWorker.c b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/Serial= StatusCodeWorker.c index 0b98e7ec63..348f55edba 100644 --- a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/SerialStatusCodeW= orker.c +++ b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/SerialStatusCo +++ deWorker.c @@ -151,6 +151,16 @@ SerialStatusCodeReportWorker ( // SerialPortWrite ((UINT8 *) Buffer, CharCount); + //+ // If regist= er an unregister function of gEfiEventExitBootServicesGuid,+ // then some = log called in ExitBootServices() will be lost,+ // so unregister the handl= er 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)) {+ Unregi= sterSerialBootTimeHandlers();+ }+ return EFI_SUCCESS; } diff --git a/Mde= ModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDx= e.c b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandler= RuntimeDxe.c index a8c0fe5b71..d50335af8a 100644 --- a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandler= RuntimeDxe.c +++ b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHand +++ lerRuntimeDxe.c @@ -10,23 +10,17 @@ #include "StatusCodeHandlerRuntimeDxe.h" EFI_EVENT mVirtu= alAddressChangeEvent =3D NULL;-static EFI_EVENT mExitBootServicesE= vent =3D NULL; EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol =3D= NULL; /** Unregister status code callback functions only available at b= oot time from report status code router when exiting boot services. - @p= aram Event Event whose notification function is being invoked.- @= param Context Pointer to the notification function's context, which = is- always zero in current implementation.- **/ VOID= EFIAPI-UnregisterBootTimeHandlers (- IN EFI_EVENT Event,- IN VOID= *Context+UnregisterSerialBootTimeHandlers (+ VOID ) { if = (PcdGetBool (PcdStatusCodeUseSerial)) {@@ -178,15 +172,6 @@ StatusCodeHandl= erRuntimeDxeEntry ( mRscHandlerProtocol->Register (RtMemoryStatusCodeReportWorker, TPL_HIG= H_LEVEL); } - Status =3D gBS->CreateEventEx (- EVT_NOTI= FY_SIGNAL,- TPL_NOTIFY,- UnregisterBootTi= meHandlers,- NULL,- &gEfiEventExitBootSer= vicesGuid,- &mExitBootServicesEvent- );- = Status =3D gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, = TPL_NOTIFY,diff --git a/MdeModulePkg/Universal/StatusCodeHand= ler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h b/MdeModulePkg/Universal/Statu= sCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h index fd4689c2d7..a2cf2ae0b7 100644 --- a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandler= RuntimeDxe.h +++ b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHand +++ lerRuntimeDxe.h @@ -118,4 +118,15 @@ RtMemoryStatusCodeReportWorker ( IN EFI_STATUS_CODE_DATA *Data OPTIONAL ); +/**+ Unregis= ter status code callback functions only available at boot time from+ repor= t status code router when exiting boot services.++**/+VOID+EFIAPI+Unregiste= rSerialBootTimeHandlers (+ VOID+ );+ #endif--=20 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 (#69173): https://edk2.groups.io/g/devel/message/69173 Mute This Topic: https://groups.io/mt/79055338/2557430 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [ming.tan@intel.com] -=3D= -=3D-=3D-=3D-=3D-=3D