Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C756BC4CED1 for ; Fri, 4 Oct 2019 14:18:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A0458222C8 for ; Fri, 4 Oct 2019 14:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389050AbfJDOSq (ORCPT ); Fri, 4 Oct 2019 10:18:46 -0400 Received: from foss.arm.com ([217.140.110.172]:46262 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389012AbfJDOSo (ORCPT ); Fri, 4 Oct 2019 10:18:44 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 873781597; Fri, 4 Oct 2019 07:18:43 -0700 (PDT) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.197.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BAB483F68E; Fri, 4 Oct 2019 07:18:42 -0700 (PDT) From: Andre Przywara To: Paolo Bonzini , Andrew Jones Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [kvm-unit-tests PATCH v2 5/6] arm: selftest: Make MPIDR output stable Date: Fri, 4 Oct 2019 15:18:28 +0100 Message-Id: <20191004141829.87135-6-andre.przywara@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191004141829.87135-1-andre.przywara@arm.com> References: <20191004141829.87135-1-andre.przywara@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 Reviewed-by: Andrew Jones --- 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 #include +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