From nobody Wed Nov 5 02:37:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532530391189776.7401917140968; Wed, 25 Jul 2018 07:53:11 -0700 (PDT) Received: from localhost ([::1]:51787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiLA5-0006VW-7y for importer@patchew.org; Wed, 25 Jul 2018 10:53:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiL8u-0005nn-PZ for qemu-devel@nongnu.org; Wed, 25 Jul 2018 10:51:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiL8r-0001MU-S2 for qemu-devel@nongnu.org; Wed, 25 Jul 2018 10:51:56 -0400 Received: from 5.mo6.mail-out.ovh.net ([46.105.54.31]:35023) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fiL8r-0001Fa-JC for qemu-devel@nongnu.org; Wed, 25 Jul 2018 10:51:53 -0400 Received: from player797.ha.ovh.net (unknown [10.109.160.230]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 6E454170EE5 for ; Wed, 25 Jul 2018 16:51:44 +0200 (CEST) Received: from bahia.lan (lns-bzn-46-82-253-208-248.adsl.proxad.net [82.253.208.248]) (Authenticated sender: groug@kaod.org) by player797.ha.ovh.net (Postfix) with ESMTPA id B96642E0538; Wed, 25 Jul 2018 16:45:32 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Wed, 25 Jul 2018 16:45:26 +0200 Message-ID: <153252992640.319494.8451297710133862507.stgit@bahia.lan> User-Agent: StGit/0.17.1-46-g6855-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 10165187309110008114 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtiedrjeeigdekudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.54.31 Subject: [Qemu-devel] [PATCH for-3.1] tests/cpu-plug-test: check CPU hotplug on ppc64 with KVM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , =?utf-8?q?C=C3=A9dric?= Le Goater , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Commit b585395b655 fixed a regression introduced by some recent changes in the XICS code, that was causing QEMU to crash instantly during CPU hotplug with KVM. This is typically the kind of bug we'd like our test suite to detect before it gets merged. Unfortunately, the current tests run with '-machine accel=3Dqtest' and don't exercise KVM specific paths in QEMU. This patch hence changes add_pseries_test_case() to launch QEMU with '-machine accel=3Dkvm' if KVM is available. A notable consequence is that the guest will execute SLOF, but for some reasons SLOF sometimes hits a program exception. This causes the guest to loop forever and the test to be stuck. Since we don't need the guest to be truely running, let's pass -S to QEMU to avoid that. Also disable machine capabilities that could be unavailable in KVM, eg, when using PR KVM. Signed-off-by: Greg Kurz --- tests/cpu-plug-test.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c index 5f39ba0df394..2107557809b7 100644 --- a/tests/cpu-plug-test.c +++ b/tests/cpu-plug-test.c @@ -21,6 +21,7 @@ struct PlugTestData { unsigned cores; unsigned threads; unsigned maxcpus; + const char *extra_args; }; typedef struct PlugTestData PlugTestData; =20 @@ -106,9 +107,10 @@ static void test_plug_with_device_add_coreid(gconstpoi= nter data) char *args; unsigned int c; =20 - args =3D g_strdup_printf("-machine %s -cpu %s " + args =3D g_strdup_printf("-machine %s -cpu %s %s " "-smp 1,sockets=3D%u,cores=3D%u,threads=3D%u,ma= xcpus=3D%u", td->machine, td->cpu_model, + td->extra_args ? td->extra_args : "", td->sockets, td->cores, td->threads, td->maxcpu= s); qtest_start(args); =20 @@ -195,10 +197,20 @@ static void add_pseries_test_case(const char *mname) (g_str_has_prefix(mname, "pseries-2.") && atoi(&mname[10]) < 7)) { return; } - data =3D g_new(PlugTestData, 1); + data =3D g_new0(PlugTestData, 1); data->machine =3D g_strdup(mname); data->cpu_model =3D "power8_v2.0"; - data->device_model =3D g_strdup("power8_v2.0-spapr-cpu-core"); + if (!access("/sys/module/kvm_hv", F_OK) || + !access("/sys/module/kvm_pr", F_OK)) { + data->cpu_model =3D "host"; + data->extra_args =3D + "-machine accel=3Dkvm " + "-machine cap-cfpc=3Dbroken,cap-sbbc=3Dbroken,cap-ibs=3Dbroken= " + "-machine cap-htm=3Doff " + "-machine cap-hpt-max-page-size=3D64k " + "-S"; + } + data->device_model =3D g_strdup_printf("%s-spapr-cpu-core", data->cpu_= model); data->sockets =3D 2; data->cores =3D 3; data->threads =3D 1; @@ -221,7 +233,7 @@ static void add_s390x_test_case(const char *mname) return; } =20 - data =3D g_new(PlugTestData, 1); + data =3D g_new0(PlugTestData, 1); data->machine =3D g_strdup(mname); data->cpu_model =3D "qemu"; data->device_model =3D g_strdup("qemu-s390x-cpu");