From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 087599411D9 for ; Tue, 10 Oct 2023 08:46:21 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=3Am7+u3lN2rE7f8nsNgiACrTs5GWWE9eNAmSQs/zuuI=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1696927580; v=1; b=v7hvU/g3joSJk1f3auI0OijgTHIQ9JiBFL65YAYgSsATezcjXdUeAu2DSZdusVjxAQ+Jv0hx FFZ26g2+/i9Qa4QJDJX9vCRrBtFP7i88YNNoQf930XGR34GOf/14udjdh98BkXUu6g8EEF2PRbv HgXQss01vd94nExeBpZVm9yY= X-Received: by 127.0.0.2 with SMTP id tmiAYY7687511xv0Mtcd4kdD; Tue, 10 Oct 2023 01:46:20 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.86629.1696927579939862690 for ; Tue, 10 Oct 2023 01:46:20 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-517--8wju6hqOG6H-y-2GkzDcw-1; Tue, 10 Oct 2023 04:46:15 -0400 X-MC-Unique: -8wju6hqOG6H-y-2GkzDcw-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EC49481156E; Tue, 10 Oct 2023 08:46:14 +0000 (UTC) X-Received: from [10.39.192.135] (unknown [10.39.192.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 55097215670B; Tue, 10 Oct 2023 08:46:13 +0000 (UTC) Message-ID: <1f7f2772-2cd4-ffa4-2ffa-628fe18f15c7@redhat.com> Date: Tue, 10 Oct 2023 10:46:12 +0200 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v2 2/4] MdePkg: DelayedDispatch: Added WaitOnEvent interface To: devel@edk2.groups.io, kuqin12@gmail.com Cc: Michael D Kinney , Liming Gao , Zhiguang Liu , Mike Turner References: <20231010001856.1567-1-kuqin12@gmail.com> <20231010001856.1567-3-kuqin12@gmail.com> From: "Laszlo Ersek" In-Reply-To: <20231010001856.1567-3-kuqin12@gmail.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: GAfVf8svv6e0KLvVTk65a3hwx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="v7hvU/g3"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 10/10/23 02:18, Kun Qin wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4496 >=20 > This change adds a new interface for the delayed dispatch PPI. This > new addition allows functional components relying on delayed dispatch > callbacks to be managed/dispatched with definitive order. >=20 > The full defintion has been added into PI spec. >=20 > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Zhiguang Liu >=20 > Co-authored-by: Mike Turner > Signed-off-by: Kun Qin > --- >=20 > Notes: > v2: > - Fixed PI spec version number to v1.8 [Liming] >=20 > MdePkg/Include/Ppi/DelayedDispatch.h | 26 ++++++++++++++++++-- > 1 file changed, 24 insertions(+), 2 deletions(-) I have a question that admittedly targets the spec more than it targets the implementation. What is the envisaged programming model / use case for WaitOnEvent? How are multiple PEIMs to interoperate via the UniqueId GUIDs? Some concrete use case would be good to know. Second: the WaitOnEvent function can wait for completion in one of two ways= : (a) by calling back into the PEI dispatcher, (b) by longjumping to the PEI dispatcher, and then the PEI dispatcher longjumping back to WaitOnEvent. Option (b) seems complicated (although not unseen in edk2; we frequently use StackSwitch for various purposes, and see for example the Exit() boot service -- that can *only* work with longjump). Option (a) seems problematic, because if multiple PEIMs use ("nest") WaitOnEvent, then we get repeated stack frames that all stand for the PEI dispatcher. Stack space is considered "premium" during PEI; because -- for example -- otherwise we wouldn't have EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH, opposing EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK. Thanks, Laszlo >=20 > diff --git a/MdePkg/Include/Ppi/DelayedDispatch.h b/MdePkg/Include/Ppi/De= layedDispatch.h > index 098d57758551..0efcfdbfced6 100644 > --- a/MdePkg/Include/Ppi/DelayedDispatch.h > +++ b/MdePkg/Include/Ppi/DelayedDispatch.h > @@ -1,5 +1,5 @@ > /** @file > - EFI Delayed Dispatch PPI as defined in the PI 1.7 Specification > + EFI Delayed Dispatch PPI as defined in the PI 1.8 Specification > =20 > Provide timed event service in PEI > =20 > @@ -50,6 +50,7 @@ This service is the single member function of the EFI_D= ELAYED_DISPATCH_PPI > @param[in] This Pointer to the EFI_DELAYED_DISPATCH_PPI inst= ance > @param[in] Function Function to call back > @param[in] Context Context data > + @param[in] UniqueId GUID for this Delayed Dispatch request. > @param[in] Delay Delay interval > =20 > @retval EFI_SUCCESS Function successfully loaded > @@ -63,9 +64,29 @@ EFI_STATUS > IN EFI_DELAYED_DISPATCH_PPI *This, > IN EFI_DELAYED_DISPATCH_FUNCTION Function, > IN UINT64 Context, > + IN EFI_GUID *UniqueId OPTIONAL, > IN UINT32 Delay > ); > =20 > +/** > + Wait on a registered Delayed Dispatch unit that has a UniqueId. Conti= nue > + to dispatch all registered delayed dispatch entries until *ALL* entrie= s with > + UniqueId have completed. > + > + @param[in] This The Delayed Dispatch PPI pointer. > + @param[in] UniqueId UniqueId of delayed dispatch entry. > + > + @retval EFI_SUCCESS The operation succeeds. > + @retval EFI_INVALID_PARAMETER The parameters are invalid. > + > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *EFI_DELAYED_DISPATCH_WAIT_ON_EVENT)( > + IN EFI_DELAYED_DISPATCH_PPI *This, > + IN EFI_GUID *UniqueId > + ); > + > /// > /// This PPI is a pointer to the Delayed Dispatch Service. > /// This service will be published by the Pei Foundation. The PEI Founda= tion > @@ -73,7 +94,8 @@ EFI_STATUS > /// execution. > /// > struct _EFI_DELAYED_DISPATCH_PPI { > - EFI_DELAYED_DISPATCH_REGISTER Register; > + EFI_DELAYED_DISPATCH_REGISTER Register; > + EFI_DELAYED_DISPATCH_WAIT_ON_EVENT WaitOnEvent; > }; > =20 > extern EFI_GUID gEfiPeiDelayedDispatchPpiGuid; -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109481): https://edk2.groups.io/g/devel/message/109481 Mute This Topic: https://groups.io/mt/101865809/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-