From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066296500203.86755495559078; Mon, 20 Mar 2017 20:18:16 -0700 (PDT) Received: from localhost ([::1]:36387 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAJL-0001QB-3U for importer@patchew.org; Mon, 20 Mar 2017 23:18:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAIC-0001OR-5m for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:17:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAIB-0000KX-DK for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:17:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43186) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAI6-0000IT-80; Mon, 20 Mar 2017 23:16:58 -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 EE91D81F01; Tue, 21 Mar 2017 03:16:53 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDAAAA2A50; Tue, 21 Mar 2017 03:16:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EE91D81F01 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EE91D81F01 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:20 +0800 Message-Id: <20170321031635.22123-2-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.25]); Tue, 21 Mar 2017 03:16:54 +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 01/16] block: Define BLK_PERM_AIO_CONTEXT_CHANGE 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" Signed-off-by: Fam Zheng --- block.c | 2 ++ include/block/block.h | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 6e906ec..ae9327b 100644 --- a/block.c +++ b/block.c @@ -1547,6 +1547,8 @@ static char *bdrv_perm_names(uint64_t perm) { BLK_PERM_WRITE_UNCHANGED, "write unchanged" }, { BLK_PERM_RESIZE, "resize" }, { BLK_PERM_GRAPH_MOD, "change children" }, + { BLK_PERM_AIO_CONTEXT_CHANGE, + "aio context change" }, { 0, NULL } }; =20 diff --git a/include/block/block.h b/include/block/block.h index 5149260..989bdcc 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -221,7 +221,12 @@ enum { */ BLK_PERM_GRAPH_MOD =3D 0x10, =20 - BLK_PERM_ALL =3D 0x1f, + /** + * This permission is required to change the AioContext of this node. + */ + BLK_PERM_AIO_CONTEXT_CHANGE =3D 0x20, + + BLK_PERM_ALL =3D 0x3f, }; =20 /* disk I/O throttling */ --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066313780209.98744489099386; Mon, 20 Mar 2017 20:18:33 -0700 (PDT) Received: from localhost ([::1]:36391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAJc-0001aq-CS for importer@patchew.org; Mon, 20 Mar 2017 23:18:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAIJ-0001UJ-JN for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:17:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAII-0000P5-RT for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:17:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43274) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAIE-0000Lg-JD; Mon, 20 Mar 2017 23:17:06 -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 A192281F07; Tue, 21 Mar 2017 03:17:06 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 187AB9F366; Tue, 21 Mar 2017 03:16:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A192281F07 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A192281F07 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:21 +0800 Message-Id: <20170321031635.22123-3-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.25]); Tue, 21 Mar 2017 03:17:06 +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 02/16] block-backend: Add blk_request_perm 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" This function tries to request, if not granted yet, for the given permissions. Signed-off-by: Fam Zheng --- block/block-backend.c | 12 ++++++++++++ include/sysemu/block-backend.h | 1 + 2 files changed, 13 insertions(+) diff --git a/block/block-backend.c b/block/block-backend.c index 5742c09..5d17404 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -595,6 +595,18 @@ void blk_get_perm(BlockBackend *blk, uint64_t *perm, u= int64_t *shared_perm) *shared_perm =3D blk->shared_perm; } =20 +int blk_request_perm(BlockBackend *blk, uint64_t perm, Error **errp) +{ + uint64_t blk_perm, shared_perm; + + blk_get_perm(blk, &blk_perm, &shared_perm); + if ((blk_perm & perm) =3D=3D perm) { + return 0; + } + blk_perm |=3D perm; + return blk_set_perm(blk, blk_perm, shared_perm, errp); +} + static int blk_do_attach_dev(BlockBackend *blk, void *dev) { if (blk->dev) { diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 096c17f..016632e 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -108,6 +108,7 @@ bool bdrv_is_root_node(BlockDriverState *bs); int blk_set_perm(BlockBackend *blk, uint64_t perm, uint64_t shared_perm, Error **errp); void blk_get_perm(BlockBackend *blk, uint64_t *perm, uint64_t *shared_perm= ); +int blk_request_perm(BlockBackend *blk, uint64_t perm, Error **errp); =20 void blk_set_allow_write_beyond_eof(BlockBackend *blk, bool allow); void blk_iostatus_enable(BlockBackend *blk); --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066588287164.2784876635818; Mon, 20 Mar 2017 20:23:08 -0700 (PDT) Received: from localhost ([::1]:36413 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAO2-0005M7-RT for importer@patchew.org; Mon, 20 Mar 2017 23:23:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAIS-0001aI-6v for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:17:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAIR-0000TF-I1 for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:17:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54558) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAIN-0000Ql-Hg; Mon, 20 Mar 2017 23:17:15 -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 99103C002425; Tue, 21 Mar 2017 03:17:15 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1E95A2A72; Tue, 21 Mar 2017 03:17:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 99103C002425 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 99103C002425 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:22 +0800 Message-Id: <20170321031635.22123-4-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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]); Tue, 21 Mar 2017 03:17:15 +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 03/16] blockjob: Add BLK_PERM_AIO_CONTEXT_CHANGE shared perm on bs 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" Signed-off-by: Fam Zheng --- blockjob.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/blockjob.c b/blockjob.c index 69126af..3fd84b7 100644 --- a/blockjob.c +++ b/blockjob.c @@ -197,6 +197,9 @@ void *block_job_create(const char *job_id, const BlockJ= obDriver *driver, } } =20 + /* The notifier we'll register on @blk takes care of following context + * change, so permit it. */ + shared_perm |=3D BLK_PERM_AIO_CONTEXT_CHANGE; blk =3D blk_new(perm, shared_perm); ret =3D blk_insert_bs(blk, bs, errp); if (ret < 0) { --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066747000590.2419067618442; Mon, 20 Mar 2017 20:25:47 -0700 (PDT) Received: from localhost ([::1]:36428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAQb-0007j4-CZ for importer@patchew.org; Mon, 20 Mar 2017 23:25:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAIh-0001lx-9u for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:17:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAIg-0000Z8-Cu for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:17:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35540) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAIb-0000X3-K8; Mon, 20 Mar 2017 23:17:29 -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 AAB9E41A23; Tue, 21 Mar 2017 03:17:29 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2A1178DD3; Tue, 21 Mar 2017 03:17:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AAB9E41A23 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AAB9E41A23 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:23 +0800 Message-Id: <20170321031635.22123-5-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.30]); Tue, 21 Mar 2017 03:17:29 +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 04/16] block: Propagate BLK_PERM_AIO_CONTEXT_CHANGE down the graph 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" bdrv_set_aio_context can take care of children recursively, so it is okay to pass down the perm. Signed-off-by: Fam Zheng --- block.c | 18 ++++++++++-------- block/vvfat.c | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/block.c b/block.c index ae9327b..0190087 100644 --- a/block.c +++ b/block.c @@ -1670,7 +1670,8 @@ int bdrv_child_try_set_perm(BdrvChild *c, uint64_t pe= rm, uint64_t shared, #define DEFAULT_PERM_PASSTHROUGH (BLK_PERM_CONSISTENT_READ \ | BLK_PERM_WRITE \ | BLK_PERM_WRITE_UNCHANGED \ - | BLK_PERM_RESIZE) + | BLK_PERM_RESIZE \ + | BLK_PERM_AIO_CONTEXT_CHANGE) #define DEFAULT_PERM_UNCHANGED (BLK_PERM_ALL & ~DEFAULT_PERM_PASSTHROUGH) =20 void bdrv_filter_default_perms(BlockDriverState *bs, BdrvChild *c, @@ -1713,21 +1714,22 @@ void bdrv_format_default_perms(BlockDriverState *bs= , BdrvChild *c, perm |=3D BLK_PERM_CONSISTENT_READ; shared &=3D ~(BLK_PERM_WRITE | BLK_PERM_RESIZE); } else { - /* We want consistent read from backing files if the parent needs = it. + /* We want consistent read and aio context change from backing fil= es if + * the parent needs it. * No other operations are performed on backing files. */ - perm &=3D BLK_PERM_CONSISTENT_READ; + perm &=3D BLK_PERM_CONSISTENT_READ | BLK_PERM_AIO_CONTEXT_CHANGE; =20 - /* If the parent can deal with changing data, we're okay with a + /* If the parent can deal with changing aio context, we're okay to= o; + * If the parent can deal with changing data, we're okay with a * writable and resizable backing file. */ /* TODO Require !(perm & BLK_PERM_CONSISTENT_READ), too? */ + shared &=3D BLK_PERM_AIO_CONTEXT_CHANGE | BLK_PERM_WRITE; if (shared & BLK_PERM_WRITE) { - shared =3D BLK_PERM_WRITE | BLK_PERM_RESIZE; - } else { - shared =3D 0; + shared |=3D BLK_PERM_WRITE | BLK_PERM_RESIZE; } =20 shared |=3D BLK_PERM_CONSISTENT_READ | BLK_PERM_GRAPH_MOD | - BLK_PERM_WRITE_UNCHANGED; + BLK_PERM_WRITE_UNCHANGED | BLK_PERM_AIO_CONTEXT_CHANGE; } =20 *nperm =3D perm; diff --git a/block/vvfat.c b/block/vvfat.c index af5153d..70ce452 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -3080,7 +3080,7 @@ static void vvfat_child_perm(BlockDriverState *bs, Bd= rvChild *c, if (c =3D=3D s->qcow) { /* This is a private node, nobody should try to attach to it */ *nperm =3D BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE; - *nshared =3D BLK_PERM_WRITE_UNCHANGED; + *nshared =3D BLK_PERM_WRITE_UNCHANGED | BLK_PERM_AIO_CONTEXT_CHANG= E; } else { /* The backing file is there so 'commit' can use it. vvfat doesn't * access it in any way. */ --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066468874383.1563715078564; Mon, 20 Mar 2017 20:21:08 -0700 (PDT) Received: from localhost ([::1]:36399 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAM7-0003dP-Lo for importer@patchew.org; Mon, 20 Mar 2017 23:21:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAIx-0001z5-6z for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:17:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAIu-0000fQ-27 for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:17:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33346) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAIq-0000du-D9; Mon, 20 Mar 2017 23:17: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 mx1.redhat.com (Postfix) with ESMTPS id 7A42285547; Tue, 21 Mar 2017 03:17:44 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54B7978DD3; Tue, 21 Mar 2017 03:17:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7A42285547 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7A42285547 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:24 +0800 Message-Id: <20170321031635.22123-6-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.28]); Tue, 21 Mar 2017 03:17:44 +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 05/16] backup: Request BLK_PERM_AIO_CONTEXT_CHANGE on target 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" What's done in the source's context change notifier is moving the target's context to follow the new one, so we request this permission here. Signed-off-by: Fam Zheng --- block/backup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/backup.c b/block/backup.c index a4fb288..546c5c5 100644 --- a/block/backup.c +++ b/block/backup.c @@ -636,7 +636,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, } =20 /* The target must match the source in size, so no resize here either = */ - job->target =3D blk_new(BLK_PERM_WRITE, + job->target =3D blk_new(BLK_PERM_WRITE | BLK_PERM_AIO_CONTEXT_CHANGE, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE | BLK_PERM_WRITE_UNCHANGED | BLK_PERM_GRAPH_MOD); ret =3D blk_insert_bs(job->target, target, errp); --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066482967790.6590650710322; Mon, 20 Mar 2017 20:21:22 -0700 (PDT) Received: from localhost ([::1]:36407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAML-0003uF-Mc for importer@patchew.org; Mon, 20 Mar 2017 23:21:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAJF-0002Dr-NS for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:18:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAJE-0000rQ-NS for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:18:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58158) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAJC-0000p0-Lj; Mon, 20 Mar 2017 23:18:06 -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 A9CB320264; Tue, 21 Mar 2017 03:18:06 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB7E578DD3; Tue, 21 Mar 2017 03:17:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A9CB320264 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A9CB320264 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:25 +0800 Message-Id: <20170321031635.22123-7-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.29]); Tue, 21 Mar 2017 03:18:06 +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 06/16] backup: Do initial aio context move of target via BB interface 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" The old aio context check is hacky because when it was added we didn't have the permission system to enforce a general rule. It only checks if the target BDS has a BB, which is in fact insufficient because there may be other BBs in the graph that cannot handle the aio context change. Do this through blk_set_aio_context interface, in backup_job_create() as a central place for both drive-backup and blockdev-backup, to take care of the compatibility check. Also the bdrv_set_aio_context in do_drive_backup could have been conditional, to save a recursion when possible. Signed-off-by: Fam Zheng --- block/backup.c | 9 +++++++++ blockdev.c | 14 -------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/block/backup.c b/block/backup.c index 546c5c5..9136f91 100644 --- a/block/backup.c +++ b/block/backup.c @@ -564,6 +564,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, BlockDriverInfo bdi; BackupBlockJob *job =3D NULL; int ret; + AioContext *aio_context, *target_context; =20 assert(bs); assert(target); @@ -644,6 +645,14 @@ BlockJob *backup_job_create(const char *job_id, BlockD= riverState *bs, goto error; } =20 + aio_context =3D bdrv_get_aio_context(bs); + target_context =3D bdrv_get_aio_context(target); + if (target_context !=3D aio_context) { + aio_context_acquire(target_context); + blk_set_aio_context(job->target, aio_context); + aio_context_release(target_context); + } + job->on_source_error =3D on_source_error; job->on_target_error =3D on_target_error; job->sync_mode =3D sync_mode; diff --git a/blockdev.c b/blockdev.c index c5b2c2c..5d89a9a 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3259,8 +3259,6 @@ static BlockJob *do_drive_backup(DriveBackup *backup,= BlockJobTxn *txn, goto out; } =20 - bdrv_set_aio_context(target_bs, aio_context); - if (backup->has_bitmap) { bmap =3D bdrv_find_dirty_bitmap(bs, backup->bitmap); if (!bmap) { @@ -3337,18 +3335,6 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup,= BlockJobTxn *txn, if (!target_bs) { goto out; } - - if (bdrv_get_aio_context(target_bs) !=3D aio_context) { - if (!bdrv_has_blk(target_bs)) { - /* The target BDS is not attached, we can safely move it to an= other - * AioContext. */ - bdrv_set_aio_context(target_bs, aio_context); - } else { - error_setg(errp, "Target is attached to a different thread fro= m " - "source."); - goto out; - } - } job =3D backup_job_create(backup->job_id, bs, target_bs, backup->speed, backup->sync, NULL, backup->compress, backup->on_source_error, backup->on_target_err= or, --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066614529633.5272249481994; Mon, 20 Mar 2017 20:23:34 -0700 (PDT) Received: from localhost ([::1]:36416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAOS-0005oH-TC for importer@patchew.org; Mon, 20 Mar 2017 23:23:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAJZ-0002RC-0r for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:18:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAJY-0000z3-5S for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:18:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39286) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAJT-0000xI-VB; Mon, 20 Mar 2017 23:18:24 -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 042C161D1D; Tue, 21 Mar 2017 03:18:24 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD8AC78DD3; Tue, 21 Mar 2017 03:18:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 042C161D1D Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 042C161D1D From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:26 +0800 Message-Id: <20170321031635.22123-8-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.39]); Tue, 21 Mar 2017 03:18:24 +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 07/16] mirror: Request aio context change permission on target 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" What's done in the source's context change notifier is moving the target's context to follow the new one, so we request this permission here. Signed-off-by: Fam Zheng --- block/mirror.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/mirror.c b/block/mirror.c index ca4baa5..7101b11 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1185,6 +1185,7 @@ static void mirror_start_job(const char *job_id, Bloc= kDriverState *bs, target_is_backing =3D bdrv_chain_contains(bs, target); target_graph_mod =3D (backing_mode !=3D MIRROR_LEAVE_BACKING_CHAIN); s->target =3D blk_new(BLK_PERM_WRITE | BLK_PERM_RESIZE | + BLK_PERM_AIO_CONTEXT_CHANGE | (target_graph_mod ? BLK_PERM_GRAPH_MOD : 0), BLK_PERM_WRITE_UNCHANGED | (target_is_backing ? BLK_PERM_CONSISTENT_READ | --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 149006660790152.29110796057273; Mon, 20 Mar 2017 20:23:27 -0700 (PDT) Received: from localhost ([::1]:36415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAOK-0005hL-Jw for importer@patchew.org; Mon, 20 Mar 2017 23:23:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAJk-0002c0-PO for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:18:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAJj-00013J-VP for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:18:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55254) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAJf-00011b-Gb; Mon, 20 Mar 2017 23:18:35 -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 9356BC04D2EC; Tue, 21 Mar 2017 03:18:35 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85B469F366; Tue, 21 Mar 2017 03:18:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9356BC04D2EC 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 9356BC04D2EC From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:27 +0800 Message-Id: <20170321031635.22123-9-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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]); Tue, 21 Mar 2017 03:18:35 +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 08/16] commit: Allow aio context change on s->base 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" The block job has the aio context change notifier, we should allow it here as well. Signed-off-by: Fam Zheng --- block/commit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/commit.c b/block/commit.c index 2832482..a1805c2 100644 --- a/block/commit.c +++ b/block/commit.c @@ -388,7 +388,8 @@ void commit_start(const char *job_id, BlockDriverState = *bs, | BLK_PERM_RESIZE, BLK_PERM_CONSISTENT_READ | BLK_PERM_GRAPH_MOD - | BLK_PERM_WRITE_UNCHANGED); + | BLK_PERM_WRITE_UNCHANGED + | BLK_PERM_AIO_CONTEXT_CHANGE); ret =3D blk_insert_bs(s->base, base, errp); if (ret < 0) { goto fail; --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066871669840.0577343072564; Mon, 20 Mar 2017 20:27:51 -0700 (PDT) Received: from localhost ([::1]:36449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqASc-0001EK-Dd for importer@patchew.org; Mon, 20 Mar 2017 23:27:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAJz-0002oA-9j for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:18:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAJy-00018a-AU for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:18:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6363) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAJt-00016P-PX; Mon, 20 Mar 2017 23:18:49 -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 D276EC054C58; Tue, 21 Mar 2017 03:18:49 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0099DA2A6A; Tue, 21 Mar 2017 03:18:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D276EC054C58 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D276EC054C58 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:28 +0800 Message-Id: <20170321031635.22123-10-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.32]); Tue, 21 Mar 2017 03:18:50 +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 09/16] mirror: Do initial aio context move of target via BB interface 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" While blockdev-backup tried to verify before moving target's aio context, t= he same is missing for blockdev-mirror. Now that we have the right interface, = fix this as well. As a bounus, the aio context move is now conditional, which avoids unnecess= ary operations in bdrv_set_aio_context. Signed-off-by: Fam Zheng --- block/mirror.c | 9 +++++++++ blockdev.c | 4 ---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 7101b11..ed26e8c 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1116,6 +1116,7 @@ static void mirror_start_job(const char *job_id, Bloc= kDriverState *bs, bool is_none_mode, BlockDriverState *base, bool auto_complete, const char *filter_node_n= ame) { + AioContext *aio_context, *target_context; MirrorBlockJob *s; BlockDriverState *mirror_top_bs; bool target_graph_mod; @@ -1196,6 +1197,14 @@ static void mirror_start_job(const char *job_id, Blo= ckDriverState *bs, goto fail; } =20 + aio_context =3D bdrv_get_aio_context(bs); + target_context =3D bdrv_get_aio_context(target); + if (target_context !=3D aio_context) { + aio_context_acquire(target_context); + blk_set_aio_context(s->target, aio_context); + aio_context_release(target_context); + } + s->replaces =3D g_strdup(replaces); s->on_source_error =3D on_source_error; s->on_target_error =3D on_target_error; diff --git a/blockdev.c b/blockdev.c index 5d89a9a..5298a93 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3556,8 +3556,6 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp) goto out; } =20 - bdrv_set_aio_context(target_bs, aio_context); - blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, targe= t_bs, arg->has_replaces, arg->replaces, arg->sync, backing_mode, arg->has_speed, arg->speed, @@ -3608,8 +3606,6 @@ void qmp_blockdev_mirror(bool has_job_id, const char = *job_id, aio_context =3D bdrv_get_aio_context(bs); aio_context_acquire(aio_context); =20 - bdrv_set_aio_context(target_bs, aio_context); - blockdev_mirror_common(has_job_id ? job_id : NULL, bs, target_bs, has_replaces, replaces, sync, backing_mode, has_speed, speed, --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066803747397.6972446320814; Mon, 20 Mar 2017 20:26:43 -0700 (PDT) Received: from localhost ([::1]:36441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqARW-0000Jb-F8 for importer@patchew.org; Mon, 20 Mar 2017 23:26:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAK9-0002wL-BQ for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:19:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAK8-0001Cg-Jt for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:19:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57028) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAK4-0001AY-9a; Mon, 20 Mar 2017 23:19:00 -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 5DB7B7E9C9; Tue, 21 Mar 2017 03:19:00 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42D2078DD3; Tue, 21 Mar 2017 03:18:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5DB7B7E9C9 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5DB7B7E9C9 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:29 +0800 Message-Id: <20170321031635.22123-11-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.26]); Tue, 21 Mar 2017 03:19:00 +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 10/16] virtio-scsi: Request BLK_PERM_AIO_CONTEXT_CHANGE for dataplane 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" blk_set_aio_context is audited by perm API, so follow the protocol and request for permission first. Signed-off-by: Fam Zheng --- hw/scsi/virtio-scsi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 1dbc4bc..6a48356 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -811,6 +811,10 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplu= g_dev, DeviceState *dev, return; } virtio_scsi_acquire(s); + if (!blk_request_perm(sd->conf.blk, BLK_PERM_AIO_CONTEXT_CHANGE, e= rrp)) { + virtio_scsi_release(s); + return; + } blk_set_aio_context(sd->conf.blk, s->ctx); virtio_scsi_release(s); =20 --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066632897986.8322457404691; Mon, 20 Mar 2017 20:23:52 -0700 (PDT) Received: from localhost ([::1]:36418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAOl-00066m-4W for importer@patchew.org; Mon, 20 Mar 2017 23:23:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAKR-0003Bh-SR for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:19:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAKO-0001Kb-P1 for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:19:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55628) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAKM-0001JX-Mx; Mon, 20 Mar 2017 23:19:18 -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 B715AC05093D; Tue, 21 Mar 2017 03:19:18 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 050CE78DD3; Tue, 21 Mar 2017 03:19:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B715AC05093D 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 B715AC05093D From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:30 +0800 Message-Id: <20170321031635.22123-12-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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]); Tue, 21 Mar 2017 03:19:18 +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 11/16] virtio-blk: Request BLK_PERM_AIO_CONTEXT_CHANGE for dataplane 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" blk_set_aio_context is audited by perm API, so follow the protocol and request for permission first. Previously the return code in error path is hardcoded as -EPERM, but returning 'r' is more meaningful here both for the new error and existing errors. Signed-off-by: Fam Zheng --- hw/block/dataplane/virtio-blk.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-bl= k.c index 5556f0e..8f2ff2df 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -168,6 +168,7 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) unsigned i; unsigned nvqs =3D s->conf->num_queues; int r; + Error *local_err =3D NULL; =20 if (vblk->dataplane_started || s->starting) { return 0; @@ -175,12 +176,18 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) =20 s->starting =3D true; =20 + r =3D blk_request_perm(s->conf->conf.blk, BLK_PERM_AIO_CONTEXT_CHANGE, + &local_err); + if (r) { + error_report_err(local_err); + goto fail; + } /* Set up guest notifier (irq) */ r =3D k->set_guest_notifiers(qbus->parent, nvqs, true); if (r !=3D 0) { fprintf(stderr, "virtio-blk failed to set guest notifier (%d), " "ensure -enable-kvm is set\n", r); - goto fail_guest_notifiers; + goto fail; } =20 /* Set up virtqueue notify */ @@ -191,7 +198,7 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) while (i--) { virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); } - goto fail_guest_notifiers; + goto fail; } } =20 @@ -219,11 +226,11 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) aio_context_release(s->ctx); return 0; =20 - fail_guest_notifiers: +fail: vblk->dataplane_disabled =3D true; s->starting =3D false; vblk->dataplane_started =3D true; - return -ENOSYS; + return r; } =20 /* Context: QEMU global mutex held */ --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066740791603.460665178793; Mon, 20 Mar 2017 20:25:40 -0700 (PDT) Received: from localhost ([::1]:36427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAQV-0007eF-Es for importer@patchew.org; Mon, 20 Mar 2017 23:25:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAKc-0003H0-9n for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:19:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAKb-0001Ow-EY for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:19:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36740) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAKX-0001NM-5j; Mon, 20 Mar 2017 23:19:29 -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 4A9073D952; Tue, 21 Mar 2017 03:19:29 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B412A2A50; Tue, 21 Mar 2017 03:19:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4A9073D952 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4A9073D952 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:31 +0800 Message-Id: <20170321031635.22123-13-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.30]); Tue, 21 Mar 2017 03:19:29 +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 12/16] blk: fix aio context loss on media change 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" From: Vladimir Sementsov-Ogievskiy If we have separate iothread for cdrom, we lose connection to it on qmp_blockdev_change_medium, as aio_context is on bds which is dropped and switched with new one. As an example result, after such media change we have crash on virtio_scsi_ctx_check: Assertion `blk_get_aio_context(d->conf.blk) =3D=3D s= ->ctx' failed. Signed-off-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Fam Zheng --- block/block-backend.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/block/block-backend.c b/block/block-backend.c index 5d17404..ec8747f 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -65,6 +65,8 @@ struct BlockBackend { bool allow_write_beyond_eof; =20 NotifierList remove_bs_notifiers, insert_bs_notifiers; + + AioContext *aio_context; }; =20 typedef struct BlockBackendAIOCB { @@ -559,6 +561,10 @@ int blk_insert_bs(BlockBackend *blk, BlockDriverState = *bs, Error **errp) } bdrv_ref(bs); =20 + if (blk->aio_context !=3D NULL) { + bdrv_set_aio_context(bs, blk->aio_context); + } + notifier_list_notify(&blk->insert_bs_notifiers, blk); if (blk->public.throttle_state) { throttle_timers_attach_aio_context( @@ -1619,6 +1625,7 @@ void blk_set_aio_context(BlockBackend *blk, AioContex= t *new_context) { BlockDriverState *bs =3D blk_bs(blk); =20 + blk->aio_context =3D new_context; if (bs) { if (blk->public.throttle_state) { throttle_timers_detach_aio_context(&blk->public.throttle_timer= s); --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066919329930.7445314139845; Mon, 20 Mar 2017 20:28:39 -0700 (PDT) Received: from localhost ([::1]:36452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqATN-00020J-Qu for importer@patchew.org; Mon, 20 Mar 2017 23:28:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAKn-0003Q4-Gr for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:19:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAKm-0001Ss-Mu for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:19:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34634) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAKh-0001Qg-5I; Mon, 20 Mar 2017 23:19:39 -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 346188047A; Tue, 21 Mar 2017 03:19:39 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C374A2A50; Tue, 21 Mar 2017 03:19:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 346188047A Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 346188047A From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:32 +0800 Message-Id: <20170321031635.22123-14-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.28]); Tue, 21 Mar 2017 03:19:39 +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 13/16] nbd: Allow BLK_PERM_AIO_CONTEXT_CHANGE on BB 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" This is safe because of the aio context notifier we'll register on this node. So allow it. Signed-off-by: Fam Zheng --- nbd/server.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nbd/server.c b/nbd/server.c index 924a1fe..a8f58fb 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -900,8 +900,10 @@ NBDExport *nbd_export_new(BlockDriverState *bs, off_t = dev_offset, off_t size, if ((nbdflags & NBD_FLAG_READ_ONLY) =3D=3D 0) { perm |=3D BLK_PERM_WRITE; } - blk =3D blk_new(perm, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHAN= GED | - BLK_PERM_WRITE | BLK_PERM_GRAPH_MOD); + blk =3D blk_new(perm, + BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGED | + BLK_PERM_WRITE | BLK_PERM_GRAPH_MOD | + BLK_PERM_AIO_CONTEXT_CHANGE); ret =3D blk_insert_bs(blk, bs, errp); if (ret < 0) { goto fail; --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 149006698559914.409857008432596; Mon, 20 Mar 2017 20:29:45 -0700 (PDT) Received: from localhost ([::1]:36463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAUS-00032P-HC for importer@patchew.org; Mon, 20 Mar 2017 23:29:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAL0-0003cR-Rw for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:19:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAKz-0001YG-RR for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:19:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40192) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAKv-0001WO-Ct; Mon, 20 Mar 2017 23:19: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 6B70C61D06; Tue, 21 Mar 2017 03:19:53 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2C0378DD3; Tue, 21 Mar 2017 03:19:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6B70C61D06 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6B70C61D06 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:33 +0800 Message-Id: <20170321031635.22123-15-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.39]); Tue, 21 Mar 2017 03:19:53 +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 14/16] block: Add perm assertion on blk_set_aio_context 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" Now that all BB users comply with the BLK_PERM_AIO_CONTEXT_CHANGE rule, we can assert it. Signed-off-by: Fam Zheng --- block/block-backend.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/block-backend.c b/block/block-backend.c index ec8747f..8284b83 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1623,8 +1623,12 @@ static AioContext *blk_aiocb_get_aio_context(BlockAI= OCB *acb) =20 void blk_set_aio_context(BlockBackend *blk, AioContext *new_context) { + uint64_t perm, shared_perm; BlockDriverState *bs =3D blk_bs(blk); =20 + blk_get_perm(blk, &perm, &shared_perm); + assert(perm & BLK_PERM_AIO_CONTEXT_CHANGE); + blk->aio_context =3D new_context; if (bs) { if (blk->public.throttle_state) { --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490067044479743.1747262384592; Mon, 20 Mar 2017 20:30:44 -0700 (PDT) Received: from localhost ([::1]:36470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAVP-0003cN-8L for importer@patchew.org; Mon, 20 Mar 2017 23:30:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqAMs-0005EQ-FF for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:21:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAMr-0002ae-PI for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:21:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32792) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAMn-0002Y6-Go; Mon, 20 Mar 2017 23:21:49 -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 866A72EF19C; Tue, 21 Mar 2017 03:21:49 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB17B78DD3; Tue, 21 Mar 2017 03:19:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 866A72EF19C Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 866A72EF19C From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:34 +0800 Message-Id: <20170321031635.22123-16-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.29]); Tue, 21 Mar 2017 03:21:49 +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 15/16] mirror: Lazily request aio context change permission on target 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" What's done in the source's context change notifier is moving the target's context to follow the new one, so we request this permission here. Signed-off-by: Fam Zheng --- block/mirror.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/mirror.c b/block/mirror.c index ed26e8c..168cf60 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -983,6 +983,7 @@ static void mirror_attached_aio_context(BlockJob *job, = AioContext *new_context) { MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common); =20 + blk_request_perm(s->target, BLK_PERM_AIO_CONTEXT_CHANGE, &error_abort); blk_set_aio_context(s->target, new_context); } =20 --=20 2.9.3 From nobody Sun May 5 18:12:48 2024 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.zoho.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 1490066853806216.7983384948442; Mon, 20 Mar 2017 20:27:33 -0700 (PDT) Received: from localhost ([::1]:36445 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqASK-0000zy-Eq for importer@patchew.org; Mon, 20 Mar 2017 23:27:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqANC-0005bD-EE for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:22:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqAN9-0002k3-BC for qemu-devel@nongnu.org; Mon, 20 Mar 2017 23:22:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37040) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cqAN7-0002ij-9n; Mon, 20 Mar 2017 23:22:09 -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 03C2B80487; Tue, 21 Mar 2017 03:22:09 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-61.pek2.redhat.com [10.72.8.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37902A2A6A; Tue, 21 Mar 2017 03:21:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 03C2B80487 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 03C2B80487 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 21 Mar 2017 11:16:35 +0800 Message-Id: <20170321031635.22123-17-famz@redhat.com> In-Reply-To: <20170321031635.22123-1-famz@redhat.com> References: <20170321031635.22123-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.28]); Tue, 21 Mar 2017 03:22:09 +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 16/16] Revert "mirror: Request aio context change permission on target" 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: Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, Stefan Hajnoczi , Max Reitz 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" This reverts commit bee8490438adfb30785cd5256019e8cba9fb3a07. Signed-off-by: Fam Zheng --- block/mirror.c | 1 - 1 file changed, 1 deletion(-) diff --git a/block/mirror.c b/block/mirror.c index 168cf60..240da19 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1187,7 +1187,6 @@ static void mirror_start_job(const char *job_id, Bloc= kDriverState *bs, target_is_backing =3D bdrv_chain_contains(bs, target); target_graph_mod =3D (backing_mode !=3D MIRROR_LEAVE_BACKING_CHAIN); s->target =3D blk_new(BLK_PERM_WRITE | BLK_PERM_RESIZE | - BLK_PERM_AIO_CONTEXT_CHANGE | (target_graph_mod ? BLK_PERM_GRAPH_MOD : 0), BLK_PERM_WRITE_UNCHANGED | (target_is_backing ? BLK_PERM_CONSISTENT_READ | --=20 2.9.3