From nobody Fri May 3 23:55:10 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.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512748713999658.5356631917634; Fri, 8 Dec 2017 07:58:33 -0800 (PST) Received: from localhost ([::1]:37846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNL2f-0000su-BF for importer@patchew.org; Fri, 08 Dec 2017 10:58:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNL02-0006VL-Cw for qemu-devel@nongnu.org; Fri, 08 Dec 2017 10:55:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNL01-0000a6-BJ for qemu-devel@nongnu.org; Fri, 08 Dec 2017 10:55:42 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:38941) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eNKzw-0000TT-Kw; Fri, 08 Dec 2017 10:55:36 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.21/8.16.0.21) with SMTP id vB8Fq9ou173884; Fri, 8 Dec 2017 15:55:33 GMT Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2eqwqx00r1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Dec 2017 15:55:33 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vB8FtWl4005737 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Dec 2017 15:55:32 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id vB8FtWhj018761; Fri, 8 Dec 2017 15:55:32 GMT Received: from mhkanda-aus-1.us.oracle.com (/10.135.188.192) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 08 Dec 2017 07:55:31 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : in-reply-to : references; s=corp-2017-10-26; bh=nas6PFlqcosbrCbqJOAcFvu9B52OwkaxLEbzYEZJM2o=; b=ThykgMh3yJpTnirzjGfVGyiYJW7xQdja+xGnDdVR7isxzDIbXCsjrlGYZ29amLEQ4Oyt K0iJGEKkp3ciYWvH1QFZeGW9Gt4LvI4+qayA434fOQbvyx0J6th5sMaXuTZ/oVBuyaBa lFPVTnPe0Bb/J9BE7sXHPjTJ84QTFKiA+DlxUcSK0BOSfsYb1v/jjj6hCqZsg+j1FOCp aW5Lz8JXDK4zDnufUYzAndsQ9rTSacuMgtFs3Sfada5qxSSp7iGw8WYF6c2uMWyg4OCY DsNpgQnkS+2cf9cxg4orXVe9Hj2Yp/Jq0PxKH5L4FxzztmR/8X376PGsaV+lxvv44G4c Og== From: Mark Kanda To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Fri, 8 Dec 2017 09:57:26 -0600 Message-Id: <69085bc5e9cc05d4dd04805e2321cac5928c4106.1512748083.git.mark.kanda@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8738 signatures=668644 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1712080218 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 141.146.126.79 Subject: [Qemu-devel] [PATCH v2 1/2] virtio-blk: make queue size configurable 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: martin.petersen@oracle.com, konrad.wilk@oracle.com, ameya.more@oracle.com, stefanha@redhat.com, karl.heubaum@oracle.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Depending on the configuration, it can be beneficial to adjust the virtio-b= lk queue size to something other than the current default of 128. Add a new property to make the queue size configurable. Signed-off-by: Mark Kanda Reviewed-by: Karl Heubaum Reviewed-by: Martin K. Petersen Reviewed-by: Ameya More --- hw/block/virtio-blk.c | 10 +++++++++- include/hw/virtio/virtio-blk.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 05d1440..fb59f57 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -928,6 +928,13 @@ static void virtio_blk_device_realize(DeviceState *dev= , Error **errp) error_setg(errp, "num-queues property must be larger than 0"); return; } + if (!is_power_of_2(conf->queue_size) || + conf->queue_size > VIRTQUEUE_MAX_SIZE) { + error_setg(errp, "invalid queue-size property (%" PRIu16 "), " + "must be a power of 2 (max %d)", + conf->queue_size, VIRTQUEUE_MAX_SIZE); + return; + } =20 blkconf_serial(&conf->conf, &conf->serial); blkconf_apply_backend_options(&conf->conf, @@ -953,7 +960,7 @@ static void virtio_blk_device_realize(DeviceState *dev,= Error **errp) s->sector_mask =3D (s->conf.conf.logical_block_size / BDRV_SECTOR_SIZE= ) - 1; =20 for (i =3D 0; i < conf->num_queues; i++) { - virtio_add_queue(vdev, 128, virtio_blk_handle_output); + virtio_add_queue(vdev, conf->queue_size, virtio_blk_handle_output); } virtio_blk_data_plane_create(vdev, conf, &s->dataplane, &err); if (err !=3D NULL) { @@ -1012,6 +1019,7 @@ static Property virtio_blk_properties[] =3D { DEFINE_PROP_BIT("request-merging", VirtIOBlock, conf.request_merging, = 0, true), DEFINE_PROP_UINT16("num-queues", VirtIOBlock, conf.num_queues, 1), + DEFINE_PROP_UINT16("queue-size", VirtIOBlock, conf.queue_size, 128), DEFINE_PROP_LINK("iothread", VirtIOBlock, conf.iothread, TYPE_IOTHREAD, IOThread *), DEFINE_PROP_END_OF_LIST(), diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index d3c8a6f..5117431 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -39,6 +39,7 @@ struct VirtIOBlkConf uint32_t config_wce; uint32_t request_merging; uint16_t num_queues; + uint16_t queue_size; }; =20 struct VirtIOBlockDataPlane; --=20 1.8.3.1 From nobody Fri May 3 23:55:10 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.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512748635382941.5944013003276; Fri, 8 Dec 2017 07:57:15 -0800 (PST) Received: from localhost ([::1]:37842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNL1O-0007D2-6s for importer@patchew.org; Fri, 08 Dec 2017 10:57:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNL02-0006VD-Ao for qemu-devel@nongnu.org; Fri, 08 Dec 2017 10:55:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNL01-0000a0-8K for qemu-devel@nongnu.org; Fri, 08 Dec 2017 10:55:42 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:37010) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eNKzw-0000TU-Nn; Fri, 08 Dec 2017 10:55:36 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.21/8.16.0.21) with SMTP id vB8FqDtu121309; Fri, 8 Dec 2017 15:55:34 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2eqw9rr7rh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Dec 2017 15:55:34 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id vB8FtXF2031454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Dec 2017 15:55:33 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id vB8FtWL1016921; Fri, 8 Dec 2017 15:55:33 GMT Received: from mhkanda-aus-1.us.oracle.com (/10.135.188.192) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 08 Dec 2017 07:55:32 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : in-reply-to : references; s=corp-2017-10-26; bh=J2ndYOtc14ZbKKeVnkJzEdqWV4HbN7HxJF5RJsik+Lc=; b=R2Zf6j3o002GrTItwHJlhnSONYCmoL5eObY9z6giMQpVuGPd2wGfujaE1lAxXc2X+L9C LGmz0eqh6cwhS+XkACh6Hp14xnlpvv0FSqSsskgCslk1ZuX6PheQkqJq9v2f1Lgq6ObE +zFvOUpSJV1oOtPSOlcJTOSiXabOnto029wZCL6m1MqF0BuZIjmtUaOJdIUU5LynKzLi 5mWqNRwYm78NFmbdQ8N+XNNfglWAbhjB54pinOXymEIIBvEqgo5W7uUvqLX88NywJYmn zEro59zMXe1jd9b7jNkvx6js+8yIc1fyO3+z8m856g/ToE/f4wygc025eVxZW9WjaX9K VQ== From: Mark Kanda To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Fri, 8 Dec 2017 09:57:27 -0600 Message-Id: <917e1bbf765dc05629ecfcfea193d3dab52fa0d9.1512748083.git.mark.kanda@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8738 signatures=668644 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1712080218 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 141.146.126.78 Subject: [Qemu-devel] [PATCH v2 2/2] virtio-blk: reject configs with logical block size > physical block size 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: martin.petersen@oracle.com, konrad.wilk@oracle.com, ameya.more@oracle.com, stefanha@redhat.com, karl.heubaum@oracle.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" virtio-blk logical block size should never be larger than physical block size because it doesn't make sense to have such configurations. QEMU doesn't have a way to effectively express this condition; the best it can do is report the physical block exponent as 0 - indicating the logical block size equals the physical block size. This is identical to commit 3da023b5827543ee4c022986ea2ad9d1274410b2 but applied to virtio-blk (instead of virtio-scsi). Signed-off-by: Mark Kanda Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Ameya More Reviewed-by: Stefan Hajnoczi --- hw/block/virtio-blk.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index fb59f57..36c7608 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -952,6 +952,13 @@ static void virtio_blk_device_realize(DeviceState *dev= , Error **errp) } blkconf_blocksizes(&conf->conf); =20 + if (conf->conf.logical_block_size > + conf->conf.physical_block_size) { + error_setg(errp, + "logical_block_size > physical_block_size not supported= "); + return; + } + virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK, sizeof(struct virtio_blk_config)); =20 --=20 1.8.3.1