From: Andre Przywara <andre.przywara@arm.com>
To: Paolo Bonzini <pbonzini@redhat.com>, Andrew Jones <drjones@redhat.com>
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Subject: [kvm-unit-tests PATCH 5/6] arm: selftest: Make MPIDR output stable
Date: Fri, 27 Sep 2019 11:42:26 +0100 [thread overview]
Message-ID: <20190927104227.253466-6-andre.przywara@arm.com> (raw)
In-Reply-To: <20190927104227.253466-1-andre.przywara@arm.com>
At the moment the smp selftest outputs one line for each vCPU, with the
CPU number and its MPIDR printed in the same test result line.
For automated test frameworks this has the problem of including variable
output in the test name, also the number of tests varies, depending on the
number of vCPUs.
Fix this by only generating a single line of output for the SMP test,
which summarises the result. We use two cpumasks, to let each vCPU report
its result and completion of the test (code stolen from the GIC test).
For informational purposes we keep the one line per CPU, but prefix it
with an INFO: tag, so that frameworks can ignore it.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
arm/selftest.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/arm/selftest.c b/arm/selftest.c
index a0c1ab8..e9dc5c0 100644
--- a/arm/selftest.c
+++ b/arm/selftest.c
@@ -17,6 +17,8 @@
#include <asm/smp.h>
#include <asm/barrier.h>
+static cpumask_t ready, valid;
+
static void __user_psci_system_off(void)
{
psci_system_off();
@@ -341,8 +343,11 @@ static void cpu_report(void *data __unused)
uint64_t mpidr = get_mpidr();
int cpu = smp_processor_id();
- report("CPU(%3d) mpidr=%010" PRIx64,
- mpidr_to_cpu(mpidr) == cpu, cpu, mpidr);
+ if (mpidr_to_cpu(mpidr) == cpu)
+ cpumask_set_cpu(smp_processor_id(), &valid);
+ smp_wmb(); /* Paired with rmb in main(). */
+ cpumask_set_cpu(smp_processor_id(), &ready);
+ report_info("CPU%3d: MPIDR=%010" PRIx64, cpu, mpidr);
}
int main(int argc, char **argv)
@@ -371,6 +376,11 @@ int main(int argc, char **argv)
report("PSCI version", psci_check());
on_cpus(cpu_report, NULL);
+ while (!cpumask_full(&ready))
+ cpu_relax();
+ smp_rmb(); /* Paired with wmb in cpu_report(). */
+ report("MPIDR test on all CPUs", cpumask_full(&valid));
+ report_info("%d CPUs reported back", nr_cpus);
} else {
printf("Unknown subtest\n");
--
2.17.1
next prev parent reply other threads:[~2019-09-27 10:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-27 10:42 [kvm-unit-tests PATCH 0/6] arm: Use stable test output lines Andre Przywara
2019-09-27 10:42 ` [kvm-unit-tests PATCH 1/6] arm: gic: check_acked: add test description Andre Przywara
2019-09-27 12:18 ` Andrew Jones
2019-09-27 12:40 ` Andre Przywara
2019-09-27 12:55 ` Andrew Jones
2019-09-27 10:42 ` [kvm-unit-tests PATCH 2/6] arm: gic: Split variable output data from test name Andre Przywara
2019-09-27 12:25 ` Andrew Jones
2019-09-27 10:42 ` [kvm-unit-tests PATCH 3/6] arm: timer: " Andre Przywara
2019-09-27 12:25 ` Andrew Jones
2019-09-27 10:42 ` [kvm-unit-tests PATCH 4/6] arm: selftest: " Andre Przywara
2019-09-27 12:26 ` Andrew Jones
2019-09-27 10:42 ` Andre Przywara [this message]
2019-09-27 12:30 ` [kvm-unit-tests PATCH 5/6] arm: selftest: Make MPIDR output stable Andrew Jones
2019-09-27 10:42 ` [kvm-unit-tests PATCH 6/6] arm: Add missing test name prefix calls Andre Przywara
2019-09-27 12:31 ` Andrew Jones
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=20190927104227.253466-6-andre.przywara@arm.com \
--to=andre.przywara@arm.com \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=pbonzini@redhat.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