From: Denis Plotnikov <dplotnikov@virtuozzo.com>
To: qemu-devel@nongnu.org
Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com,
ehabkost@redhat.com, qemu-block@nongnu.org, mst@redhat.com,
stefanha@redhat.com, mreitz@redhat.com, pbonzini@redhat.com,
den@virtuozzo.com
Subject: [PATCH v1 1/4] virtio: introduce VIRTQUEUE_DEFUALT_SIZE instead of hardcoded constants
Date: Wed, 29 Jan 2020 17:06:59 +0300 [thread overview]
Message-ID: <20200129140702.5411-2-dplotnikov@virtuozzo.com> (raw)
In-Reply-To: <20200129140702.5411-1-dplotnikov@virtuozzo.com>
Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
---
hw/block/virtio-blk.c | 6 ++++--
hw/scsi/virtio-scsi.c | 5 +++--
include/hw/virtio/virtio.h | 1 +
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 09f46ed85f..72f935033f 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -914,7 +914,8 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
memset(&blkcfg, 0, sizeof(blkcfg));
virtio_stq_p(vdev, &blkcfg.capacity, capacity);
virtio_stl_p(vdev, &blkcfg.seg_max,
- s->conf.seg_max_adjust ? s->conf.queue_size - 2 : 128 - 2);
+ s->conf.seg_max_adjust ? s->conf.queue_size - 2 :
+ VIRTQUEUE_DEFAULT_SIZE - 2);
virtio_stw_p(vdev, &blkcfg.geometry.cylinders, conf->cyls);
virtio_stl_p(vdev, &blkcfg.blk_size, blk_size);
virtio_stw_p(vdev, &blkcfg.min_io_size, conf->min_io_size / blk_size);
@@ -1272,7 +1273,8 @@ static Property virtio_blk_properties[] = {
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_UINT16("queue-size", VirtIOBlock, conf.queue_size,
+ VIRTQUEUE_DEFAULT_SIZE),
DEFINE_PROP_BOOL("seg-max-adjust", VirtIOBlock, conf.seg_max_adjust, true),
DEFINE_PROP_LINK("iothread", VirtIOBlock, conf.iothread, TYPE_IOTHREAD,
IOThread *),
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 3b61563609..36f66046ae 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -660,7 +660,8 @@ static void virtio_scsi_get_config(VirtIODevice *vdev,
virtio_stl_p(vdev, &scsiconf->num_queues, s->conf.num_queues);
virtio_stl_p(vdev, &scsiconf->seg_max,
- s->conf.seg_max_adjust ? s->conf.virtqueue_size - 2 : 128 - 2);
+ s->conf.seg_max_adjust ? s->conf.virtqueue_size - 2 :
+ VIRTQUEUE_DEFAULT_SIZE - 2);
virtio_stl_p(vdev, &scsiconf->max_sectors, s->conf.max_sectors);
virtio_stl_p(vdev, &scsiconf->cmd_per_lun, s->conf.cmd_per_lun);
virtio_stl_p(vdev, &scsiconf->event_info_size, sizeof(VirtIOSCSIEvent));
@@ -965,7 +966,7 @@ static void virtio_scsi_device_unrealize(DeviceState *dev, Error **errp)
static Property virtio_scsi_properties[] = {
DEFINE_PROP_UINT32("num_queues", VirtIOSCSI, parent_obj.conf.num_queues, 1),
DEFINE_PROP_UINT32("virtqueue_size", VirtIOSCSI,
- parent_obj.conf.virtqueue_size, 128),
+ parent_obj.conf.virtqueue_size, VIRTQUEUE_DEFAULT_SIZE),
DEFINE_PROP_BOOL("seg_max_adjust", VirtIOSCSI,
parent_obj.conf.seg_max_adjust, true),
DEFINE_PROP_UINT32("max_sectors", VirtIOSCSI, parent_obj.conf.max_sectors,
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index b69d517496..a66ea2368b 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -48,6 +48,7 @@ size_t virtio_feature_get_config_size(VirtIOFeature *features,
typedef struct VirtQueue VirtQueue;
#define VIRTQUEUE_MAX_SIZE 1024
+#define VIRTQUEUE_DEFAULT_SIZE 128
typedef struct VirtQueueElement
{
--
2.17.0
next prev parent reply other threads:[~2020-01-29 14:08 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-29 14:06 [PATCH v1 0/4] Increase default virtqueue size to improve performance Denis Plotnikov
2020-01-29 14:06 ` Denis Plotnikov [this message]
2020-01-29 17:02 ` [PATCH v1 1/4] virtio: introduce VIRTQUEUE_DEFUALT_SIZE instead of hardcoded constants Philippe Mathieu-Daudé
2020-01-29 17:55 ` Cornelia Huck
2020-01-30 14:56 ` Stefan Hajnoczi
2020-02-03 12:15 ` Denis Plotnikov
2020-01-30 13:38 ` Michael S. Tsirkin
2020-02-03 12:17 ` Denis Plotnikov
2020-02-03 12:51 ` Michael S. Tsirkin
2020-02-03 12:56 ` Denis Plotnikov
2020-01-29 14:07 ` [PATCH v1 2/4] virtio: increase virtuqueue size for virtio-scsi and virtio-blk Denis Plotnikov
2020-01-30 13:40 ` Michael S. Tsirkin
2020-02-03 12:18 ` Denis Plotnikov
2020-01-30 14:58 ` Stefan Hajnoczi
2020-02-04 9:59 ` Denis Plotnikov
2020-02-05 11:19 ` Stefan Hajnoczi
2020-02-07 8:48 ` Denis Plotnikov
2020-02-07 16:13 ` Stefan Hajnoczi
2020-02-09 7:49 ` Michael S. Tsirkin
2020-02-10 15:34 ` Denis Plotnikov
2020-02-11 10:32 ` Michael S. Tsirkin
2020-02-10 17:06 ` Stefan Hajnoczi
2021-09-08 13:17 ` Stefano Garzarella
2021-09-08 13:22 ` Stefano Garzarella
2021-09-08 15:20 ` Denis Plotnikov
2021-09-09 8:28 ` Stefano Garzarella
2021-09-09 11:26 ` Denis Plotnikov
2020-01-29 14:07 ` [PATCH v1 3/4] tests: add virtuqueue size checking to virtio_seg_max_adjust test Denis Plotnikov
2020-01-30 13:42 ` Michael S. Tsirkin
2020-02-03 12:21 ` Denis Plotnikov
2020-01-29 14:07 ` [PATCH v1 4/4] tests: rename virtio_seg_max_adjust to virtio_check_params Denis Plotnikov
2021-09-08 15:45 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200129140702.5411-2-dplotnikov@virtuozzo.com \
--to=dplotnikov@virtuozzo.com \
--cc=den@virtuozzo.com \
--cc=ehabkost@redhat.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).