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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 (!req->timeout)
>                req->timeout = q->rq_timeout;
>        if (!blk_mq_rq_set_deadline(req, jiffies + req->timeout, old, new))
>                WARN_ON_ONCE(true);
> 
>        trace_printk("jiffies %lx to %x ldl %lx gen %u dl %x\n",
>                        jiffies,
>                        req->timeout,
>                        blk_rq_deadline(req),
>                        req->das.generation,
>                        req->das.deadline);
>  
>        return __blk_add_timer(req);
>  }
> 
> And get log below:
> 
>      jbd2/sda2-8-320   [000] ...1    95.030824: blk_mq_add_timer: jiffies ffff37c0 to 1d4c ldl ffff550c40000000 gen 0 dl ffff550c
>     kworker/0:1H-136   [000] ...1    95.031822: blk_mq_add_timer: jiffies ffff37c0 to 1d4c ldl ffff550c40000000 gen 0 dl ffff550c
>     kworker/6:1H-244   [006] ...1    95.041695: blk_mq_add_timer: jiffies ffff37c3 to 1d4c ldl ffff550f40000000 gen 0 dl ffff550f
>     kworker/6:1H-244   [006] ...1    95.041954: blk_mq_add_timer: jiffies ffff37c3 to 1d4c ldl ffff550f40000000 gen 0 dl ffff550f
> 
> The blk_rq_deadline return ffff550c40000000 which looks really crazy.

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 field is correct:
0xffff550c - 0xffff37c0 = 7500 = 30 * 250. Does that mean that HZ = 250 on the system
on which you ran this test?

> And generation never change. 

That's a good catch. The code for incrementing the generation number occurs in
blk_mq_change_rq_state() but is missing from blk_mq_rq_set_deadline(). I will fix this.

Bart.






[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux