All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chris Friesen" <cfriesen@nortel.com>
To: Csdncannon <csdncannon@gmail.com>
Cc: linuxppc-dev@ozlabs.org, Arnd Bergmann <arnd@arndb.de>
Subject: Re: Continual reading from the PowerPc time base register is not stable
Date: Thu, 25 Mar 2010 16:00:54 -0600	[thread overview]
Message-ID: <4BABDD16.4080705@nortel.com> (raw)
In-Reply-To: <43c137a81003250800n660195c5k42c8516068aeda8d@mail.gmail.com>

On 03/25/2010 09:00 AM, Csdncannon wrote:
> I am really sorry that the previously attached code is wrong, this one
> "timebase.c" is the right one, and the "log_timebase" file is the right log.
> 
> We are using FreeScale PowerPc 8378, kernel 2.6.28 and compiled as 32-bit.


volatile unsigned long long getTimeBase()
{
	unsigned long upper,lower,upper2;
	do {
		asm volatile("sync; isync":::"memory");
		asm volatile("mftbu %0" : "=r" (upper));
		asm volatile("sync; isync":::"memory");
		asm volatile("mftbl %0" : "=r" (lower));
		asm volatile("sync; isync":::"memory");
		asm volatile("mftbu %0" : "=r" (upper2));
		asm volatile("sync; isync":::"memory");
	}while(upper2!=upper);

	return (upper<<32)|lower;
}


Shouldn't "upper" be cast to 64-bit before shifting?

Chris

  parent reply	other threads:[~2010-03-25 22:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-25  2:41 Continual reading from the PowerPc time base register is not stable Csdncannon
2010-03-25  8:21 ` Benjamin Herrenschmidt
2010-03-25 10:05   ` Arnd Bergmann
2010-03-25 15:00     ` Csdncannon
2010-03-25 20:38       ` Benjamin Herrenschmidt
2010-03-26  1:11         ` Csdncannon
2010-03-26  1:22           ` Segher Boessenkool
2010-03-26  2:01             ` Csdncannon
2010-03-26  8:52               ` Segher Boessenkool
2010-03-26  9:01                 ` Segher Boessenkool
2010-03-26 12:14                   ` Csdncannon
2010-04-06  8:02                     ` Csdncannon
2010-03-26  1:55           ` Benjamin Herrenschmidt
2010-03-26  2:04             ` Csdncannon
2010-03-25 22:00       ` Chris Friesen [this message]
2010-03-25 22:57         ` Benjamin Herrenschmidt
2010-03-25 23:37       ` Kumar Gala
2010-03-25 21:37 ` Segher Boessenkool
2010-04-10  3:14 ` Csdncannon
2010-04-22  0:44   ` Kim Phillips
2010-04-22  0:50     ` Benjamin Herrenschmidt
2010-04-22 23:27       ` Kim Phillips
2010-04-23 10:57     ` Csdncannon

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=4BABDD16.4080705@nortel.com \
    --to=cfriesen@nortel.com \
    --cc=arnd@arndb.de \
    --cc=csdncannon@gmail.com \
    --cc=linuxppc-dev@ozlabs.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.