All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
	linux-scsi@vger.kernel.org, Sagi Grimberg <sagi@grimberg.me>,
	Daniel Wagner <dwagner@suse.de>, Wen Xiong <wenxiong@us.ibm.com>,
	John Garry <john.garry@huawei.com>,
	Hannes Reinecke <hare@suse.de>, Keith Busch <kbusch@kernel.org>,
	Damien Le Moal <damien.lemoal@wdc.com>
Subject: Re: [PATCH V3 02/10] blk-mq: Introduce blk_mq_dev_map_queues
Date: Mon, 12 Jul 2021 09:32:33 +0200	[thread overview]
Message-ID: <20210712073233.GB12347@lst.de> (raw)
In-Reply-To: <20210709081005.421340-3-ming.lei@redhat.com>

> +	/*
> +	 * fallback to default mapping if driver doesn't provide
> +	 * get_queue_affinity callback
> +	 */
> +	if (!get_queue_affinity) {
> +		fallback = true;
> +		goto fallback;
> +	}
> +
> +	for (queue = 0; queue < qmap->nr_queues; queue++) {
> +		mask = get_queue_affinity(dev_data, dev_off, queue);
> +		if (!mask)
> +			goto fallback;
> +
> +		for_each_cpu(cpu, mask)
> +			qmap->mq_map[cpu] = qmap->queue_offset + queue;
> +	}
> +
> +	return 0;
> +
> +fallback:
> +	if (!fallback) {
> +		WARN_ON_ONCE(qmap->nr_queues > 1);
> +		blk_mq_clear_mq_map(qmap);
> +		return 0;
> +	}
> +	return blk_mq_map_queues(qmap);

Please remove the NULL get_affinity case and let the callers handle
the fallback.  Also I think it makes sense to leave the !mask fallback
case to the callers as well to simplify the calling conventions.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
	linux-scsi@vger.kernel.org, Sagi Grimberg <sagi@grimberg.me>,
	Daniel Wagner <dwagner@suse.de>, Wen Xiong <wenxiong@us.ibm.com>,
	John Garry <john.garry@huawei.com>,
	Hannes Reinecke <hare@suse.de>, Keith Busch <kbusch@kernel.org>,
	Damien Le Moal <damien.lemoal@wdc.com>
Subject: Re: [PATCH V3 02/10] blk-mq: Introduce blk_mq_dev_map_queues
Date: Mon, 12 Jul 2021 09:32:33 +0200	[thread overview]
Message-ID: <20210712073233.GB12347@lst.de> (raw)
In-Reply-To: <20210709081005.421340-3-ming.lei@redhat.com>

> +	/*
> +	 * fallback to default mapping if driver doesn't provide
> +	 * get_queue_affinity callback
> +	 */
> +	if (!get_queue_affinity) {
> +		fallback = true;
> +		goto fallback;
> +	}
> +
> +	for (queue = 0; queue < qmap->nr_queues; queue++) {
> +		mask = get_queue_affinity(dev_data, dev_off, queue);
> +		if (!mask)
> +			goto fallback;
> +
> +		for_each_cpu(cpu, mask)
> +			qmap->mq_map[cpu] = qmap->queue_offset + queue;
> +	}
> +
> +	return 0;
> +
> +fallback:
> +	if (!fallback) {
> +		WARN_ON_ONCE(qmap->nr_queues > 1);
> +		blk_mq_clear_mq_map(qmap);
> +		return 0;
> +	}
> +	return blk_mq_map_queues(qmap);

Please remove the NULL get_affinity case and let the callers handle
the fallback.  Also I think it makes sense to leave the !mask fallback
case to the callers as well to simplify the calling conventions.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  parent reply	other threads:[~2021-07-12  7:35 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09  8:09 [PATCH V3 0/10] blk-mq: cleanup map queues & fix blk_mq_alloc_request_hctx Ming Lei
2021-07-09  8:09 ` Ming Lei
2021-07-09  8:09 ` [PATCH V3 01/10] blk-mq: rename blk-mq-cpumap.c as blk-mq-map.c Ming Lei
2021-07-09  8:09   ` Ming Lei
2021-07-12  7:28   ` Christoph Hellwig
2021-07-12  7:28     ` Christoph Hellwig
2021-07-09  8:09 ` [PATCH V3 02/10] blk-mq: Introduce blk_mq_dev_map_queues Ming Lei
2021-07-09  8:09   ` Ming Lei
2021-07-09  8:25   ` Daniel Wagner
2021-07-09  8:25     ` Daniel Wagner
2021-07-12  7:32   ` Christoph Hellwig [this message]
2021-07-12  7:32     ` Christoph Hellwig
2021-07-09  8:09 ` [PATCH V3 03/10] blk-mq: pass use managed irq info to blk_mq_dev_map_queues Ming Lei
2021-07-09  8:09   ` Ming Lei
2021-07-12  7:35   ` Christoph Hellwig
2021-07-12  7:35     ` Christoph Hellwig
2021-07-09  8:09 ` [PATCH V3 04/10] scsi: replace blk_mq_pci_map_queues with blk_mq_dev_map_queues Ming Lei
2021-07-09  8:09   ` Ming Lei
2021-07-09 10:58   ` kernel test robot
2021-07-09 10:58     ` kernel test robot
2021-07-09 10:58     ` kernel test robot
2021-07-09 11:30   ` kernel test robot
2021-07-09 11:30     ` kernel test robot
2021-07-09 11:30     ` kernel test robot
2021-07-09 12:05   ` kernel test robot
2021-07-09 12:05     ` kernel test robot
2021-07-09 12:05     ` kernel test robot
2021-07-09  8:10 ` [PATCH V3 05/10] nvme: " Ming Lei
2021-07-09  8:10   ` Ming Lei
2021-07-09  8:10 ` [PATCH V3 06/10] virito: add APIs for retrieving vq affinity Ming Lei
2021-07-09  8:10   ` Ming Lei
2021-07-09  8:10 ` [PATCH V3 07/10] virtio: blk/scsi: replace blk_mq_virtio_map_queues with blk_mq_dev_map_queues Ming Lei
2021-07-09  8:10   ` Ming Lei
2021-07-09  8:10 ` [PATCH V3 08/10] nvme: rdma: replace blk_mq_rdma_map_queues " Ming Lei
2021-07-09  8:10   ` Ming Lei
2021-07-09  8:10 ` [PATCH V3 09/10] blk-mq: remove map queue helpers for pci, rdma and virtio Ming Lei
2021-07-09  8:10   ` Ming Lei
2021-07-09  8:10 ` [PATCH V3 10/10] blk-mq: don't deactivate hctx if managed irq isn't used Ming Lei
2021-07-09  8:10   ` Ming Lei

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=20210712073233.GB12347@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@wdc.com \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=john.garry@huawei.com \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.com \
    --cc=sagi@grimberg.me \
    --cc=wenxiong@us.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.