linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [tip:x86/vdso] clocksource: Replace vread with generic arch data
       [not found] ` <tip-433bd805e5fd2c731b3a9025b034f066272d336e@git.kernel.org>
@ 2011-07-21 20:23   ` H. Peter Anvin
  2011-07-21 20:23     ` H. Peter Anvin
  2011-07-21 20:49     ` Andrew Lutomirski
  0 siblings, 2 replies; 8+ messages in thread
From: H. Peter Anvin @ 2011-07-21 20:23 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, luto, johnstul, tony.luck, fenghua.yu,
	tglx, hpa
  Cc: linux-tip-commits, Arnd Bergmann, Linux Arch Mailing List

On 07/14/2011 09:24 PM, tip-bot for Andy Lutomirski wrote:
> 
> diff --git a/arch/x86/include/asm/clocksource.h b/arch/x86/include/asm/clocksource.h
> new file mode 100644
> index 0000000..a5df33f
> --- /dev/null
> +++ b/arch/x86/include/asm/clocksource.h
> @@ -0,0 +1,16 @@
> +/* x86-specific clocksource additions */
> +
> +#ifndef _ASM_X86_CLOCKSOURCE_H
> +#define _ASM_X86_CLOCKSOURCE_H
> +
> +#ifdef CONFIG_X86_64
> +
> +#define __ARCH_HAS_CLOCKSOURCE_DATA
> +
> +struct arch_clocksource_data {
> +	cycle_t (*vread)(void);
> +};
> +
> +#endif /* CONFIG_X86_64 */
> +
> +#endif /* _ASM_X86_CLOCKSOURCE_H */
> --- /dev/null
> +++ b/include/asm-generic/clocksource.h
> @@ -0,0 +1,4 @@
> +/*
> + * Architectures should override this file to add private userspace
> + * clock magic if needed.
> + */
> diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
> index d4646b4..0fb83c2 100644
> --- a/include/linux/clocksource.h
> +++ b/include/linux/clocksource.h
> @@ -22,6 +22,8 @@
>  typedef u64 cycle_t;
>  struct clocksource;
>  
> +#include <asm/clocksource.h>
> +
>  /**

Hi Andy,

I should have spotted this sooner... Ingo pointed out to me that this
breaks building on any non-x86 architecture.

asm-generic doesn't work quite the way you think it does, here; it's a
library for architectures to include from, not something that gets
included on all architectures by default.

To make a file from asm-generic appear in asm/ it needs to at least
appear in a generic-y statement in a Makefile; however, that is kind of
pointless in the case of an empty file.

One could argue that it would be nice if we had such a fallback
director, of if asm-generic was such a fallback directory, but currently
it is not.

The easiest way to deal with this is probably to make
ARCH_HAS_CLOCKSOURCE_DATA here a Kconfig option (autoselected for
x86-64); the only other would be to add this as generic-y stubs for
every single architecture.

Cc: Arnd Bergmann who is the asm-generic maintainer for a
recommendation, and linux-arch.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [tip:x86/vdso] clocksource: Replace vread with generic arch data
  2011-07-21 20:23   ` [tip:x86/vdso] clocksource: Replace vread with generic arch data H. Peter Anvin
@ 2011-07-21 20:23     ` H. Peter Anvin
  2011-07-21 20:49     ` Andrew Lutomirski
  1 sibling, 0 replies; 8+ messages in thread
From: H. Peter Anvin @ 2011-07-21 20:23 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, luto, johnstul, tony.luck, fenghua.yu,
	tglx, hpa, clemens
  Cc: linux-tip-commits, Arnd Bergmann, Linux Arch Mailing List

On 07/14/2011 09:24 PM, tip-bot for Andy Lutomirski wrote:
> 
> diff --git a/arch/x86/include/asm/clocksource.h b/arch/x86/include/asm/clocksource.h
> new file mode 100644
> index 0000000..a5df33f
> --- /dev/null
> +++ b/arch/x86/include/asm/clocksource.h
> @@ -0,0 +1,16 @@
> +/* x86-specific clocksource additions */
> +
> +#ifndef _ASM_X86_CLOCKSOURCE_H
> +#define _ASM_X86_CLOCKSOURCE_H
> +
> +#ifdef CONFIG_X86_64
> +
> +#define __ARCH_HAS_CLOCKSOURCE_DATA
> +
> +struct arch_clocksource_data {
> +	cycle_t (*vread)(void);
> +};
> +
> +#endif /* CONFIG_X86_64 */
> +
> +#endif /* _ASM_X86_CLOCKSOURCE_H */
> --- /dev/null
> +++ b/include/asm-generic/clocksource.h
> @@ -0,0 +1,4 @@
> +/*
> + * Architectures should override this file to add private userspace
> + * clock magic if needed.
> + */
> diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
> index d4646b4..0fb83c2 100644
> --- a/include/linux/clocksource.h
> +++ b/include/linux/clocksource.h
> @@ -22,6 +22,8 @@
>  typedef u64 cycle_t;
>  struct clocksource;
>  
> +#include <asm/clocksource.h>
> +
>  /**

Hi Andy,

I should have spotted this sooner... Ingo pointed out to me that this
breaks building on any non-x86 architecture.

asm-generic doesn't work quite the way you think it does, here; it's a
library for architectures to include from, not something that gets
included on all architectures by default.

To make a file from asm-generic appear in asm/ it needs to at least
appear in a generic-y statement in a Makefile; however, that is kind of
pointless in the case of an empty file.

One could argue that it would be nice if we had such a fallback
director, of if asm-generic was such a fallback directory, but currently
it is not.

The easiest way to deal with this is probably to make
ARCH_HAS_CLOCKSOURCE_DATA here a Kconfig option (autoselected for
x86-64); the only other would be to add this as generic-y stubs for
every single architecture.

Cc: Arnd Bergmann who is the asm-generic maintainer for a
recommendation, and linux-arch.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [tip:x86/vdso] clocksource: Replace vread with generic arch data
  2011-07-21 20:23   ` [tip:x86/vdso] clocksource: Replace vread with generic arch data H. Peter Anvin
  2011-07-21 20:23     ` H. Peter Anvin
@ 2011-07-21 20:49     ` Andrew Lutomirski
  2011-07-21 20:59       ` H. Peter Anvin
  1 sibling, 1 reply; 8+ messages in thread
From: Andrew Lutomirski @ 2011-07-21 20:49 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: mingo, linux-kernel, johnstul, tony.luck, fenghua.yu, tglx, hpa,
	clemens, linux-tip-commits, Arnd Bergmann,
	Linux Arch Mailing List

On Thu, Jul 21, 2011 at 4:23 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 07/14/2011 09:24 PM, tip-bot for Andy Lutomirski wrote:
>>
>> diff --git a/arch/x86/include/asm/clocksource.h b/arch/x86/include/asm/clocksource.h
>> new file mode 100644
>> index 0000000..a5df33f
>> --- /dev/null
>> +++ b/arch/x86/include/asm/clocksource.h
>> @@ -0,0 +1,16 @@
>> +/* x86-specific clocksource additions */
>> +
>> +#ifndef _ASM_X86_CLOCKSOURCE_H
>> +#define _ASM_X86_CLOCKSOURCE_H
>> +
>> +#ifdef CONFIG_X86_64
>> +
>> +#define __ARCH_HAS_CLOCKSOURCE_DATA
>> +
>> +struct arch_clocksource_data {
>> +     cycle_t (*vread)(void);
>> +};
>> +
>> +#endif /* CONFIG_X86_64 */
>> +
>> +#endif /* _ASM_X86_CLOCKSOURCE_H */
>> --- /dev/null
>> +++ b/include/asm-generic/clocksource.h
>> @@ -0,0 +1,4 @@
>> +/*
>> + * Architectures should override this file to add private userspace
>> + * clock magic if needed.
>> + */
>> diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
>> index d4646b4..0fb83c2 100644
>> --- a/include/linux/clocksource.h
>> +++ b/include/linux/clocksource.h
>> @@ -22,6 +22,8 @@
>>  typedef u64 cycle_t;
>>  struct clocksource;
>>
>> +#include <asm/clocksource.h>
>> +
>>  /**
>
> Hi Andy,
>
> I should have spotted this sooner... Ingo pointed out to me that this
> breaks building on any non-x86 architecture.
>
> asm-generic doesn't work quite the way you think it does, here; it's a
> library for architectures to include from, not something that gets
> included on all architectures by default.

Whoops.  If only cross-compiler toolchains were easy to build...

[...]

>
> The easiest way to deal with this is probably to make
> ARCH_HAS_CLOCKSOURCE_DATA here a Kconfig option (autoselected for
> x86-64); the only other would be to add this as generic-y stubs for
> every single architecture.
>
> Cc: Arnd Bergmann who is the asm-generic maintainer for a
> recommendation, and linux-arch.

ARCH_HAS_CLOCKSOURCE_DATA seems reasonable.  It's a little ugly
because it needs:

#ifdef CONFIG_ARCH_HAS_CLOCKSOURCE_DATA
#include <asm/clocksource.h>
#endif


If I don't hear any better suggestions, I'll implement that tomorrow.
Do you want an incremental patch or a replacement?

--Andy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [tip:x86/vdso] clocksource: Replace vread with generic arch data
  2011-07-21 20:49     ` Andrew Lutomirski
@ 2011-07-21 20:59       ` H. Peter Anvin
  2011-07-21 21:22         ` Andrew Lutomirski
  0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2011-07-21 20:59 UTC (permalink / raw)
  To: Andrew Lutomirski
  Cc: mingo, linux-kernel, johnstul, tony.luck, fenghua.yu, tglx, hpa,
	clemens, linux-tip-commits, Arnd Bergmann,
	Linux Arch Mailing List

On 07/21/2011 01:49 PM, Andrew Lutomirski wrote:
> 
> Whoops.  If only cross-compiler toolchains were easy to build...
> 

http://www.kernel.org/pub/tools/crosstool/

> 
> If I don't hear any better suggestions, I'll implement that tomorrow.
> Do you want an incremental patch or a replacement?
> 

Already did, given the timing.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [tip:x86/vdso] clocksource: Replace vread with generic arch data
  2011-07-21 20:59       ` H. Peter Anvin
@ 2011-07-21 21:22         ` Andrew Lutomirski
  2011-07-21 21:25           ` H. Peter Anvin
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Lutomirski @ 2011-07-21 21:22 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: mingo, linux-kernel, johnstul, tony.luck, fenghua.yu, tglx, hpa,
	clemens, linux-tip-commits, Arnd Bergmann,
	Linux Arch Mailing List

On Thu, Jul 21, 2011 at 4:59 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 07/21/2011 01:49 PM, Andrew Lutomirski wrote:
>>
>> Whoops.  If only cross-compiler toolchains were easy to build...
>>
>
> http://www.kernel.org/pub/tools/crosstool/

I didn't realize that thing was still maintained.  Neat!

>
>>
>> If I don't hear any better suggestions, I'll implement that tomorrow.
>> Do you want an incremental patch or a replacement?
>>
>
> Already did, given the timing.

Presumably this needs a matching fix:

http://git.kernel.org/?p=linux/kernel/git/tip/linux-tip.git;a=commit;h=574c44fa8fa6262ffd5939789ef51a6e98ed62d7

(Also, none of the IA-64 maintainers have replied to any of my
requests for review.)

--Andy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [tip:x86/vdso] clocksource: Replace vread with generic arch data
  2011-07-21 21:22         ` Andrew Lutomirski
@ 2011-07-21 21:25           ` H. Peter Anvin
  2011-07-21 21:36             ` Andrew Lutomirski
  0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2011-07-21 21:25 UTC (permalink / raw)
  To: Andrew Lutomirski
  Cc: mingo, linux-kernel, johnstul, tony.luck, fenghua.yu, tglx, hpa,
	clemens, linux-tip-commits, Arnd Bergmann,
	Linux Arch Mailing List

On 07/21/2011 02:22 PM, Andrew Lutomirski wrote:
> 
> Presumably this needs a matching fix:
> 
> http://git.kernel.org/?p=linux/kernel/git/tip/linux-tip.git;a=commit;h=574c44fa8fa6262ffd5939789ef51a6e98ed62d7
> 
> (Also, none of the IA-64 maintainers have replied to any of my
> requests for review.)
> 

What do you mean, "matching fix"?  The fix I posted should work on x86
and ia64.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [tip:x86/vdso] clocksource: Replace vread with generic arch data
  2011-07-21 21:25           ` H. Peter Anvin
@ 2011-07-21 21:36             ` Andrew Lutomirski
  2011-07-21 21:42               ` H. Peter Anvin
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Lutomirski @ 2011-07-21 21:36 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: mingo, linux-kernel, johnstul, tony.luck, fenghua.yu, tglx, hpa,
	clemens, linux-tip-commits, Arnd Bergmann,
	Linux Arch Mailing List

On Thu, Jul 21, 2011 at 5:25 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 07/21/2011 02:22 PM, Andrew Lutomirski wrote:
>>
>> Presumably this needs a matching fix:
>>
>> http://git.kernel.org/?p=linux/kernel/git/tip/linux-tip.git;a=commit;h=574c44fa8fa6262ffd5939789ef51a6e98ed62d7
>>
>> (Also, none of the IA-64 maintainers have replied to any of my
>> requests for review.)
>>
>
> What do you mean, "matching fix"?  The fix I posted should work on x86
> and ia64.
>

*sigh* I read it wrong.  Never mind.

--Andy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [tip:x86/vdso] clocksource: Replace vread with generic arch data
  2011-07-21 21:36             ` Andrew Lutomirski
@ 2011-07-21 21:42               ` H. Peter Anvin
  0 siblings, 0 replies; 8+ messages in thread
From: H. Peter Anvin @ 2011-07-21 21:42 UTC (permalink / raw)
  To: Andrew Lutomirski
  Cc: mingo, linux-kernel, johnstul, tony.luck, fenghua.yu, tglx, hpa,
	clemens, linux-tip-commits, Arnd Bergmann,
	Linux Arch Mailing List

On 07/21/2011 02:36 PM, Andrew Lutomirski wrote:
>>
>> What do you mean, "matching fix"?  The fix I posted should work on x86
>> and ia64.
>>
> 
> *sigh* I read it wrong.  Never mind.
> 

That's ok, better to say something and be wrong than to not say
something and be right...

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-07-21 21:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <3ae5ec76a168eaaae63f08a2a1060b91aa0b7759.1310563276.git.luto@mit.edu>
     [not found] ` <tip-433bd805e5fd2c731b3a9025b034f066272d336e@git.kernel.org>
2011-07-21 20:23   ` [tip:x86/vdso] clocksource: Replace vread with generic arch data H. Peter Anvin
2011-07-21 20:23     ` H. Peter Anvin
2011-07-21 20:49     ` Andrew Lutomirski
2011-07-21 20:59       ` H. Peter Anvin
2011-07-21 21:22         ` Andrew Lutomirski
2011-07-21 21:25           ` H. Peter Anvin
2011-07-21 21:36             ` Andrew Lutomirski
2011-07-21 21:42               ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).