public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, zhichao.gao@intel.com
Cc: Jian J Wang <jian.j.wang@intel.com>,
	Hao A Wu <hao.a.wu@intel.com>, Ray Ni <ray.ni@intel.com>,
	Star Zeng <star.zeng@intel.com>,
	Liming gao <liming.gao@intel.com>,
	Sean Brogan <sean.brogan@microsoft.com>,
	Michael Turner <Michael.Turner@microsoft.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Eric Dong <eric.dong@intel.com>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [edk2-devel] [PATCH V2 0/4] Fix race condition and add event protocol
Date: Wed, 10 Jul 2019 14:20:12 +0200	[thread overview]
Message-ID: <b24251bc-052e-5124-8e7c-639d8813fbb0@redhat.com> (raw)
In-Reply-To: <20190709083956.13024-1-zhichao.gao@intel.com>

On 07/09/19 10:39, Gao, Zhichao wrote:
> V1:
> There is a race condition in CoreWaitForEvent function:
> If an interrupt happens between CheckEvent and gIdleLoopEvent,
> there would be a event pending during cpu sleep. 
> So it is required to check the gEventPending with the interrupt
> disabled.
> Implement a gEfiCpu2ProtocolGuid to fix that. The protocol include
> one interface to enable interrupt and put the cpu to sleep.
> 
> Add a event protocol gEdkiiCommonEventProtocolGuid to support
> all TPL event. It is require for PI drivers that use HW interrput.
> 
> V2:
> Move EnableInterruptsAndSleep to UefiCpuPkg/CpuDxe. It is inappropiate
> to add it to MdePkg which should only contain code base on the UEFI spec.
> Change the name gEfiCpu2ProtocolGuid to gEdkiiCpu2ProtocolGuid.

Thanks for the CC.

* On patch #2, I'll defer to Eric and Ray.

* From the problem description, and from the final fix in patch #4, it
seems like the issue (the race condition) applies to all edk2
architectures. Therefore I would suggest filing a TianoCore Feature
Request BZ for "ArmPkg/Drivers/CpuDxe" as well, for producing
gEdkiiCpu2ProtocolGuid. (CC'ing Leif and Ard.)

(I do see that the patch series does not *require* the new protocol, so
it's fine to implement the ARM/AARCH64 support separately, in my opinion.)

Thanks
Laszlo

> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> cc: Ray Ni <ray.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Liming gao <liming.gao@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Michael Turner <Michael.Turner@microsoft.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> 
> Sean Brogan (3):
>   MdeModulePkg: Add gEdkiiCpu2ProtocolGuid and header file
>   UefiCpuPkg/CpuDxe: Implement Cpu2 protocol
>   MdeModulePkg/DxeMain: Implement common event protocol
> 
> Zhichao Gao (1):
>   MdeModulePkg: Add gEdkiiCommonEventProtocolGuid for creating event
> 
>  MdeModulePkg/Core/Dxe/DxeMain.h               |  64 ++++++++++-
>  MdeModulePkg/Core/Dxe/DxeMain.inf             |   2 +
>  MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c       |  22 ++++
>  .../Core/Dxe/DxeMain/DxeProtocolNotify.c      |   1 +
>  MdeModulePkg/Core/Dxe/Event/Event.c           | 102 ++++++++++++++++--
>  MdeModulePkg/Core/Dxe/Event/Event.h           |   2 +-
>  MdeModulePkg/Include/Protocol/CommonEvent.h   |  18 ++++
>  MdeModulePkg/Include/Protocol/Cpu2.h          |  43 ++++++++
>  MdeModulePkg/MdeModulePkg.dec                 |   6 ++
>  UefiCpuPkg/CpuDxe/CpuDxe.c                    |  38 +++++++
>  UefiCpuPkg/CpuDxe/CpuDxe.h                    |  25 +++++
>  UefiCpuPkg/CpuDxe/CpuDxe.inf                  |   3 +
>  .../CpuDxe/Ia32/EnableInterruptsAndSleep.c    |  24 +++++
>  .../CpuDxe/X64/EnableInterruptsAndSleep.nasm  |  31 ++++++
>  14 files changed, 368 insertions(+), 13 deletions(-)
>  create mode 100644 MdeModulePkg/Include/Protocol/CommonEvent.h
>  create mode 100644 MdeModulePkg/Include/Protocol/Cpu2.h
>  create mode 100644 UefiCpuPkg/CpuDxe/Ia32/EnableInterruptsAndSleep.c
>  create mode 100644 UefiCpuPkg/CpuDxe/X64/EnableInterruptsAndSleep.nasm
> 


      parent reply	other threads:[~2019-07-10 12:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09  8:39 [PATCH V2 0/4] Fix race condition and add event protocol Gao, Zhichao
2019-07-09  8:39 ` [PATCH V2 1/4] MdeModulePkg: Add gEdkiiCpu2ProtocolGuid and header file Gao, Zhichao
2019-07-09  8:39 ` [PATCH V2 2/4] UefiCpuPkg/CpuDxe: Implement Cpu2 protocol Gao, Zhichao
2019-07-11  2:22   ` Dong, Eric
2019-07-11  2:36     ` Gao, Zhichao
2019-07-11 10:24       ` Laszlo Ersek
2019-07-11 10:48         ` Leif Lindholm
2019-07-09  8:39 ` [PATCH V2 3/4] MdeModulePkg: Add gEdkiiCommonEventProtocolGuid for creating event Gao, Zhichao
2019-07-09  8:39 ` [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement common event protocol Gao, Zhichao
2019-07-09  9:23   ` Wang, Jian J
2019-07-10  0:24     ` Gao, Zhichao
2019-07-10  8:46       ` Wang, Jian J
2019-07-11  0:20         ` Gao, Zhichao
2019-07-11  1:26           ` Wang, Jian J
2019-07-10 12:20 ` Laszlo Ersek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b24251bc-052e-5124-8e7c-639d8813fbb0@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox