linux-mips
[Top] [All Lists]

Re: [MIPS]clocks_calc_mult_shift() may gen a too big mult value

To: Chen Jie <chenj@lemote.com>
Subject: Re: [MIPS]clocks_calc_mult_shift() may gen a too big mult value
From: Yong Zhang <yong.zhang0@gmail.com>
Date: Mon, 31 Oct 2011 17:20:13 +0800
Cc: linux-mips@linux-mips.org, LKML <linux-kernel@vger.kernel.org>, johnstul@us.ibm.com, tglx@linutronix.de, yanhua <yanh@lemote.com>, 项宇 <xiangy@lemote.com>, zhangfx <zhangfx@lemote.com>, 孙海勇 <sunhy@lemote.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=v9awrXCDz0JhwNc5c+IWc/oBmGVvxyxSYcm/Y+LZsLw=; b=rVlfCLrhf0aZCivIK7n2NrXfYLQxXG5S77UdioI7HjNUJ9d7ImupnfcIpYgOwjqF8R 7/dD2AIwEnb6znkYwfNKQeOAt9+O1D00TWWLGGRAqYm/zDJYVS2wKTyIiUaibhIr1ZaP GKf08HVZ3QqZzGEkrDB6gmKRL07uPjYUGRMoo=
In-reply-to: <CAGXxSxXmgzxN361Cko1fY_+oWwfgjXLhS61gtvqB8YYXHXZVyw@mail.gmail.com>
References: <CAGXxSxXmgzxN361Cko1fY_+oWwfgjXLhS61gtvqB8YYXHXZVyw@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org
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,
Yong

>
> e.g. when clock freq was 250000500(i.e. mips_hpt_frequency=250000500,
> and the CPU Freq will be 250000500*2=500001000), mult will be
> 0xffffde72
>
> Attachment is a script that calculates mult values for CPU Freq
> between 400050000 and 500050000, with 1KHz step. It outputs mult
> values greater than 0xf0000000:
> CPU Freq:500001000, mult:0xffffde72, shift:30
> CPU Freq:500002000, mult:0xffffbce4, shift:30
> CPU Freq:500003000, mult:0xffff9b56, shift:30
> CPU Freq:500004000, mult:0xffff79c9, shift:30
> ...
>
> The peak value appears around CPU_freq=500001000.
>
> To avoid this, it may need:
> 1. Supply a bigger maxsec value?
> 2. In clocks_calc_mult_shift(), pick next mult/shift pair if mult is
> too big? Then maxsec will not be strictly obeyed.
> 3. Change timekeeper.mult to u64?
> 4. ...
>
> Any idea?
>
>
>
> --
> Regards,
> - Chen Jie
>



-- 
Only stand for myself

<Prev in Thread] Current Thread [Next in Thread>