From nobody Mon Feb 9 07:29:11 2026 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542292431014927.1645498392917; Thu, 15 Nov 2018 06:33:51 -0800 (PST) Received: from localhost ([::1]:39188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIiL-0003Ng-LT for importer@patchew.org; Thu, 15 Nov 2018 09:33:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIgB-0002CG-DV for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNIg5-0003r8-GC for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:33 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:56144) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gNIg5-0003q5-99 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:29 -0500 Received: by mail-wm1-x343.google.com with SMTP id y139so1666783wmc.5 for ; Thu, 15 Nov 2018 06:31:28 -0800 (PST) Received: from localhost.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id x194-v6sm55262620wmd.41.2018.11.15.06.31.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 06:31:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8Tbgvo7nqHxj+E/PSacuAqrya2h0ycHk1P0mZoBsUn4=; b=oFecYQGl7MsTsEeXgPdWitOkLm2vhvs3W5VxWFMMfpyps7BPmkahMLUpA1pAaYPh1e gVoEaeceD6nupss6yRHQpnRN+BT7AsZKWAbvSIL2CFM6l79yIzyoVTI4t02w/YpDOhrP /2tszJy2q1TY1McniGP9ewfGNXND7p/FKkw/nXGFBjbN45aqwdQoXLnXLK+0gW17r91L NwZkQf9aSNFpcGRwuy/iEsX9QgsYfytmDN9IxVHMnu9Ljr+Z/tRbBTMSvLkxx+gS2YYS iLSHvbrakiSAOWj3YOz67HLl3U+Nj2dfpP2P+0sayHSTYEDlwqF3/AsNqlYZfsVC0PFy 0IcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8Tbgvo7nqHxj+E/PSacuAqrya2h0ycHk1P0mZoBsUn4=; b=TZcknk8zsU3JKsy0XYxRdQSO5NUV72l81xdM+nSzjhgcWVl7VUn/IZAxi49ZXIbK/T v/8Mas6KwGYXVNDbaS1+owAPPn2+9iWIHSUCRSgeTCk/mTBFXbpSheZWe3itRoolrWB4 r3j3jU+Ho3ykBZKN8fDtqQpu5Xyq1Ia/djfESA6iphTMzoy6kWhsH2Yki7f9B9a8LdeT y/BMnmqbFnpwHAa9n4+w/Yq2NhaRGWmgpfqM3FeyuvKsCSKVepo1eKl8zVNHchp38LBO IekCJfkmmNi8lO3NDEKRhSLtB1MinkMB/MTNJP00/Lzo9QWOmThW9EVFnPpsLF+1MPuK wr0w== X-Gm-Message-State: AGRZ1gKzJSSdqtFm6uQO+Ngvh2PsWML1QzfhbEXcCh6o2Jq1p4Cz8yV0 3GCd4/QibLtA6lXbWTrNMDxZ0Lwo X-Google-Smtp-Source: AJdET5dVZm5lYEhkz/ei8hbK7Nm0NHMSSgwbWThQYafbOpyQcrvra6peHX984n+iUKV0ilPPnnoGMw== X-Received: by 2002:a1c:2c03:: with SMTP id s3-v6mr5543318wms.38.1542292286823; Thu, 15 Nov 2018 06:31:26 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 15:31:15 +0100 Message-Id: <20181115143124.19234-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115143124.19234-1-pbonzini@redhat.com> References: <20181115143124.19234-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH 01/10] vhost-user-test: use g_cond_broadcast 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: lvivier@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jasowang@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" g_cond_signal is rarely the right thing to do, it works now because vhost-user-test only has two threads but it is not correct in general. Fix it before adding more calls. Signed-off-by: Paolo Bonzini Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/vhost-user-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 45d58d8ea2..656e51938b 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -393,7 +393,7 @@ static void chr_read(void *opaque, const uint8_t *buf, = int size) G_N_ELEMENTS(s->fds)); =20 /* signal the test that it can continue */ - g_cond_signal(&s->data_cond); + g_cond_broadcast(&s->data_cond); break; =20 case VHOST_USER_SET_VRING_KICK: @@ -419,7 +419,7 @@ static void chr_read(void *opaque, const uint8_t *buf, = int size) p =3D (uint8_t *) &msg; qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE); =20 - g_cond_signal(&s->data_cond); + g_cond_broadcast(&s->data_cond); break; =20 case VHOST_USER_SET_VRING_BASE: --=20 2.19.1 From nobody Mon Feb 9 07:29:11 2026 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542292447180563.2293525520774; Thu, 15 Nov 2018 06:34:07 -0800 (PST) Received: from localhost ([::1]:39190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIic-0003Y9-1M for importer@patchew.org; Thu, 15 Nov 2018 09:34:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIgJ-0002HT-2U for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNIgB-0003wf-EH for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:39 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:45198) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gNIg7-0003qZ-CH for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:33 -0500 Received: by mail-wr1-x443.google.com with SMTP id k15-v6so21407569wre.12 for ; Thu, 15 Nov 2018 06:31:29 -0800 (PST) Received: from localhost.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id x194-v6sm55262620wmd.41.2018.11.15.06.31.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 06:31:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7RN1mWDByY6ZO2eQH2M3QfeVNCqcyYSnR/aIdxyjMzs=; b=NX+4/paBgkb8Ibk3d0lJE1eopz3M1yXUDDQDprlIzZU7opWGKn1lG7hSZ5fhUy+Kkt T2k8OAGIMTdFe+8FiJjLjpxmUd9qyDaBKnEYYnFsCeNIFllKinmLQnYz1v+TiGNAU8O+ 0B2owEwLuIedar2FWCpzPORiPLkOyUgBiaSEKSZBs+L9sB6Q1FKdIKtwLMp74xVqPRt3 h2n5jOKoyW1x0FrB4ujytMQpQf8NOz7f2Y7M4/fsshJARPL5why2Ej8FD9FgqFmxkyb5 2LTkvZvi0Wf+hcQTiKdpfe2qArXT4IMoiHCoZQ3dhK8o9s2ywkWAHaMq33SYn+vKSqU9 zjhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=7RN1mWDByY6ZO2eQH2M3QfeVNCqcyYSnR/aIdxyjMzs=; b=dQ5KNL5JRwtuLdGAssewjSujlXx1FrSs2lVRYUhMly8RggzxEBzwvDnxB7/f8RqHks +l6rPgfdF9gcc17KYgupr63eiUpG0OY95xQpFovCXlAFh/v5cbBo7ttA6icdRPVduvkS ET/K1dQvPg/KpolGU3pDBFYZPMA6RgRye0GGom6y+yR5dkS/uUQC3ISEvGbcgDs+Xaip g6GJuew4w+c8fTVaEGXD6PC0OgSrQ5EcWs8XyZehZdrHbcGGyQ0OgGf8HNOkwLlHpkBi hBsyXFMdGqpi7UL5VM0+tNV/Tz/xBqY/Ws9UQ2JTf2seYAbTuDuVTQFNbsd3LqDrzlEG MLlA== X-Gm-Message-State: AGRZ1gKmLT3IInrpLMub1iugnP6bH7MetxsuN4HwvJFgfBWPN8RLacWe rOu0TQvmV6Zytj8pL+D7gD4v74u8 X-Google-Smtp-Source: AJdET5fYDo4J4SPwlppRQ4Ln84/i5vdHvXq6PGJ4WtN350XjnBt3hxRRSUCMiK9f13xrzh88aA3pcg== X-Received: by 2002:adf:90d0:: with SMTP id i74-v6mr5983924wri.181.1542292288217; Thu, 15 Nov 2018 06:31:28 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 15:31:16 +0100 Message-Id: <20181115143124.19234-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115143124.19234-1-pbonzini@redhat.com> References: <20181115143124.19234-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH 02/10] vhost-user-test: signal data_cond when s->rings changes 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: lvivier@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jasowang@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This speeds up wait_for_rings_started, which currently is just waiting for the timeout before checking s->rings. Signed-off-by: Paolo Bonzini Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/vhost-user-test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 656e51938b..6a805e67be 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -384,6 +384,7 @@ static void chr_read(void *opaque, const uint8_t *buf, = int size) =20 assert(msg.payload.state.index < s->queues * 2); s->rings &=3D ~(0x1ULL << msg.payload.state.index); + g_cond_broadcast(&s->data_cond); break; =20 case VHOST_USER_SET_MEM_TABLE: @@ -425,6 +426,7 @@ static void chr_read(void *opaque, const uint8_t *buf, = int size) case VHOST_USER_SET_VRING_BASE: assert(msg.payload.state.index < s->queues * 2); s->rings |=3D 0x1ULL << msg.payload.state.index; + g_cond_broadcast(&s->data_cond); break; =20 case VHOST_USER_GET_QUEUE_NUM: --=20 2.19.1 From nobody Mon Feb 9 07:29:11 2026 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542292451852593.1893596193578; Thu, 15 Nov 2018 06:34:11 -0800 (PST) Received: from localhost ([::1]:39191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIig-0003a9-ME for importer@patchew.org; Thu, 15 Nov 2018 09:34:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIgJ-0002HS-2N for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNIgB-0003wY-Dn for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:39 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:51013) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gNIg7-0003ro-E0 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:33 -0500 Received: by mail-wm1-x344.google.com with SMTP id 124-v6so19158264wmw.0 for ; Thu, 15 Nov 2018 06:31:30 -0800 (PST) Received: from localhost.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id x194-v6sm55262620wmd.41.2018.11.15.06.31.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 06:31:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JRdNPF1MXqI8p2p0w2RzxFj+0XpHIthZAC2gUeb8rag=; b=mbkS/2tNtm4+qj7Jjf+jXYXJNjQ64PxA/tX5T37miMuP45C3cDcnUhZXk9m/OUN8w4 SmV0u/ASrZXKSh7kxf9ZScnsRitp79itZJ9CI1k6oj6y7TuBsG5EaE7gbAwMkVJLNgXd sAjj7+bFjtcdJ7MZV6Xp4Q1ocM5aMifPqUq7giwJVM9ursRiQLt7/HYnedF5vaihXpcZ 4irrXFQ9mjg9ZfKvrS0UkTp9uhNQMMvtFwgbuADwI6NRNqEyhdWMGsaXb5m2/GS2I8AW JfKw7S0Be9yOaDRV3H5CrrPwW2fkd06VvIMbNKwxlCZExE15eNyshyaeSIuMhnYTfp93 hv+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=JRdNPF1MXqI8p2p0w2RzxFj+0XpHIthZAC2gUeb8rag=; b=CtZZ2Ei8ZeB8lj7UhuhIc0WfefRwqHDuY+fyCEbPglbB5E7D3t4F0ra6JlDuLD8Z+l f1tCtQwX5I49FVtVuEkhtnXre3okOedzf2+w8FfRHumf4r0Ywr52V/izbhHEsxolFThW 1ugPssfYIHTWefgBMkuDZqB6M4/oMZlWywu/K6hr5xsdTf+ftGX5SA9pNfActbOGqgJB B3ThmFXYzUZ6DZ9nr5hDaf1GW4Jmadm5uGDiIXMwYnriZ8UQIDQ0mrG844lKdWvE/Jlh VFOQVDsi/dJPDWItuwtbCijJOEy5kxh6FryTGaVjr3SzC1lWhpObmNnuDKh4KfIWe814 M21g== X-Gm-Message-State: AGRZ1gI+ctaj3/YQ9kqzGWxlHuF+5FS8UHg9+TbH/m0NHztfI14VK5LF Fq/jNBJdBUhN3EuQfkwQusPhh7Vm X-Google-Smtp-Source: AJdET5dE7LT+l0Bk4DU/GFUloGY88tvDcFRVoQdiLEhD3f6sRBGznHk83U67nV7K0mY5X+932d37qQ== X-Received: by 2002:a1c:6783:: with SMTP id b125-v6mr5274982wmc.147.1542292289401; Thu, 15 Nov 2018 06:31:29 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 15:31:17 +0100 Message-Id: <20181115143124.19234-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115143124.19234-1-pbonzini@redhat.com> References: <20181115143124.19234-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH 03/10] vhost-net: compile it for all targets 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: lvivier@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jasowang@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Currently vhost-net is compiled only for KVM-enabled targets. This is not needed anymore because ioeventfd is supported and emulated by the memory core. Compile it and vhost-user-test for all targets. While at it, fix the annoying typo CONFIG_VHOST_NET_USED. Signed-off-by: Paolo Bonzini --- configure | 13 +++++-------- include/exec/poison.h | 1 - net/net.c | 2 +- tests/Makefile.include | 5 +---- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/configure b/configure index 5b1d83ea26..d8317e1832 100755 --- a/configure +++ b/configure @@ -6512,8 +6512,11 @@ fi if test "$vhost_scsi" =3D "yes" ; then echo "CONFIG_VHOST_SCSI=3Dy" >> $config_host_mak fi -if test "$vhost_net" =3D "yes" -a "$vhost_user" =3D "yes"; then - echo "CONFIG_VHOST_NET_USED=3Dy" >> $config_host_mak +if test "$vhost_net" =3D "yes" ; then + echo "CONFIG_VHOST_NET=3Dy" >> $config_host_mak + if test "$vhost_user" =3D "yes"; then + echo "CONFIG_VHOST_NET_USER=3Dy" >> $config_host_mak + fi fi if test "$vhost_crypto" =3D "yes" ; then echo "CONFIG_VHOST_CRYPTO=3Dy" >> $config_host_mak @@ -7275,12 +7278,6 @@ if supported_xen_target $target; then fi if supported_kvm_target $target; then echo "CONFIG_KVM=3Dy" >> $config_target_mak - if test "$vhost_net" =3D "yes" ; then - echo "CONFIG_VHOST_NET=3Dy" >> $config_target_mak - if test "$vhost_user" =3D "yes" ; then - echo "CONFIG_VHOST_USER_NET_TEST_$target_name=3Dy" >> $config_= host_mak - fi - fi fi if supported_hax_target $target; then echo "CONFIG_HAX=3Dy" >> $config_target_mak diff --git a/include/exec/poison.h b/include/exec/poison.h index 32d53789f8..b158632791 100644 --- a/include/exec/poison.h +++ b/include/exec/poison.h @@ -85,7 +85,6 @@ #pragma GCC poison CONFIG_XTENSA_DIS =20 #pragma GCC poison CONFIG_LINUX_USER -#pragma GCC poison CONFIG_VHOST_NET #pragma GCC poison CONFIG_KVM #pragma GCC poison CONFIG_SOFTMMU =20 diff --git a/net/net.c b/net/net.c index 07c194a8f6..95a74add6c 100644 --- a/net/net.c +++ b/net/net.c @@ -955,7 +955,7 @@ static int (* const net_client_init_fun[NET_CLIENT_DRIV= ER__MAX])( [NET_CLIENT_DRIVER_BRIDGE] =3D net_init_bridge, #endif [NET_CLIENT_DRIVER_HUBPORT] =3D net_init_hubport, -#ifdef CONFIG_VHOST_NET_USED +#ifdef CONFIG_VHOST_NET_USER [NET_CLIENT_DRIVER_VHOST_USER] =3D net_init_vhost_user, #endif #ifdef CONFIG_L2TPV3 diff --git a/tests/Makefile.include b/tests/Makefile.include index fb0b449c02..03a64ce9c8 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -204,10 +204,7 @@ check-qtest-i386-$(CONFIG_USB_XHCI_NEC) +=3D tests/usb= -hcd-xhci-test$(EXESUF) check-qtest-i386-y +=3D tests/cpu-plug-test$(EXESUF) check-qtest-i386-y +=3D tests/q35-test$(EXESUF) check-qtest-i386-y +=3D tests/vmgenid-test$(EXESUF) -check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) +=3D tests/vhost-user-= test$(EXESUF) -ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),) -check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) +=3D tests/vhost-u= ser-test$(EXESUF) -endif +check-qtest-i386-$(CONFIG_VHOST_NET_USER) +=3D tests/vhost-user-test$(EXES= UF) check-qtest-i386-$(CONFIG_TPM_CRB) +=3D tests/tpm-crb-swtpm-test$(EXESUF) check-qtest-i386-$(CONFIG_TPM_CRB) +=3D tests/tpm-crb-test$(EXESUF) check-qtest-i386-$(CONFIG_TPM_TIS) +=3D tests/tpm-tis-swtpm-test$(EXESUF) --=20 2.19.1 From nobody Mon Feb 9 07:29:11 2026 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 154229263362615.126387281981238; Thu, 15 Nov 2018 06:37:13 -0800 (PST) Received: from localhost ([::1]:39212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIlY-0005y5-Cm for importer@patchew.org; Thu, 15 Nov 2018 09:37:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIgY-0002ST-Sk for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:32:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNIgW-00046P-RS for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:58 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:38382) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gNIgU-0003sQ-TS for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:55 -0500 Received: by mail-wr1-x442.google.com with SMTP id e3-v6so21469325wrs.5 for ; Thu, 15 Nov 2018 06:31:31 -0800 (PST) Received: from localhost.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id x194-v6sm55262620wmd.41.2018.11.15.06.31.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 06:31:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ve+4Oazo+a8oAvUqipYtF8/WTPzv/ZEskuf8pRMiVfA=; b=sLmlrfaxyxK/If5Sdl3EMGf4kOhnrekwcxDg5nYhgjU4agrhNYmb+XcSzPQ2rivv2O 4JroUwXky/Qb3wR/gv1TSknG8A3pnQCnb30hLkIVfQdpbr6yems+WvdEkZtpvVgDd2iZ wKUFTzGI/OHHpTXoqj2j3WteHzPUqgNyd3YdHcspK7neHZR5mY3hqyyjqLXWcEtkZwRd iOkCOqGdLta+vC5vjFQJhhIt0xcg4tgDmCCrE+qSktEQOrkDTXLLpypqzkQFHm33myiS oFKKrLvw0tGrkwC4dW9mObJnKfiuInj5DwjE16XzRTBSJ/ZqUtZbe4Po3G7JJh3AUbSs lZGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ve+4Oazo+a8oAvUqipYtF8/WTPzv/ZEskuf8pRMiVfA=; b=TV+/Xlylp6PUkU8M9FAOvEJwfH/Gy2tUDK1kvfkdFFCBpKUWjQFB3yKnaunkuts2gv EX6Ypq7uP44GIAG6044bdOX3TJDOUj7RZUB68YSMQen2JtV9RvhBinV8+DKPnC1oldMh htGF/9W1d2y5qtARaHluQoXuzcCKZuIxzl9Av0ec3QKI80YVe02l6Rdi7NMMcIFBv8Co jw28K9Gjfao+TOLjVjfW2TwehRUgUEwu1dm1iJx6RBVAV2lKEd28xDxMK0jemyTR3mZm lR1bV3AWqWgztn8p1wV3FXZ/pmY+lfseKMUy6tn3+yAWndkPUt5zExCL2Txd6UwAi+l3 Jrvg== X-Gm-Message-State: AA+aEWZa21WpFvO5eZHKALzX6A2XrZI4H5+IU3jWwg0kIuU0ysGdAT5m Hja2sL66m7TW+9nYBvCospYK9LJP X-Google-Smtp-Source: AFSGD/XUhtHgmtlKyuGj/MWMnrnDNm3zmRlC/aP0+yH5xKE824BNaJsbF4Efu8LDdQao76K+RwHsXQ== X-Received: by 2002:a5d:4ec4:: with SMTP id s4mr1173507wrv.187.1542292290569; Thu, 15 Nov 2018 06:31:30 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 15:31:18 +0100 Message-Id: <20181115143124.19234-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115143124.19234-1-pbonzini@redhat.com> References: <20181115143124.19234-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH 04/10] vhost-user: support cross-endian vnet headers 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: lvivier@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jasowang@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" vhost-user already has a way to communicate the endianness of the guest via the vring endianness messages. The vring endianness always matches the vnet header endianness so there is no need to do anything else in the backend. Signed-off-by: Paolo Bonzini Reviewed-by: Marc-Andr=C3=A9 Lureau --- net/vhost-user.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/net/vhost-user.c b/net/vhost-user.c index a39f9c9974..cd9659df87 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -172,6 +172,17 @@ static void net_vhost_user_cleanup(NetClientState *nc) qemu_purge_queued_packets(nc); } =20 +static int vhost_user_set_vnet_endianness(NetClientState *nc, + bool enable) +{ + /* Nothing to do. If the server supports + * VHOST_USER_PROTOCOL_F_CROSS_ENDIAN, it will get the + * vnet header endianness from there. If it doesn't, negotiation + * fails. + */ + return 0; +} + static bool vhost_user_has_vnet_hdr(NetClientState *nc) { assert(nc->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_USER); @@ -193,6 +204,8 @@ static NetClientInfo net_vhost_user_info =3D { .cleanup =3D net_vhost_user_cleanup, .has_vnet_hdr =3D vhost_user_has_vnet_hdr, .has_ufo =3D vhost_user_has_ufo, + .set_vnet_be =3D vhost_user_set_vnet_endianness, + .set_vnet_le =3D vhost_user_set_vnet_endianness, }; =20 static gboolean net_vhost_user_watch(GIOChannel *chan, GIOCondition cond, --=20 2.19.1 From nobody Mon Feb 9 07:29:11 2026 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542292679984511.641893672689; Thu, 15 Nov 2018 06:37:59 -0800 (PST) Received: from localhost ([::1]:39215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNImM-0006d6-OT for importer@patchew.org; Thu, 15 Nov 2018 09:37:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIgU-0002Qb-IZ for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNIgO-00042l-Uv for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:52 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:51375) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gNIgJ-0003vC-56 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:44 -0500 Received: by mail-wm1-x343.google.com with SMTP id w7-v6so19006851wmc.1 for ; Thu, 15 Nov 2018 06:31:32 -0800 (PST) Received: from localhost.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id x194-v6sm55262620wmd.41.2018.11.15.06.31.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 06:31:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nymRV9v4PTOMibWkGy3JmsVA590hvKJMqy4lV7iCIDA=; b=pUMj3w4VkweqbI/6HF3F2VvCJcqu7utqtJ/PenwE25hi6lrNia+Vs4Mv5HgGafa7fG 5f7MfsiRrKBhtBoXnqyjUEz2K5aIPZSe+j5HMaPkyNQ/4tPRH8VI/iBugUn9OMrNKxKy hSHqF6ExvuIiC/xHzGDQnecjPIu98H7PZg6BnsGGcu3AhTALmAnlqBlVqYezeGb0RRBB zLZG0NdDLFg7pgnfW0xuF3Ur3PLDP4CWTm/l+HDBDdzopVXVlt8hyDooFYDF9cYcPbJm a3MyI8iN+NjYkOgrbZrDr9qz4BaHo/VSePGuwjtZhdhVqPS2yNx8lgb0mEgePSiSP0kg yLSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=nymRV9v4PTOMibWkGy3JmsVA590hvKJMqy4lV7iCIDA=; b=g5SxPPkdR25Lr43bc6sg5i9FCCXkSfqQ8EM0rNeprV94Xfr5aZMSBPeKszhUlKU/Dm Z957IcWXvRGJDcFgXOvLWExRMO7Mk24A/p3DXWxcrWPwbYqLKP+LhzsCVkoAuj8yA3LG aSWStNCW2l1CgsPkshSFvv1wWhyuIZkLV/3VmBQRvWmkcW/zfdQ1NP5oSlCw0sciQ7Df JuDPBo75896Y9x3HXfAUmY7k9WGcOnlfHs96v25akzVZcpeWE4fAE5YUDH9uHZVHhgum iFUjAtU+dhpXT9tLy4l2zlQWv2rvZKs6uE8oZyAreQSaV8IIrmzPYaeEiD7vepFTqFMJ 95VQ== X-Gm-Message-State: AGRZ1gLIRpj9udEEOYHCsKcCBt/F5rxX+futhDtBhpQgKXrnrjylWXoL zs5QyyHalhwW3ANK4ka68aPd4EIz X-Google-Smtp-Source: AJdET5da7ne8F5sFwEfNaJpFeU5ZPLEbmHfMEdSIwK4PMpFdw8IS6FnaJkDr30TVCQ3Wyj7k2Gv2tQ== X-Received: by 2002:a1c:9303:: with SMTP id v3-v6mr5361479wmd.82.1542292291801; Thu, 15 Nov 2018 06:31:31 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 15:31:19 +0100 Message-Id: <20181115143124.19234-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115143124.19234-1-pbonzini@redhat.com> References: <20181115143124.19234-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH 05/10] vhost-user-test: support VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 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: lvivier@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jasowang@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This will be useful to run the qtest for ppc64 targets on (for example) x86_64 hosts. Signed-off-by: Paolo Bonzini Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/vhost-user-test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 6a805e67be..82fc6c581b 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -51,6 +51,7 @@ #define VHOST_USER_F_PROTOCOL_FEATURES 30 #define VHOST_USER_PROTOCOL_F_MQ 0 #define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1 +#define VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 6 =20 #define VHOST_LOG_PAGE 0x1000 =20 @@ -251,7 +252,7 @@ static void wait_for_fds(TestServer *s) =20 static void read_guest_mem_server(TestServer *s) { - uint32_t *guest_mem; + uint8_t *guest_mem; int i, j; size_t size; =20 @@ -278,8 +279,8 @@ static void read_guest_mem_server(TestServer *s) g_assert(guest_mem !=3D MAP_FAILED); guest_mem +=3D (s->memory.regions[i].mmap_offset / sizeof(*guest_m= em)); =20 - for (j =3D 0; j < 256; j++) { - uint32_t a =3D readl(s->memory.regions[i].guest_phys_addr + j*= 4); + for (j =3D 0; j < 1024; j++) { + uint32_t a =3D readb(s->memory.regions[i].guest_phys_addr + j); uint32_t b =3D guest_mem[j]; =20 g_assert_cmpint(a, =3D=3D, b); @@ -367,6 +368,7 @@ static void chr_read(void *opaque, const uint8_t *buf, = int size) msg.flags |=3D VHOST_USER_REPLY_MASK; msg.size =3D sizeof(m.payload.u64); msg.payload.u64 =3D 1 << VHOST_USER_PROTOCOL_F_LOG_SHMFD; + msg.payload.u64 |=3D 1 << VHOST_USER_PROTOCOL_F_CROSS_ENDIAN; if (s->queues > 1) { msg.payload.u64 |=3D 1 << VHOST_USER_PROTOCOL_F_MQ; } --=20 2.19.1 From nobody Mon Feb 9 07:29:11 2026 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542292809549745.4632761422148; Thu, 15 Nov 2018 06:40:09 -0800 (PST) Received: from localhost ([::1]:39227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIoS-0008W3-7E for importer@patchew.org; Thu, 15 Nov 2018 09:40:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIgY-0002SW-Sv for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:32:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNIgV-00045h-6Z for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:58 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:55140) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gNIgU-0003va-PP for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:54 -0500 Received: by mail-wm1-x342.google.com with SMTP id r63-v6so19120717wma.4 for ; Thu, 15 Nov 2018 06:31:34 -0800 (PST) Received: from localhost.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id x194-v6sm55262620wmd.41.2018.11.15.06.31.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 06:31:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rB3lmxo96gR1gARBk5c8RKWWRRjC2b3pa8ZLnu7LbeY=; b=mpptXxJ5VgKbCEuvCSzm0t0nC50b19GbLiFlLCjAMqKRhq0U9BRurCnu8X2qSB+9CD 6PJgdBJk15fW04BlgCLsY3a5UYbL69o38NJmNUYPh3HY6aWzBnIO7r4s2bs1ye4J/cAB qhutCSiereMQQrX2AX6486WRD6Qm6hZ2Tf7nh7N1KDt3ask4IezuzK0qeUq3SW+uEySB JXL8a24+3ne+cqZBhIByaWK217E8f0e+VrPVCwN9SpLB9FEiCbLWQNFGK1WuZOc0D2th 0EjocP9zhhF1kyfdooa3cq+cmu81XDzrXynRGK5DfzdXLCOD4ugta8uGnwwUlby4PTTm dNGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=rB3lmxo96gR1gARBk5c8RKWWRRjC2b3pa8ZLnu7LbeY=; b=cC2yS/7D8qt22zCe0aHpwzXODqP3dO/Gr+Ww1OnXoCz1XbS7uZ4aczKYnMb1O/1oTu nwTc//81bfh6YE//wURlB2UGZ0k2/hD3bmhmCk2UVm7tdAwDaO4iXmaBRmcJxdTyTmiK 08GVVbp8MZsZSnv8EzVPWO865GbBYXDPKrBm+Xott0xFgFq0qTxOyTFrR1kwAitgRLad ihrs2PFVUcGsTmscyuWSruBULsVne/5H4LqBQoVOqCiDJ3qnygKnD3wQeJ9wxjB8fOBM WmJH1FYa4s0qTL7fuWVlBHd0QfGoKLQHY4mn1yehNwFFcotiO+5njgpSsVivvv6CyInL 1Zww== X-Gm-Message-State: AGRZ1gJKoR16rLZnVtgDZlzzaI4xlE+RwW8Gd/HkFVRC5P8BrtjPZlwH c7cuxmKk6RWEfW7F8dDGzIA4x/2E X-Google-Smtp-Source: AJdET5fAtQvy7iaaCaQax2weIzYeUFPdlxdivFhWy4toaRw//pD8JSTMG5NweKYs2eNg7NGaW8gThw== X-Received: by 2002:a1c:1f11:: with SMTP id f17mr3384828wmf.56.1542292292840; Thu, 15 Nov 2018 06:31:32 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 15:31:20 +0100 Message-Id: <20181115143124.19234-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115143124.19234-1-pbonzini@redhat.com> References: <20181115143124.19234-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH 06/10] vhost-user-test: skip if there is no memory at address 0 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: lvivier@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jasowang@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The virt machine cannot run the vhost-user qtests because they hardcode the presence of memory at address 0. Report the tests as a skip so that they can be converted to use qgraph. Signed-off-by: Paolo Bonzini --- tests/vhost-user-test.c | 58 ++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 82fc6c581b..59e1aec397 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -228,9 +228,11 @@ static void uninit_virtio_dev(TestServer *s) qvirtio_pci_device_free(s->dev); } =20 -static void wait_for_fds(TestServer *s) +static bool wait_for_fds(TestServer *s) { gint64 end_time; + bool got_region; + int i; =20 g_mutex_lock(&s->data_mutex); =20 @@ -248,6 +250,19 @@ static void wait_for_fds(TestServer *s) g_assert_cmpint(s->fds_num, =3D=3D, s->memory.nregions); =20 g_mutex_unlock(&s->data_mutex); + + got_region =3D false; + for (i =3D 0; i < s->memory.nregions; ++i) { + VhostUserMemoryRegion *reg =3D &s->memory.regions[i]; + if (reg->guest_phys_addr =3D=3D 0) { + got_region =3D true; + break; + } + } + if (!got_region) { + g_test_skip("No memory at address 0x0"); + } + return got_region; } =20 static void read_guest_mem_server(TestServer *s) @@ -256,8 +271,6 @@ static void read_guest_mem_server(TestServer *s) int i, j; size_t size; =20 - wait_for_fds(s); - g_mutex_lock(&s->data_mutex); =20 /* iterate all regions */ @@ -577,8 +590,6 @@ static void write_guest_mem(TestServer *s, uint32_t see= d) int i, j; size_t size; =20 - wait_for_fds(s); - /* iterate all regions */ for (i =3D 0; i < s->fds_num; i++) { =20 @@ -661,8 +672,13 @@ static void test_read_guest_mem(const void *arg) =20 init_virtio_dev(server, 1u << VIRTIO_NET_F_MAC); =20 + if (!wait_for_fds(server)) { + goto exit; + } + read_guest_mem_server(server); =20 +exit: uninit_virtio_dev(server); =20 qtest_quit(s); @@ -689,8 +705,10 @@ static void test_migrate(void) g_free(cmd); =20 init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); - init_virtio_dev(dest, 1u << VIRTIO_NET_F_MAC); - wait_for_fds(s); + if (!wait_for_fds(s)) { + goto exit; + } + size =3D get_log_size(s); g_assert_cmpint(size, =3D=3D, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8)= ); =20 @@ -699,6 +717,7 @@ static void test_migrate(void) g_free(tmp); to =3D qtest_init(cmd); g_free(cmd); + init_virtio_dev(dest, 1u << VIRTIO_NET_F_MAC); =20 source =3D g_source_new(&test_migrate_source_funcs, sizeof(TestMigrateSource)); @@ -738,15 +757,18 @@ static void test_migrate(void) global_qtest =3D to; qmp_eventwait("RESUME"); =20 + g_assert(wait_for_fds(s)); read_guest_mem_server(dest); =20 - uninit_virtio_dev(s); uninit_virtio_dev(dest); + qtest_quit(to); =20 g_source_destroy(source); g_source_unref(source); =20 - qtest_quit(to); +exit: + uninit_virtio_dev(s); + test_server_free(dest); qtest_quit(from); test_server_free(s); @@ -810,16 +832,20 @@ static void test_reconnect_subprocess(void) g_free(cmd); =20 init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); - wait_for_fds(s); + if (!wait_for_fds(s)) { + goto exit; + } + wait_for_rings_started(s, 2); =20 /* reconnect */ s->fds_num =3D 0; s->rings =3D 0; g_idle_add(reconnect_cb, s); - wait_for_fds(s); + g_assert(wait_for_fds(s)); wait_for_rings_started(s, 2); =20 +exit: uninit_virtio_dev(s); =20 qtest_end(); @@ -848,9 +874,12 @@ static void test_connect_fail_subprocess(void) g_free(cmd); =20 init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); - wait_for_fds(s); + if (!wait_for_fds(s)) { + goto exit; + } wait_for_rings_started(s, 2); =20 +exit: uninit_virtio_dev(s); =20 qtest_end(); @@ -878,9 +907,12 @@ static void test_flags_mismatch_subprocess(void) g_free(cmd); =20 init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); - wait_for_fds(s); + if (!wait_for_fds(s)) { + goto exit; + } wait_for_rings_started(s, 2); =20 +exit: uninit_virtio_dev(s); =20 qtest_end(); --=20 2.19.1 From nobody Mon Feb 9 07:29:11 2026 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542293018291569.4600599329476; Thu, 15 Nov 2018 06:43:38 -0800 (PST) Received: from localhost ([::1]:39252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIro-0003DL-8O for importer@patchew.org; Thu, 15 Nov 2018 09:43:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIga-0002UV-Ng for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:32:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNIgZ-00048F-3n for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:32:00 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:55141) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gNIgY-0003w6-OA for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:58 -0500 Received: by mail-wm1-x343.google.com with SMTP id r63-v6so19120773wma.4 for ; Thu, 15 Nov 2018 06:31:35 -0800 (PST) Received: from localhost.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id x194-v6sm55262620wmd.41.2018.11.15.06.31.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 06:31:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ppXImhltsxcdhzpFhgx+Canp1HXjcIszeLgMMZbyMc0=; b=NSrCY3komSOZmnPbyI58mDHNAYXiIBfPrKJLY3RyKMu3yhHyzC1Rz/K01I5lDPW1/l 5cwY83MEoGeS+wvorWbp1oEHtUDXT3pjNnJgYJjHVrDtrIaBoNPWZxEc+rfo5Osa/lBe 423tQnjQe8HjB1TGLNMqzZihoyQnjX9Hnvi6u9CCSZ5GaIZLcxgB1aXQmyObmI+NWDJZ UUKXGoaEX9he80U6aWz9+nGYDXupJ7YCEizu0jwsGm/4+CdlKjA9RGo98wvMXusp5PC7 31ydCKJrWB4nhDn7Dgt42Y/sLZt24Viot81yWqiyVQ7IP/WFlGxx+vc39oe5ciL8DCZ9 Ln/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ppXImhltsxcdhzpFhgx+Canp1HXjcIszeLgMMZbyMc0=; b=VdFd/BSRZQSHe8dzKvaFOYSCWBAHUdDk5zwL769qWfQ34hk3nS2a/zjqnET3zVszoA /CU18+EBeTwZ8zENxFHsFRx3F/iKzfvXoMhc1tMydSG/H/UCrNq/N9HPSsHSIegV4tFU 4BJS5gwCJ2MnpMgT7v53O1ip2XQ4QYSSbN1jVNhUG5dr6LXWyxGxmjQqlMLrZKQJpXaV C1PMSY6APIGZQ+bto/tqz84yPHNILqmiW8WD+1/2/JOnK28w3er2s7I84QMFZmoU9Dxi 3Ki8aUPmnhJV4t+JOgtyG4oPdRjyasdFu2jrwSMjhy956UksvpSDJgW6r9a5v8EUrqlK dwSw== X-Gm-Message-State: AGRZ1gKrvSi7mw2TCxcHIkGO4V1b22w3AhfeNjQli7jd49CqdJVSCkG6 KG+e9Y+y6NpMDtC3yFUEuquwdC9+ X-Google-Smtp-Source: AJdET5dshT2s+Sx5QVIgRXw9icwtz0+AQp7i78npAFKEubdtZiX6st1IDvuWqsYJxE9Phe4YlLO9dg== X-Received: by 2002:a7b:c095:: with SMTP id r21mr618123wmh.118.1542292293832; Thu, 15 Nov 2018 06:31:33 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 15:31:21 +0100 Message-Id: <20181115143124.19234-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115143124.19234-1-pbonzini@redhat.com> References: <20181115143124.19234-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH 07/10] vhost-user-test: reduce usage of global_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: lvivier@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jasowang@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Whenever the code can run on multiple QTestStates, use them explicitly inst= ead of global_qtest. Signed-off-by: Paolo Bonzini Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/vhost-user-test.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 59e1aec397..c3a8af3d85 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -187,12 +187,12 @@ static char *get_qemu_cmd(TestServer *s, } } =20 -static void init_virtio_dev(TestServer *s, uint32_t features_mask) +static void init_virtio_dev(QTestState *qts, TestServer *s, uint32_t featu= res_mask) { uint32_t features; int i; =20 - s->bus =3D qpci_init_pc(global_qtest, NULL); + s->bus =3D qpci_init_pc(qts, NULL); g_assert_nonnull(s->bus); =20 s->dev =3D qvirtio_pci_device_find(s->bus, VIRTIO_ID_NET); @@ -203,7 +203,7 @@ static void init_virtio_dev(TestServer *s, uint32_t fea= tures_mask) qvirtio_set_acknowledge(&s->dev->vdev); qvirtio_set_driver(&s->dev->vdev); =20 - s->alloc =3D pc_alloc_init(global_qtest); + s->alloc =3D pc_alloc_init(qts); =20 for (i =3D 0; i < s->queues * 2; i++) { s->vq[i] =3D qvirtqueue_setup(&s->dev->vdev, s->alloc, i); @@ -265,7 +265,7 @@ static bool wait_for_fds(TestServer *s) return got_region; } =20 -static void read_guest_mem_server(TestServer *s) +static void read_guest_mem_server(QTestState *qts, TestServer *s) { uint8_t *guest_mem; int i, j; @@ -293,7 +293,7 @@ static void read_guest_mem_server(TestServer *s) guest_mem +=3D (s->memory.regions[i].mmap_offset / sizeof(*guest_m= em)); =20 for (j =3D 0; j < 1024; j++) { - uint32_t a =3D readb(s->memory.regions[i].guest_phys_addr + j); + uint32_t a =3D qtest_readb(qts, s->memory.regions[i].guest_phy= s_addr + j); uint32_t b =3D guest_mem[j]; =20 g_assert_cmpint(a, =3D=3D, b); @@ -670,13 +670,13 @@ static void test_read_guest_mem(const void *arg) s =3D qtest_start(qemu_cmd); g_free(qemu_cmd); =20 - init_virtio_dev(server, 1u << VIRTIO_NET_F_MAC); + init_virtio_dev(global_qtest, server, 1u << VIRTIO_NET_F_MAC); =20 if (!wait_for_fds(server)) { goto exit; } =20 - read_guest_mem_server(server); + read_guest_mem_server(global_qtest, server); =20 exit: uninit_virtio_dev(server); @@ -690,7 +690,7 @@ static void test_migrate(void) TestServer *s =3D test_server_new("src"); TestServer *dest =3D test_server_new("dest"); char *uri =3D g_strdup_printf("%s%s", "unix:", dest->mig_path); - QTestState *global =3D global_qtest, *from, *to; + QTestState *from, *to; GSource *source; gchar *cmd, *tmp; QDict *rsp; @@ -704,7 +704,7 @@ static void test_migrate(void) from =3D qtest_start(cmd); g_free(cmd); =20 - init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); + init_virtio_dev(from, s, 1u << VIRTIO_NET_F_MAC); if (!wait_for_fds(s)) { goto exit; } @@ -717,7 +717,7 @@ static void test_migrate(void) g_free(tmp); to =3D qtest_init(cmd); g_free(cmd); - init_virtio_dev(dest, 1u << VIRTIO_NET_F_MAC); + init_virtio_dev(to, dest, 1u << VIRTIO_NET_F_MAC); =20 source =3D g_source_new(&test_migrate_source_funcs, sizeof(TestMigrateSource)); @@ -753,12 +753,10 @@ static void test_migrate(void) qobject_unref(rsp); =20 qmp_eventwait("STOP"); + qtest_qmp_eventwait(to, "RESUME"); =20 - global_qtest =3D to; - qmp_eventwait("RESUME"); - - g_assert(wait_for_fds(s)); - read_guest_mem_server(dest); + g_assert(wait_for_fds(dest)); + read_guest_mem_server(to, dest); =20 uninit_virtio_dev(dest); qtest_quit(to); @@ -773,8 +771,6 @@ exit: qtest_quit(from); test_server_free(s); g_free(uri); - - global_qtest =3D global; } =20 static void wait_for_rings_started(TestServer *s, size_t count) @@ -831,7 +827,7 @@ static void test_reconnect_subprocess(void) qtest_start(cmd); g_free(cmd); =20 - init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); + init_virtio_dev(global_qtest, s, 1u << VIRTIO_NET_F_MAC); if (!wait_for_fds(s)) { goto exit; } @@ -873,7 +869,7 @@ static void test_connect_fail_subprocess(void) qtest_start(cmd); g_free(cmd); =20 - init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); + init_virtio_dev(global_qtest, s, 1u << VIRTIO_NET_F_MAC); if (!wait_for_fds(s)) { goto exit; } @@ -906,7 +902,7 @@ static void test_flags_mismatch_subprocess(void) qtest_start(cmd); g_free(cmd); =20 - init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); + init_virtio_dev(global_qtest, s, 1u << VIRTIO_NET_F_MAC); if (!wait_for_fds(s)) { goto exit; } @@ -957,7 +953,7 @@ static void test_multiqueue(void) qtest_start(cmd); g_free(cmd); =20 - init_virtio_dev(s, features_mask); + init_virtio_dev(global_qtest, s, features_mask); =20 wait_for_rings_started(s, s->queues * 2); =20 --=20 2.19.1 From nobody Mon Feb 9 07:29:11 2026 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542292638079687.0779740974907; Thu, 15 Nov 2018 06:37:18 -0800 (PST) Received: from localhost ([::1]:39213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIlg-000657-Ql for importer@patchew.org; Thu, 15 Nov 2018 09:37:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIgY-0002SV-Sm for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:32:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNIgU-00045J-TC for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:58 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:37210) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gNIgU-0003x7-MT for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:54 -0500 Received: by mail-wr1-x441.google.com with SMTP id j10so7230789wru.4 for ; Thu, 15 Nov 2018 06:31:36 -0800 (PST) Received: from localhost.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id x194-v6sm55262620wmd.41.2018.11.15.06.31.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 06:31:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8ybSngDbAsnKU74wJybZnE/Dejvufdpkcaf4Hf4ar/s=; b=I3T0+30/6sB4lC/C71KizYZkJE76DU5YEQnay34EsIwuY89DuSXnQMmiZ6u48ZWGlc /CuPr7Ft76lb13hCbkWECbSdYi5rBDOfs/HnUbo/WjD/buTDAHYsuEfYD54BsoBbQb+E rG1UHsBzp6MihWMroG9JQTAqz61CfHfwpdnkVGTVs/bfxHkCB8sn28f5dptiI7BA0kdN sC+QWwv87n31dIgIglv1wDGgwFZ6XRtpe85aM2G2Ykz7u10bm0dMjPnP2TpKG1LNXXDG 0q+xTl0W1iXqOdTnZJ8nAOPZ72+UlFly3XnnjOVH78Lw/5blO9k28k1EgidIoogqxg+o EleQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8ybSngDbAsnKU74wJybZnE/Dejvufdpkcaf4Hf4ar/s=; b=f2wRA7xzFwuo2soam5fmH4O3o1u/j+++82Mtelze3Fx0pKGCatM2uCqdrb8juYHR19 V2r2E3yNkUykus7jdleD1usi9OCl+Myq14uVWhiPIWhgjV0JrV0XFJxykZy/9ep8kvwI LGSYkrrLmOM0qu6yhelp+RupbR6PBE3GXTONqjY8P8jkUPC9Ng29XX6Z9CGa/BtRwo17 aBYZb9x/7AOOrPd+JkcBIky690ILxcE/iqG2mSOIjEQrAIqSGbcxHw8t1UpqUK9dqEEb gFrY+LqRisKtBATN+oxsZlETxa5hwyw2Qdaha8yFSl9RJhdndbjYzJYE0vhrAXBs6ZC0 0iGg== X-Gm-Message-State: AGRZ1gIGCHkagUIMfN6hhTI88YnRYBoKbl+p9MWscYPuLfRMcAyRW0vc JAvmulhc5EurV3+3YeHfOo8Ra5YP X-Google-Smtp-Source: AJdET5eYG6UqXzfzCZ7/9RcNzTG/imVB307/T0F8ZGMaRRihPyFuu2jQ/VXUpaDiqSaeJTVHkzQ5jg== X-Received: by 2002:a05:6000:1091:: with SMTP id y17mr5909856wrw.226.1542292295072; Thu, 15 Nov 2018 06:31:35 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 15:31:22 +0100 Message-Id: <20181115143124.19234-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115143124.19234-1-pbonzini@redhat.com> References: <20181115143124.19234-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PATCH 08/10] vhost-user-test: create a main loop per TestServer 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: lvivier@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jasowang@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This makes the tests more independent and removes the need to defer test_se= rver_free via an idle event source. Signed-off-by: Paolo Bonzini Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/vhost-user-test.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index c3a8af3d85..93d5157b13 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -143,6 +143,8 @@ typedef struct TestServer { int fds_num; int fds[VHOST_MEMORY_MAX_NREGIONS]; VhostUserMemory memory; + GMainLoop *loop; + GThread *thread; GMutex data_mutex; GCond data_cond; int log_fd; @@ -490,6 +492,10 @@ static TestServer *test_server_new(const gchar *name) { TestServer *server =3D g_new0(TestServer, 1); =20 + server->loop =3D g_main_loop_new(NULL, FALSE); + /* run the main loop thread so the chardev may operate */ + server->thread =3D g_thread_new(NULL, thread_function, server->loop); + server->socket_path =3D g_strdup_printf("%s/%s.sock", tmpfs, name); server->mig_path =3D g_strdup_printf("%s/%s.mig", tmpfs, name); server->chr_name =3D g_strdup_printf("chr-%s", name); @@ -533,9 +539,18 @@ static void test_server_listen(TestServer *server) test_server_create_chr(server, ",server,nowait"); } =20 -static gboolean _test_server_free(TestServer *server) +static void test_server_free(TestServer *server) { int i; + int ret; + + /* finish the helper thread and dispatch pending sources */ + g_main_loop_quit(server->loop); + g_thread_join(server->thread); + while (g_main_context_pending(NULL)) { + g_main_context_iteration (NULL, TRUE); + } + g_main_loop_unref(server->loop); =20 qemu_chr_fe_deinit(&server->chr, true); =20 @@ -558,13 +573,6 @@ static gboolean _test_server_free(TestServer *server) qpci_free_pc(server->bus); =20 g_free(server); - - return FALSE; -} - -static void test_server_free(TestServer *server) -{ - g_idle_add((GSourceFunc)_test_server_free, server); } =20 static void wait_for_log_fd(TestServer *s) @@ -969,8 +977,6 @@ int main(int argc, char **argv) const char *hugefs; int ret; char template[] =3D "/tmp/vhost-test-XXXXXX"; - GMainLoop *loop; - GThread *thread; =20 g_test_init(&argc, &argv, NULL); =20 @@ -991,10 +997,6 @@ int main(int argc, char **argv) root =3D tmpfs; } =20 - loop =3D g_main_loop_new(NULL, FALSE); - /* run the main loop thread so the chardev may operate */ - thread =3D g_thread_new(NULL, thread_function, loop); - if (qemu_memfd_check(0)) { qtest_add_data_func("/vhost-user/read-guest-mem/memfd", GINT_TO_POINTER(TEST_MEMFD_YES), @@ -1022,14 +1024,6 @@ int main(int argc, char **argv) =20 /* cleanup */ =20 - /* finish the helper thread and dispatch pending sources */ - g_main_loop_quit(loop); - g_thread_join(thread); - while (g_main_context_pending(NULL)) { - g_main_context_iteration (NULL, TRUE); - } - g_main_loop_unref(loop); - ret =3D rmdir(tmpfs); if (ret !=3D 0) { g_test_message("unable to rmdir: path (%s): %s\n", --=20 2.19.1 From nobody Mon Feb 9 07:29:11 2026 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 154229265279526.07251462573754; Thu, 15 Nov 2018 06:37:32 -0800 (PST) Received: from localhost ([::1]:39214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIlv-0006Gv-Nd for importer@patchew.org; Thu, 15 Nov 2018 09:37:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIgY-0002SU-Sl for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:32:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNIgV-00045c-65 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:58 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:43964) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gNIgU-0003xX-PT for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:54 -0500 Received: by mail-wr1-x442.google.com with SMTP id r10so3915335wrs.10 for ; Thu, 15 Nov 2018 06:31:37 -0800 (PST) Received: from localhost.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id x194-v6sm55262620wmd.41.2018.11.15.06.31.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 06:31:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n3Z4Wkp/6Rcmbei2bnIHPlmtAbA3I6U//zg9UvWDla4=; b=uTtRnTEcmV1GxjgqCN4Ynjp7QCdBUGOTacFIHETmJhXR5KbxWaCzmvFOV/vVh6iZEp ohTKJ+1AFWjPHXBIrs4XDCsBF42hKKPDU6f8GoKcpNn+ci6LWHx9xbgPRx8FV7wo/6Cc y9eQ2oNJmgbBjPnU6TVa+Z63WM8l6o2hOkFUUL7K8jpcV28KM233R6//18oSrn3mofU7 HOoeqFBPoMYnugPuitozB+lUXvp/k5DMq0HXtmNmTxDe5efKI7AmNdA5kc8KqkhKtoep 2nkW9xOZyuqqF2J8ToI7nJT9qL7BEb1eLWwkKmMbBRlLdvyt5AxUIGZcmTcUGDV6x+i+ xXGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=n3Z4Wkp/6Rcmbei2bnIHPlmtAbA3I6U//zg9UvWDla4=; b=TOx+cZ4Fe/YOFFtVYV2MwcrSlUOOgAq+ULVXOjo0oo9HxywX2UMSUOQYJ+cRzVOVwC GaIflRoEGj9g2wnnQexi+EMT1+9E6zKTaDGo4B8kco2K6nEsBDY8gqakZ56rRiz6qZ6F CY+xI0G6HkqY0PjtHS0+IKX+7NGWh4Hy30IYRYRGOtrP+CHcN0Qn7pdL3VbelF040xJ5 v90LhZ0RLJ/jvqmc2ka1Tb8ETlh/moItqXnvF8UJpYrbMkfw1zj0wS8KLDnc0KZCOEad 2z88h7Pjwm3Lj2MSNJVl45EzTGu1I6G4DxlO8Qyaw9FMdf9uVD6vGMIbe1VmwZHg48CB aTLQ== X-Gm-Message-State: AGRZ1gIGc3g2YXzB8ti+dJZ/S5358KJwXufbdutmGjf/mO5p4/6NhefF VfS2gSMHzn1vZkkulTL2Cd0agy5l X-Google-Smtp-Source: AJdET5e9Nzf+SuZXeNU8fzuowD25/78gd9vFRqY/+aHQ5JbG6n7rt78ZWO3gP3BbQyTaFKJ5ZXV+Aw== X-Received: by 2002:adf:dc87:: with SMTP id r7-v6mr6147982wrj.143.1542292296174; Thu, 15 Nov 2018 06:31:36 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 15:31:23 +0100 Message-Id: <20181115143124.19234-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115143124.19234-1-pbonzini@redhat.com> References: <20181115143124.19234-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH 09/10] vhost-user-test: small changes to init_hugepagefs 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: lvivier@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jasowang@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" After the conversion to qgraph, the equivalent of "main" will be in a constructor and will run even if the tests are not being requested. Therefore, it should not assert that init_hugepagefs succeeds and will be called when creating the TestServer. This patch changes the prototype of init_hugepagefs, this way the next patch looks nicer. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/vhost-user-test.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 93d5157b13..a282fc57c8 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -461,13 +461,19 @@ static void chr_read(void *opaque, const uint8_t *buf= , int size) g_mutex_unlock(&s->data_mutex); } =20 -static const char *init_hugepagefs(const char *path) +static const char *init_hugepagefs(void) { + const char *path =3D getenv("QTEST_HUGETLBFS_PATH"); struct statfs fs; int ret; =20 + if (!path) { + return NULL; + } + if (access(path, R_OK | W_OK | X_OK)) { g_test_message("access on path (%s): %s\n", path, strerror(errno)); + abort(); return NULL; } =20 @@ -477,11 +483,13 @@ static const char *init_hugepagefs(const char *path) =20 if (ret !=3D 0) { g_test_message("statfs on path (%s): %s\n", path, strerror(errno)); + abort(); return NULL; } =20 if (fs.f_type !=3D HUGETLBFS_MAGIC) { g_test_message("Warning: path not on HugeTLBFS: %s\n", path); + abort(); return NULL; } =20 @@ -974,7 +982,6 @@ static void test_multiqueue(void) =20 int main(int argc, char **argv) { - const char *hugefs; int ret; char template[] =3D "/tmp/vhost-test-XXXXXX"; =20 @@ -989,13 +996,7 @@ int main(int argc, char **argv) } g_assert(tmpfs); =20 - hugefs =3D getenv("QTEST_HUGETLBFS_PATH"); - if (hugefs) { - root =3D init_hugepagefs(hugefs); - g_assert(root); - } else { - root =3D tmpfs; - } + root =3D init_hugepagefs() ? : tmpfs; =20 if (qemu_memfd_check(0)) { qtest_add_data_func("/vhost-user/read-guest-mem/memfd", --=20 2.19.1 From nobody Mon Feb 9 07:29:11 2026 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542292821364898.3088064564568; Thu, 15 Nov 2018 06:40:21 -0800 (PST) Received: from localhost ([::1]:39228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIoZ-0000BJ-7E for importer@patchew.org; Thu, 15 Nov 2018 09:40:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNIgY-0002SQ-S3 for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:32:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNIgU-000453-Kt for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:58 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:41707) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gNIgS-0003y6-7Y for qemu-devel@nongnu.org; Thu, 15 Nov 2018 09:31:54 -0500 Received: by mail-wr1-x443.google.com with SMTP id v18-v6so21438349wrt.8 for ; Thu, 15 Nov 2018 06:31:38 -0800 (PST) Received: from localhost.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id x194-v6sm55262620wmd.41.2018.11.15.06.31.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Nov 2018 06:31:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WgN15ZnbyRndunhEYct3fs6j7FBtvQKi/K1WwlhzPkY=; b=Pcg0ba+UFav9lwQyWvqv3V3zmTYZ6iYOWAOxollhYNyncnMO3q5SvO1wrj+ykuojkA FbLAIn1JSyxBO02en8jsfPe1YVvaU4Wg0Ry4BrIBbDFDn6TCqrRHm5utNKeGKuCK6Y+N rTHpjwefNsv45U3QFI15XETOC7psPIQdCOG5kkQbI9th2ykccpW2XcPnz4TF4ZzJBnrt pdrfEzRteV0uUpmkRHPH7Bv+9np4CUrDQbQtGPk1bB4tsZG2Purt548sVX4UCJkuH8JK eKx+uYu+dnyvNMBIbOXsNncP51GVeQu58xXcqwnNi6vcDInC+ciq71QNz9gB4cckx2LJ M/Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=WgN15ZnbyRndunhEYct3fs6j7FBtvQKi/K1WwlhzPkY=; b=PXdQAHpYZYc8vPp30RqdCZb8BaygRJRql0D4VCY6/1GO6FoYR8/hE5bFJ0aythGnyy Ov6JUxZ5gce45qKKZiNRbMH+/M0zRB0idv7bgY6RQUiMuWGvlUqLt/3k8aPDoW6VulUM xCFvMUHPwRLCmp7dOxBd+BW6oeXnmNa5FrnW2nQOoBa5cB42SINGuvqEi8U94rXYG1QF 3hw2cVAeBMoY1DZKUuPclYCMzB8OrRNWvbvdJxKv6tClCcOmDPVgX0nDbQFusmk+WpJ9 QWZKrNjbwLQiGfj460eaox4YR4uU8/6QZNKOOb5cVRV1R371D2usMT/0DfrN+zUh7hLy FXvA== X-Gm-Message-State: AGRZ1gL6s/1C2aF6mQj+iqg5G1u1n7aR97OIGPQxZSUodGg6JoJdsRIx pbidAhjSLBxgh+ifQK4WsnUOlsxN X-Google-Smtp-Source: AJdET5ezF0Ryfmyf/Y0Ejj53wXWY2RObTBHbRJ6YazaiL9vtmdcllL1kD/7v+pzOgE5xryFtWrGcvQ== X-Received: by 2002:adf:9563:: with SMTP id 90-v6mr5986239wrs.60.1542292297336; Thu, 15 Nov 2018 06:31:37 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 15 Nov 2018 15:31:24 +0100 Message-Id: <20181115143124.19234-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181115143124.19234-1-pbonzini@redhat.com> References: <20181115143124.19234-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH 10/10] vhost-user-test: create a temporary directory per TestServer 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: lvivier@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , jasowang@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This makes the tests more independent, and also the source and destination TestServers in the migration test. Signed-off-by: Paolo Bonzini Reviewed-by: Marc-Andr=C3=A9 Lureau --- tests/vhost-user-test.c | 75 +++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index a282fc57c8..23f129f6fe 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -139,6 +139,8 @@ typedef struct TestServer { gchar *socket_path; gchar *mig_path; gchar *chr_name; + const gchar *mem_path; + gchar *tmpfs; CharBackend chr; int fds_num; int fds[VHOST_MEMORY_MAX_NREGIONS]; @@ -159,9 +161,6 @@ static TestServer *test_server_new(const gchar *name); static void test_server_free(TestServer *server); static void test_server_listen(TestServer *server); =20 -static const char *tmpfs; -static const char *root; - enum test_memfd { TEST_MEMFD_AUTO, TEST_MEMFD_YES, @@ -169,7 +168,7 @@ enum test_memfd { }; =20 static char *get_qemu_cmd(TestServer *s, - int mem, enum test_memfd memfd, const char *mem_= path, + int mem, enum test_memfd memfd, const char *chr_opts, const char *extra) { if (memfd =3D=3D TEST_MEMFD_AUTO && qemu_memfd_check(0)) { @@ -184,7 +183,7 @@ static char *get_qemu_cmd(TestServer *s, } else { return g_strdup_printf(QEMU_CMD_MEM QEMU_CMD_CHR QEMU_CMD_NETDEV QEMU_CMD_NET "%s", mem, mem, - mem_path, s->chr_name, s->socket_path, + s->mem_path, s->chr_name, s->socket_path, chr_opts, s->chr_name, extra); } } @@ -499,11 +498,21 @@ static const char *init_hugepagefs(void) static TestServer *test_server_new(const gchar *name) { TestServer *server =3D g_new0(TestServer, 1); + char template[] =3D "/tmp/vhost-test-XXXXXX"; + const char *tmpfs; =20 server->loop =3D g_main_loop_new(NULL, FALSE); /* run the main loop thread so the chardev may operate */ server->thread =3D g_thread_new(NULL, thread_function, server->loop); =20 + tmpfs =3D mkdtemp(template); + if (!tmpfs) { + g_test_message("mkdtemp on path (%s): %s\n", template, strerror(er= rno)); + } + g_assert(tmpfs); + + server->tmpfs =3D g_strdup(tmpfs); + server->mem_path =3D init_hugepagefs() ? : server->tmpfs; server->socket_path =3D g_strdup_printf("%s/%s.sock", tmpfs, name); server->mig_path =3D g_strdup_printf("%s/%s.mig", tmpfs, name); server->chr_name =3D g_strdup_printf("chr-%s", name); @@ -560,6 +569,18 @@ static void test_server_free(TestServer *server) } g_main_loop_unref(server->loop); =20 + unlink(server->socket_path); + g_free(server->socket_path); + + unlink(server->mig_path); + g_free(server->mig_path); + + ret =3D rmdir(server->tmpfs); + if (ret !=3D 0) { + g_test_message("unable to rmdir: path (%s): %s\n", + server->tmpfs, strerror(errno)); + } + qemu_chr_fe_deinit(&server->chr, true); =20 for (i =3D 0; i < server->fds_num; i++) { @@ -570,12 +591,6 @@ static void test_server_free(TestServer *server) close(server->log_fd); } =20 - unlink(server->socket_path); - g_free(server->socket_path); - - unlink(server->mig_path); - g_free(server->mig_path); - g_free(server->chr_name); g_assert(server->bus); qpci_free_pc(server->bus); @@ -681,7 +696,7 @@ static void test_read_guest_mem(const void *arg) "read-guest-memfd" : "read-guest-mem"); test_server_listen(server); =20 - qemu_cmd =3D get_qemu_cmd(server, 512, memfd, root, "", ""); + qemu_cmd =3D get_qemu_cmd(server, 512, memfd, "", ""); =20 s =3D qtest_start(qemu_cmd); g_free(qemu_cmd); @@ -716,7 +731,7 @@ static void test_migrate(void) test_server_listen(s); test_server_listen(dest); =20 - cmd =3D get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, "", ""); + cmd =3D get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, "", ""); from =3D qtest_start(cmd); g_free(cmd); =20 @@ -729,7 +744,7 @@ static void test_migrate(void) g_assert_cmpint(size, =3D=3D, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8)= ); =20 tmp =3D g_strdup_printf(" -incoming %s", uri); - cmd =3D get_qemu_cmd(dest, 2, TEST_MEMFD_AUTO, root, "", tmp); + cmd =3D get_qemu_cmd(dest, 2, TEST_MEMFD_AUTO, "", tmp); g_free(tmp); to =3D qtest_init(cmd); g_free(cmd); @@ -839,7 +854,7 @@ static void test_reconnect_subprocess(void) char *cmd; =20 g_thread_new("connect", connect_thread, s); - cmd =3D get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, ",server", ""); + cmd =3D get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, ",server", ""); qtest_start(cmd); g_free(cmd); =20 @@ -881,7 +896,7 @@ static void test_connect_fail_subprocess(void) =20 s->test_fail =3D true; g_thread_new("connect", connect_thread, s); - cmd =3D get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, ",server", ""); + cmd =3D get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, ",server", ""); qtest_start(cmd); g_free(cmd); =20 @@ -914,7 +929,7 @@ static void test_flags_mismatch_subprocess(void) =20 s->test_flags =3D TEST_FLAGS_DISCONNECT; g_thread_new("connect", connect_thread, s); - cmd =3D get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, ",server", ""); + cmd =3D get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, ",server", ""); qtest_start(cmd); g_free(cmd); =20 @@ -962,7 +977,7 @@ static void test_multiqueue(void) cmd =3D g_strdup_printf( QEMU_CMD_MEM QEMU_CMD_CHR QEMU_CMD_NETDEV ",queues=3D%d " "-device virtio-net-pci,netdev=3Dnet0,mq=3Don,vectors=3D%d", - 512, 512, root, s->chr_name, + 512, 512, s->mem_path, s->chr_name, s->socket_path, "", s->chr_name, s->queues, s->queues * 2 + 2); } @@ -982,22 +997,11 @@ static void test_multiqueue(void) =20 int main(int argc, char **argv) { - int ret; - char template[] =3D "/tmp/vhost-test-XXXXXX"; - g_test_init(&argc, &argv, NULL); =20 module_call_init(MODULE_INIT_QOM); qemu_add_opts(&qemu_chardev_opts); =20 - tmpfs =3D mkdtemp(template); - if (!tmpfs) { - g_test_message("mkdtemp on path (%s): %s\n", template, strerror(er= rno)); - } - g_assert(tmpfs); - - root =3D init_hugepagefs() ? : tmpfs; - if (qemu_memfd_check(0)) { qtest_add_data_func("/vhost-user/read-guest-mem/memfd", GINT_TO_POINTER(TEST_MEMFD_YES), @@ -1021,16 +1025,5 @@ int main(int argc, char **argv) qtest_add_func("/vhost-user/flags-mismatch", test_flags_mismatch); } =20 - ret =3D g_test_run(); - - /* cleanup */ - - ret =3D rmdir(tmpfs); - if (ret !=3D 0) { - g_test_message("unable to rmdir: path (%s): %s\n", - tmpfs, strerror(errno)); - } - g_assert_cmpint(ret, =3D=3D, 0); - - return ret; + return g_test_run(); } --=20 2.19.1