public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Keith Busch <keith.busch@intel.com>
Cc: "jianchao.wang" <jianchao.w.wang@oracle.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	Ming Lei <ming.lei@redhat.com>
Subject: Re: WARNING: CPU: 2 PID: 207 at drivers/nvme/host/core.c:527 nvme_setup_cmd+0x3d3
Date: Thu, 1 Feb 2018 13:55:34 -0700	[thread overview]
Message-ID: <5585297e-385d-8f8b-06bb-834d655293dc@kernel.dk> (raw)
In-Reply-To: <20180201195212.GD24417@localhost.localdomain>

On 2/1/18 12:52 PM, Keith Busch wrote:
> On Thu, Feb 01, 2018 at 10:58:23AM -0700, Jens Axboe wrote:
>> I was able to reproduce on a test box, pretty trivially in fact:
>>
>> # echo mq-deadline > /sys/block/nvme2n1/queue/scheduler
>> # mkfs.ext4 /dev/nvme2n1
>> # mount /dev/nvme2n1 /data -o discard
>> # dd if=/dev/zero of=/data/10g bs=1M count=10k
>> # sync
>> # rm /data/10g
>> # sync <- triggered
>>
>> Your patch still doesn't work, but mainly because we init the segments
>> to 0 when setting up a discard. The below works for me, and cleans up
>> the merge path a bit, since your patch was missing various adjustments
>> on both the merged and freed request.
> 
> I'm still finding cases not accounted even your patch. I had to use the
> following on top of that, and this pattern looks like it needs to be
> repeated for all schedulers:
> 
> ---
> diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
> index 55c0a745b427..25c14c58385c 100644
> --- a/block/blk-mq-sched.c
> +++ b/block/blk-mq-sched.c
> @@ -259,6 +259,8 @@ bool blk_mq_sched_try_merge(struct request_queue *q, struct bio *bio,
>  		if (!*merged_request)
>  			elv_merged_request(q, rq, ELEVATOR_FRONT_MERGE);
>  		return true;
> +	case ELEVATOR_DISCARD_MERGE:
> +		return bio_attempt_discard_merge(q, rq, bio);

Yes, we need this to enable the bio-to-request merging.

> diff --git a/block/mq-deadline.c b/block/mq-deadline.c
> index c56f211c8440..a0f5752b6858 100644
> --- a/block/mq-deadline.c
> +++ b/block/mq-deadline.c
> @@ -451,7 +451,7 @@ static int dd_request_merge(struct request_queue *q, struct request **rq,
>  
>  		if (elv_bio_merge_ok(__rq, bio)) {
>  			*rq = __rq;
> -			return ELEVATOR_FRONT_MERGE;
> +			return blk_try_merge(__rq, bio);

This isn't needed. We already know it's a front merge at this point,
and it can only be a normal read/write request.

-- 
Jens Axboe

  reply	other threads:[~2018-02-01 20:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30 15:41 WARNING: CPU: 2 PID: 207 at drivers/nvme/host/core.c:527 nvme_setup_cmd+0x3d3 Jens Axboe
2018-01-30 15:57 ` Jens Axboe
2018-01-30 20:30   ` Keith Busch
2018-01-30 20:32     ` Jens Axboe
2018-01-30 20:49       ` Keith Busch
2018-01-30 20:55         ` Jens Axboe
2018-01-31  4:25   ` jianchao.wang
2018-01-31 15:29     ` Jens Axboe
2018-01-31 23:33       ` Keith Busch
2018-02-01  3:03         ` Jens Axboe
2018-02-01  3:03       ` jianchao.wang
2018-02-01  3:07         ` Jens Axboe
2018-02-01  3:33           ` jianchao.wang
2018-02-01  3:35             ` Jens Axboe
2018-02-01  4:56           ` Keith Busch
2018-02-01 15:26             ` Jens Axboe
2018-02-01 17:58               ` Jens Axboe
2018-02-01 18:12                 ` Keith Busch
2018-02-01 19:52                 ` Keith Busch
2018-02-01 20:55                   ` Jens Axboe [this message]
2018-02-01 18:01               ` Keith Busch

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=5585297e-385d-8f8b-06bb-834d655293dc@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=jianchao.w.wang@oracle.com \
    --cc=keith.busch@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=ming.lei@redhat.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