From nobody Fri May 3 12:02:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552659686055853.1254163469969; Fri, 15 Mar 2019 07:21:26 -0700 (PDT) Received: from localhost ([127.0.0.1]:55982 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4ni1-00082v-NQ for importer@patchew.org; Fri, 15 Mar 2019 10:21:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4nXj-00006o-7c for qemu-devel@nongnu.org; Fri, 15 Mar 2019 10:10:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4nXi-0001fx-9B for qemu-devel@nongnu.org; Fri, 15 Mar 2019 10:10:39 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2195 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h4nSX-0007dw-SQ; Fri, 15 Mar 2019 10:05:18 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 146351BB9CAF239026AC; Fri, 15 Mar 2019 22:05:08 +0800 (CST) Received: from HGHY1l002846723.china.huawei.com (10.177.251.193) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.408.0; Fri, 15 Mar 2019 22:04:59 +0800 From: Zhengui li To: , , Date: Fri, 15 Mar 2019 22:04:38 +0800 Message-ID: <1552658678-7816-1-git-send-email-lizhengui@huawei.com> X-Mailer: git-send-email 2.7.2.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.251.193] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 45.249.212.190 Subject: [Qemu-devel] [PATCH] vpc: unlock Coroutine lock to make IO submit Concurrently 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: wangjie88@huawei.com, lizhengui@huawei.com, qemu-devel@nongnu.org, qemu-block@nongnu.org, eric.fangyi@huawei.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Concurrent IO becomes serial IO because of the qemu Coroutine lock, which reduce IO performance severely. So unlock Coroutine lock before bdrv_co_pwritev and bdrv_co_preadv to fix it. Signed-off-by: Zhengui li Reviewed-by: Paolo Bonzini --- block/vpc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/vpc.c b/block/vpc.c index 52ab717..1133855 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -639,8 +639,10 @@ vpc_co_preadv(BlockDriverState *bs, uint64_t offset, u= int64_t bytes, qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); =20 + qemu_co_mutex_unlock(&s->lock); ret =3D bdrv_co_preadv(bs->file, image_offset, n_bytes, &local_qiov, 0); + qemu_co_mutex_lock(&s->lock); if (ret < 0) { goto fail; } @@ -697,8 +699,10 @@ vpc_co_pwritev(BlockDriverState *bs, uint64_t offset, = uint64_t bytes, qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); =20 + qemu_co_mutex_unlock(&s->lock); ret =3D bdrv_co_pwritev(bs->file, image_offset, n_bytes, &local_qiov, 0); + qemu_co_mutex_lock(&s->lock); if (ret < 0) { goto fail; } --=20 2.7.2.windows.1