2008-02-07 22:25:26

by Paul Mackerras

[permalink] [raw]
Subject: [PATCH] Fix compilation of powerpc asm-offsets.c with old gcc

From: Tony Breeds <[email protected]>

Commit ad7f71674ad7c3c4467e48f6ab9e85516dae2720 corrected the clock
resolution reported by the VDSO clock_getres() but introduced another
problem in that older versions of gcc (gcc-4.0 and earlier) fail to
compile the new code in arch/powerpc/kernel/asm-offsets.c.

This fixes it by introducing a new MONOTONIC_RES_NSEC define in the
generic code which is equivalent to KTIME_MONOTONIC_RES but is just an
integer constant, not a ktime union.

Signed-off-by: Tony Breeds <[email protected]>
Signed-off-by: Paul Mackerras <[email protected]>
---

Linus, I'm sending you this as a patch since it touches generic code.
Please apply, since mainline is broken for powerpc users who are using
gcc-4.0 or earlier.

diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index e6e4928..4b749c4 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -313,7 +313,7 @@ int main(void)
DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
DEFINE(NSEC_PER_SEC, NSEC_PER_SEC);
- DEFINE(CLOCK_REALTIME_RES, (KTIME_MONOTONIC_RES).tv64);
+ DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);

#ifdef CONFIG_BUG
DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry));
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 8371b66..203591e 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -225,11 +225,14 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
* idea of the (in)accuracy of timers. Timer values are rounded up to
* this resolution values.
*/
-# define KTIME_HIGH_RES (ktime_t) { .tv64 = 1 }
+# define HIGH_RES_NSEC 1
+# define KTIME_HIGH_RES (ktime_t) { .tv64 = HIGH_RES_NSEC }
+# define MONOTONIC_RES_NSEC HIGH_RES_NSEC
# define KTIME_MONOTONIC_RES KTIME_HIGH_RES

#else

+# define MONOTONIC_RES_NSEC LOW_RES_NSEC
# define KTIME_MONOTONIC_RES KTIME_LOW_RES

/*
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index a6ddec1..36c542b 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -316,7 +316,8 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
* idea of the (in)accuracy of timers. Timer values are rounded up to
* this resolution values.
*/
-#define KTIME_LOW_RES (ktime_t){ .tv64 = TICK_NSEC }
+#define LOW_RES_NSEC TICK_NSEC
+#define KTIME_LOW_RES (ktime_t){ .tv64 = LOW_RES_NSEC }

/* Get the monotonic time in timespec format: */
extern void ktime_get_ts(struct timespec *ts);


2008-02-07 22:54:37

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] Fix compilation of powerpc asm-offsets.c with old gcc



On Fri, 8 Feb 2008, Paul Mackerras wrote:
>
> From: Tony Breeds <[email protected]>
>
> Commit ad7f71674ad7c3c4467e48f6ab9e85516dae2720 corrected the clock
> ..

Please, when mentioning hex numbers, also do the one-liner shortlog.

I realize that in gitk (or even just with two terminal windows open and a
git repository) it's trivial to just follow the link and see what that
commit was, but even you're just doing a "git log" or more commonly if you
read the commit log somewhere else (like a mail gateway that posts them
automatically when I apply things), it's really much more readable if you
were to say something like:

Commit ad7f71674ad7c3c4467e48f6ab9e85516dae2720 ("[POWERPC] Use a
sensible default for clock_getres() in the VDSO") corrected the clock
...

which reads much mroe naturally without having to go wonder what that
commit was doing. No?

As it is, I'm pretty used to editing those things in (I do it all the
time), and I will do so for this email too, but I want to keep bringing
this up so that I hopfully wouldn't have to do it so often. So please
write your commit messages with the specific git information available,
but without _requiring_ people to be git users to get the gist of the
matter, ok?

Linus

2008-02-08 18:09:48

by Paul Jackson

[permalink] [raw]
Subject: Re: [PATCH] Fix compilation of powerpc asm-offsets.c with old gcc

Linus wrote:
> Please, when mentioning hex numbers, also do the one-liner shortlog.
> ...
> without _requiring_ people to be git users to get the gist of the
> matter, ok?


Thanks for sticking up for us git-challenged contributors.

Can anyone point me at instructions providing the shortest
path for getting from one of those git hex numbers to the
log or change it represents, for non-git users?

Or do those instructions begin with a first step of:

1. become a git user
2. ...

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.940.382.4214

2008-02-08 18:20:38

by Olof Johansson

[permalink] [raw]
Subject: Re: [PATCH] Fix compilation of powerpc asm-offsets.c with old gcc

On Fri, Feb 08, 2008 at 12:06:23PM -0600, Paul Jackson wrote:
> Linus wrote:
> > Please, when mentioning hex numbers, also do the one-liner shortlog.
> > ...
> > without _requiring_ people to be git users to get the gist of the
> > matter, ok?
>
>
> Thanks for sticking up for us git-challenged contributors.
>
> Can anyone point me at instructions providing the shortest
> path for getting from one of those git hex numbers to the
> log or change it represents, for non-git users?
>
> Or do those instructions begin with a first step of:
>
> 1. become a git user
> 2. ...

Does this count?

1. Go to http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git
2. Enter the SHA string in the 'search' field at the top right


-Olo

2008-02-08 18:20:54

by Harvey Harrison

[permalink] [raw]
Subject: Re: [PATCH] Fix compilation of powerpc asm-offsets.c with old gcc

On Fri, 2008-02-08 at 12:06 -0600, Paul Jackson wrote:
> Linus wrote:
> > Please, when mentioning hex numbers, also do the one-liner shortlog.
> > ...
> > without _requiring_ people to be git users to get the gist of the
> > matter, ok?
>
>
> Thanks for sticking up for us git-challenged contributors.
>
> Can anyone point me at instructions providing the shortest
> path for getting from one of those git hex numbers to the
> log or change it represents, for non-git users?
>

Replace <SHA> as needed:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=<SHA>

Harvey

2008-02-08 18:22:41

by Olof Johansson

[permalink] [raw]
Subject: Re: [PATCH] Fix compilation of powerpc asm-offsets.c with old gcc

On Fri, Feb 08, 2008 at 12:21:54PM -0600, Olof Johansson wrote:
> On Fri, Feb 08, 2008 at 12:06:23PM -0600, Paul Jackson wrote:
> > Linus wrote:
> > > Please, when mentioning hex numbers, also do the one-liner shortlog.
> > > ...
> > > without _requiring_ people to be git users to get the gist of the
> > > matter, ok?
> >
> >
> > Thanks for sticking up for us git-challenged contributors.
> >
> > Can anyone point me at instructions providing the shortest
> > path for getting from one of those git hex numbers to the
> > log or change it represents, for non-git users?
> >
> > Or do those instructions begin with a first step of:
> >
> > 1. become a git user
> > 2. ...
>
> Does this count?
>
> 1. Go to http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git
> 2. Enter the SHA string in the 'search' field at the top right

Ack, that just found the commit that referred to it, not the original
one. My bad.

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=<hex value>

Will bring it up though.


-Olof

2008-02-08 18:26:07

by Simon Holm Thøgersen

[permalink] [raw]
Subject: Re: [PATCH] Fix compilation of powerpc asm-offsets.c with old gcc


fre, 08 02 2008 kl. 12:06 -0600, skrev Paul Jackson:
> Linus wrote:
> > Please, when mentioning hex numbers, also do the one-liner shortlog.
> > ...
> > without _requiring_ people to be git users to get the gist of the
> > matter, ok?
>
>
> Thanks for sticking up for us git-challenged contributors.
>
> Can anyone point me at instructions providing the shortest
> path for getting from one of those git hex numbers to the
> log or change it represents, for non-git users?

Use gitweb [1], Linus' tree is here [2]. Just search for the hex.

[1] http://git.kernel.org/
[2]
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary


Simon Holm Thøgersen

2008-02-08 18:39:38

by Paul Jackson

[permalink] [raw]
Subject: Re: [PATCH] Fix compilation of powerpc asm-offsets.c with old gcc

Thanks, Olof and Harvey.

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=

Just what I was looking for.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.940.382.4214

2008-02-11 10:36:49

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] Fix compilation of powerpc asm-offsets.c with old gcc

On Fri, 8 Feb 2008, Simon Holm Th?gersen wrote:
> fre, 08 02 2008 kl. 12:06 -0600, skrev Paul Jackson:
> > Linus wrote:
> > > Please, when mentioning hex numbers, also do the one-liner shortlog.
> > > ...
> > > without _requiring_ people to be git users to get the gist of the
> > > matter, ok?
> >
> >
> > Thanks for sticking up for us git-challenged contributors.
> >
> > Can anyone point me at instructions providing the shortest
> > path for getting from one of those git hex numbers to the
> > log or change it represents, for non-git users?
>
> Use gitweb [1], Linus' tree is here [2]. Just search for the hex.
>
> [1] http://git.kernel.org/
> [2]
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary

As the IDs are supposed to be unique, it doesn't matter where you look it up,
as long as the tree has that commit ;-)

BTW, time for Google to start handling git IDs?

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: [email protected]
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619