From: luferry <luferry@163.com>
To: "Christoph Hellwig" <hch@lst.de>
Cc: "Jens Axboe" <axboe@kernel.dk>,
"Dongli Zhang" <dongli.zhang@oracle.com>,
"Ming Lei" <ming.lei@redhat.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re:Re: [PATCH] make blk_mq_map_queues more friendly for cpu topology
Date: Tue, 26 Mar 2019 15:55:10 +0800 (CST) [thread overview]
Message-ID: <48ca2186.fc76.169b8fef63a.Coremail.luferry@163.com> (raw)
In-Reply-To: <20190326073954.GD21617@lst.de>
At 2019-03-26 15:39:54, "Christoph Hellwig" <hch@lst.de> wrote:
>Why isn't this using the automatic PCI-level affinity assignment to
>start with?
When enable virtio-blk with multi queues but with only 2 msix-vector.
vp_dev->per_vq_vectors will be false, vp_get_vq_affintity will return NULL directly
so blk_mq_virtio_map_queues will fallback to blk_mq_map_queues.
448 const struct cpumask *vp_get_vq_affinity(struct virtio_device *vdev, int index)
449 {
450 struct virtio_pci_device *vp_dev = to_vp_device(vdev);
451
452 if (!vp_dev->per_vq_vectors ||
453 vp_dev->vqs[index]->msix_vector == VIRTIO_MSI_NO_VECTOR)
454 return NULL;
455
456 return pci_irq_get_affinity(vp_dev->pci_dev,
457 vp_dev->vqs[index]->msix_vector);
458 }
32 int blk_mq_virtio_map_queues(struct blk_mq_queue_map *qmap,
33 struct virtio_device *vdev, int first_vec)
34 {
35 const struct cpumask *mask;
36 unsigned int queue, cpu;
37
38 if (!vdev->config->get_vq_affinity)
39 goto fallback;
40
41 for (queue = 0; queue < qmap->nr_queues; queue++) {
42 mask = vdev->config->get_vq_affinity(vdev, first_vec + queue); //vp_get_vq_affinity return NULL
43 if (!mask)
44 goto fallback;
45
46 for_each_cpu(cpu, mask)
47 qmap->mq_map[cpu] = qmap->queue_offset + queue;
48 }
49
50 return 0;
51 fallback:
52 return blk_mq_map_queues(qmap);
53 }
here is previous discussion
https://patchwork.kernel.org/patch/10865461/
next prev parent reply other threads:[~2019-03-26 8:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-25 15:26 [PATCH] make blk_mq_map_queues more friendly for cpu topology luferry
2019-03-26 7:39 ` Christoph Hellwig
2019-03-26 7:55 ` luferry [this message]
2019-03-27 8:16 ` Christoph Hellwig
2019-03-27 9:17 ` luferry
2019-03-27 9:39 ` Dongli Zhang
2019-03-27 9:53 ` luferry
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=48ca2186.fc76.169b8fef63a.Coremail.luferry@163.com \
--to=luferry@163.com \
--cc=axboe@kernel.dk \
--cc=dongli.zhang@oracle.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@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