All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ed L Cashin <ecashin@uga.edu>
To: sparclinux@vger.kernel.org
Subject: Re: why "mov %0, %0" after "rd %%tick, %0"?
Date: Fri, 23 Jan 2004 21:31:47 +0000	[thread overview]
Message-ID: <87r7xqgxmk.fsf@uga.edu> (raw)
In-Reply-To: <20040123125806.215b41da.davem@redhat.com>

"David S. Miller" <davem@redhat.com> writes:

> On Fri, 23 Jan 2004 15:59:13 -0500
> Ed L Cashin <ecashin@uga.edu> wrote:
>
>> One thing I don't get is why there's a mov %0, %0 instruction after
>> reading the tick register.  Is this because of the delay slot?
>
> No, there is a bug in some of the UltraSPARC processors in that if
> you go:
>
> 	rd	%tick, %reg
> 	cmp	%reg, XXX
>
> the compare will get an incorrect result.  If we force the %tick result
> into a simple move instruction this prevents the sequence that leads up
> to the bug.

Oh!  Thanks.  Do you think it's worth a comment?

--- linux-2.6.1/arch/sparc64/kernel/time.c.orig	Fri Jan 23 16:21:38 2004
+++ linux-2.6.1/arch/sparc64/kernel/time.c	Fri Jan 23 16:24:44 2004
@@ -108,6 +108,14 @@
 {
 	unsigned long ret;
 
+	/* There is a bug in some of the UltraSPARC processors
+	 * where a compare following a read of the %tick 
+	 * register gets an incorrect result.
+	 *
+	 * If we force the %tick result into a simple move
+	 * instruction this prevents the sequence that leads up
+	 * to the bug.
+	 */
 	__asm__ __volatile__("rd	%%tick, %0\n\t"
 			     "mov	%0, %0"
 			     : "=r" (ret));


-- 
--Ed L Cashin            |   PGP public key:
  ecashin@uga.edu        |   http://noserose.net/e/pgp/


      parent reply	other threads:[~2004-01-23 21:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-23 20:58 why "mov %0, %0" after "rd %%tick, %0"? David S. Miller
2004-01-23 20:59 ` Ed L Cashin
2004-01-23 21:31 ` Ed L Cashin [this message]

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=87r7xqgxmk.fsf@uga.edu \
    --to=ecashin@uga.edu \
    --cc=sparclinux@vger.kernel.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.