From: John Stultz <johnstul@us.ibm.com>
To: Chen Jie <chenj@lemote.com>
Cc: "Yong Zhang" <yong.zhang0@gmail.com>,
linux-mips@linux-mips.org, LKML <linux-kernel@vger.kernel.org>,
tglx@linutronix.de, yanhua <yanh@lemote.com>,
项宇 <xiangy@lemote.com>, zhangfx <zhangfx@lemote.com>,
孙海勇 <sunhy@lemote.com>
Subject: Re: [MIPS]clocks_calc_mult_shift() may gen a too big mult value
Date: Mon, 31 Oct 2011 09:03:17 -0400 [thread overview]
Message-ID: <1320066197.2266.11.camel@js-netbook> (raw)
In-Reply-To: <CAGXxSxUHGN99hXK8K5k9ayVfMenAWAbWVpqkotix_JyUbPCU+w@mail.gmail.com>
On Mon, 2011-10-31 at 18:48 +0800, Chen Jie wrote:
> Hi,
>
> 2011/10/31 Yong Zhang <yong.zhang0@gmail.com>:
> > On Mon, Oct 31, 2011 at 5:00 PM, Chen Jie <chenj@lemote.com> wrote:
> >> Hi all,
> >>
> >> On MIPS, with maxsec=4, clocks_calc_mult_shift() may generate a very
> >> big mult, which may easily cause timekeeper.mult overflow within
> >> timekeeping jobs.
> >
> > Hmmm, why not use clocksource_register_hz()/clocksource_register_khz()
> > instead? it's more convenient.
>
> Thanks for the suggestion. And sorry for I didn't notice the upstream
> code has already hooked to clocksource_register_hz() in csrc-r4k.c
> (We're using r4000 clock source)
>
> I'm afraid this still doesn't fix my case. Through
> clocksource_register_hz()->__clocksource_register_scale()->__clocksource_updatefreq_scale,
> I got a calculated maxsec = (0xffffffff - (0xffffffff>>5))/250000500 =
> 16 # assume mips_hpt_frequency=250000500
>
> With this maxsec, I got a mult of 0xffffde72, still too big.
Hrmm. Yong Zang is right to suggest clocksource_register_hz(), as the
intention of that code is to try to avoid these sorts of issues.
What is the corresponding shift value you're getting for the value
above?
Could you annotate clocks_calc_mult_shift() a little bit to see where
things might be going wrong?
thanks
-john
next prev parent reply other threads:[~2011-10-31 13:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-31 9:00 [MIPS]clocks_calc_mult_shift() may gen a too big mult value Chen Jie
2011-10-31 9:20 ` Yong Zhang
2011-10-31 10:48 ` Chen Jie
2011-10-31 13:03 ` John Stultz [this message]
2011-10-31 13:59 ` zhangfx
2011-10-31 18:12 ` John Stultz
2011-10-31 18:30 ` David Daney
2011-10-31 19:51 ` John Stultz
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=1320066197.2266.11.camel@js-netbook \
--to=johnstul@us.ibm.com \
--cc=chenj@lemote.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=sunhy@lemote.com \
--cc=tglx@linutronix.de \
--cc=xiangy@lemote.com \
--cc=yanh@lemote.com \
--cc=yong.zhang0@gmail.com \
--cc=zhangfx@lemote.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