From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: vinod.koul@intel.com, dmaengine@vger.kernel.org,
linux-nvdimm@lists.01.org
Subject: Re: [PATCH v2 4/5] libnvdimm: Adding blk-mq support to the pmem driver
Date: Thu, 3 Aug 2017 14:04:50 -0600 [thread overview]
Message-ID: <20170803200450.GA18341@linux.intel.com> (raw)
In-Reply-To: <150169927933.59677.7382159914302175097.stgit@djiang5-desk3.ch.intel.com>
On Wed, Aug 02, 2017 at 11:41:19AM -0700, Dave Jiang wrote:
> Adding blk-mq support to the pmem driver in addition to the direct bio
> support. This allows for hardware offloading via DMA engines. By default
> the bio method will be enabled. The blk-mq support can be turned on via
> module parameter queue_mode=1.
>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
One small nit with error handling. With that addressed you can add:
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> @@ -303,17 +369,47 @@ static int pmem_attach_disk(struct device *dev,
> return -EBUSY;
> }
>
> - q = blk_alloc_queue_node(GFP_KERNEL, dev_to_node(dev));
> - if (!q)
> - return -ENOMEM;
> + if (queue_mode == PMEM_Q_MQ) {
> + pmem->tag_set.ops = &pmem_mq_ops;
> + pmem->tag_set.nr_hw_queues = nr_online_nodes;
> + pmem->tag_set.queue_depth = 64;
> + pmem->tag_set.numa_node = dev_to_node(dev);
> + pmem->tag_set.cmd_size = sizeof(struct pmem_cmd);
> + pmem->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
> + pmem->tag_set.driver_data = pmem;
> +
> + rc = blk_mq_alloc_tag_set(&pmem->tag_set);
> + if (rc < 0)
> + return rc;
> +
> + pmem->q = blk_mq_init_queue(&pmem->tag_set);
> + if (IS_ERR(pmem->q)) {
> + blk_mq_free_tag_set(&pmem->tag_set);
> + return -ENOMEM;
> + }
>
> - if (devm_add_action_or_reset(dev, pmem_release_queue, q))
> - return -ENOMEM;
> + if (devm_add_action_or_reset(dev, pmem_release_queue, pmem)) {
In the failure case for both this devm_add_action_or_reset() and the one a few
lines down in the PMEM_Q_BIO case, I think you should manually call
pmem_release_queue() instead of calling blk_mq_free_tag_set(). This will free
the tag set and it will clean up the queue you just set up with
blk_mq_init_queue() or blk_alloc_queue_node().
> + blk_mq_free_tag_set(&pmem->tag_set);
> + return -ENOMEM;
> + }
> + } else if (queue_mode == PMEM_Q_BIO) {
> + pmem->q = blk_alloc_queue_node(GFP_KERNEL, dev_to_node(dev));
> + if (!pmem->q)
> + return -ENOMEM;
> +
> + if (devm_add_action_or_reset(dev, pmem_release_queue, pmem))
The 2nd case. This one was like this in the previous code, but should be
fixed unless I'm missing something.
> + return -ENOMEM;
> +
> + blk_queue_make_request(pmem->q, pmem_make_request);
> + } else {
> + dev_warn(dev, "Invalid queue mode: %d\n", queue_mode);
> + return -EINVAL;
> + }
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
next prev parent reply other threads:[~2017-08-03 20:02 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-02 18:40 [PATCH v2 0/5] Adding blk-mq and DMA support to pmem block driver Dave Jiang
2017-08-02 18:41 ` [PATCH v2 1/5] dmaengine: ioatdma: revert 7618d035 to allow sharing of DMA channels Dave Jiang
2017-08-02 18:41 ` [PATCH v2 2/5] dmaengine: ioatdma: dma_prep_memcpy_sg support Dave Jiang
2017-08-02 18:41 ` [PATCH v2 3/5] dmaengine: add SG support to dmaengine_unmap Dave Jiang
2017-08-02 18:41 ` [PATCH v2 4/5] libnvdimm: Adding blk-mq support to the pmem driver Dave Jiang
2017-08-03 20:04 ` Ross Zwisler [this message]
2017-08-02 18:41 ` [PATCH v2 5/5] libnvdimm: add DMA support for pmem blk-mq Dave Jiang
2017-08-02 19:22 ` Sinan Kaya
2017-08-02 20:52 ` Dave Jiang
2017-08-02 21:10 ` Sinan Kaya
2017-08-02 21:13 ` Dave Jiang
2017-08-03 5:01 ` Vinod Koul
2017-08-03 5:11 ` Jiang, Dave
2017-08-03 5:28 ` Vinod Koul
2017-08-03 5:36 ` Jiang, Dave
2017-08-03 8:59 ` Vinod Koul
2017-08-03 14:36 ` Jiang, Dave
2017-08-03 15:55 ` Vinod Koul
2017-08-03 16:14 ` Dan Williams
2017-08-03 17:07 ` Dave Jiang
2017-08-03 18:35 ` Allen Hubbe
2017-08-16 16:50 ` Vinod Koul
2017-08-16 17:06 ` Dan Williams
2017-08-16 17:16 ` Dave Jiang
2017-08-16 17:20 ` Dan Williams
2017-08-16 17:27 ` Dave Jiang
2017-08-18 5:35 ` Vinod Koul
2017-08-03 20:20 ` Ross Zwisler
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=20170803200450.GA18341@linux.intel.com \
--to=ross.zwisler@linux.intel.com \
--cc=dave.jiang@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=vinod.koul@intel.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