Re: [PATCH] blk-mq: Rework blk-mq timeout handling again

2018-05-14 Thread Bart Van Assche
On Mon, 2018-05-14 at 13:15 +0800, jianchao.wang wrote: > a 32bit deadline is indeed OK to judge whether a request is timeout or not. > but how is the expires value determined for __blk_add_timer -> mod_timer ? > as we know, when a request is started, we need to arm a timer for it. > the expires

Re: [PATCH] blk-mq: Rework blk-mq timeout handling again

2018-05-13 Thread jianchao.wang
Hi Bart On 05/14/2018 12:03 PM, Bart Van Assche wrote: > On Mon, 2018-05-14 at 09:37 +0800, jianchao.wang wrote: >> In addition, on a 64bit system, how do you set up the timer with a 32bit >> deadline ? > > If timeout handling occurs less than (1 << 31) / HZ seconds after a request > has been

Re: [PATCH] blk-mq: Rework blk-mq timeout handling again

2018-05-13 Thread Bart Van Assche
On Mon, 2018-05-14 at 09:37 +0800, jianchao.wang wrote: > In addition, on a 64bit system, how do you set up the timer with a 32bit > deadline ? If timeout handling occurs less than (1 << 31) / HZ seconds after a request has been submitted then a 32-bit variable is sufficient to store the

Re: [PATCH] blk-mq: Rework blk-mq timeout handling again

2018-05-13 Thread jianchao.wang
Hi Bart On 05/11/2018 11:26 PM, Bart Van Assche wrote: > The bug is in the above trace_printk() call: blk_rq_deadline() must only be > used > for the legacy block layer and not for blk-mq code. If you have a look at the > value > of the das.deadline field then one can see that the value of that

Re: [PATCH] blk-mq: Rework blk-mq timeout handling again

2018-05-13 Thread jianchao.wang
Hi bart On 05/11/2018 11:29 PM, Bart Van Assche wrote: > On Fri, 2018-05-11 at 14:35 +0200, Christoph Hellwig wrote: >>> It should be due to union blk_deadline_and_state. >>> +union blk_deadline_and_state { >>> + struct { >>> + uint32_t generation:30; >>> + uint32_t

Re: [PATCH] blk-mq: Rework blk-mq timeout handling again

2018-05-11 Thread Bart Van Assche
On Fri, 2018-05-11 at 14:35 +0200, Christoph Hellwig wrote: > > It should be due to union blk_deadline_and_state. > > +union blk_deadline_and_state { > > + struct { > > + uint32_t generation:30; > > + uint32_t state:2; > > + uint32_t deadline; > > + }; > > +

Re: [PATCH] blk-mq: Rework blk-mq timeout handling again

2018-05-11 Thread Bart Van Assche
On Fri, 2018-05-11 at 20:06 +0800, jianchao.wang wrote: > Hi bart > > I add debug log in blk_mq_add_timer as following > > void blk_mq_add_timer(struct request *req, enum mq_rq_state old, > enum mq_rq_state new) > { >struct request_queue *q = req->q; > >if

Re: [PATCH] blk-mq: Rework blk-mq timeout handling again

2018-05-11 Thread Christoph Hellwig
> It should be due to union blk_deadline_and_state. > +union blk_deadline_and_state { > + struct { > + uint32_t generation:30; > + uint32_t state:2; > + uint32_t deadline; > + }; > + unsigned long legacy_deadline; > + uint64_t das; > +}; Yikes.

Re: [PATCH] blk-mq: Rework blk-mq timeout handling again

2018-05-11 Thread jianchao.wang
Hi bart I add debug log in blk_mq_add_timer as following void blk_mq_add_timer(struct request *req, enum mq_rq_state old, enum mq_rq_state new) { struct request_queue *q = req->q; if (!req->timeout) req->timeout = q->rq_timeout; if

[PATCH] blk-mq: Rework blk-mq timeout handling again

2018-05-10 Thread Bart Van Assche
Recently the blk-mq timeout handling code was reworked. See also Tejun Heo, "[PATCHSET v4] blk-mq: reimplement timeout handling", 08 Jan 2018 (https://www.mail-archive.com/linux-block@vger.kernel.org/msg16985.html). This patch reworks the blk-mq timeout handling code again. The timeout handling