All of lore.kernel.org
 help / color / mirror / Atom feed
From: axboe@fb.com (Jens Axboe)
Subject: [PATCH v9] NVMe: Convert to blk-mq
Date: Tue, 24 Jun 2014 19:38:21 -0600	[thread overview]
Message-ID: <53AA280D.2030103@fb.com> (raw)
In-Reply-To: <1403651531-24891-2-git-send-email-m@bjorling.me>

On 2014-06-24 17:12, Matias Bj?rling wrote:
> +static int nvme_admin_init_request(void *data, struct request *req,
> +				unsigned int hctx_idx, unsigned int rq_idx,
> +				unsigned int numa_node)
>   {
> -	return DIV_ROUND_UP(depth, 8) + (depth * sizeof(struct nvme_cmd_info));
> +	struct nvme_dev *dev = data;
> +	struct nvme_cmd_info *cmd = blk_mq_rq_to_pdu(req);
> +	struct nvme_queue *nvmeq = dev->queues[0];
> +
> +	WARN_ON(!nvmeq);
> +	WARN_ON(!cmd);
> +	cmd->nvmeq = nvmeq;
> +	return 0;

Get rid of the WARN_ON(!cmd) - if that should trigger, we'll see the 
obvious oops right after.

> +static int nvme_init_request(void *data, struct request *req,
> +				unsigned int hctx_idx, unsigned int rq_idx,
> +				unsigned int numa_node)
> +{
> +	struct nvme_dev *dev = data;
> +	struct nvme_cmd_info *cmd = blk_mq_rq_to_pdu(req);
> +	struct nvme_queue *nvmeq = dev->queues[hctx_idx + 1];
> +
> +	WARN_ON(!nvmeq);
> +	WARN_ON(!cmd);
> +	cmd->nvmeq = nvmeq;
> +	return 0;

Ditto

> +/* Admin queue isn't initialized as a request queue. If at some point this
> + * happens anyway, make sure to notify the user */
> +static int nvme_admin_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req)
>   {
> -	struct nvme_ns *ns = q->queuedata;
> -	struct nvme_queue *nvmeq = get_nvmeq(ns->dev);
> -	int result = -EBUSY;
> -
> -	if (!nvmeq) {
> -		bio_endio(bio, -EIO);
> -		return;
> -	}
> -
> -	spin_lock_irq(&nvmeq->q_lock);
> -	if (!nvmeq->q_suspended && bio_list_empty(&nvmeq->sq_cong))
> -		result = nvme_submit_bio_queue(nvmeq, ns, bio);
> -	if (unlikely(result)) {
> -		if (!waitqueue_active(&nvmeq->sq_full))
> -			add_wait_queue(&nvmeq->sq_full, &nvmeq->sq_cong_wait);
> -		bio_list_add(&nvmeq->sq_cong, bio);
> -	}
> -
> -	nvme_process_cq(nvmeq);
> -	spin_unlock_irq(&nvmeq->q_lock);
> -	put_nvmeq(nvmeq);
> +	WARN_ON(1);
> +	return BLK_MQ_RQ_QUEUE_ERROR;

That should be a WARN_ON_ONCE(1). In case it does trigger, you don't 
want to see it tons of times, once is enough.

-- 
Jens Axboe

WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <axboe@fb.com>
To: "Matias Bjørling" <m@bjorling.me>,
	willy@linux.intel.com, keith.busch@intel.com,
	sbradshaw@micron.com, linux-kernel@vger.kernel.org,
	linux-nvme@lists.infradead.org, hch@infradead.org,
	rlnelson@google.com, tom.leiming@gmail.com
Subject: Re: [PATCH v9] NVMe: Convert to blk-mq
Date: Tue, 24 Jun 2014 19:38:21 -0600	[thread overview]
Message-ID: <53AA280D.2030103@fb.com> (raw)
In-Reply-To: <1403651531-24891-2-git-send-email-m@bjorling.me>

On 2014-06-24 17:12, Matias Bjørling wrote:
> +static int nvme_admin_init_request(void *data, struct request *req,
> +				unsigned int hctx_idx, unsigned int rq_idx,
> +				unsigned int numa_node)
>   {
> -	return DIV_ROUND_UP(depth, 8) + (depth * sizeof(struct nvme_cmd_info));
> +	struct nvme_dev *dev = data;
> +	struct nvme_cmd_info *cmd = blk_mq_rq_to_pdu(req);
> +	struct nvme_queue *nvmeq = dev->queues[0];
> +
> +	WARN_ON(!nvmeq);
> +	WARN_ON(!cmd);
> +	cmd->nvmeq = nvmeq;
> +	return 0;

Get rid of the WARN_ON(!cmd) - if that should trigger, we'll see the 
obvious oops right after.

> +static int nvme_init_request(void *data, struct request *req,
> +				unsigned int hctx_idx, unsigned int rq_idx,
> +				unsigned int numa_node)
> +{
> +	struct nvme_dev *dev = data;
> +	struct nvme_cmd_info *cmd = blk_mq_rq_to_pdu(req);
> +	struct nvme_queue *nvmeq = dev->queues[hctx_idx + 1];
> +
> +	WARN_ON(!nvmeq);
> +	WARN_ON(!cmd);
> +	cmd->nvmeq = nvmeq;
> +	return 0;

Ditto

> +/* Admin queue isn't initialized as a request queue. If at some point this
> + * happens anyway, make sure to notify the user */
> +static int nvme_admin_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req)
>   {
> -	struct nvme_ns *ns = q->queuedata;
> -	struct nvme_queue *nvmeq = get_nvmeq(ns->dev);
> -	int result = -EBUSY;
> -
> -	if (!nvmeq) {
> -		bio_endio(bio, -EIO);
> -		return;
> -	}
> -
> -	spin_lock_irq(&nvmeq->q_lock);
> -	if (!nvmeq->q_suspended && bio_list_empty(&nvmeq->sq_cong))
> -		result = nvme_submit_bio_queue(nvmeq, ns, bio);
> -	if (unlikely(result)) {
> -		if (!waitqueue_active(&nvmeq->sq_full))
> -			add_wait_queue(&nvmeq->sq_full, &nvmeq->sq_cong_wait);
> -		bio_list_add(&nvmeq->sq_cong, bio);
> -	}
> -
> -	nvme_process_cq(nvmeq);
> -	spin_unlock_irq(&nvmeq->q_lock);
> -	put_nvmeq(nvmeq);
> +	WARN_ON(1);
> +	return BLK_MQ_RQ_QUEUE_ERROR;

That should be a WARN_ON_ONCE(1). In case it does trigger, you don't 
want to see it tons of times, once is enough.

-- 
Jens Axboe


  reply	other threads:[~2014-06-25  1:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24 23:12 [PATCH v9] Convert NVMe driver to blk-mq Matias Bjørling
2014-06-24 23:12 ` Matias Bjørling
2014-06-24 23:12 ` [PATCH v9] NVMe: Convert " Matias Bjørling
2014-06-24 23:12   ` Matias Bjørling
2014-06-25  1:38   ` Jens Axboe [this message]
2014-06-25  1:38     ` Jens Axboe
2014-06-25  1:51   ` Ming Lei
2014-06-25  1:51     ` Ming Lei
2014-06-25 11:37   ` Christoph Hellwig
2014-06-25 11:37     ` Christoph Hellwig
2014-06-25 18:56     ` Matias Bjørling
2014-06-25 18:56       ` Matias Bjørling
2014-06-26  7:40       ` Christoph Hellwig
2014-06-26  7:40         ` Christoph Hellwig
2014-06-26  9:21         ` Matias Bjørling
2014-06-26  9:21           ` Matias Bjørling

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=53AA280D.2030103@fb.com \
    --to=axboe@fb.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.