All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Schmielau <tim@physik3.uni-rostock.de>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>,
	James Bottomley <James.Bottomley@SteelEye.com>,
	johnstul@us.ibm.com, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fix get_jiffies_64 to work on voyager
Date: Tue, 6 Jan 2004 18:11:57 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.53.0401061807070.9108@gockel.physik3.uni-rostock.de> (raw)
In-Reply-To: <Pine.LNX.4.58.0401060826570.2653@home.osdl.org>

On Tue, 6 Jan 2004, Linus Torvalds wrote:

> Augh. If you cast it to "unsigned long long" anyway, why not just use the 
> right value? It's "jiffies_64".

Lessons in straight thinking...

We then need to make jiffies_64 volatile, since we violate the rule to 
never read it.

Tim 


--- linux-2.6.1-rc1/arch/i386/kernel/timers/timer_tsc.c	2003-12-31 14:21:19.000000000 +0100
+++ linux-2.6.1-rc1-j64/arch/i386/kernel/timers/timer_tsc.c	2004-01-06 18:05:24.000000000 +0100
@@ -140,7 +140,8 @@
 #ifndef CONFIG_NUMA
 	if (!use_tsc)
 #endif
-		return (unsigned long long)get_jiffies_64() * (1000000000 / HZ);
+		/* no locking but a rare wrong value is not a big deal */
+		return (unsigned long long)jiffies_64 * (1000000000 / HZ);
 
 	/* Read the Time Stamp Counter */
 	rdtscll(this_offset);

--- linux-2.6.1-rc1/include/linux/jiffies.h	2003-12-31 14:22:05.000000000 +0100
+++ linux-2.6.1-rc1-j64/include/linux/jiffies.h	2004-01-06 17:56:15.000000000 +0100
@@ -9,11 +9,11 @@
 #include <asm/param.h>			/* for HZ */
 
 /*
- * The 64-bit value is not volatile - you MUST NOT read it
- * without sampling the sequence number in xtime_lock.
+ * NEVER EVER read jiffies_64 without sampling the sequence number
+ * in xtime_lock.
  * get_jiffies_64() will do this for you as appropriate.
  */
-extern u64 jiffies_64;
+extern u64 volatile jiffies_64;
 extern unsigned long volatile jiffies;
 
 #if (BITS_PER_LONG < 64)
@@ -21,7 +21,7 @@
 #else
 static inline u64 get_jiffies_64(void)
 {
-	return (u64)jiffies;
+	return jiffies_64;
 }
 #endif
 

  parent reply	other threads:[~2004-01-06 17:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-06 16:04 [PATCH] fix get_jiffies_64 to work on voyager James Bottomley
2004-01-06 16:19 ` Andrew Morton
2004-01-06 16:26   ` James Bottomley
2004-01-06 17:05     ` Andrew Morton
2004-01-06 18:53       ` James Bottomley
2004-01-06 16:29   ` Linus Torvalds
2004-01-06 17:05     ` Andrew Morton
2004-01-06 17:11     ` Tim Schmielau [this message]
2004-01-06 17:22       ` Andrew Morton
2004-01-06 17:37         ` Tim Schmielau
2004-01-06 18:02       ` Linus Torvalds
2004-01-06 16:30   ` Tim Schmielau
2004-01-06 16:26 ` Linus Torvalds
2004-01-06 18:29   ` Paulo Marques
2004-01-06 18:46     ` Linus Torvalds
2004-01-06 19:04       ` Paulo Marques

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=Pine.LNX.4.53.0401061807070.9108@gockel.physik3.uni-rostock.de \
    --to=tim@physik3.uni-rostock.de \
    --cc=James.Bottomley@SteelEye.com \
    --cc=akpm@osdl.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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.