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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 20, 2020 at 08:14:11AM -0800, Bart Van Assche wrote:
> On 2/20/20 2:05 AM, Ming Lei wrote:
> > On Wed, Feb 19, 2020 at 06:44:35PM -0800, Bart Van Assche wrote:
> > > 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.

Actually, I suggested to do the following way:

if (set->nr_maps == 1)
	set->map[HCTX_TYPE_DEFAULT].nr_queues = set->nr_hw_queues;

then people won't be confused wrt. relation between set->nr_hw_queues
and .nr_queues of each mapping.

Thanks, 
Ming




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux