From nobody Wed Nov 5 09:04:37 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499671547701531.8624572893714; Mon, 10 Jul 2017 00:25:47 -0700 (PDT) Received: from localhost ([::1]:38984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUT4k-000420-HR for importer@patchew.org; Mon, 10 Jul 2017 03:25:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUT05-0000Uo-5V for qemu-devel@nongnu.org; Mon, 10 Jul 2017 03:20:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUT02-00010r-0z for qemu-devel@nongnu.org; Mon, 10 Jul 2017 03:20:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50772) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dUT01-00010f-NF for qemu-devel@nongnu.org; Mon, 10 Jul 2017 03:20:53 -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 mx1.redhat.com (Postfix) with ESMTPS id A8C50C04B32C for ; Mon, 10 Jul 2017 07:20:52 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-94.pek2.redhat.com [10.72.12.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA9347D571; Mon, 10 Jul 2017 07:20:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A8C50C04B32C Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A8C50C04B32C From: Fam Zheng To: qemu-devel@nongnu.org Date: Mon, 10 Jul 2017 15:20:27 +0800 Message-Id: <20170710072027.7948-6-famz@redhat.com> In-Reply-To: <20170710072027.7948-1-famz@redhat.com> References: <20170710072027.7948-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 10 Jul 2017 07:20:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC 5/5] virtio-blk: Add iothread-group property 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: pbonzini@redhat.com, Fam Zheng , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Do I/O on the IOThreadGroup's aio context. This is mutually exclusive to iothread property. Signed-off-by: Fam Zheng --- hw/block/dataplane/virtio-blk.c | 18 +++++++++++------- hw/block/virtio-blk.c | 6 ++++++ include/hw/virtio/virtio-blk.h | 2 ++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-bl= k.c index 6fdc6f6..4b76f8b 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -40,7 +40,6 @@ struct VirtIOBlockDataPlane { * (because you don't own the file descriptor or handle; you just * use it). */ - IOThread *iothread; AioContext *ctx; }; =20 @@ -86,7 +85,7 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, Vir= tIOBlkConf *conf, =20 *dataplane =3D NULL; =20 - if (conf->iothread) { + if (conf->iothread || conf->iothread_group) { if (!k->set_guest_notifiers || !k->ioeventfd_assign) { error_setg(errp, "device is incompatible with iothread " @@ -116,9 +115,11 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, = VirtIOBlkConf *conf, s->conf =3D conf; =20 if (conf->iothread) { - s->iothread =3D IOTHREAD(conf->iothread); - object_ref(OBJECT(s->iothread)); - s->ctx =3D iothread_get_aio_context(s->iothread); + object_ref(conf->iothread); + s->ctx =3D iothread_get_aio_context(IOTHREAD(conf->iothread)); + } else if (conf->iothread_group) { + object_ref(conf->iothread_group); + s->ctx =3D iothread_group_get_aio_context(IOTHREAD_GROUP(conf->iot= hread_group)); } else { s->ctx =3D qemu_get_aio_context(); } @@ -141,8 +142,11 @@ void virtio_blk_data_plane_destroy(VirtIOBlockDataPlan= e *s) assert(!vblk->dataplane_started); g_free(s->batch_notify_vqs); qemu_bh_delete(s->bh); - if (s->iothread) { - object_unref(OBJECT(s->iothread)); + if (s->conf->iothread) { + object_unref(s->conf->iothread); + } + if (s->conf->iothread_group) { + object_unref(s->conf->iothread_group); } g_free(s); } diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 8146306..cfd847b 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -918,6 +918,10 @@ static void virtio_blk_device_realize(DeviceState *dev= , Error **errp) error_setg(errp, "drive property not set"); return; } + if (conf->iothread && conf->iothread_group) { + error_setg(errp, "iothread and iothread-group cannot be used toget= her"); + return; + } if (!blk_is_inserted(conf->conf.blk)) { error_setg(errp, "Device needs media, but drive is empty"); return; @@ -1011,6 +1015,8 @@ static Property virtio_blk_properties[] =3D { true), DEFINE_PROP_UINT16("num-queues", VirtIOBlock, conf.num_queues, 1), DEFINE_PROP_LINK("iothread", VirtIOBlock, conf.iothread, TYPE_IOTHREAD= ), + DEFINE_PROP_LINK("iothread-group", VirtIOBlock, conf.iothread_group, + TYPE_IOTHREAD_GROUP), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index 2452074..16e72e0 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -35,6 +35,8 @@ struct VirtIOBlkConf BlockConf conf; /* IOThread pointer to be filled by link property */ Object *iothread; + /* IOThreadGroup pointer to be filled by link property */ + Object *iothread_group; char *serial; uint32_t scsi; uint32_t config_wce; --=20 2.9.4