2014-10-28 00:04:47

by Alexander Graf

[permalink] [raw]
Subject: [PATCH] Documentation: Restrict TSC test code to x86

The prctl test code in Documentation/ tries to show how to
use a call that only makes sense on x86. Restrict it there
so that other platforms don't try to call asm("rdtsc").

Signed-off-by: Alexander Graf <[email protected]>
---
Documentation/prctl/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/prctl/Makefile b/Documentation/prctl/Makefile
index 3e3232d..2948b7b 100644
--- a/Documentation/prctl/Makefile
+++ b/Documentation/prctl/Makefile
@@ -1,5 +1,5 @@
# List of programs to build
-hostprogs-y := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test disable-tsc-test
+hostprogs-$(CONFIG_X86) := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test disable-tsc-test
# Tell kbuild to always build the programs
always := $(hostprogs-y)

--
2.1.0


2014-10-28 00:08:13

by Peter Foley

[permalink] [raw]
Subject: Re: [PATCH] Documentation: Restrict TSC test code to x86

On Mon, Oct 27, 2014 at 8:03 PM, Alexander Graf <[email protected]> wrote:
> The prctl test code in Documentation/ tries to show how to
> use a call that only makes sense on x86. Restrict it there
> so that other platforms don't try to call asm("rdtsc").
>
> Signed-off-by: Alexander Graf <[email protected]>

Acked-by: Peter Foley <[email protected]>

2014-10-28 12:47:39

by Jonathan Corbet

[permalink] [raw]
Subject: Re: [PATCH] Documentation: Restrict TSC test code to x86

On Mon, 27 Oct 2014 20:07:51 -0400
Peter Foley <[email protected]> wrote:

> > The prctl test code in Documentation/ tries to show how to
> > use a call that only makes sense on x86. Restrict it there
> > so that other platforms don't try to call asm("rdtsc").
> >
> > Signed-off-by: Alexander Graf <[email protected]>
>
> Acked-by: Peter Foley <[email protected]>

Snagged into the docs tree, thanks.

jon

2014-10-28 13:12:46

by Alexander Graf

[permalink] [raw]
Subject: Re: [PATCH] Documentation: Restrict TSC test code to x86




> Am 28.10.2014 um 13:47 schrieb Jonathan Corbet <[email protected]>:
>
> On Mon, 27 Oct 2014 20:07:51 -0400
> Peter Foley <[email protected]> wrote:
>
>>> The prctl test code in Documentation/ tries to show how to
>>> use a call that only makes sense on x86. Restrict it there
>>> so that other platforms don't try to call asm("rdtsc").
>>>
>>> Signed-off-by: Alexander Graf <[email protected]>
>>
>> Acked-by: Peter Foley <[email protected]>
>
> Snagged into the docs tree, thanks.

Awesome, please make sure this makes it into 3.18 - the build is broken on non-x86 archs there ;).

Alex

2014-11-01 12:03:27

by Matwey V. Kornilov

[permalink] [raw]
Subject: Re: [PATCH] Documentation: Restrict TSC test code to x86

28.10.2014 16:12, Alexander Graf пишет:
>
>
>
>> Am 28.10.2014 um 13:47 schrieb Jonathan Corbet <[email protected]>:
>>
>> On Mon, 27 Oct 2014 20:07:51 -0400
>> Peter Foley <[email protected]> wrote:
>>
>>>> The prctl test code in Documentation/ tries to show how to
>>>> use a call that only makes sense on x86. Restrict it there
>>>> so that other platforms don't try to call asm("rdtsc").
>>>>
>>>> Signed-off-by: Alexander Graf <[email protected]>
>>>
>>> Acked-by: Peter Foley <[email protected]>
>>
>> Snagged into the docs tree, thanks.
>
> Awesome, please make sure this makes it into 3.18 - the build is broken on non-x86 archs there ;).
>
> Alex
>

Hi,

Sorry for criticism, but the patch is not complete.
CONFIG_X86 deals with target architecture, at the same time the problem
deals with the host architecture.

Imagine, that I run arm, aarch64 or something else and do
cross-compiling kernel for x86 on it. Then CONFIG_X86 will evaluate to
'y' and make will try to compile the apps with the host-compiler, which
is not x86 one.

2014-11-01 21:16:50

by Alexander Graf

[permalink] [raw]
Subject: Re: [PATCH] Documentation: Restrict TSC test code to x86



On 01.11.14 13:03, Matwey V. Kornilov wrote:
> 28.10.2014 16:12, Alexander Graf пишет:
>>
>>
>>
>>> Am 28.10.2014 um 13:47 schrieb Jonathan Corbet <[email protected]>:
>>>
>>> On Mon, 27 Oct 2014 20:07:51 -0400
>>> Peter Foley <[email protected]> wrote:
>>>
>>>>> The prctl test code in Documentation/ tries to show how to
>>>>> use a call that only makes sense on x86. Restrict it there
>>>>> so that other platforms don't try to call asm("rdtsc").
>>>>>
>>>>> Signed-off-by: Alexander Graf <[email protected]>
>>>>
>>>> Acked-by: Peter Foley <[email protected]>
>>>
>>> Snagged into the docs tree, thanks.
>>
>> Awesome, please make sure this makes it into 3.18 - the build is broken on non-x86 archs there ;).
>>
>> Alex
>>
>
> Hi,
>
> Sorry for criticism, but the patch is not complete.
> CONFIG_X86 deals with target architecture, at the same time the problem
> deals with the host architecture.
>
> Imagine, that I run arm, aarch64 or something else and do
> cross-compiling kernel for x86 on it. Then CONFIG_X86 will evaluate to
> 'y' and make will try to compile the apps with the host-compiler, which
> is not x86 one.

Good point. Any ideas how I can easily limit this to x86 hosts?


Alex

2014-11-02 07:46:35

by Matwey V. Kornilov

[permalink] [raw]
Subject: Re: [PATCH] Documentation: Restrict TSC test code to x86

I wish I knew. We need KBuild guru to ask how to take into account
host architecture.


2014-11-02 0:16 GMT+03:00 Alexander Graf <[email protected]>:
>
>
> On 01.11.14 13:03, Matwey V. Kornilov wrote:
>> 28.10.2014 16:12, Alexander Graf пишет:
>>>
>>>
>>>
>>>> Am 28.10.2014 um 13:47 schrieb Jonathan Corbet <[email protected]>:
>>>>
>>>> On Mon, 27 Oct 2014 20:07:51 -0400
>>>> Peter Foley <[email protected]> wrote:
>>>>
>>>>>> The prctl test code in Documentation/ tries to show how to
>>>>>> use a call that only makes sense on x86. Restrict it there
>>>>>> so that other platforms don't try to call asm("rdtsc").
>>>>>>
>>>>>> Signed-off-by: Alexander Graf <[email protected]>
>>>>>
>>>>> Acked-by: Peter Foley <[email protected]>
>>>>
>>>> Snagged into the docs tree, thanks.
>>>
>>> Awesome, please make sure this makes it into 3.18 - the build is broken on non-x86 archs there ;).
>>>
>>> Alex
>>>
>>
>> Hi,
>>
>> Sorry for criticism, but the patch is not complete.
>> CONFIG_X86 deals with target architecture, at the same time the problem
>> deals with the host architecture.
>>
>> Imagine, that I run arm, aarch64 or something else and do
>> cross-compiling kernel for x86 on it. Then CONFIG_X86 will evaluate to
>> 'y' and make will try to compile the apps with the host-compiler, which
>> is not x86 one.
>
> Good point. Any ideas how I can easily limit this to x86 hosts?
>
>
> Alex



--
With best regards,
Matwey V. Kornilov
http://blog.matwey.name
xmpp://[email protected]

2014-11-02 08:16:54

by Alexander Graf

[permalink] [raw]
Subject: Re: [PATCH] Documentation: Restrict TSC test code to x86



On 02.11.14 08:46, Matwey V. Kornilov wrote:
> I wish I knew. We need KBuild guru to ask how to take into account
> host architecture.

Hrm. At least this patch makes things more consistent with the other
Documentation makefiles:

Documentation/timers/Makefile:hostprogs-$(CONFIG_X86) := hpet_example
Documentation/vDSO/Makefile:hostprogs-$(CONFIG_X86) :=
vdso_standalone_test_x86

But I agree, it is wrong in general - hostprogs should make sure the
host arch matches.

We could maybe just evaluate the host uname output:

ifeq ($(shell uname -m),x86_64)
hostprogs-$(CONFIG_X86) := ...
endif

Then we're double safe ;). Not sure how to easily add x86 to the mix as
well here, but I'm not sure anyone cares. Do people still compile on
32bit x86 hosts? And expect Documentation/ examples to build?


Alex

2014-11-02 10:29:03

by Matwey V. Kornilov

[permalink] [raw]
Subject: Re: [PATCH] Documentation: Restrict TSC test code to x86

I've added Yann and Michal to the discussion.

The issue is that we have

hostprogs-y := disable-tsc-ctxt-sw-stress-test
disable-tsc-on-off-stress-test disable-tsc-test

in Documentation/prctl/Makefile

and disable-tsc-ctxt-sw-stress-test has x86 assembler inside and must
be restricted only to this host architecture.


2014-11-02 11:16 GMT+03:00 Alexander Graf <[email protected]>:
>
>
> On 02.11.14 08:46, Matwey V. Kornilov wrote:
>> I wish I knew. We need KBuild guru to ask how to take into account
>> host architecture.
>
> Hrm. At least this patch makes things more consistent with the other
> Documentation makefiles:
>
> Documentation/timers/Makefile:hostprogs-$(CONFIG_X86) := hpet_example
> Documentation/vDSO/Makefile:hostprogs-$(CONFIG_X86) :=
> vdso_standalone_test_x86
>
> But I agree, it is wrong in general - hostprogs should make sure the
> host arch matches.
>
> We could maybe just evaluate the host uname output:
>
> ifeq ($(shell uname -m),x86_64)
> hostprogs-$(CONFIG_X86) := ...
> endif
>
> Then we're double safe ;). Not sure how to easily add x86 to the mix as
> well here, but I'm not sure anyone cares. Do people still compile on
> 32bit x86 hosts? And expect Documentation/ examples to build?
>
>
> Alex



--
With best regards,
Matwey V. Kornilov
http://blog.matwey.name
xmpp://[email protected]