From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.85.221.68, mailfrom: philmd@redhat.com) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by groups.io with SMTP; Mon, 29 Jul 2019 07:39:02 -0700 Received: by mail-wr1-f68.google.com with SMTP id g17so62135458wrr.5 for ; Mon, 29 Jul 2019 07:39:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CAh1jsh1OFqvzWZQ8c1il09C6eqp/NBdJ0ma3CT2a8g=; b=n0ZnUtgFjb7Xh0b/9BAy4/3Nta9ZP2hidJIjBmrMgkxmxvI+jioCHeLp6gtgcWPrOR 2KUwSmLaQCgr1+SfPoXQaxCt8TDlch1BDOGj1eHyzitR1mixnAZdhbDECZEg7bb4J6ZZ sKvQfI7nzhNLAHoF2tlnSXfjeKfBxcnMi9tsvgjzhGNRWOjZi69Vy2xSDuiKcAPFXHxR dqW7QT8AAzZJDsDXhXc+/QkjlCNKZV+V8H27MuvDGfJVOyRsR9xKW+HbjWun+l5zPX70 +oaRYgpx3w3XmhDlqkC9zNg3fFHBjUy2b8ePzkJDdMHoXNgbKR3iWWobexhslLnzw+MO 8FGw== X-Gm-Message-State: APjAAAWXaiK4cZgN0El7I206B4Nz75sH6HR9AvGWICSDQmLndkEAS0TW vn40gLNDeIuKKJ2NBo/KSvGcFg== X-Google-Smtp-Source: APXvYqxq5cfyVTxZIIYJEPBtJlXD37A/xccS81I4OlubhNxwe7B8gR5oBsZ8x1Ip5D08OEE/7vKxag== X-Received: by 2002:a5d:6b11:: with SMTP id v17mr44142586wrw.323.1564411141194; Mon, 29 Jul 2019 07:39:01 -0700 (PDT) Return-Path: Received: from [192.168.1.38] (190.red-81-40-121.staticip.rima-tde.net. [81.40.121.190]) by smtp.gmail.com with ESMTPSA id x20sm140914040wrg.10.2019.07.29.07.39.00 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jul 2019 07:39:00 -0700 (PDT) Subject: Re: [edk2-devel][Patch 1/3] MdePkg/UefiDebugLibConOut: Add destructor to CloseEvent To: devel@edk2.groups.io, wei6.xu@intel.com Cc: Michael D Kinney , Liming Gao References: <20190726031055.10020-1-wei6.xu@intel.com> <20190726031055.10020-2-wei6.xu@intel.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Openpgp: id=89C1E78F601EE86C867495CBA2A3FD6EDEADC0DE; url=http://pgp.mit.edu/pks/lookup?op=get&search=0xA2A3FD6EDEADC0DE Message-ID: Date: Mon, 29 Jul 2019 16:38:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190726031055.10020-2-wei6.xu@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Hi, On 7/26/19 5:10 AM, Xu, Wei6 wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2012 > > When driver is unloaded, the ExitBootSerivesEvent must be closed at > the same time. Otherwise exception will occur when ExitBootServices. > > Cc: Michael D Kinney > Cc: Liming Gao > Signed-off-by: Wei6 Xu > --- > .../UefiDebugLibConOut/DebugLibConstructor.c | 23 ++++++++++++++++++++++ > .../UefiDebugLibConOut/UefiDebugLibConOut.inf | 1 + > 2 files changed, 24 insertions(+) > > diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c > index 8005370372..ed73f92818 100644 > --- a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c > +++ b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c > @@ -73,5 +73,28 @@ DxeDebugLibConstructor( > &mExitBootServicesEvent > ); > > return EFI_SUCCESS; > } > + > +/** > + The destructor closes Exit Boot Services Event. > + > + @param ImageHandle The firmware allocated handle for the EFI image. > + @param SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The destructor always returns EFI_SUCCESS. > + > +**/ > +EFI_STATUS > +EFIAPI > +DxeDebugLibDestructor( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + if (mExitBootServicesEvent != NULL) { > + SystemTable->BootServices->CloseEvent (mExitBootServicesEvent); > + } Is it OK to let mDebugST (pointer to SystemTable) initialized? > + > + return EFI_SUCCESS; > +} > diff --git a/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf b/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf > index 4c279a5bf2..b577d52ac6 100644 > --- a/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf > +++ b/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf > @@ -20,10 +20,11 @@ > MODULE_TYPE = UEFI_DRIVER > VERSION_STRING = 1.0 > LIBRARY_CLASS = DebugLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER > > CONSTRUCTOR = DxeDebugLibConstructor > + DESTRUCTOR = DxeDebugLibDestructor > > # > # VALID_ARCHITECTURES = IA32 X64 EBC > # > >