From: "Michal Prívozník" <mprivozn@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Emanuele Giuseppe Esposito" <eesposit@redhat.com>,
qemu-block@nongnu.org, "Eric Blake" <eblake@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [RFC 0/3] virtio-blk: add iothread-vq-mapping parameter
Date: Mon, 6 Feb 2023 15:11:21 +0100 [thread overview]
Message-ID: <8291c176-b868-c0e9-af59-0827c6c46807@redhat.com> (raw)
In-Reply-To: <20230118194732.1258208-1-stefanha@redhat.com>
On 1/18/23 20:47, Stefan Hajnoczi wrote:
> This is a preview of the iothread-vq-mapping parameter that assigns virtqueues
> to IOThreads. The syntax is implemented but multiple IOThreads are not actually
> supported yet. The purpose of this RFC is to reach agreement on the syntax and
> to prepare for libvirt support.
>
> virtio-blk and virtio-scsi devices will need a way to specify the
> mapping between IOThreads and virtqueues. At the moment all virtqueues
> are assigned to a single IOThread or the main loop. This single thread
> can be a CPU bottleneck, so it is necessary to allow finer-grained
> assignment to spread the load.
>
> This series introduces command-line syntax for the new iothread-vq-mapping
> property is as follows:
>
> --device '{"driver":"virtio-blk-pci","iothread-vq-mapping":[{"iothread":"iothread0","vqs":[0,1,2]},...]},...'
>
> IOThreads are specified by name and virtqueues are specified by 0-based
> index.
>
> It will be common to simply assign virtqueues round-robin across a set
> of IOThreads. A convenient syntax that does not require specifying
> individual virtqueue indices is available:
>
> --device '{"driver":"virtio-blk-pci","iothread-vq-mapping":[{"iothread":"iothread0"},{"iothread":"iothread1"},...]},...'
>
> There is no way to reassign virtqueues at runtime and I expect that to be a
> very rare requirement.
>
> Perhaps libvirt only needs to support round-robin because specifying individual
> virtqueues is very specific and probably only useful for low-level performance
> investigation. The libvirt domain XML syntax for this could be:
>
> <driver name='qemu' type='qcow2'>
> <iothreads>
> <iothread id="1"/>
> <iothread id="2"/>
> <iothread id="3"/>
> </iothreads>
> ...
> </driver>
Just for completeness, this how disk XML looks now:
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' queues='4' iothread='1'/>
<source file='/tmp/data.qcow'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
It corresponds to the following cmd line:
-blockdev '{"driver":"file","filename":"/tmp/data.qcow","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-3-format","read-only":false,"driver":"qcow2","file":"libvirt-3-storage"}' \
-device '{"driver":"virtio-blk-pci","iothread":"iothread1","num-queues":4,"bus":"pci.0","addr":"0x3","drive":"libvirt-3-format","id":"virtio-disk0","bootindex":1}' \
We already have @iothread attribute, so inventing an <iothread/>
subelement is a bit misleading, because if users query which disk uses
iothreads, they need to change their XPATH. Currently they can get away
with:
//disk[driver/@iothread]/source/@file
but I guess for backwards compatibility, we can put the first iothread
ID into the attribute, e.g.:
<driver iothread="2">
<iothread>
<iothread id="2"/>
<iothread id="4"/>
</iothread>
</driver>
We've done something similar, when introducing multiple listen addresses
for VNC.
Now, an iothread is actually a thread pool. I guess we will never ever
need to assign individual threads from the pool to queues, right?
Michal
next prev parent reply other threads:[~2023-02-06 14:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 19:47 [RFC 0/3] virtio-blk: add iothread-vq-mapping parameter Stefan Hajnoczi
2023-01-18 19:47 ` [RFC 1/3] qdev-properties: alias all object class properties Stefan Hajnoczi
2023-01-18 19:47 ` [RFC 2/3] qdev: add IOThreadVirtQueueMappingList property type Stefan Hajnoczi
2023-01-18 19:47 ` [RFC 3/3] virtio-blk: add iothread-vq-mapping parameter Stefan Hajnoczi
2023-02-06 14:11 ` Michal Prívozník [this message]
2023-02-06 20:31 ` [RFC 0/3] " Stefan Hajnoczi
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=8291c176-b868-c0e9-af59-0827c6c46807@redhat.com \
--to=mprivozn@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=eesposit@redhat.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).