From: Andrew Morton <akpm@osdl.org>
To: Andi Kleen <ak@muc.de>
Cc: anemo@mba.ocn.ne.jp, clameter@engr.sgi.com,
linux-kernel@vger.kernel.org, ralf@linux-mips.org,
johnstul@us.ibm.com, rth@twiddle.net
Subject: Re: [PATCH] simplify update_times (avoid jiffies/jiffies_64 aliasing problem)
Date: Sat, 4 Mar 2006 03:40:50 -0800 [thread overview]
Message-ID: <20060304034050.40f29251.akpm@osdl.org> (raw)
In-Reply-To: <20060304112010.GA94875@muc.de>
Andi Kleen <ak@muc.de> wrote:
>
> > b) On 64-bit machines jiffies and jiffies_64 always have the same
> > address (don't they?) Is the compiler really going to move a read of an
> > absolute address ahead of a modification of the same address?
> >
> > <looks>
> >
> > The address of jiffies isn't known until link time, so yup, the risk
> > is there.
>
> Yes maybe it would be better to just use #define there.
> jiffies_64 always was a bit too clever.
hm. It's actually rather hard.
One could do something like:
extern u64 __jiffy_data jiffies_64;
#define jiffies (*(u32 *)((long)&jiffies_64 + 2))
or
#if BITS_PER_LONG == 64
extern u64 __jiffy_data jiffies;
#define jiffies_64 jiffies
#else
extern union jiffy_thing {
#ifdef BIG_ENDIAN
struct {
u32 pad;
u32 jiffies;
},
u64 jiffies_64;
#else
u64 jiffies_64;
struct {
u32 pad;
u32 jiffies;
},
#endif
} __jiffy_data jiffies_thing;
#define jiffies_64 jiffies_thing.jiffies_64
#define jiffies jiffies_thing.jiffies
#endif
But then any code which uses `jiffies' as a local variable will explode. I
guess we should rename those anyway. include/linux/cyclades.h is one such.
Making `jiffies_64' a #define is less risky, but that doesn't work for
32-bit.
> >
> > c) jiffies is declared volatile. In practice, if I know my gcc, it's
> > just not going to play these reordering games with a volatile.
> >
> > If that's true, and if some standard (presumably c99) says that it
> > must be true then I don't think we need the patch.
>
> The standards definition of volatile is unfortunately quite vague,
> so at least from this side you cannot rely on much.
Yup.
> Also I assume Atsushi-san did the patch because he saw a real problem?
I don't know. I suspect its only observeable effect would be an
off-by-one-tick in wall_jiffies which will cancel out whereever anyone
takes a delta.
next prev parent reply other threads:[~2006-03-04 11:42 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-02 14:02 Atsushi Nemoto
2006-03-02 15:51 ` Atsushi Nemoto
2006-03-02 19:09 ` Christoph Lameter
2006-03-03 2:44 ` Atsushi Nemoto
2006-03-03 3:04 ` Andrew Morton
2006-03-03 3:20 ` Andi Kleen
2006-03-03 4:31 ` Atsushi Nemoto
2006-03-03 5:45 ` David S. Miller
2006-03-03 16:26 ` Atsushi Nemoto
2006-03-03 16:31 ` Atsushi Nemoto
2006-03-04 8:18 ` Andrew Morton
2006-03-04 11:20 ` Andi Kleen
2006-03-04 11:40 ` Andrew Morton [this message]
2006-03-04 5:21 ` Andi Kleen
2006-03-04 23:13 ` Paul Mackerras
2006-03-06 2:32 ` Atsushi Nemoto
2006-03-04 11:42 ` Paul Mackerras
2006-03-04 11:44 ` Andrew Morton
2006-03-04 12:33 ` Paul Mackerras
2006-03-04 16:43 ` Atsushi Nemoto
2006-03-03 20:17 ` john stultz
2006-03-03 21:15 ` Andrew Morton
2006-03-04 17:15 ` Atsushi Nemoto
2006-07-30 14:54 ` Atsushi Nemoto
2006-07-31 10:36 ` Martin Schwidefsky
2006-08-01 14:44 ` Atsushi Nemoto
2006-08-02 12:50 ` Martin Schwidefsky
2006-08-03 15:53 ` Atsushi Nemoto
2006-08-04 14:02 ` Martin Schwidefsky
2006-08-06 16:13 ` Atsushi Nemoto
2006-08-07 11:28 ` Martin Schwidefsky
2006-08-07 19:58 ` Andrew Morton
2006-08-08 8:11 ` Martin Schwidefsky
2006-08-09 15:07 ` Atsushi Nemoto
2006-03-03 18:13 ` john stultz
2006-03-04 2:34 ` Ralf Baechle
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=20060304034050.40f29251.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=ak@muc.de \
--cc=anemo@mba.ocn.ne.jp \
--cc=clameter@engr.sgi.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ralf@linux-mips.org \
--cc=rth@twiddle.net \
/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
all inboxes | Powered by JetHome®