All of lore.kernel.org
 help / color / mirror / Atom feed
From: "jianchao.wang" <jianchao.w.wang@oracle.com>
To: Bart Van Assche <Bart.VanAssche@wdc.com>,
	"keith.busch@linux.intel.com" <keith.busch@linux.intel.com>
Cc: "hch@lst.de" <hch@lst.de>,
	"keith.busch@intel.com" <keith.busch@intel.com>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"ming.lei@redhat.com" <ming.lei@redhat.com>
Subject: Re: [RFC PATCH 3/3] blk-mq: Remove generation seqeunce
Date: Fri, 13 Jul 2018 10:40:16 +0800	[thread overview]
Message-ID: <d19bebcd-8a60-fcbc-ddf5-1dcf1fe553ca@oracle.com> (raw)
In-Reply-To: <7cad25b821c3a640e036f28ff1bbe51e7362d25d.camel@wdc.com>


On 07/13/2018 06:24 AM, Bart Van Assche wrote:
> Hello Keith,
> 
> Before commit 12f5b9314545 ("blk-mq: Remove generation seqeunce"), if a
> request completion was reported after request timeout processing had
> started, completion handling was skipped. The following code in
> blk_mq_complete_request() realized that:
> 
> 	if (blk_mq_rq_aborted_gstate(rq) != rq->gstate)
> 		__blk_mq_complete_request(rq);

Even if before tejun's patch, we also have this for both blk-mq and blk-legacy code.

blk_rq_check_expired

    if (time_after_eq(jiffies, rq->deadline)) {
        list_del_init(&rq->timeout_list);

        /*
         * Check if we raced with end io completion
         */
        if (!blk_mark_rq_complete(rq))
            blk_rq_timed_out(rq);
    } 
 

blk_complete_request
    
    if (!blk_mark_rq_complete(req))
        __blk_complete_request(req);

blk_mq_check_expired
    
    if (time_after_eq(jiffies, rq->deadline)) {
        if (!blk_mark_rq_complete(rq))
            blk_mq_rq_timed_out(rq, reserved);
    }


blk_mq_complete_request

    if (!blk_mark_rq_complete(rq))
        __blk_mq_complete_request(rq);

Thanks
Jianchao

> 
> Since commit 12f5b9314545, if a completion occurs after request timeout
> processing has started, that completion is processed if the request has the
> state MQ_RQ_IN_FLIGHT. blk_mq_rq_timed_out() does not modify the request
> state unless the block driver timeout handler modifies it, e.g. by calling
> blk_mq_end_request() or by calling blk_mq_requeue_request(). The typical
> behavior of scsi_times_out() is to queue sending of a SCSI abort and hence
> not to change the request state immediately. In other words, if a request
> completion occurs during or shortly after a timeout occurred then
> blk_mq_complete_request() will call __blk_mq_complete_request() and will
> complete the request, although that is not allowed because timeout handling
> has already started. Do you agree with this analysis?

WARNING: multiple messages have this Message-ID (diff)
From: jianchao.w.wang@oracle.com (jianchao.wang)
Subject: [RFC PATCH 3/3] blk-mq: Remove generation seqeunce
Date: Fri, 13 Jul 2018 10:40:16 +0800	[thread overview]
Message-ID: <d19bebcd-8a60-fcbc-ddf5-1dcf1fe553ca@oracle.com> (raw)
In-Reply-To: <7cad25b821c3a640e036f28ff1bbe51e7362d25d.camel@wdc.com>


On 07/13/2018 06:24 AM, Bart Van Assche wrote:
> Hello Keith,
> 
> Before commit 12f5b9314545 ("blk-mq: Remove generation seqeunce"), if a
> request completion was reported after request timeout processing had
> started, completion handling was skipped. The following code in
> blk_mq_complete_request() realized that:
> 
> 	if (blk_mq_rq_aborted_gstate(rq) != rq->gstate)
> 		__blk_mq_complete_request(rq);

Even if before tejun's patch, we also have this for both blk-mq and blk-legacy code.

blk_rq_check_expired

    if (time_after_eq(jiffies, rq->deadline)) {
        list_del_init(&rq->timeout_list);

        /*
         * Check if we raced with end io completion
         */
        if (!blk_mark_rq_complete(rq))
            blk_rq_timed_out(rq);
    } 
 

blk_complete_request
    
    if (!blk_mark_rq_complete(req))
        __blk_complete_request(req);

blk_mq_check_expired
    
    if (time_after_eq(jiffies, rq->deadline)) {
        if (!blk_mark_rq_complete(rq))
            blk_mq_rq_timed_out(rq, reserved);
    }


blk_mq_complete_request

    if (!blk_mark_rq_complete(rq))
        __blk_mq_complete_request(rq);

Thanks
Jianchao

> 
> Since commit 12f5b9314545, if a completion occurs after request timeout
> processing has started, that completion is processed if the request has the
> state MQ_RQ_IN_FLIGHT. blk_mq_rq_timed_out() does not modify the request
> state unless the block driver timeout handler modifies it, e.g. by calling
> blk_mq_end_request() or by calling blk_mq_requeue_request(). The typical
> behavior of scsi_times_out() is to queue sending of a SCSI abort and hence
> not to change the request state immediately. In other words, if a request
> completion occurs during or shortly after a timeout occurred then
> blk_mq_complete_request() will call __blk_mq_complete_request() and will
> complete the request, although that is not allowed because timeout handling
> has already started. Do you agree with this analysis?

  parent reply	other threads:[~2018-07-13  2:40 UTC|newest]

Thread overview: 128+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21 23:11 [RFC PATCH 0/3] blk-mq: Timeout rework Keith Busch
2018-05-21 23:11 ` Keith Busch
2018-05-21 23:11 ` [RFC PATCH 1/3] blk-mq: Reference count request usage Keith Busch
2018-05-21 23:11   ` Keith Busch
2018-05-22  2:27   ` Ming Lei
2018-05-22  2:27     ` Ming Lei
2018-05-22 15:19   ` Christoph Hellwig
2018-05-22 15:19     ` Christoph Hellwig
2018-05-21 23:11 ` [RFC PATCH 2/3] blk-mq: Fix timeout and state order Keith Busch
2018-05-21 23:11   ` Keith Busch
2018-05-22  2:28   ` Ming Lei
2018-05-22  2:28     ` Ming Lei
2018-05-22 15:24   ` Christoph Hellwig
2018-05-22 15:24     ` Christoph Hellwig
2018-05-22 16:27     ` Bart Van Assche
2018-05-22 16:27       ` Bart Van Assche
2018-05-21 23:11 ` [RFC PATCH 3/3] blk-mq: Remove generation seqeunce Keith Busch
2018-05-21 23:11   ` Keith Busch
2018-05-21 23:29   ` Bart Van Assche
2018-05-21 23:29     ` Bart Van Assche
2018-05-22 14:15     ` Keith Busch
2018-05-22 14:15       ` Keith Busch
2018-05-22 16:29       ` Bart Van Assche
2018-05-22 16:29         ` Bart Van Assche
2018-05-22 16:34         ` Keith Busch
2018-05-22 16:34           ` Keith Busch
2018-05-22 16:48           ` Bart Van Assche
2018-05-22 16:48             ` Bart Van Assche
2018-05-22  2:49   ` Ming Lei
2018-05-22  2:49     ` Ming Lei
2018-05-22  3:16     ` Jens Axboe
2018-05-22  3:16       ` Jens Axboe
2018-05-22  3:47       ` Ming Lei
2018-05-22  3:47         ` Ming Lei
2018-05-22  3:51         ` Jens Axboe
2018-05-22  3:51           ` Jens Axboe
2018-05-22  8:51           ` Ming Lei
2018-05-22  8:51             ` Ming Lei
2018-05-22 14:35             ` Jens Axboe
2018-05-22 14:35               ` Jens Axboe
2018-05-22 14:20     ` Keith Busch
2018-05-22 14:20       ` Keith Busch
2018-05-22 14:37       ` Ming Lei
2018-05-22 14:37         ` Ming Lei
2018-05-22 14:46         ` Keith Busch
2018-05-22 14:46           ` Keith Busch
2018-05-22 14:57           ` Ming Lei
2018-05-22 14:57             ` Ming Lei
2018-05-22 15:01             ` Keith Busch
2018-05-22 15:01               ` Keith Busch
2018-05-22 15:07               ` Ming Lei
2018-05-22 15:07                 ` Ming Lei
2018-05-22 15:17                 ` Keith Busch
2018-05-22 15:17                   ` Keith Busch
2018-05-22 15:23                   ` Ming Lei
2018-05-22 15:23                     ` Ming Lei
2018-05-22 16:17   ` Christoph Hellwig
2018-05-22 16:17     ` Christoph Hellwig
2018-05-23  0:34     ` Ming Lei
2018-05-23  0:34       ` Ming Lei
2018-05-23 14:35       ` Keith Busch
2018-05-23 14:35         ` Keith Busch
2018-05-24  1:52         ` Ming Lei
2018-05-24  1:52           ` Ming Lei
2018-05-23  5:48     ` Hannes Reinecke
2018-05-23  5:48       ` Hannes Reinecke
2018-07-12 18:16   ` Bart Van Assche
2018-07-12 18:16     ` Bart Van Assche
2018-07-12 19:24     ` Keith Busch
2018-07-12 19:24       ` Keith Busch
2018-07-12 22:24       ` Bart Van Assche
2018-07-12 22:24         ` Bart Van Assche
2018-07-13  1:12         ` jianchao.wang
2018-07-13  1:12           ` jianchao.wang
2018-07-13  2:40         ` jianchao.wang [this message]
2018-07-13  2:40           ` jianchao.wang
2018-07-13 15:43         ` Keith Busch
2018-07-13 15:43           ` Keith Busch
2018-07-13 15:52           ` Bart Van Assche
2018-07-13 15:52             ` Bart Van Assche
2018-07-13 18:47             ` Keith Busch
2018-07-13 18:47               ` Keith Busch
2018-07-13 23:03               ` Bart Van Assche
2018-07-13 23:03                 ` Bart Van Assche
2018-07-13 23:58                 ` Keith Busch
2018-07-13 23:58                   ` Keith Busch
2018-07-18 19:56                   ` hch
2018-07-18 19:56                     ` hch
2018-07-18 20:39                     ` hch
2018-07-18 20:39                       ` hch
2018-07-18 21:05                       ` Bart Van Assche
2018-07-18 21:05                         ` Bart Van Assche
2018-07-18 22:53                       ` Keith Busch
2018-07-18 22:53                         ` Keith Busch
2018-07-18 20:53                     ` Keith Busch
2018-07-18 20:53                       ` Keith Busch
2018-07-18 20:58                       ` Bart Van Assche
2018-07-18 20:58                         ` Bart Van Assche
2018-07-18 21:17                         ` Keith Busch
2018-07-18 21:17                           ` Keith Busch
2018-07-18 21:30                           ` Bart Van Assche
2018-07-18 21:30                             ` Bart Van Assche
2018-07-18 21:33                             ` Keith Busch
2018-07-18 21:33                               ` Keith Busch
2018-07-19 13:19                           ` hch
2018-07-19 13:19                             ` hch
2018-07-19 14:59                             ` Keith Busch
2018-07-19 14:59                               ` Keith Busch
2018-07-19 15:56                               ` Keith Busch
2018-07-19 15:56                                 ` Keith Busch
2018-07-19 16:04                                 ` Bart Van Assche
2018-07-19 16:04                                   ` Bart Van Assche
2018-07-19 16:22                                   ` Keith Busch
2018-07-19 16:22                                     ` Keith Busch
2018-07-19 16:29                                     ` hch
2018-07-19 16:29                                       ` hch
2018-07-19 20:18                                       ` Keith Busch
2018-07-19 20:18                                         ` Keith Busch
2018-07-19 13:22                       ` hch
2018-07-19 13:22                         ` hch
2018-05-21 23:29 ` [RFC PATCH 0/3] blk-mq: Timeout rework Bart Van Assche
2018-05-21 23:29   ` Bart Van Assche
2018-05-22 14:06   ` Keith Busch
2018-05-22 14:06     ` Keith Busch
2018-05-22 16:30     ` Bart Van Assche
2018-05-22 16:30       ` Bart Van Assche
2018-05-22 16:44       ` Keith Busch
2018-05-22 16:44         ` 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=d19bebcd-8a60-fcbc-ddf5-1dcf1fe553ca@oracle.com \
    --to=jianchao.w.wang@oracle.com \
    --cc=Bart.VanAssche@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=keith.busch@intel.com \
    --cc=keith.busch@linux.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 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.