Linux-NVDIMM Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Dave Jiang <dave.jiang@intel.com>
Cc: vinod.koul@intel.com, dmaengine@vger.kernel.org,
	linux-nvdimm@lists.01.org
Subject: Re: [PATCH v4 7/8] libnvdimm: Adding blk-mq support to the pmem driver
Date: Fri, 11 Aug 2017 03:57:23 -0700	[thread overview]
Message-ID: <20170811105723.GA25839@infradead.org> (raw)
In-Reply-To: <150212399361.23722.13317531480320953298.stgit@djiang5-desk3.ch.intel.com>

On Mon, Aug 07, 2017 at 09:39:53AM -0700, Dave Jiang wrote:
> Adding blk-mq support to the pmem driver in addition to the direct bio
> support.

Can you explain why this is only done for pmem and not btt and nd_blk?

> 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.

Any way to auto-discovery the right mode?  Also I'd actually much
prefer for this to be a separate driver instead of having two entirely
different I/O paths in the same module.

> +struct pmem_cmd {
> +	struct request *rq;
> +};

There is no point in having private data that just has a struct
request backpointer.  Just pass the request along.

>  
> -static void pmem_release_queue(void *q)
> +static void pmem_release_queue(void *data)
>  {
> -	blk_cleanup_queue(q);
> +	struct pmem_device *pmem = (struct pmem_device *)data;

No need for the cast.

> +static int pmem_handle_cmd(struct pmem_cmd *cmd)

Please merge this into the queue_rq handler.

> +	struct request *req = cmd->rq;
> +	struct request_queue *q = req->q;
> +	struct pmem_device *pmem = q->queuedata;
> +	struct nd_region *nd_region = to_region(pmem);
> +	struct bio_vec bvec;
> +	struct req_iterator iter;
> +	int rc = 0;
> +
> +	if (req->cmd_flags & REQ_FLUSH)
> +		nvdimm_flush(nd_region);

For a blk-mq driver you need to check for REQ_OP_FLUSH, .e.g.

	switch (req_op(req)) {
	case REQ_FLUSH:
		ret = nvdimm_flush(nd_region);
		break;
	case REQ_OP_READ:
		ret = pmem_do_io(req, false);
		break;
	case REQ_OP_WRITE:
		ret = pmem_do_io(req, true);
		if (req->cmd_flags & REQ_FUA)
			nvdimm_flush(nd_region);
		break;
	default:
		ret = BLK_STS_NOTSUPP;
		break;
	}

> +		pmem->tag_set.queue_depth = 64;

Where does this magic number come from?
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2017-08-11 10:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-07 16:39 [PATCH v4 0/8] Adding blk-mq and DMA support to pmem block driver Dave Jiang
2017-08-07 16:39 ` [PATCH v4 1/8] dmaengine: ioatdma: revert 7618d035 to allow sharing of DMA channels Dave Jiang
2017-08-07 16:39 ` [PATCH v4 2/8] dmaengine: change transaction type DMA_SG to DMA_SG_SG Dave Jiang
2017-08-10  2:15   ` Dan Williams
2017-08-10  2:20     ` Dan Williams
2017-08-10 16:22       ` Dave Jiang
2017-08-10 19:05         ` Dan Williams
2017-08-10 19:44           ` Dave Jiang
2017-08-10 20:09             ` Dan Williams
2017-08-07 16:39 ` [PATCH v4 3/8] dmaengine: Add DMA_MEMCPY_SG transaction op Dave Jiang
2017-08-08 13:16   ` Sinan Kaya
2017-08-08 15:58     ` Dave Jiang
2017-08-07 16:39 ` [PATCH v4 4/8] dmaengine: add verification of DMA_MEMSET_SG in dmaengine Dave Jiang
2017-08-10  2:24   ` Dan Williams
2017-08-27 11:16     ` Vinod Koul
2017-08-07 16:39 ` [PATCH v4 5/8] dmaengine: ioatdma: dma_prep_memcpy_sg support Dave Jiang
2017-08-07 16:39 ` [PATCH v4 6/8] dmaengine: add SG support to dmaengine_unmap Dave Jiang
2017-08-10  2:44   ` Dan Williams
2017-08-07 16:39 ` [PATCH v4 7/8] libnvdimm: Adding blk-mq support to the pmem driver Dave Jiang
2017-08-11 10:57   ` Christoph Hellwig [this message]
2017-08-11 17:18     ` Dave Jiang
2017-08-11 17:59     ` Dan Williams
2017-08-07 16:39 ` [PATCH v4 8/8] libnvdimm: add DMA support for pmem blk-mq Dave Jiang
2017-08-11 11:04   ` Christoph Hellwig
2017-08-11 18:01     ` Dave Jiang
2017-08-11 17:54 ` [PATCH v4 0/8] Adding blk-mq and DMA support to pmem block driver Elliott, Robert (Persistent Memory)

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=20170811105723.GA25839@infradead.org \
    --to=hch@infradead.org \
    --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