From: Dongli Zhang <dongli.zhang@oracle.com>
To: linux-scsi@vger.kernel.org,
virtualization@lists.linux-foundation.org,
linux-block@vger.kernel.org
Cc: mst@redhat.com, jasowang@redhat.com, axboe@kernel.dk,
jejb@linux.ibm.com, martin.petersen@oracle.com,
cohuck@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] scsi: virtio_scsi: limit number of hw queues by nr_cpu_ids
Date: Wed, 27 Mar 2019 18:36:35 +0800 [thread overview]
Message-ID: <1553682995-5682-3-git-send-email-dongli.zhang@oracle.com> (raw)
In-Reply-To: <1553682995-5682-1-git-send-email-dongli.zhang@oracle.com>
When tag_set->nr_maps is 1, the block layer limits the number of hw queues
by nr_cpu_ids. No matter how many hw queues are used by virtio-scsi, as it
has (tag_set->nr_maps == 1), it can use at most nr_cpu_ids hw queues.
In addition, specifically for pci scenario, when the 'num_queues' specified
by qemu is more than maxcpus, virtio-scsi would not be able to allocate
more than maxcpus vectors in order to have a vector for each queue. As a
result, it falls back into MSI-X with one vector for config and one shared
for queues.
Considering above reasons, this patch limits the number of hw queues used
by virtio-scsi by nr_cpu_ids.
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
drivers/scsi/virtio_scsi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 8af0177..9c4a3e1 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -793,6 +793,7 @@ static int virtscsi_probe(struct virtio_device *vdev)
/* We need to know how many queues before we allocate. */
num_queues = virtscsi_config_get(vdev, num_queues) ? : 1;
+ num_queues = min_t(unsigned int, nr_cpu_ids, num_queues);
num_targets = virtscsi_config_get(vdev, max_target) + 1;
--
2.7.4
next prev parent reply other threads:[~2019-03-27 10:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-27 10:36 [PATCH 0/2] Limit number of hw queues by nr_cpu_ids for virtio-blk and virtio-scsi Dongli Zhang
2019-03-27 10:36 ` [PATCH 1/2] virtio-blk: limit number of hw queues by nr_cpu_ids Dongli Zhang
2019-04-10 13:12 ` Stefan Hajnoczi
2019-03-27 10:36 ` Dongli Zhang [this message]
2019-04-10 13:12 ` [PATCH 2/2] scsi: virtio_scsi: " Stefan Hajnoczi
2019-04-08 13:57 ` [PATCH 0/2] Limit number of hw queues by nr_cpu_ids for virtio-blk and virtio-scsi Dongli Zhang
2019-04-10 14:18 ` Jens Axboe
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=1553682995-5682-3-git-send-email-dongli.zhang@oracle.com \
--to=dongli.zhang@oracle.com \
--cc=axboe@kernel.dk \
--cc=cohuck@redhat.com \
--cc=jasowang@redhat.com \
--cc=jejb@linux.ibm.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/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
all inboxes | Powered by JetHome®