public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Nikodem, Damian" <damian.nikodem@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Eric" <eric.dong@intel.com>,
	"You, Benjamin" <benjamin.you@intel.com>,
	Laszlo Ersek <lersek@redhat.com>,
	"Rusocki, Krzysztof" <krzysztof.rusocki@intel.com>
Subject: Re: [PATCH v3] UefiCpuPkg: Fix potential spinLock issue in SmmStartupThisAp
Date: Wed, 11 Sep 2019 17:37:44 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C2D164D@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20190911082301.1488-1-damian.nikodem@intel.com>

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Nikodem, Damian
> Sent: Wednesday, September 11, 2019 1:23 AM
> To: devel@edk2.groups.io
> Cc: Nikodem, Damian <damian.nikodem@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; You,
> Benjamin <benjamin.you@intel.com>; Laszlo Ersek <lersek@redhat.com>; Rusocki, Krzysztof <krzysztof.rusocki@intel.com>
> Subject: [PATCH v3] UefiCpuPkg: Fix potential spinLock issue in SmmStartupThisAp
> 
> Due to needs a tackling the deficiency of the AP API, is necessary to ensure that in non-blocking mode
> previous AP executed command is finished before start new one.
> 
> To remedy above:
>   1) execute AcquireSpinLock instead AcquireSpinLockOrFail - this will ensure time "window" to eliminate potential
>      race condition beetwen BSP and AP spinLock release in non-blocking mode.
>      This also will eliminate possibility to start executing new AP function before last is finished.
>   2) remove returns EFI_STATUS - EFI_NOT_READY - in new scenario returned status is not necessary to caller.
> 
> Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Benjamin You <benjamin.you@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Krzysztof Rusocki <krzysztof.rusocki@intel.com>
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> index d8d2b6f444..0685637c2b 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> @@ -1235,14 +1235,9 @@ InternalSmmStartupThisAp (
>      return EFI_INVALID_PARAMETER;
>    }
> 
> -  if (Token == NULL) {
> -    AcquireSpinLock (mSmmMpSyncData->CpuData[CpuIndex].Busy);
> -  } else {
> -    if (!AcquireSpinLockOrFail (mSmmMpSyncData->CpuData[CpuIndex].Busy)) {
> -      DEBUG((DEBUG_ERROR, "Can't acquire mSmmMpSyncData->CpuData[%d].Busy\n", CpuIndex));
> -      return EFI_NOT_READY;
> -    }
> +  AcquireSpinLock (mSmmMpSyncData->CpuData[CpuIndex].Busy);
> 
> +  if (Token != NULL) {
>      *Token = (MM_COMPLETION) CreateToken ();
>    }

      parent reply	other threads:[~2019-09-11 17:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11  8:23 [PATCH v3] UefiCpuPkg: Fix potential spinLock issue in SmmStartupThisAp Damian Nikodem
2019-09-11 14:45 ` Laszlo Ersek
2019-09-11 17:37 ` Ni, Ray [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=734D49CCEBEEF84792F5B80ED585239D5C2D164D@SHSMSX104.ccr.corp.intel.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