Thread (13 messages) 13 messages, 2 authors, 2020-02-21

Re: [PATCH v2 2/8] blk-mq: Keep set->nr_hw_queues and set->map[].nr_queues in sync

From: Bart Van Assche <bvanassche@acm.org>
Date: 2020-02-20 16:14:15

On 2/20/20 2:05 AM, Ming Lei wrote:
On Wed, Feb 19, 2020 at 06:44:35PM -0800, Bart Van Assche wrote:
quoted
blk_mq_map_queues() and multiple .map_queues() implementations expect that
set->map[HCTX_TYPE_DEFAULT].nr_queues is set to the number of hardware
Only single queue mapping expects set->map[HCTX_TYPE_DEFAULT].nr_queues
to be set->nr_hw_queues. For multiple mapping, set->nr_hw_queues should
be sum of each mapping's nr_queue.
That's how it should work but that doesn't match what I found in the 
kernel tree. Here is an example of a .map_queues() implementation that 
depends on .nr_queues being set before it is called:

static int scsi_map_queues(struct blk_mq_tag_set *set)
{
	struct Scsi_Host *shost = container_of(set, struct Scsi_Host,
					       tag_set);

	if (shost->hostt->map_queues)
		return shost->hostt->map_queues(shost);
	return blk_mq_map_queues(&set->map[HCTX_TYPE_DEFAULT]);
}

If shost->hostt->map_queues == NULL, the above function only works 
correctly if .nr_queues is set before this function is called. 
Additionally, scsi_map_queues() may call e.g. the following function:

static int qla2xxx_map_queues(struct Scsi_Host *shost)
{
	int rc;
	scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata;
	struct blk_mq_queue_map *qmap =
		&shost->tag_set.map[HCTX_TYPE_DEFAULT];

	if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase)
		rc = blk_mq_map_queues(qmap);
	else
		rc = blk_mq_pci_map_queues(qmap, vha->hw->pdev,
			vha->irq_offset);
	return rc;
}

Both blk_mq_map_queues() and blk_mq_pci_map_queues() assume that 
blk_mq_queue_map.nr_queues is set before these functions are called.

Bart.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help