All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Ehab Ababneh <ehab.ababneh@intel.com>
Cc: Hans de Goede <hansg@kernel.org>,
	tony.luck@intel.com,  ashok.raj.linux@gmail.com,
	platform-driver-x86@vger.kernel.org,
	 LKML <linux-kernel@vger.kernel.org>,
	tglx@kernel.org, mingo@redhat.com,  bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
	 rostedt@goodmis.org, mhiramat@kernel.org,
	mathieu.desnoyers@efficios.com,
	 linux-trace-kernel@vger.kernel.org, peterz@infradead.org,
	 sathyanarayanan.kuppuswamy@linux.intel.com,
	pengfei.xu@intel.com,  ravi.v.shankar@intel.com
Subject: Re: [PATCH v2 10/17] platform/x86/intel/ifs: Warn if a group test fails with CPUs missing
Date: Thu, 19 Nov 2026 13:42:37 +0200 (EET)	[thread overview]
Message-ID: <039913bc-ab42-bea2-1af6-c2aa6f92aa7b@linux.intel.com> (raw)
In-Reply-To: <20261118193259.519568-11-ehab.ababneh@intel.com>

[-- Attachment #1: Type: text/plain, Size: 5965 bytes --]

On Wed, 18 Nov 2026, Ehab Ababneh wrote:

> All the logical processors that share a SCAN test engine must join a
> group test. TID_BIT_SHIFT [1] gives the number of low APIC ID bits that
> tell these logical processors apart. The driver builds the group from
> topology_cluster_cpumask(), which only holds CPUs that are enumerated
> and online. So it cannot tell whether every logical processor sharing
> the engine actually takes part, for example on a part that exposes only
> one core per module, or when a sibling has been taken offline.
> 
> Checking this once at driver load does not help: the group can change
> at runtime through CPU hotplug, and failing to load would stop parts
> that may still test fine. Instead, read TID_BIT_SHIFT at init and, when
> a test does not pass, check whether all logical processors in the
> CPU's TID_BIT_SHIFT APIC ID range were in the group. If not, say so in
> the log. The test is run either way.
> 
> TID_BIT_SHIFT is only enumerated starting with SAF_GEN=2 (Granite
> Rapids), so skip the check on SAF_GEN=0 parts (Sapphire Rapids and
> Emerald Rapids).
> 
> [1] Vol. 4 "Table 2-56. Additional MSRs Supported by the Intel® Xeon®
>     6 P-Core Processors" in the Intel Software Developers' Manual,
>     March 2025.
> 
> Suggested-by: Tony Luck <tony.luck@intel.com>
> Co-developed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
> Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
> Signed-off-by: Ehab Ababneh <ehab.ababneh@intel.com>
> Tested-by: Yi Lai <yi1.lai@intel.com>
> ---
>  arch/x86/include/asm/msr-index.h         |  1 +
>  drivers/platform/x86/intel/ifs/core.c    |  6 +++++
>  drivers/platform/x86/intel/ifs/ifs.h     |  2 ++
>  drivers/platform/x86/intel/ifs/runtest.c | 30 ++++++++++++++++++++++++
>  4 files changed, 39 insertions(+)
> 
> diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
> index 9224b55e1f07..baa16d75749d 100644
> --- a/arch/x86/include/asm/msr-index.h
> +++ b/arch/x86/include/asm/msr-index.h
> @@ -283,6 +283,7 @@
>  #define MSR_INTEGRITY_CAPS_PERIODIC_SCAN_BIST_BIT	4
>  #define MSR_INTEGRITY_CAPS_PERIODIC_SCAN_BIST		BIT(MSR_INTEGRITY_CAPS_PERIODIC_SCAN_BIST_BIT)
>  #define MSR_INTEGRITY_CAPS_SAF_GEN_MASK			GENMASK_ULL(10, 9)
> +#define MSR_INTEGRITY_CAPS_TID_BIT_SHIFT_MASK		GENMASK_ULL(20, 16)
>  #define MSR_INTEGRITY_CAPS_ALL_LP_JOIN_BIT		21
>  #define MSR_INTEGRITY_CAPS_ALL_LP_JOIN			BIT(MSR_INTEGRITY_CAPS_ALL_LP_JOIN_BIT)
>  
> diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c
> index f2d2caab0479..b9ac04228141 100644
> --- a/drivers/platform/x86/intel/ifs/core.c
> +++ b/drivers/platform/x86/intel/ifs/core.c
> @@ -122,6 +122,12 @@ static int __init ifs_init(void)
>  		 */
>  		ifs_devices[i].rw_data.all_lp_join = ifs_devices[i].rw_data.generation ?
>  						(msrval & MSR_INTEGRITY_CAPS_ALL_LP_JOIN) : true;
> +
> +		/* TID_BIT_SHIFT is only enumerated on SAF_GEN=2 and later */
> +		if (ifs_devices[i].rw_data.generation)
> +			ifs_devices[i].rw_data.tid_bit_shift =
> +				FIELD_GET(MSR_INTEGRITY_CAPS_TID_BIT_SHIFT_MASK, msrval);
> +
>  		ifs_devices[i].rw_data.array_gen = (u32)m->driver_data;
>  		ret = misc_register(&ifs_devices[i].misc);
>  		if (ret)
> diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h
> index 365429fafe7a..62db0a6aa940 100644
> --- a/drivers/platform/x86/intel/ifs/ifs.h
> +++ b/drivers/platform/x86/intel/ifs/ifs.h
> @@ -297,6 +297,7 @@ struct ifs_test_msrs {
>   * @chunk_size: size of a test chunk
>   * @array_gen: test generation of array test
>   * @all_lp_join: all logical processors join test
> + * @tid_bit_shift: APIC-ID bits of the logical processors sharing a scan engine
>   */
>  struct ifs_data {
>  	cpumask_t	grp_cpumask;
> @@ -311,6 +312,7 @@ struct ifs_data {
>  	u32	chunk_size;
>  	u32	array_gen;
>  	bool	all_lp_join;
> +	u8	tid_bit_shift;
>  };
>  
>  struct ifs_work {
> diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c
> index c618857cd620..783b29f234ba 100644
> --- a/drivers/platform/x86/intel/ifs/runtest.c
> +++ b/drivers/platform/x86/intel/ifs/runtest.c
> @@ -425,6 +425,32 @@ static void build_cpugroup_mask(struct device *dev, int cpu)
>  	cpumask_copy(&ifsd->grp_cpumask, topology_cluster_cpumask(cpu));
>  }
>  
> +/*
> + * Check whether all logical processors that share the scan engine with @cpu
> + * (the TID_BIT_SHIFT APIC-ID range) are online and in the test group. If not,
> + * the test is still attempted; it may pass if the microcode handles the
> + * missing logical processors, e.g. a module with only one core.
> + */
> +static bool ifs_group_incomplete(int cpu, struct ifs_data *ifsd)
> +{
> +	u32 shift = ifsd->tid_bit_shift;
> +	u32 engine = cpu_data(cpu).topo.apicid >> shift;
> +	int i;
> +
> +	if (!ifsd->generation || !ifsd->all_lp_join)
> +		return false;
> +
> +	if (cpumask_weight(&ifsd->grp_cpumask) != 1U << shift)

BIT()

> +		return true;
> +
> +	for_each_cpu(i, &ifsd->grp_cpumask) {
> +		if (cpu_data(i).topo.apicid >> shift != engine)
> +			return true;
> +	}
> +
> +	return false;
> +}
> +
>  /*
>   * Initiate per core test. It wakes up work queue threads on the target CPU and
>   * its sibling CPU. Once all sibling threads wake up, the scan test gets executed and
> @@ -464,6 +490,10 @@ int do_core_test(int cpu, struct device *dev)
>  	default:
>  		ret = -EINVAL;
>  	}
> +
> +	if (!ret && ifsd->status != SCAN_TEST_PASS && ifs_group_incomplete(cpu, ifsd))
> +		dev_warn(dev, "CPU %d: test did not pass; not all CPUs sharing the scan engine were found (group %*pbl)\n",
> +			 cpu, cpumask_pr_args(&ifsd->grp_cpumask));

Add include.

Add braces to multiline constructs even if they're single statement.

>  out:
>  	cpus_read_unlock();
>  	return ret;
> 

-- 
 i.

  reply	other threads:[~2026-11-19 11:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 19:32 [PATCH v2 00/17] platform/x86/intel/ifs: Support group-based In-Field Scan and Diamond Rapids Ehab Ababneh
2026-11-18 19:32 ` [PATCH v2 01/17] platform/x86/intel/ifs: Revert SBAF feature Ehab Ababneh
2026-11-18 19:32 ` [PATCH v2 02/17] platform/x86/intel/ifs: Fix IFS sysfs interfaces in the comments Ehab Ababneh
2026-11-18 19:32 ` [PATCH v2 03/17] platform/x86/intel/ifs: Clarify In-Field Scan MSR bit macro definitions Ehab Ababneh
2026-11-18 19:32 ` [PATCH v2 04/17] platform/x86/intel/ifs: Use u64 to define the bits of IFS MSR registers Ehab Ababneh
2026-11-18 19:32 ` [PATCH v2 05/17] platform/x86/intel/ifs: Early return on the IFS image hash/chunk error Ehab Ababneh
2026-11-18 19:32 ` [PATCH v2 06/17] platform/x86/intel/ifs: Refactor Array BIST function interface Ehab Ababneh
2026-11-18 19:32 ` [PATCH v2 07/17] stop_machine: Add stop_cluster_cpuslocked() for per-cluster operations Ehab Ababneh
2026-11-19 11:28   ` Ilpo Järvinen
2026-11-18 19:32 ` [PATCH v2 08/17] platform/x86/intel/ifs: Enumerate the bit to determine if CPUs need to join for IFS tests Ehab Ababneh
2026-11-18 19:32 ` [PATCH v2 09/17] platform/x86/intel/ifs: Select CPUs from topology_cluster_cpumask() for simultaneous " Ehab Ababneh
2026-11-19 11:38   ` Ilpo Järvinen
2026-11-18 19:32 ` [PATCH v2 10/17] platform/x86/intel/ifs: Warn if a group test fails with CPUs missing Ehab Ababneh
2026-11-19 11:42   ` Ilpo Järvinen [this message]
2026-11-18 19:32 ` [PATCH v2 11/17] platform/x86/intel/ifs: Track and report scan results on a per-CPU basis Ehab Ababneh
2026-11-18 19:47   ` sashiko-bot
2026-11-19 12:00   ` Ilpo Järvinen
2026-11-18 19:32 ` [PATCH v2 12/17] platform/x86/intel/ifs: Add new sysfs interfaces {status, details, cpus_ran}_list Ehab Ababneh
2026-11-19 12:06   ` Ilpo Järvinen
2026-11-18 19:32 ` [PATCH v2 13/17] platform/x86/intel/ifs: Add additional details sysfs interface Ehab Ababneh
2026-11-18 19:32 ` [PATCH v2 14/17] platform/x86/intel/ifs: Add Intel Diamond Rapids server support Ehab Ababneh
2026-11-18 19:32 ` [PATCH v2 15/17] platform/x86/intel/ifs: Remove limit on number of batch files Ehab Ababneh
2026-11-19 12:09   ` Ilpo Järvinen
2026-11-18 19:32 ` [PATCH v2 16/17] platform/x86/intel/ifs: Update IFS documentation Ehab Ababneh
2026-11-19 12:12   ` Ilpo Järvinen
2026-11-18 19:32 ` [PATCH v2 17/17] Documentation/ABI: Update IFS ABI doc Ehab Ababneh
2026-11-19 12:13   ` 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=039913bc-ab42-bea2-1af6-c2aa6f92aa7b@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=ashok.raj.linux@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=ehab.ababneh@intel.com \
    --cc=hansg@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=pengfei.xu@intel.com \
    --cc=peterz@infradead.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=ravi.v.shankar@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=tglx@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.