From nobody Sat May 4 09:53:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550237552952664.5456795778103; Fri, 15 Feb 2019 05:32:32 -0800 (PST) Received: from localhost ([127.0.0.1]:39947 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gudbN-00063C-LU for importer@patchew.org; Fri, 15 Feb 2019 08:32:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gudZT-0004sN-Mc for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:30:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gudZR-0003uj-TT for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:30:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49540) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gudZP-0003jI-Uv; Fri, 15 Feb 2019 08:30:24 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 76F7FC0D7F3D; Fri, 15 Feb 2019 13:30:21 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-138.ams2.redhat.com [10.36.117.138]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12AC560A9B; Fri, 15 Feb 2019 13:30:17 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2019 14:30:00 +0100 Message-Id: <20190215133005.15955-2-david@redhat.com> In-Reply-To: <20190215133005.15955-1-david@redhat.com> References: <20190215133005.15955-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 15 Feb 2019 13:30:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/6] cpus: Properly release the iothread lock when killing a dummy VCPU 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: Laurent Vivier , Thomas Huth , "Michael S . Tsirkin" , Pierre Morel , Peter Crosthwaite , Cornelia Huck , David Hildenbrand , Collin Walling , Eduardo Habkost , Greg Kurz , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Igor Mammedov , Paolo Bonzini , David Gibson , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This enables CPU unplug under qtest. Signed-off-by: David Hildenbrand Reviewed-by: David Gibson Reviewed-by: Greg Kurz Reviewed-by: Michael S. Tsirkin Reviewed-by: Thomas Huth --- cpus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cpus.c b/cpus.c index 154daf57dc..e83f72b48b 100644 --- a/cpus.c +++ b/cpus.c @@ -1333,6 +1333,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) qemu_wait_io_event(cpu); } while (!cpu->unplug); =20 + qemu_mutex_unlock_iothread(); rcu_unregister_thread(); return NULL; #endif --=20 2.17.2 From nobody Sat May 4 09:53:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550237926694120.41902489013921; Fri, 15 Feb 2019 05:38:46 -0800 (PST) Received: from localhost ([127.0.0.1]:40040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gudhI-0002L5-UP for importer@patchew.org; Fri, 15 Feb 2019 08:38:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gudZX-0004yh-7H for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:30:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gudZV-00042l-H9 for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:30:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41102) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gudZT-0003tS-IW; Fri, 15 Feb 2019 08:30:27 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1FE94C7857; Fri, 15 Feb 2019 13:30:25 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-138.ams2.redhat.com [10.36.117.138]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6F3260C80; Fri, 15 Feb 2019 13:30:21 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2019 14:30:01 +0100 Message-Id: <20190215133005.15955-3-david@redhat.com> In-Reply-To: <20190215133005.15955-1-david@redhat.com> References: <20190215133005.15955-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 15 Feb 2019 13:30:25 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/6] spapr: support memory unplug for qtest 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: Laurent Vivier , Thomas Huth , "Michael S . Tsirkin" , Pierre Morel , Peter Crosthwaite , Cornelia Huck , David Hildenbrand , Collin Walling , Eduardo Habkost , Greg Kurz , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Igor Mammedov , Paolo Bonzini , David Gibson , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fake availability of OV5_HP_EVT, so we can test memory unplug in qtest. Signed-off-by: David Hildenbrand Acked-by: David Gibson Reviewed-by: Greg Kurz Reviewed-by: Michael S. Tsirkin --- hw/ppc/spapr_ovec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/ppc/spapr_ovec.c b/hw/ppc/spapr_ovec.c index 318bf33de4..12510b236a 100644 --- a/hw/ppc/spapr_ovec.c +++ b/hw/ppc/spapr_ovec.c @@ -16,6 +16,7 @@ #include "qemu/bitmap.h" #include "exec/address-spaces.h" #include "qemu/error-report.h" +#include "sysemu/qtest.h" #include "trace.h" #include =20 @@ -131,6 +132,11 @@ bool spapr_ovec_test(sPAPROptionVector *ov, long bitnr) g_assert(ov); g_assert(bitnr < OV_MAXBITS); =20 + /* support memory unplug for qtest */ + if (qtest_enabled() && bitnr =3D=3D OV5_HP_EVT) { + return true; + } + return test_bit(bitnr, ov->bitmap) ? true : false; } =20 --=20 2.17.2 From nobody Sat May 4 09:53:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155023757485588.11832455799322; Fri, 15 Feb 2019 05:32:54 -0800 (PST) Received: from localhost ([127.0.0.1]:39953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gudbk-0006KC-LZ for importer@patchew.org; Fri, 15 Feb 2019 08:32:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gudZb-00052m-1R for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:30:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gudZZ-0004Aj-5A for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:30:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54432) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gudZX-00040d-6h; Fri, 15 Feb 2019 08:30:33 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C3903AB42A; Fri, 15 Feb 2019 13:30:28 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-138.ams2.redhat.com [10.36.117.138]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6745E611B8; Fri, 15 Feb 2019 13:30:25 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2019 14:30:02 +0100 Message-Id: <20190215133005.15955-4-david@redhat.com> In-Reply-To: <20190215133005.15955-1-david@redhat.com> References: <20190215133005.15955-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 15 Feb 2019 13:30:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 3/6] tests/device-plug: Add a simple PCI unplug request test 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: Laurent Vivier , Thomas Huth , "Michael S . Tsirkin" , Pierre Morel , Peter Crosthwaite , Cornelia Huck , David Hildenbrand , Collin Walling , Eduardo Habkost , Greg Kurz , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Igor Mammedov , Paolo Bonzini , David Gibson , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The issue with testing asynchronous unplug requests it that they usually require a running guest to handle the request. However, to test if unplug of PCI devices works, we can apply a nice little trick on some architectures: On system reset, x86 ACPI, s390x and spapr will perform the unplug, resulting in the device of interest to get deleted and a DEVICE_DELETED event getting sent. On s390x, we still get a warning qemu-system-s390x: -device virtio-mouse-pci,id=3Ddev0: warning: Plugging a PCI/zPCI device without the 'zpci' CPU feature enabled; the guest will not be able to see/use this device This will be fixed soon, when we enable the zpci CPU feature always (Conny already has a patch for this queued). Signed-off-by: David Hildenbrand Reviewed-by: Collin Walling Reviewed-by: David Gibson Reviewed-by: Greg Kurz Reviewed-by: Michael S. Tsirkin Reviewed-by: Thomas Huth --- tests/Makefile.include | 4 ++ tests/device-plug-test.c | 93 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 tests/device-plug-test.c diff --git a/tests/Makefile.include b/tests/Makefile.include index b39e989f72..f242d65ea2 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -192,6 +192,7 @@ check-qtest-i386-$(CONFIG_ISA_IPMI_KCS) +=3D tests/ipmi= -kcs-test$(EXESUF) # check-qtest-i386-$(CONFIG_ISA_IPMI_BT) +=3D tests/ipmi-bt-test$(EXESUF) check-qtest-i386-y +=3D tests/i440fx-test$(EXESUF) check-qtest-i386-y +=3D tests/fw_cfg-test$(EXESUF) +check-qtest-i386-y +=3D tests/device-plug-test$(EXESUF) check-qtest-i386-y +=3D tests/drive_del-test$(EXESUF) check-qtest-i386-$(CONFIG_WDT_IB700) +=3D tests/wdt_ib700-test$(EXESUF) check-qtest-i386-y +=3D tests/tco-test$(EXESUF) @@ -256,6 +257,7 @@ check-qtest-ppc-$(CONFIG_M48T59) +=3D tests/m48t59-test= $(EXESUF) =20 check-qtest-ppc64-y +=3D $(check-qtest-ppc-y) check-qtest-ppc64-$(CONFIG_PSERIES) +=3D tests/spapr-phb-test$(EXESUF) +check-qtest-ppc64-$(CONFIG_PSERIES) +=3D tests/device-plug-test$(EXESUF) check-qtest-ppc64-$(CONFIG_POWERNV) +=3D tests/pnv-xscom-test$(EXESUF) check-qtest-ppc64-y +=3D tests/migration-test$(EXESUF) check-qtest-ppc64-$(CONFIG_PSERIES) +=3D tests/rtas-test$(EXESUF) @@ -310,6 +312,7 @@ check-qtest-s390x-$(CONFIG_SLIRP) +=3D tests/test-netfi= lter$(EXESUF) check-qtest-s390x-$(CONFIG_POSIX) +=3D tests/test-filter-mirror$(EXESUF) check-qtest-s390x-$(CONFIG_POSIX) +=3D tests/test-filter-redirector$(EXESU= F) check-qtest-s390x-y +=3D tests/drive_del-test$(EXESUF) +check-qtest-s390x-y +=3D tests/device-plug-test$(EXESUF) check-qtest-s390x-y +=3D tests/virtio-ccw-test$(EXESUF) check-qtest-s390x-y +=3D tests/cpu-plug-test$(EXESUF) check-qtest-s390x-y +=3D tests/migration-test$(EXESUF) @@ -750,6 +753,7 @@ tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o tests/qom-test$(EXESUF): tests/qom-test.o tests/test-hmp$(EXESUF): tests/test-hmp.o tests/machine-none-test$(EXESUF): tests/machine-none-test.o +tests/device-plug-test$(EXESUF): tests/device-plug-test.o tests/drive_del-test$(EXESUF): tests/drive_del-test.o $(libqos-virtio-obj-= y) tests/nvme-test$(EXESUF): tests/nvme-test.o $(libqos-pc-obj-y) tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o diff --git a/tests/device-plug-test.c b/tests/device-plug-test.c new file mode 100644 index 0000000000..066433ebf5 --- /dev/null +++ b/tests/device-plug-test.c @@ -0,0 +1,93 @@ +/* + * QEMU device plug/unplug handling + * + * Copyright (C) 2019 Red Hat Inc. + * + * Authors: + * David Hildenbrand + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "libqtest.h" +#include "qapi/qmp/qdict.h" +#include "qapi/qmp/qstring.h" + +static void device_del_request(QTestState *qtest, const char *id) +{ + QDict *resp; + + resp =3D qtest_qmp(qtest, + "{'execute': 'device_del', 'arguments': { 'id': %s } = }", + id); + g_assert(qdict_haskey(resp, "return")); + qobject_unref(resp); +} + +static void system_reset(QTestState *qtest) +{ + QDict *resp; + + resp =3D qtest_qmp(qtest, "{'execute': 'system_reset'}"); + g_assert(qdict_haskey(resp, "return")); + qobject_unref(resp); +} + +static void wait_device_deleted_event(QTestState *qtest, const char *id) +{ + QDict *resp, *data; + QString *qstr; + + /* + * Other devices might get removed along with the removed device. Skip + * these. The device of interest will be the last one. + */ + for (;;) { + resp =3D qtest_qmp_eventwait_ref(qtest, "DEVICE_DELETED"); + data =3D qdict_get_qdict(resp, "data"); + if (!data || !qdict_get(data, "device")) { + qobject_unref(resp); + continue; + } + qstr =3D qobject_to(QString, qdict_get(data, "device")); + g_assert(qstr); + if (!strcmp(qstring_get_str(qstr), id)) { + qobject_unref(resp); + break; + } + qobject_unref(resp); + } +} + +static void test_pci_unplug_request(void) +{ + QTestState *qtest =3D qtest_initf("-device virtio-mouse-pci,id=3Ddev0"= ); + + /* + * Request device removal. As the guest is not running, the request wo= n't + * be processed. However during system reset, the removal will be + * handled, removing the device. + */ + device_del_request(qtest, "dev0"); + system_reset(qtest); + wait_device_deleted_event(qtest, "dev0"); + + qtest_quit(qtest); +} + +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + + /* + * We need a system that will process unplug requests during system re= sets + * and does not do PCI surprise removal. This holds for x86 ACPI, + * s390x and spapr. + */ + qtest_add_func("/device-plug/pci_unplug_request", + test_pci_unplug_request); + + return g_test_run(); +} --=20 2.17.2 From nobody Sat May 4 09:53:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15502381185711014.9047056838498; Fri, 15 Feb 2019 05:41:58 -0800 (PST) Received: from localhost ([127.0.0.1]:40113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gudkY-000529-HK for importer@patchew.org; Fri, 15 Feb 2019 08:41:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guda0-0005Rb-JU for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:31:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gudZu-0004Tv-UU for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:30:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54622) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gudZk-0004Hx-B7; Fri, 15 Feb 2019 08:30:47 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 40BA8AB41F; Fri, 15 Feb 2019 13:30:39 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-138.ams2.redhat.com [10.36.117.138]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14C9F611B8; Fri, 15 Feb 2019 13:30:28 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2019 14:30:03 +0100 Message-Id: <20190215133005.15955-5-david@redhat.com> In-Reply-To: <20190215133005.15955-1-david@redhat.com> References: <20190215133005.15955-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 15 Feb 2019 13:30:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 4/6] tests/device-plug: Add CCW unplug test for s390x 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: Laurent Vivier , Thomas Huth , "Michael S . Tsirkin" , Pierre Morel , Peter Crosthwaite , Cornelia Huck , David Hildenbrand , Collin Walling , Eduardo Habkost , Greg Kurz , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Igor Mammedov , Paolo Bonzini , David Gibson , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" As CCW unplugs are surprise removals without asking the guest first, we can test this without any guest interaction. Signed-off-by: David Hildenbrand Reviewed-by: Michael S. Tsirkin Reviewed-by: Thomas Huth --- tests/device-plug-test.c | 41 +++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/tests/device-plug-test.c b/tests/device-plug-test.c index 066433ebf5..6f7255552a 100644 --- a/tests/device-plug-test.c +++ b/tests/device-plug-test.c @@ -15,17 +15,26 @@ #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" =20 -static void device_del_request(QTestState *qtest, const char *id) +static void device_del_start(QTestState *qtest, const char *id) { - QDict *resp; + qtest_qmp_send(qtest, + "{'execute': 'device_del', 'arguments': { 'id': %s } }"= , id); +} + +static void device_del_finish(QTestState *qtest) +{ + QDict *resp =3D qtest_qmp_receive(qtest); =20 - resp =3D qtest_qmp(qtest, - "{'execute': 'device_del', 'arguments': { 'id': %s } = }", - id); g_assert(qdict_haskey(resp, "return")); qobject_unref(resp); } =20 +static void device_del_request(QTestState *qtest, const char *id) +{ + device_del_start(qtest, id); + device_del_finish(qtest); +} + static void system_reset(QTestState *qtest) { QDict *resp; @@ -77,8 +86,25 @@ static void test_pci_unplug_request(void) qtest_quit(qtest); } =20 +static void test_ccw_unplug(void) +{ + QTestState *qtest =3D qtest_initf("-device virtio-balloon-ccw,id=3Ddev= 0"); + + /* + * The DEVICE_DELETED events will be sent before the command + * completes. + */ + device_del_start(qtest, "dev0"); + wait_device_deleted_event(qtest, "dev0"); + device_del_finish(qtest); + + qtest_quit(qtest); +} + int main(int argc, char **argv) { + const char *arch =3D qtest_get_arch(); + g_test_init(&argc, &argv, NULL); =20 /* @@ -89,5 +115,10 @@ int main(int argc, char **argv) qtest_add_func("/device-plug/pci_unplug_request", test_pci_unplug_request); =20 + if (!strcmp(arch, "s390x")) { + qtest_add_func("/device-plug/ccw_unplug", + test_ccw_unplug); + } + return g_test_run(); } --=20 2.17.2 From nobody Sat May 4 09:53:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155023794363817.289399934641324; Fri, 15 Feb 2019 05:39:03 -0800 (PST) Received: from localhost ([127.0.0.1]:40048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gudhk-0002e2-Iz for importer@patchew.org; Fri, 15 Feb 2019 08:39:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guda2-0005Sk-9j for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:31:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1guda1-0004b2-IZ for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:31:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51828) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1guda0-0004Kg-LP; Fri, 15 Feb 2019 08:31:01 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D8748CF49A; Fri, 15 Feb 2019 13:30:42 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-138.ams2.redhat.com [10.36.117.138]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89CD3611B8; Fri, 15 Feb 2019 13:30:39 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2019 14:30:04 +0100 Message-Id: <20190215133005.15955-6-david@redhat.com> In-Reply-To: <20190215133005.15955-1-david@redhat.com> References: <20190215133005.15955-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 15 Feb 2019 13:30:43 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 5/6] tests/device-plug: Add CPU core unplug request test for spapr 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: Laurent Vivier , Thomas Huth , "Michael S . Tsirkin" , Pierre Morel , Peter Crosthwaite , Cornelia Huck , David Hildenbrand , Collin Walling , Eduardo Habkost , Greg Kurz , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Igor Mammedov , Paolo Bonzini , David Gibson , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We can easily test this, just like PCI. Signed-off-by: David Hildenbrand Reviewed-by: Greg Kurz Reviewed-by: Michael S. Tsirkin Reviewed-by: Thomas Huth --- tests/device-plug-test.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/device-plug-test.c b/tests/device-plug-test.c index 6f7255552a..ec6cb5de7b 100644 --- a/tests/device-plug-test.c +++ b/tests/device-plug-test.c @@ -101,6 +101,21 @@ static void test_ccw_unplug(void) qtest_quit(qtest); } =20 +static void test_spapr_cpu_unplug_request(void) +{ + QTestState *qtest; + + qtest =3D qtest_initf("-cpu power9_v2.0 -smp 1,maxcpus=3D2 " + "-device power9_v2.0-spapr-cpu-core,core-id=3D1,id= =3Ddev0"); + + /* similar to test_pci_unplug_request */ + device_del_request(qtest, "dev0"); + system_reset(qtest); + wait_device_deleted_event(qtest, "dev0"); + + qtest_quit(qtest); +} + int main(int argc, char **argv) { const char *arch =3D qtest_get_arch(); @@ -120,5 +135,10 @@ int main(int argc, char **argv) test_ccw_unplug); } =20 + if (!strcmp(arch, "ppc64")) { + qtest_add_func("/device-plug/spapr_cpu_unplug_request", + test_spapr_cpu_unplug_request); + } + return g_test_run(); } --=20 2.17.2 From nobody Sat May 4 09:53:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550237764396844.5925641804861; Fri, 15 Feb 2019 05:36:04 -0800 (PST) Received: from localhost ([127.0.0.1]:40010 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gudeq-0000CJ-AO for importer@patchew.org; Fri, 15 Feb 2019 08:36:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guda2-0005Sl-GU for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:31:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1guda1-0004bM-LP for qemu-devel@nongnu.org; Fri, 15 Feb 2019 08:31:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43652) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1guda1-0004QQ-FR; Fri, 15 Feb 2019 08:31:01 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 744D2C0D7F0E; Fri, 15 Feb 2019 13:30:48 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-138.ams2.redhat.com [10.36.117.138]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B42E60C80; Fri, 15 Feb 2019 13:30:43 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2019 14:30:05 +0100 Message-Id: <20190215133005.15955-7-david@redhat.com> In-Reply-To: <20190215133005.15955-1-david@redhat.com> References: <20190215133005.15955-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 15 Feb 2019 13:30:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 6/6] tests/device-plug: Add memory unplug request test for spapr 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: Laurent Vivier , Thomas Huth , "Michael S . Tsirkin" , Pierre Morel , Peter Crosthwaite , Cornelia Huck , David Hildenbrand , Collin Walling , Eduardo Habkost , Greg Kurz , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Igor Mammedov , Paolo Bonzini , David Gibson , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We can easily test this, just like PCI. Signed-off-by: David Hildenbrand Reviewed-by: Greg Kurz Reviewed-by: Michael S. Tsirkin Reviewed-by: Thomas Huth --- tests/device-plug-test.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/device-plug-test.c b/tests/device-plug-test.c index ec6cb5de7b..4c581319c0 100644 --- a/tests/device-plug-test.c +++ b/tests/device-plug-test.c @@ -116,6 +116,22 @@ static void test_spapr_cpu_unplug_request(void) qtest_quit(qtest); } =20 +static void test_spapr_memory_unplug_request(void) +{ + QTestState *qtest; + + qtest =3D qtest_initf("-m 1G,slots=3D1,maxmem=3D2G " + "-object memory-backend-ram,id=3Dmem0,size=3D1G " + "-device pc-dimm,id=3Ddev0,memdev=3Dmem0"); + + /* similar to test_pci_unplug_request */ + device_del_request(qtest, "dev0"); + system_reset(qtest); + wait_device_deleted_event(qtest, "dev0"); + + qtest_quit(qtest); +} + int main(int argc, char **argv) { const char *arch =3D qtest_get_arch(); @@ -140,5 +156,10 @@ int main(int argc, char **argv) test_spapr_cpu_unplug_request); } =20 + if (!strcmp(arch, "ppc64")) { + qtest_add_func("/device-plug/spapr_memory_unplug_request", + test_spapr_memory_unplug_request); + } + return g_test_run(); } --=20 2.17.2