public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
To: "Chang S. Bae" <chang.seok.bae@intel.com>, linux-kernel@vger.kernel.org
Cc: x86@kernel.org, platform-driver-x86@vger.kernel.org,
	tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, hdegoede@redhat.com,
	ilpo.jarvinen@linux.intel.com, tony.luck@intel.com,
	ashok.raj@intel.com, jithu.joseph@intel.com
Subject: Re: [PATCH 2/2] platform/x86/intel/ifs: Initialize AMX state for the scan test
Date: Wed, 8 May 2024 17:45:21 -0700	[thread overview]
Message-ID: <0c983c29-d146-4ddb-a554-6c9728ff2af4@linux.intel.com> (raw)
In-Reply-To: <20240430212508.105117-3-chang.seok.bae@intel.com>


On 4/30/24 2:25 PM, Chang S. Bae wrote:
> The scan test does not start when the AMX state remains active and is not
> re-initialized. With the extension of kernel_fpu_begin_mask(), the driver
> code can now initialize the state properly.
>
> Introduce custom FPU handling wrappers to ensure compliant with the
> established FPU API semantics, as kernel_fpu_begin() exclusively sets
> legacy states. This follows the EFI case from commit b0dc553cfc9d
> ("x86/fpu: Make the EFI FPU calling convention explicit").
>
> Then, use these wrappers to surround the MSR_ACTIVATE_SCAN write to
> minimize the critical section. To prevent unnecessary delays, invoke
> ifs_fpu_begin() before entering the rendezvous loop.
>
> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
> Reviewed-by: Jithu Joseph <jithu.joseph@intel.com>
> Tested-by: Jithu Joseph <jithu.joseph@intel.com>
> ---

Looks good to me.

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
>  drivers/platform/x86/intel/ifs/ifs.h     | 14 ++++++++++++++
>  drivers/platform/x86/intel/ifs/runtest.c |  6 ++++++
>  2 files changed, 20 insertions(+)
>
> diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h
> index 56b9f3e3cf76..71d8b50854b2 100644
> --- a/drivers/platform/x86/intel/ifs/ifs.h
> +++ b/drivers/platform/x86/intel/ifs/ifs.h
> @@ -325,4 +325,18 @@ int do_core_test(int cpu, struct device *dev);
>  extern struct attribute *plat_ifs_attrs[];
>  extern struct attribute *plat_ifs_array_attrs[];
>  
> +static inline void ifs_fpu_begin(void)
> +{
> +	/*
> +	 * The AMX state must be initialized prior to executing In-Field
> +	 * Scan tests, according to Intel SDM.

Nit: May be helpful to include the section title in SDM.

> +	 */
> +	kernel_fpu_begin_mask(KFPU_AMX);
> +}
> +
> +static inline void ifs_fpu_end(void)
> +{
> +	kernel_fpu_end();
> +}
> +
>  #endif
> diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c
> index 95b4b71fab53..a35eac7c0b44 100644
> --- a/drivers/platform/x86/intel/ifs/runtest.c
> +++ b/drivers/platform/x86/intel/ifs/runtest.c
> @@ -188,6 +188,9 @@ static int doscan(void *data)
>  	/* Only the first logical CPU on a core reports result */
>  	first = cpumask_first(cpu_smt_mask(cpu));
>  
> +	/* Prepare FPU state before entering the rendezvous loop*/
> +	ifs_fpu_begin();
> +
>  	wait_for_sibling_cpu(&scan_cpus_in, NSEC_PER_SEC);
>  
>  	/*
> @@ -199,6 +202,9 @@ static int doscan(void *data)
>  	 * are processed in a single pass) before it retires.
>  	 */
>  	wrmsrl(MSR_ACTIVATE_SCAN, params->activate->data);
> +
> +	ifs_fpu_end();
> +
>  	rdmsrl(MSR_SCAN_STATUS, status.data);
>  
>  	trace_ifs_status(ifsd->cur_batch, start, stop, status.data);

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


  parent reply	other threads:[~2024-05-09  0:45 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 21:25 [PATCH 0/2] x86/fpu: Extend kernel_fpu_begin_mask() for the In-Field Scan driver Chang S. Bae
2024-04-30 21:25 ` [PATCH 1/2] x86/fpu: Extend kernel_fpu_begin_mask() to initialize AMX state Chang S. Bae
2024-04-30 23:42   ` Ashok Raj
2024-04-30 21:25 ` [PATCH 2/2] platform/x86/intel/ifs: Initialize AMX state for the scan test Chang S. Bae
2024-05-01  0:06   ` Ashok Raj
2024-05-01  8:58   ` Hans de Goede
2024-05-08  0:22     ` Chang S. Bae
2024-05-02 11:00   ` Ilpo Järvinen
2024-05-02 22:19     ` Chang S. Bae
2024-05-09  0:45   ` Kuppuswamy Sathyanarayanan [this message]
2024-05-02 20:52 ` [PATCH 0/2] x86/fpu: Extend kernel_fpu_begin_mask() for the In-Field Scan driver Chang S. Bae
2024-05-02 21:35   ` Chang S. Bae
2024-05-02 20:59 ` Dave Hansen
2024-05-07 23:53 ` [PATCH v2 " Chang S. Bae
2024-05-07 23:53   ` [PATCH v2 1/2] x86/fpu: Extend kernel_fpu_begin_mask() to initialize AMX state Chang S. Bae
2024-05-08 13:00     ` Thomas Gleixner
2024-05-08 14:40     ` Dave Hansen
2024-05-08 18:03       ` Chang S. Bae
2024-05-08 19:11         ` Dave Hansen
2024-05-09  0:29       ` Chang S. Bae
2024-05-09 17:36         ` Dave Hansen
2024-05-09 17:41           ` Dave Hansen
2024-05-09 18:41           ` Chang S. Bae
2024-05-09 18:50             ` Dave Hansen
2024-05-10  7:51           ` Thomas Gleixner
2024-05-07 23:53   ` [PATCH v2 2/2] platform/x86/intel/ifs: Initialize AMX state for the scan test Chang S. Bae
2024-05-08  0:19     ` Ashok Raj
2024-05-08  0:21       ` Chang S. Bae
2024-05-08  8:28   ` [PATCH v2 0/2] x86/fpu: Extend kernel_fpu_begin_mask() for the In-Field Scan driver Ilpo Järvinen

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-all 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=0c983c29-d146-4ddb-a554-6c9728ff2af4@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=ashok.raj@intel.com \
    --cc=bp@alien8.de \
    --cc=chang.seok.bae@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jithu.joseph@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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