From: Mike Christie <michael.christie@oracle.com>
To: Stefan Hajnoczi <stefanha@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>
Cc: fam@euphon.net, jasowang@redhat.com, mst@redhat.com,
pbonzini@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] vhost-scsi: Add support for a worker thread per virtqueue
Date: Wed, 15 Nov 2023 10:56:51 -0600 [thread overview]
Message-ID: <04faa337-d0dc-4683-a05f-2dee0dea0eb4@oracle.com> (raw)
In-Reply-To: <20231115125718.GA301867@fedora>
On 11/15/23 6:57 AM, Stefan Hajnoczi wrote:
> On Wed, Nov 15, 2023 at 12:43:02PM +0100, Stefano Garzarella wrote:
>> On Mon, Nov 13, 2023 at 06:36:44PM -0600, Mike Christie wrote:
>>> This adds support for vhost-scsi to be able to create a worker thread
>>> per virtqueue. Right now for vhost-net we get a worker thread per
>>> tx/rx virtqueue pair which scales nicely as we add more virtqueues and
>>> CPUs, but for scsi we get the single worker thread that's shared by all
>>> virtqueues. When trying to send IO to more than 2 virtqueues the single
>>> thread becomes a bottlneck.
>>>
>>> This patch adds a new setting, virtqueue_workers, which can be set to:
>>>
>>> 1: Existing behavior whre we get the single thread.
>>> -1: Create a worker per IO virtqueue.
>>
>> I find this setting a bit odd. What about a boolean instead?
>>
>> `per_virtqueue_workers`:
>> false: Existing behavior whre we get the single thread.
>> true: Create a worker per IO virtqueue.
>
> Me too, I thought there would be round-robin assignment for 1 <
> worker_cnt < (dev->nvqs - VHOST_SCSI_VQ_NUM_FIXED) but instead only 1
> and -1 have any meaning.
>
> Do you want to implement round-robin assignment?
>
It was an int because I originally did round robin but at some point
dropped it. I found that our users at least:
1. Are used to configuring number of virtqueues.
2. In the userspace guest OS are used to checking the queue to CPU
mappings to figure out how their app should optimize itself.
So users would just do a virtqueue per vCPU or if trying to reduce
mem usage would do N virtqueues < vCPUs. For both cases they just did the
worker per virtqueue.
However, I left it an int in case in the future someone wanted
the future.
next prev parent reply other threads:[~2023-11-15 16:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-14 0:36 [PATCH 0/2] vhost-scsi: Support worker ioctls Mike Christie
2023-11-14 0:36 ` [PATCH 1/2] vhost: Add worker backend callouts Mike Christie
2023-11-14 0:36 ` [PATCH 2/2] vhost-scsi: Add support for a worker thread per virtqueue Mike Christie
2023-11-15 11:43 ` Stefano Garzarella
2023-11-15 12:57 ` Stefan Hajnoczi
2023-11-15 16:56 ` Mike Christie [this message]
2023-11-15 17:24 ` Stefan Hajnoczi
2023-11-15 16:48 ` Mike Christie
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=04faa337-d0dc-4683-a05f-2dee0dea0eb4@oracle.com \
--to=michael.christie@oracle.com \
--cc=fam@euphon.net \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--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).