lkml.org 
[lkml]   [2013]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC PATCH 4/5] clocksource: Enlarge the maxim time interval when configuring the scale and shift
    On Mon, Jan 21, 2013 at 02:38:44PM +0800, Feng Tang wrote:
    > Date: Mon, 21 Jan 2013 14:38:44 +0800
    > From: Feng Tang <feng.tang@intel.com>
    > To: Thomas Gleixner <tglx@linutronix.de>, John Stultz
    > <john.stultz@linaro.org>, Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin"
    > <hpa@linux.intel.com>, x86@kernel.org, Len Brown <lenb@kernel.org>,
    > "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
    > linux-kernel@vger.kernel.org
    > Cc: Feng Tang <feng.tang@intel.com>
    > Subject: [RFC PATCH 4/5] clocksource: Enlarge the maxim time interval when
    > configuring the scale and shift
    > X-Mailer: git-send-email 1.7.9.5
    >
    > On our x86 platform, we see a failure case of calling clocksource_cyc2ns(),
    > which return a negative value. The reason is the time interval was large
    > (more than 1000 seconds), while its TSC frequency is 2GHz, so the following
    > fomular overflowed:
    > ((u64) cycles * mult) >> shift
    >
    > So enlarge the time interval from 10 mins to 40 mins to fix the bug.
    >
    > Another solution may be adding a "max_interval" in struct clocksource, and
    > use a default value (like current 10 minutes) when clocksource driver
    > doesn't set it.
    >
    As you said, it looks like it is a littleb it arbitrary from 10m -> 40m, I
    think max_interval is a better choice, if timer guys not minding too many
    control knobs :-).

    > Signed-off-by: Feng Tang <feng.tang@intel.com>
    > ---
    > kernel/time/clocksource.c | 6 +++---
    > 1 file changed, 3 insertions(+), 3 deletions(-)
    >
    > diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
    > index c958338..48fbfcb 100644
    > --- a/kernel/time/clocksource.c
    > +++ b/kernel/time/clocksource.c
    > @@ -663,7 +663,7 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq)
    > * Calc the maximum number of seconds which we can run before
    > * wrapping around. For clocksources which have a mask > 32bit
    > * we need to limit the max sleep time to have a good
    > - * conversion precision. 10 minutes is still a reasonable
    > + * conversion precision. 40 minutes is still a reasonable
    > * amount. That results in a shift value of 24 for a
    > * clocksource with mask >= 40bit and f >= 4GHz. That maps to
    > * ~ 0.06ppm granularity for NTP. We apply the same 12.5%
    > @@ -674,8 +674,8 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq)
    > do_div(sec, scale);
    > if (!sec)
    > sec = 1;
    > - else if (sec > 600 && cs->mask > UINT_MAX)
    > - sec = 600;
    > + else if (sec > 2400 && cs->mask > UINT_MAX)
    > + sec = 2400;
    >
    > clocks_calc_mult_shift(&cs->mult, &cs->shift, freq,
    > NSEC_PER_SEC / scale, sec * scale);
    > --
    > 1.7.9.5
    >
    > --
    > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    > the body of a message to majordomo@vger.kernel.org
    > More majordomo info at http://vger.kernel.org/majordomo-info.html
    > Please read the FAQ at http://www.tux.org/lkml/
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2013-01-21 09:01    [W:4.519 / U:0.236 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site