lkml.org 
[lkml]   [2010]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: [PATCH] clarify a usage constraint for cnt32_to_63()
On Tue, Dec 14, 2010 at 7:44 PM, Nicolas Pitre <nico@fluxnic.net> wrote:
>
> The cnt32_to_63 algorithm relies on proper counter data evaluation
> ordering to work properly. This was missing from the provided
> documentation.
>
> Let's augment the documentation with the missing usage constraint and
> fix the only instance that got it wrong.

Hmm. In the meantime, mn10300 seems to have changed its get_cycles()
to count up like a normal architecture.

So I _think_ the nm10300 part of the patch should now look like the
attached. Untested. I'd like to get an ack from David or at least
somebody who compiles (and preferably tests) mn10300. And then
preferably a re-send of the whole patch.

Hmm?

Linus
arch/mn10300/kernel/time.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/mn10300/kernel/time.c b/arch/mn10300/kernel/time.c
index f860a34..5114eb8 100644
--- a/arch/mn10300/kernel/time.c
+++ b/arch/mn10300/kernel/time.c
@@ -40,21 +40,17 @@ unsigned long long sched_clock(void)
unsigned long long ll;
unsigned l[2];
} tsc64, result;
- unsigned long tsc, tmp;
+ unsigned long tmp;
unsigned product[3]; /* 96-bit intermediate value */

/* cnt32_to_63() is not safe with preemption */
preempt_disable();

- /* read the TSC value
- */
- tsc = get_cycles();
-
/* expand to 64-bits.
* - sched_clock() must be called once a minute or better or the
* following will go horribly wrong - see cnt32_to_63()
*/
- tsc64.ll = cnt32_to_63(tsc) & 0x7fffffffffffffffULL;
+ tsc64.ll = cnt32_to_63(get_cycles()) & 0x7fffffffffffffffULL;

preempt_enable();
\
 
 \ /
  Last update: 2010-12-19 22:23    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site