public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Wu, Jiaxin" <jiaxin.wu@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Laszlo Ersek <lersek@redhat.com>,
	"Dong, Eric" <eric.dong@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	"Kumar, Rahul R" <rahul.r.kumar@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 5/6] UefiCpuPkg/PiSmmCpuDxeSmm: Invert ReleaseAllAPs & InitializeDebugAgent
Date: Tue, 26 Dec 2023 02:21:33 +0000	[thread overview]
Message-ID: <MN6PR11MB8244D4FD81B3DEC9413D2C418C98A@MN6PR11MB8244.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20231225162034.2052-6-jiaxin.wu@intel.com>

Source level debugging in SMM doesn't enable timer interrupt so it does not support break-in from HOST debugger.
It only supports debugging AP code which is stopped by breakpoints.
I agree that with this change, the debug window of APs is a bit increased.

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

Thanks,
Ray
> -----Original Message-----
> From: Wu, Jiaxin <jiaxin.wu@intel.com>
> Sent: Tuesday, December 26, 2023 12:21 AM
> To: devel@edk2.groups.io
> Cc: Laszlo Ersek <lersek@redhat.com>; Dong, Eric <eric.dong@intel.com>; Ni,
> Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Gerd Hoffmann
> <kraxel@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>
> Subject: [PATCH v2 5/6] UefiCpuPkg/PiSmmCpuDxeSmm: Invert
> ReleaseAllAPs & InitializeDebugAgent
> 
> Existing BSP handler stops source level debug, then call ReleaseAllAPs
> to tell all APs can reset the Present flag to FALSE:
>   InitializeDebugAgent (); /// Stop source level debug
>   ReleaseAllAPs ();        /// Tell APs can reset "Present" flag.
> 
> This patch is to invert ReleaseAllAPs & InitializeDebugAgent:
>   ReleaseAllAPs ();        /// Tell APs can reset "Present" flag.
>   InitializeDebugAgent (); /// Stop source level debug
> 
> After this change, there is no negative impact since SMM source level
> debug feature doesn't depend on AP's "Present" flag, no impact to the
> SMM source level debug capability.
> 
> Instead, the change will benefit the AP source level debug capability
> to trace its "Present" flag change for SMI exit since the source
> level debug feature will be stopped after each AP has the chance to
> reset the state.
> 
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zeng Star <star.zeng@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> index bd2c9f841b..9aa9908863 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> @@ -648,23 +648,23 @@ BSPHandler (
>    //
>    // Wait for all APs to complete their pending tasks including MTRR
> programming if needed.
>    //
>    SmmCpuSyncWaitForAPs (mSmmMpSyncData->SyncContext, ApCount,
> CpuIndex);
> 
> +  //
> +  // Signal APs to Reset states/semaphore for this processor
> +  //
> +  ReleaseAllAPs ();
> +
>    if (mSmmDebugAgentSupport) {
>      //
>      // Stop source level debug in BSP handler, the code below will not be
>      // debugged.
>      //
>      InitializeDebugAgent (DEBUG_AGENT_INIT_EXIT_SMI, NULL, NULL);
>    }
> 
> -  //
> -  // Signal APs to Reset states/semaphore for this processor
> -  //
> -  ReleaseAllAPs ();
> -
>    //
>    // Perform pending operations for hot-plug
>    //
>    SmmCpuUpdate ();
> 
> --
> 2.16.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112903): https://edk2.groups.io/g/devel/message/112903
Mute This Topic: https://groups.io/mt/103360806/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-12-26  2:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-25 16:20 [edk2-devel] [PATCH v2 0/6] Reduce one round BSP & AP sync Wu, Jiaxin
2023-12-25 16:20 ` [edk2-devel] [PATCH v2 1/6] SourceLevelDebugPkg/Library: Indicate SMM Debug Agent support or not Wu, Jiaxin
2023-12-26  2:17   ` Ni, Ray
2023-12-25 16:20 ` [edk2-devel] [PATCH v2 2/6] MdeModulePkg/DebugAgentLibNull: " Wu, Jiaxin
2023-12-26  2:18   ` Ni, Ray
2023-12-25 16:20 ` [edk2-devel] [PATCH v2 3/6] UefiCpuPkg/PiSmmCpuDxeSmm: Check " Wu, Jiaxin
2023-12-26  2:18   ` Ni, Ray
2023-12-25 16:20 ` [edk2-devel] [PATCH v2 4/6] UefiCpuPkg/PiSmmCpuDxeSmm: Align BSP and AP sync logic for SMI exit Wu, Jiaxin
2023-12-26  2:19   ` Ni, Ray
2023-12-25 16:20 ` [edk2-devel] [PATCH v2 5/6] UefiCpuPkg/PiSmmCpuDxeSmm: Invert ReleaseAllAPs & InitializeDebugAgent Wu, Jiaxin
2023-12-26  2:21   ` Ni, Ray [this message]
2023-12-25 16:20 ` [edk2-devel] [PATCH v2 6/6] UefiCpuPkg/PiSmmCpuDxeSmm: Reduce one round BSP & AP sync Wu, Jiaxin
2023-12-26  5:02   ` Ni, Ray

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=MN6PR11MB8244D4FD81B3DEC9413D2C418C98A@MN6PR11MB8244.namprd11.prod.outlook.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