From: Ashok Raj <ashok.raj@intel.com>
To: Hans de Goede <hdegoede@redhat.com>,
Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>,
markgross@kernel.org
Cc: Jithu Joseph <jithu.joseph@intel.com>,
rostedt@goodmis.org, ashok.raj@intel.com, tony.luck@intel.com,
LKML <linux-kernel@vger.kernel.org>,
platform-driver-x86@vger.kernel.org, patches@lists.linux.dev,
pengfei.xu@intel.com
Subject: [PATCH 5/5] platform/x86/intel/ifs: Add an entry rendezvous for SAF
Date: Thu, 25 Jan 2024 00:22:54 -0800 [thread overview]
Message-ID: <20240125082254.424859-6-ashok.raj@intel.com> (raw)
In-Reply-To: <20240125082254.424859-1-ashok.raj@intel.com>
The activation for SAF includes a parameter to make microcode wait for both
threads to join. It's preferable to perform an entry rendezvous before
the activation to ensure that they start the `wrmsr` close enough to each
other. In some cases it has been observed that one of the threads might be
just a bit late to arrive. An entry rendezvous reduces the likelihood of
these cases occurring.
Add an entry rendezvous to ensure the activation on both threads happen
close enough to each other.
Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
---
drivers/platform/x86/intel/ifs/runtest.c | 48 +++++++++++++-----------
1 file changed, 26 insertions(+), 22 deletions(-)
diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c
index e3307dd8e3c4..95b4b71fab53 100644
--- a/drivers/platform/x86/intel/ifs/runtest.c
+++ b/drivers/platform/x86/intel/ifs/runtest.c
@@ -140,6 +140,29 @@ static bool can_restart(union ifs_status status)
return false;
}
+#define SPINUNIT 100 /* 100 nsec */
+static atomic_t array_cpus_in;
+static atomic_t scan_cpus_in;
+
+/*
+ * Simplified cpu sibling rendezvous loop based on microcode loader __wait_for_cpus()
+ */
+static void wait_for_sibling_cpu(atomic_t *t, long long timeout)
+{
+ int cpu = smp_processor_id();
+ const struct cpumask *smt_mask = cpu_smt_mask(cpu);
+ int all_cpus = cpumask_weight(smt_mask);
+
+ atomic_inc(t);
+ while (atomic_read(t) < all_cpus) {
+ if (timeout < SPINUNIT)
+ return;
+ ndelay(SPINUNIT);
+ timeout -= SPINUNIT;
+ touch_nmi_watchdog();
+ }
+}
+
/*
* Execute the scan. Called "simultaneously" on all threads of a core
* at high priority using the stop_cpus mechanism.
@@ -165,6 +188,8 @@ static int doscan(void *data)
/* Only the first logical CPU on a core reports result */
first = cpumask_first(cpu_smt_mask(cpu));
+ wait_for_sibling_cpu(&scan_cpus_in, NSEC_PER_SEC);
+
/*
* This WRMSR will wait for other HT threads to also write
* to this MSR (at most for activate.delay cycles). Then it
@@ -230,6 +255,7 @@ static void ifs_test_core(int cpu, struct device *dev)
}
params.activate = &activate;
+ atomic_set(&scan_cpus_in, 0);
stop_core_cpuslocked(cpu, doscan, ¶ms);
status = params.status;
@@ -270,28 +296,6 @@ static void ifs_test_core(int cpu, struct device *dev)
}
}
-#define SPINUNIT 100 /* 100 nsec */
-static atomic_t array_cpus_in;
-
-/*
- * Simplified cpu sibling rendezvous loop based on microcode loader __wait_for_cpus()
- */
-static void wait_for_sibling_cpu(atomic_t *t, long long timeout)
-{
- int cpu = smp_processor_id();
- const struct cpumask *smt_mask = cpu_smt_mask(cpu);
- int all_cpus = cpumask_weight(smt_mask);
-
- atomic_inc(t);
- while (atomic_read(t) < all_cpus) {
- if (timeout < SPINUNIT)
- return;
- ndelay(SPINUNIT);
- timeout -= SPINUNIT;
- touch_nmi_watchdog();
- }
-}
-
static int do_array_test(void *data)
{
union ifs_array *command = data;
--
2.39.2
next prev parent reply other threads:[~2024-01-25 8:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 8:22 [PATCH 0/5] Miscelleanous fixes and improvements to Infield Scan Ashok Raj
2024-01-25 8:22 ` [PATCH 1/5] platform/x86/intel/ifs: Call release_firmware() when handling errors Ashok Raj
2024-01-25 13:04 ` Ilpo Järvinen
2024-01-26 19:15 ` Hans de Goede
2024-01-29 3:55 ` Pengfei Xu
2024-01-29 8:39 ` Hans de Goede
2024-01-25 8:22 ` [PATCH 2/5] platform/x86/intel/ifs: Trace on all HT threads when executing a test Ashok Raj
2024-01-25 8:22 ` [PATCH 3/5] platform/x86/intel/ifs: Add current batch number to trace output Ashok Raj
2024-01-25 8:22 ` [PATCH 4/5] platform/x86/intel/ifs: Replace the exit rendezvous with an entry rendezvous for ARRAY_BIST Ashok Raj
2024-01-25 8:22 ` Ashok Raj [this message]
2024-01-31 10:29 ` [PATCH 0/5] Miscelleanous fixes and improvements to Infield Scan 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=20240125082254.424859-6-ashok.raj@intel.com \
--to=ashok.raj@intel.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jithu.joseph@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=patches@lists.linux.dev \
--cc=pengfei.xu@intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tony.luck@intel.com \
/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
all inboxes | Powered by JetHome®