All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ehab Ababneh" <ehab.ababneh@intel.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v2 11/17] platform/x86/intel/ifs: Track and report scan results on a per-CPU basis
Date: Wed, 18 Nov 2026 19:47:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-221890@kernel.org> (raw)
In-Reply-To: <20261118193259.519568-12-ehab.ababneh@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] platform/x86/intel/ifs: stale ifsd->scan_details in
  ifs_test_core()
- [Medium] platform/x86/intel/ifs: update_group_status() clobbers
  passing CPUs
--

commit 3bcc71cc2c29c09c3eadc3e6e70f27cf28c60879
Author: Jithu Joseph <jithu.joseph@intel.com>

platform/x86/intel/ifs: Track and report scan results on a per-CPU basis

This commit records In-Field Scan test results in a per-CPU structure for
all CPUs in the tested group, restarting from the lowest chunk reached
across the group and evaluating results across all CPUs sharing the scan
engine.

> diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c
> index 783b29f234ba2..b93d8de4ca063 100644
> --- a/drivers/platform/x86/intel/ifs/runtest.c
> +++ b/drivers/platform/x86/intel/ifs/runtest.c

[ ... ]

> @@ -211,12 +205,103 @@ static int doscan(void *data)
>  	trace_ifs_status(ifsd->cur_batch, start, stop, status.data);
>  
>  	/* Pass back the result of the scan */
> -	if (cpu == first)
> +	if (cpu == ifsd->cpu)
>  		params->status = status;
>  
> +	pcpu_scan->test_details = status.data;
> +
>  	return 0;
>  }
>  
> +#define get_scan_status(stat) ((union ifs_status *)(&((stat)->test_details)))
> +
> +static void update_group_status(struct device *dev, int reason)
> +{
> +	struct ifs_data *ifsd = ifs_get_data(dev);
> +	struct ifs_test_output *pcpu_scan;
> +	union ifs_status *scan_status;
> +	int lcpu;
> +
> +	for_each_cpu(lcpu, &ifsd->grp_cpumask) {
> +		pcpu_scan = per_cpu_ptr(ifsd->result_ptr, lcpu);
> +		scan_status = get_scan_status(pcpu_scan);
> +		/* Don't hide an error code reported by the hardware */
> +		if (scan_status->error_code == IFS_NO_ERROR)
> +			scan_status->error_code = reason;
> +	}
> +}

[Severity: Medium]
Can update_group_status() overwrite scan_status->error_code on a CPU that
has already completed all chunks?

When one CPU in the group finishes through to_stop (leaving chunk_num >
to_stop and error_code == IFS_NO_ERROR) while another CPU stalls on an
earlier chunk until the test times out or exhausts retries,
update_group_status() sets error_code to reason on the completed CPU as
well.  update_group_result() then sees a non-zero error_code and marks that
passing CPU as SCAN_NOT_TESTED.

[ ... ]

> +static void update_group_result(struct device *dev, int stop_chunk)
> +{
> +	struct ifs_data *ifsd = ifs_get_data(dev);
> +	struct ifs_test_output *pcpu_scan;
> +	union ifs_status *scan_status;
> +	u32 reached_chunk;
> +	int lcpu;
> +
> +	for_each_cpu(lcpu, &ifsd->grp_cpumask) {
> +		pcpu_scan = per_cpu_ptr(ifsd->result_ptr, lcpu);
> +		scan_status = get_scan_status(pcpu_scan);
> +		reached_chunk = ifsd->generation ? scan_status->gen2.chunk_num :
> +				scan_status->gen0.chunk_num;
> +
> +		if (scan_status->signature_error) {
> +			pcpu_scan->test_result = SCAN_TEST_FAIL;
> +			message_fail(dev, lcpu, *scan_status);
> +		} else if (scan_status->control_error || scan_status->error_code ||
> +			   reached_chunk <= stop_chunk) {
> +			/* E.g. another CPU in the group stopped the scan */
> +			if (!scan_status->control_error && !scan_status->error_code)
> +				scan_status->error_code = IFS_SW_PARTIAL_COMPLETION;
> +			pcpu_scan->test_result = SCAN_NOT_TESTED;
> +			message_not_tested(dev, lcpu, *scan_status);
> +		} else {
> +			pcpu_scan->test_result = SCAN_TEST_PASS;
> +		}
> +
> +		if (lcpu == ifsd->cpu)
> +			ifsd->status = pcpu_scan->test_result;
> +	}
> +}

[ ... ]

> @@ -258,6 +348,7 @@ static void ifs_test_core(int cpu, struct device *dev)
>  	while (to_start <= to_stop) {
>  		if (time_after(jiffies, timeout)) {
>  			status.error_code = IFS_SW_TIMEOUT;
> +			update_group_status(dev, IFS_SW_TIMEOUT);
>  			break;
>  		}
>  
> @@ -272,15 +363,16 @@ static void ifs_test_core(int cpu, struct device *dev)
>  		status = params.status;
>  
>  		/* Some cases can be retried, give up for others */
> -		if (!can_restart(status))
> +		if (!can_restart_test_group(dev))
>  			break;
>  
> -		status_chunk = ifsd->generation ? status.gen2.chunk_num : status.gen0.chunk_num;
> +		status_chunk = group_min_chunk(ifsd);
>  		if (status_chunk == to_start) {
>  			/* Check for forward progress */
>  			if (--retries == 0) {
>  				if (status.error_code == IFS_NO_ERROR)
>  					status.error_code = IFS_SW_PARTIAL_COMPLETION;
> +				update_group_status(dev, IFS_SW_PARTIAL_COMPLETION);
>  				break;
>  			}
>  		} else {
> @@ -295,16 +387,7 @@ static void ifs_test_core(int cpu, struct device *dev)
>  
>  	/* Update status for this core */
>  	ifsd->scan_details = status.data;
> -
> -	if (status.signature_error) {
> -		ifsd->status = SCAN_TEST_FAIL;
> -		message_fail(dev, cpu, status);
> -	} else if (status.control_error || status.error_code) {
> -		ifsd->status = SCAN_NOT_TESTED;
> -		message_not_tested(dev, cpu, status);
> -	} else {
> -		ifsd->status = SCAN_TEST_PASS;
> -	}
> +	update_group_result(dev, to_stop);
>  }

[Severity: Medium]
Can ifsd->scan_details diverge from the target CPU's per-CPU test_details?

ifs_test_core() writes status.data to ifsd->scan_details before
update_group_result() runs.  If another CPU in the group aborts the scan
with a non-restartable error while ifsd->cpu stopped at reached_chunk <=
stop_chunk with no error, update_group_result() sets
IFS_SW_PARTIAL_COMPLETION in pcpu_scan->test_details and sets ifsd->status
to SCAN_NOT_TESTED, leaving ifsd->scan_details (exposed via sysfs details)
with error_code == 0.  Also, the timeout path unconditionally sets
status.error_code = IFS_SW_TIMEOUT, overwriting any retryable hardware
error code from the previous iteration that update_group_status()
preserved in pcpu_scan->test_details.

Assigning ifsd->scan_details = pcpu_scan->test_details when lcpu ==
ifsd->cpu in update_group_result() would keep both in sync.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118193259.519568-1-ehab.ababneh@intel.com?part=11

  reply	other threads:[~2026-11-18 19:47 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
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 [this message]
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=sashiko-outbox-221890@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ehab.ababneh@intel.com \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.