From nobody Tue May 14 03:51:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 ARC-Seal: i=1; a=rsa-sha256; t=1601041556; cv=none; d=zohomail.com; s=zohoarc; b=l2oxeBcdc5eWVFpxS88PLgMA0my+JdcpaZF3ULUXwYH/dbMZyDNElNoRJ8UrzuXMwjdvNlvuKjPWZwF4dbMHAlU5bDXV+Grz5NM/8kCyzDLiLRdLmq4i+xH1MpuPwwljraMXZ+Hg16IBXyzM170OltAp0YOse3+gtoS9OxyGddA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601041556; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aQ6mKk/Xvpoh0FwSh8rFgMjwPJbPcXVa/7jUk56NGb0=; b=WJ3S7JuhLxN/XmNRnUtnaU1u6oRLvc5RgoD7mRcC9U3YUVOGZr1L5dj4DV4n9biN4UgNkq635md6mHOn/zGz90P+XhT8pUzviCzmdawOs1uBozbuER958+1OzzCFlPnKk7e/OJhwUfF5hv2BzXeB9Djnzf4ymgFrGPgpGA96sKM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601041556928344.14578859756534; Fri, 25 Sep 2020 06:45:56 -0700 (PDT) Received: from localhost ([::1]:54738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLo2r-0006k4-LP for importer@patchew.org; Fri, 25 Sep 2020 09:45:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLnzo-0004QH-Kh for qemu-devel@nongnu.org; Fri, 25 Sep 2020 09:42:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28020) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kLnzm-0008GZ-QJ for qemu-devel@nongnu.org; Fri, 25 Sep 2020 09:42:44 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-537-G77nen3mPeGzG8tz11lYAA-1; Fri, 25 Sep 2020 09:42:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C73048030A6; Fri, 25 Sep 2020 13:42:38 +0000 (UTC) Received: from localhost (ovpn-115-66.ams2.redhat.com [10.36.115.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E2DE55785; Fri, 25 Sep 2020 13:42:35 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601041361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aQ6mKk/Xvpoh0FwSh8rFgMjwPJbPcXVa/7jUk56NGb0=; b=SwpDu56VAsPYZsghCASe5ANvmQqDna/7qrFymXVZlLHBq/5JYAG/2lwqSrORxN9DmpQ3Oy 4XyZE/iAtC5Bz5L+HgB6wsj7NfteeBVpb3DF7kb+qFgRhcNacLpSWtneNDQCOMMygNdHWO aNEzuSxKFM4JfBZ07OtORqNGx4PL1xY= X-MC-Unique: G77nen3mPeGzG8tz11lYAA-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 1/4] util/vhost-user-server: use static library in meson.build Date: Fri, 25 Sep 2020 14:42:26 +0100 Message-Id: <20200925134229.246169-2-stefanha@redhat.com> In-Reply-To: <20200925134229.246169-1-stefanha@redhat.com> References: <20200925134229.246169-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/25 02:48:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.199, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MIME_BASE64_TEXT=1.741, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Laurent Vivier , Thomas Huth , qemu-block@nongnu.org, Markus Armbruster , Coiby Xu , Max Reitz , Stefan Hajnoczi , Paolo Bonzini 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" Don't compile contrib/libvhost-user/libvhost-user.c again. Instead build the static library once and then reuse it throughout QEMU. Also switch from CONFIG_LINUX to CONFIG_VHOST_USER, which is what the vhost-user tools (vhost-user-gpu, etc) do. Signed-off-by: Stefan Hajnoczi --- block/export/export.c | 8 ++++---- block/export/meson.build | 2 +- contrib/libvhost-user/meson.build | 1 + meson.build | 6 +++++- tests/qtest/meson.build | 2 +- util/meson.build | 4 +++- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/block/export/export.c b/block/export/export.c index bd7cac241f..550897e236 100644 --- a/block/export/export.c +++ b/block/export/export.c @@ -17,17 +17,17 @@ #include "sysemu/block-backend.h" #include "block/export.h" #include "block/nbd.h" -#if CONFIG_LINUX -#include "block/export/vhost-user-blk-server.h" -#endif #include "qapi/error.h" #include "qapi/qapi-commands-block-export.h" #include "qapi/qapi-events-block-export.h" #include "qemu/id.h" +#ifdef CONFIG_VHOST_USER +#include "vhost-user-blk-server.h" +#endif =20 static const BlockExportDriver *blk_exp_drivers[] =3D { &blk_exp_nbd, -#if CONFIG_LINUX +#ifdef CONFIG_VHOST_USER &blk_exp_vhost_user_blk, #endif }; diff --git a/block/export/meson.build b/block/export/meson.build index ef3a9576f7..469a7aa0f5 100644 --- a/block/export/meson.build +++ b/block/export/meson.build @@ -1,2 +1,2 @@ block_ss.add(files('export.c')) -block_ss.add(when: 'CONFIG_LINUX', if_true: files('vhost-user-blk-server.c= ', '../../contrib/libvhost-user/libvhost-user.c')) +block_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-blk-ser= ver.c')) diff --git a/contrib/libvhost-user/meson.build b/contrib/libvhost-user/meso= n.build index e68dd1a581..a261e7665f 100644 --- a/contrib/libvhost-user/meson.build +++ b/contrib/libvhost-user/meson.build @@ -1,3 +1,4 @@ libvhost_user =3D static_library('vhost-user', files('libvhost-user.c', 'libvhost-user-gli= b.c'), build_by_default: false) +vhost_user =3D declare_dependency(link_with: libvhost_user) diff --git a/meson.build b/meson.build index 4c6c7310fa..eb84b97ebb 100644 --- a/meson.build +++ b/meson.build @@ -788,6 +788,11 @@ trace_events_subdirs +=3D [ 'util', ] =20 +vhost_user =3D not_found +if 'CONFIG_VHOST_USER' in config_host + subdir('contrib/libvhost-user') +endif + subdir('qapi') subdir('qobject') subdir('stubs') @@ -1169,7 +1174,6 @@ if have_tools install: true) =20 if 'CONFIG_VHOST_USER' in config_host - subdir('contrib/libvhost-user') subdir('contrib/vhost-user-blk') subdir('contrib/vhost-user-gpu') subdir('contrib/vhost-user-input') diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index c72821b09a..aa8d0985e1 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -191,7 +191,7 @@ qos_test_ss.add( ) qos_test_ss.add(when: 'CONFIG_VIRTFS', if_true: files('virtio-9p-test.c')) qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-test= .c')) -qos_test_ss.add(when: 'CONFIG_LINUX', if_true: files('vhost-user-blk-test.= c')) +qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-blk-= test.c')) =20 extra_qtest_deps =3D { 'bios-tables-test': [io], diff --git a/util/meson.build b/util/meson.build index 2296e81b34..9b2a7a5de9 100644 --- a/util/meson.build +++ b/util/meson.build @@ -66,7 +66,9 @@ if have_block util_ss.add(files('main-loop.c')) util_ss.add(files('nvdimm-utils.c')) util_ss.add(files('qemu-coroutine.c', 'qemu-coroutine-lock.c', 'qemu-cor= outine-io.c')) - util_ss.add(when: 'CONFIG_LINUX', if_true: files('vhost-user-server.c')) + util_ss.add(when: 'CONFIG_VHOST_USER', if_true: [ + files('vhost-user-server.c'), vhost_user + ]) util_ss.add(files('block-helpers.c')) util_ss.add(files('qemu-coroutine-sleep.c')) util_ss.add(files('qemu-co-shared-resource.c')) --=20 2.26.2 From nobody Tue May 14 03:51:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 ARC-Seal: i=1; a=rsa-sha256; t=1601041712; cv=none; d=zohomail.com; s=zohoarc; b=Nyf01t0qdIwMjjD1sSS+tBN8dXYn4+Cnv/xeJB/DJqMAs13kPvFJoiljThBtdeHsjoRtZO/CyKEb8ofL/uojuqgHko77MQVpoV0CW54/m+MgHyA5UfCJ24HPXtksOYwa6mOEzxqtwezjJrp8966KdvfwDX6a6h5cnoyC4WDhog0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601041712; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qKmmhtjbbMd4B37UMRyp5VloG9uMAGkWR1Fvk8XbqmA=; b=GI/UdZ3bhzx0iJpXUn8CZl3CYOSEu9YFEf/tJR5c3IUyNhC7xrKpT/0uINvLifGt6SZiJTg0vQ0pZRFeocYIAxYINbXDvXJyzrOBcLIFLenwpnsMb9N02Cz57qszGh/uaia7hsI6frKGlUHhaVWevnUqRUdBOa1Qgwd9q4HGKUg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601041712331848.078751573371; Fri, 25 Sep 2020 06:48:32 -0700 (PDT) Received: from localhost ([::1]:33376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLo5O-0001FW-KC for importer@patchew.org; Fri, 25 Sep 2020 09:48:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLnzs-0004YA-KM for qemu-devel@nongnu.org; Fri, 25 Sep 2020 09:42:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kLnzq-0008HY-UK for qemu-devel@nongnu.org; Fri, 25 Sep 2020 09:42:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-330-GVL-aUC2Op6K-Xnq5BUyBg-1; Fri, 25 Sep 2020 09:42:44 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 712C8807341; Fri, 25 Sep 2020 13:42:43 +0000 (UTC) Received: from localhost (ovpn-115-66.ams2.redhat.com [10.36.115.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1767A60C15; Fri, 25 Sep 2020 13:42:39 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601041366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qKmmhtjbbMd4B37UMRyp5VloG9uMAGkWR1Fvk8XbqmA=; b=KbZfJpQNEwArl5LLgj7OWrA/HRLOnqN3gMbRm0l2UfvZcK+oSPZxvnWVLI3uWukV+PllaL POnoExaf52vxwb+nS+k8n/cPmIyUCnVBJDIW8+jA44u/Y98fss2M33Z2M0jLiN+Zns/EM1 dAjcIAr5jXe1GlPFwKdxiUGhXyBGjx4= X-MC-Unique: GVL-aUC2Op6K-Xnq5BUyBg-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 2/4] qemu-storage-daemon: avoid compiling blockdev_ss twice Date: Fri, 25 Sep 2020 14:42:27 +0100 Message-Id: <20200925134229.246169-3-stefanha@redhat.com> In-Reply-To: <20200925134229.246169-1-stefanha@redhat.com> References: <20200925134229.246169-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/25 01:07:33 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.199, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MIME_BASE64_TEXT=1.741, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Laurent Vivier , Thomas Huth , qemu-block@nongnu.org, Markus Armbruster , Coiby Xu , Max Reitz , Stefan Hajnoczi , Paolo Bonzini 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" Introduce libblkdev.fa to avoid recompiling blockdev_ss twice. Suggested-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi Reviewed-by: Paolo Bonzini --- meson.build | 12 ++++++++++-- storage-daemon/meson.build | 3 +-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index eb84b97ebb..18d689b423 100644 --- a/meson.build +++ b/meson.build @@ -857,7 +857,6 @@ blockdev_ss.add(files( blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c')) softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')]) =20 -softmmu_ss.add_all(blockdev_ss) softmmu_ss.add(files( 'bootdevice.c', 'dma-helpers.c', @@ -952,6 +951,15 @@ block =3D declare_dependency(link_whole: [libblock], link_args: '@block.syms', dependencies: [crypto, io]) =20 +blockdev_ss =3D blockdev_ss.apply(config_host, strict: false) +libblockdev =3D static_library('blockdev', blockdev_ss.sources() + genh, + dependencies: blockdev_ss.dependencies(), + name_suffix: 'fa', + build_by_default: false) + +blockdev =3D declare_dependency(link_whole: [libblockdev], + dependencies: [block]) + qmp_ss =3D qmp_ss.apply(config_host, strict: false) libqmp =3D static_library('qmp', qmp_ss.sources() + genh, dependencies: qmp_ss.dependencies(), @@ -968,7 +976,7 @@ foreach m : block_mods + softmmu_mods install_dir: config_host['qemu_moddir']) endforeach =20 -softmmu_ss.add(authz, block, chardev, crypto, io, qmp) +softmmu_ss.add(authz, blockdev, chardev, crypto, io, qmp) common_ss.add(qom, qemuutil) =20 common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss]) diff --git a/storage-daemon/meson.build b/storage-daemon/meson.build index 0409acc3f5..c5adce81c3 100644 --- a/storage-daemon/meson.build +++ b/storage-daemon/meson.build @@ -1,7 +1,6 @@ qsd_ss =3D ss.source_set() qsd_ss.add(files('qemu-storage-daemon.c')) -qsd_ss.add(block, chardev, qmp, qom, qemuutil) -qsd_ss.add_all(blockdev_ss) +qsd_ss.add(blockdev, chardev, qmp, qom, qemuutil) =20 subdir('qapi') =20 --=20 2.26.2 From nobody Tue May 14 03:51:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 ARC-Seal: i=1; a=rsa-sha256; t=1601041527; cv=none; d=zohomail.com; s=zohoarc; b=CbfNfAvJybfko2XzUEk7GmL2sEls2kfDb31lH/MWy7JnzsT+yjMMkehZ+Bg6hj9fUjl1CUWb1n6OA0FNgERrpR2geG0dnEgh3i/erx+SUTzsg/eE1GIQ9Zfm9NbpWdYOXdM/Nw5fky7bdQ71tHJRLyG8xRnDdlgt8/Neq0DIJzk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601041527; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=b+PQ1XCVWyw8Vzb4sm+9NjeEI3fhUEwkC0Qw/MszMWs=; b=PRzt5x1SbETQx6FEyoXo4osbBi3BqpdMktlaAQ67avyqBKmj4q8oR09mWzJL7waN5ycDfCIU2gm4O8WK2tbkzk8FVi1Jcz9iysiYIuJedUVdjVnEac/lt5+BpFZr2AyNUX1/ruBL1fVnEQq5WKLRGzXAMmF3XKzWii8qfeSflKI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601041527347581.1995008347272; Fri, 25 Sep 2020 06:45:27 -0700 (PDT) Received: from localhost ([::1]:53436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLo2P-0006CC-CT for importer@patchew.org; Fri, 25 Sep 2020 09:45:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLnzy-0004lM-O5 for qemu-devel@nongnu.org; Fri, 25 Sep 2020 09:42:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:39217) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kLnzv-0008J9-Qz for qemu-devel@nongnu.org; Fri, 25 Sep 2020 09:42:54 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-202-LWA7ESYZN8GCYacw2ZqUdQ-1; Fri, 25 Sep 2020 09:42:49 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 093B0805EE4; Fri, 25 Sep 2020 13:42:48 +0000 (UTC) Received: from localhost (ovpn-115-66.ams2.redhat.com [10.36.115.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9569E7882B; Fri, 25 Sep 2020 13:42:44 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601041371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b+PQ1XCVWyw8Vzb4sm+9NjeEI3fhUEwkC0Qw/MszMWs=; b=M5RKi+xuUsuh+qpWBDXMSLGmV7kKnsu+78F3DpS8wgn6u2aq+dhqi7i2CHVDWuAi5wqkZk VvxkbTZ6FMBiSYgVxuKyQ6zTm7Zaharp6YxhF/DQtQc7tyaoo0dbTr8pXbGtM3xFSO+rNn 5bw0Wv06sidLE3bFnAS+por/KhKOs4U= X-MC-Unique: LWA7ESYZN8GCYacw2ZqUdQ-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 3/4] block: move block exports to libblockdev Date: Fri, 25 Sep 2020 14:42:28 +0100 Message-Id: <20200925134229.246169-4-stefanha@redhat.com> In-Reply-To: <20200925134229.246169-1-stefanha@redhat.com> References: <20200925134229.246169-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/25 01:07:33 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.199, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MIME_BASE64_TEXT=1.741, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Laurent Vivier , Thomas Huth , qemu-block@nongnu.org, Markus Armbruster , Coiby Xu , Max Reitz , Stefan Hajnoczi , Paolo Bonzini 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" Block exports are used by softmmu, qemu-storage-daemon, and qemu-nbd. They are not used by other programs and are not otherwise needed in libblock. Undo the recent move of blockdev-nbd.c from blockdev_ss into block_ss. Two stubs are required to support this: 1. bdrv_close_all() (libblock) calls blk_exp_close_all() (libblockdev). 2. qemu_system_killed() is called by os-posix.c (libblockdev) and not implemented in qemu-nbd. Signed-off-by: Stefan Hajnoczi --- stubs/blk-exp-close-all.c | 7 +++++++ stubs/qemu-system-killed.c | 10 ++++++++++ block/export/meson.build | 4 ++-- meson.build | 4 ++-- nbd/meson.build | 2 ++ stubs/meson.build | 2 ++ 6 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 stubs/blk-exp-close-all.c create mode 100644 stubs/qemu-system-killed.c diff --git a/stubs/blk-exp-close-all.c b/stubs/blk-exp-close-all.c new file mode 100644 index 0000000000..1c71316763 --- /dev/null +++ b/stubs/blk-exp-close-all.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "block/export.h" + +/* Only used in programs that support block exports (libblockdev.fa) */ +void blk_exp_close_all(void) +{ +} diff --git a/stubs/qemu-system-killed.c b/stubs/qemu-system-killed.c new file mode 100644 index 0000000000..9af131917b --- /dev/null +++ b/stubs/qemu-system-killed.c @@ -0,0 +1,10 @@ +#include "qemu/osdep.h" +#include "sysemu/runstate.h" + +/* + * This function is needed by os-posix.c but only implemented by softmmu a= nd + * qemu-storage-daemon. Other programs may have no need for it. + */ +void qemu_system_killed(int signal, pid_t pid) +{ +} diff --git a/block/export/meson.build b/block/export/meson.build index 469a7aa0f5..a2772a0dce 100644 --- a/block/export/meson.build +++ b/block/export/meson.build @@ -1,2 +1,2 @@ -block_ss.add(files('export.c')) -block_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-blk-ser= ver.c')) +blockdev_ss.add(files('export.c')) +blockdev_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-blk-= server.c')) diff --git a/meson.build b/meson.build index 18d689b423..0e9528adab 100644 --- a/meson.build +++ b/meson.build @@ -835,7 +835,6 @@ subdir('dump') =20 block_ss.add(files( 'block.c', - 'blockdev-nbd.c', 'blockjob.c', 'job.c', 'qemu-io-cmds.c', @@ -848,6 +847,7 @@ subdir('block') =20 blockdev_ss.add(files( 'blockdev.c', + 'blockdev-nbd.c', 'iothread.c', 'job-qmp.c', )) @@ -1171,7 +1171,7 @@ if have_tools qemu_io =3D executable('qemu-io', files('qemu-io.c'), dependencies: [block, qemuutil], install: true) qemu_nbd =3D executable('qemu-nbd', files('qemu-nbd.c'), - dependencies: [block, qemuutil], install: true) + dependencies: [blockdev, qemuutil], install: true) =20 subdir('storage-daemon') subdir('contrib/rdmacm-mux') diff --git a/nbd/meson.build b/nbd/meson.build index 0c00a776d3..2baaa36948 100644 --- a/nbd/meson.build +++ b/nbd/meson.build @@ -1,5 +1,7 @@ block_ss.add(files( 'client.c', 'common.c', +)) +blockdev_ss.add(files( 'server.c', )) diff --git a/stubs/meson.build b/stubs/meson.build index e0b322bc28..60234571b1 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -1,6 +1,7 @@ stub_ss.add(files('arch_type.c')) stub_ss.add(files('bdrv-next-monitor-owned.c')) stub_ss.add(files('blk-commit-all.c')) +stub_ss.add(files('blk-exp-close-all.c')) stub_ss.add(files('blockdev-close-all-bdrv-states.c')) stub_ss.add(files('change-state-handler.c')) stub_ss.add(files('clock-warp.c')) @@ -25,6 +26,7 @@ stub_ss.add(files('monitor.c')) stub_ss.add(files('monitor-core.c')) stub_ss.add(files('pci-bus.c')) stub_ss.add(files('pci-host-piix.c')) +stub_ss.add(files('qemu-system-killed.c')) stub_ss.add(files('qemu-timer-notify-cb.c')) stub_ss.add(files('qmp_memory_device.c')) stub_ss.add(files('qtest.c')) --=20 2.26.2 From nobody Tue May 14 03:51:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 ARC-Seal: i=1; a=rsa-sha256; t=1601041860; cv=none; d=zohomail.com; s=zohoarc; b=BJK1ccEjDrzGhujUXLBMZ+VuJ6xeqLoK59LIyY4dsQ+cpQcslNY/PAYcdcukdT/bn5hkXB5XOxR6JSM1VCdOQjw56FENMYHNsCdT6HykzmE8oVKPkdsU2M3MUjFi0aEtwvIMjPQYx2lSOkia582+H6WLPTOrNqjKAMyZw4tl2J4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601041860; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=on72vSdxS28kZfDu2pYVVObQVetDsjIKlZe+QSATkhs=; b=NXN2V/9uDdIY7afl4Br+lr3C4NYoWd3gZ0nQk04W/2BmUCSq33biXEJsIkFmRlo2wTL4+AOXkaMVP0DoQ2/Y1TnTItAvhMZE9pPBmluoSaqup5TWAgF039IEjoBk2oM18gJeoo+EwtAFudyjbQFzVJ4szENONRizvj8eQirNQVU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160104186000746.73266770875466; Fri, 25 Sep 2020 06:51:00 -0700 (PDT) Received: from localhost ([::1]:40164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLo7m-00044V-M5 for importer@patchew.org; Fri, 25 Sep 2020 09:50:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLo01-0004lu-6l for qemu-devel@nongnu.org; Fri, 25 Sep 2020 09:42:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22938) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kLnzy-0008KK-MI for qemu-devel@nongnu.org; Fri, 25 Sep 2020 09:42:56 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-289-w7SSzs2WO-GAcofAhYLlLQ-1; Fri, 25 Sep 2020 09:42:50 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A081280732A; Fri, 25 Sep 2020 13:42:49 +0000 (UTC) Received: from localhost (ovpn-115-66.ams2.redhat.com [10.36.115.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4451155786; Fri, 25 Sep 2020 13:42:49 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601041374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=on72vSdxS28kZfDu2pYVVObQVetDsjIKlZe+QSATkhs=; b=AJcm78M5LgvZGHyD15S9x2Ifo0/V0V7w2nPg4IQJPxbrNY00PJlY2vgRY22oJn+ZrrbJbc o30VZoFAoLvJtqQlmmtAxL7wI56fJJBki3UWglTWz9A9wfHwMcOcPuRsraM/M16ynOCWfM v0blIEduhRVkHOA0G2IUZ2ezuky0REE= X-MC-Unique: w7SSzs2WO-GAcofAhYLlLQ-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 4/4] block/export: add BlockExportOptions->iothread member Date: Fri, 25 Sep 2020 14:42:29 +0100 Message-Id: <20200925134229.246169-5-stefanha@redhat.com> In-Reply-To: <20200925134229.246169-1-stefanha@redhat.com> References: <20200925134229.246169-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/25 02:48:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.199, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MIME_BASE64_TEXT=1.741, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Laurent Vivier , Thomas Huth , qemu-block@nongnu.org, Markus Armbruster , Coiby Xu , Max Reitz , Stefan Hajnoczi , Paolo Bonzini 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" Make it possible to specify the iothread where the export will run. Signed-off-by: Stefan Hajnoczi --- Note the x-blockdev-set-iothread QMP command can be used to do the same, but not from the command-line. And it requires sending an additional command. In the long run vhost-user-blk will support per-virtqueue iothread mappings. But for now a single iothread makes sense and most other transports will just use one iothread anyway. --- qapi/block-export.json | 4 ++++ block/export/export.c | 26 +++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/qapi/block-export.json b/qapi/block-export.json index 87ac5117cd..eba6f6eae9 100644 --- a/qapi/block-export.json +++ b/qapi/block-export.json @@ -219,11 +219,15 @@ # export before completion is signalled. (since: 5.2; # default: false) # +# @iothread: The name of the iothread object where the export will run. The +# default is the main loop thread. (since: 5.2) +# # Since: 4.2 ## { 'union': 'BlockExportOptions', 'base': { 'type': 'BlockExportType', 'id': 'str', + '*iothread': 'str', 'node-name': 'str', '*writable': 'bool', '*writethrough': 'bool' }, diff --git a/block/export/export.c b/block/export/export.c index 550897e236..0fb3d76ee3 100644 --- a/block/export/export.c +++ b/block/export/export.c @@ -15,6 +15,7 @@ =20 #include "block/block.h" #include "sysemu/block-backend.h" +#include "sysemu/iothread.h" #include "block/export.h" #include "block/nbd.h" #include "qapi/error.h" @@ -66,7 +67,7 @@ BlockExport *blk_exp_add(BlockExportOptions *export, Erro= r **errp) const BlockExportDriver *drv; BlockExport *exp =3D NULL; BlockDriverState *bs; - BlockBackend *blk; + BlockBackend *blk =3D NULL; AioContext *ctx; uint64_t perm; int ret; @@ -102,6 +103,29 @@ BlockExport *blk_exp_add(BlockExportOptions *export, E= rror **errp) ctx =3D bdrv_get_aio_context(bs); aio_context_acquire(ctx); =20 + if (export->has_iothread) { + IOThread *iothread; + AioContext *new_ctx; + + iothread =3D iothread_by_id(export->iothread); + if (!iothread) { + error_setg(errp, "iothread \"%s\" not found", export->iothread= ); + goto fail; + } + + new_ctx =3D iothread_get_aio_context(iothread); + + ret =3D bdrv_try_set_aio_context(bs, new_ctx, errp); + if (ret !=3D 0) { + goto fail; + } + + aio_context_release(ctx); + aio_context_acquire(new_ctx); + + ctx =3D new_ctx; + } + /* * Block exports are used for non-shared storage migration. Make sure * that BDRV_O_INACTIVE is cleared and the image is ready for write --=20 2.26.2