From: Daniel Walker <dwalker@mvista.com>
To: "Carlos R. Mafra" <crmafra2@gmail.com>
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
venkatesh.pallipadi@intel.com
Subject: Re: x86: Clean up computation of HPET .mult variables
Date: Tue, 06 May 2008 19:17:41 -0700 [thread overview]
Message-ID: <1210126661.17132.223.camel@localhost.localdomain> (raw)
In-Reply-To: <20080506205003.GA3749@beyonder.ift.unesp.br>
On Tue, 2008-05-06 at 17:50 -0300, Carlos R. Mafra wrote:
> so there is no difference at all at this precision level!
>
> Out of curiosity I computed the "exact" value by hand and
> got 292935555.9 so we can't even talk about "error" because
> the difference is in the extra digit not considered with
> the precision I used to print the results.
>
> And if you look at the patch to do computation using
> clocksource_hz2mult() you will see that it is uglier
> than the simple call to div_sc(), as you have to
> consider an extra variable hpet_freq and do an extra
> do_div() together with an extra rounding.
>
> So I think you will be ok with the patch now, right? :-)
Not yet ..
I used you patch with some formatting changes and I get,
clocksource_hpet.mult walker = 292935555
clocksource_hpet.mult my patch = 292935555
Same as yours .. just checking ;)
Now I modify the shift value from 22 to 25 and I get this,
clocksource_hpet.mult walker = 2343484437
clocksource_hpet.mult my patch = 2343484446
I don't think this is due to rounding .. I'm not really sure why they're
different .. I would assume the clocksource_hz2mult is more correct, but
feel free to check into it if you want..
The reason I'm messing with the shift is cause 22 is actually too low..
For your period it can be 25, which would give better accuracy.
If you want to check the shift calculation I used it looks like this,
static inline u32 clocksource_hz2shift(u32 bits, u32 hz)
{
u64 temp;
for (; bits > 0; bits--) {
temp = (u64) NSEC_PER_SEC << bits;
do_div(temp, hz);
if ((temp >> 32) == 0)
break;
}
return bits;
}
Daniel
next prev parent reply other threads:[~2008-05-07 2:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-05 23:11 Carlos R. Mafra
2008-05-05 23:58 ` Daniel Walker
2008-05-06 2:13 ` Carlos R. Mafra
2008-05-06 3:23 ` Daniel Walker
2008-05-06 12:59 ` Carlos R. Mafra
2008-05-06 16:21 ` Daniel Walker
2008-05-06 20:50 ` Carlos R. Mafra
2008-05-07 2:17 ` Daniel Walker [this message]
2008-05-07 3:39 ` Carlos R. Mafra
2008-05-07 4:21 ` Daniel Walker
2008-05-07 7:13 ` Ingo Molnar
2008-05-06 12:43 ` Ingo Molnar
2008-05-06 13:13 ` Carlos R. Mafra
2008-05-06 18:51 ` rtc-cmos.c: Build fix Carlos R. Mafra
2008-05-07 7:10 ` Ingo Molnar
2008-05-07 21:31 ` Andrew Morton
2008-05-09 8:32 ` Ingo Molnar
2008-05-09 12:33 ` Carlos R. Mafra
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=1210126661.17132.223.camel@localhost.localdomain \
--to=dwalker@mvista.com \
--cc=crmafra2@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=venkatesh.pallipadi@intel.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
Powered by JetHome