linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: linux-block@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Cong Wang <cong.wang@bytedance.com>, Jens Axboe <axboe@kernel.dk>,
	Fam Zheng <fam.zheng@bytedance.com>,
	Xiongchun Duan <duanxiongchun@bytedance.com>
Subject: Re: [Patch] blk-wbt: fix a divide-by-zero error in rwb_arm_timer()
Date: Tue, 20 Apr 2021 12:53:00 -0700	[thread overview]
Message-ID: <CAM_iQpVsAhsG_SLDSgTkZ0RjvCzhu2d5Nt5SQ=NoVa0UYYMoug@mail.gmail.com> (raw)
In-Reply-To: <20210418044101.26730-1-xiyou.wangcong@gmail.com>

On Sat, Apr 17, 2021 at 9:41 PM Cong Wang <xiyou.wangcong@gmail.com> wrote:
>
> From: Cong Wang <cong.wang@bytedance.com>
>
> We hit a divide error in rwb_arm_timer() and crash dump shows
> rqd->scale_step is 16777215 (0xffffff in hex), so the expression
> "(rqd->scale_step + 1) << 8)" is 0x100000000, which is just beyond
> 32-bit integer range, hence it is truncated to 0 and int_sqrt(0)
> returns 0 too, so we end up passing 0 as a divisor to div_u64().
>

Never mind. rqd->scale_step should be capped by
rq_depth_scale_down(), so should never be so large. In the old
calc_wb_limits() implementation, rwb->wb_max was set to zero
accidentally.

Thanks.

      reply	other threads:[~2021-04-20 19:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18  4:41 [Patch] blk-wbt: fix a divide-by-zero error in rwb_arm_timer() Cong Wang
2021-04-20 19:53 ` Cong Wang [this message]

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='CAM_iQpVsAhsG_SLDSgTkZ0RjvCzhu2d5Nt5SQ=NoVa0UYYMoug@mail.gmail.com' \
    --to=xiyou.wangcong@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=cong.wang@bytedance.com \
    --cc=duanxiongchun@bytedance.com \
    --cc=fam.zheng@bytedance.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).