[lkml]   [2006]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] simplify update_times (avoid jiffies/jiffies_64 aliasing problem)
Andi Kleen <> 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))


#if BITS_PER_LONG == 64
extern u64 __jiffy_data jiffies;
#define jiffies_64 jiffies
extern union jiffy_thing {
struct {
u32 pad;
u32 jiffies;
u64 jiffies_64;
u64 jiffies_64;
struct {
u32 pad;
u32 jiffies;
} __jiffy_data jiffies_thing;
#define jiffies_64 jiffies_thing.jiffies_64
#define jiffies jiffies_thing.jiffies

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

> >
> > 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.


> 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.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-03-04 12:44    [W:0.097 / U:0.080 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site