Skip to contentSkip to conversation

Documentation: Restrict TSC test code to x86

PATCH In review Alexander Graf 4 participants 9 messages Oct 28, 2014 – Nov 2, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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").

---
 Documentation/prctl/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/prctl/Makefile +1 -1
index 3e3232d..2948b7b 100644
@@ -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)
 
Signature · 1 line
2.1.0
#3 lore raw
Quoted 12 lines

Am 28.10.2014 um 13:47 schrieb Jonathan Corbet <[email protected]>:

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

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

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

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

#4 lore raw

28.10.2014 16:12, Alexander Graf пишет:

Quoted 14 lines
Quoted 14 lines

Am 28.10.2014 um 13:47 schrieb Jonathan Corbet <[email protected]>:

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

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

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

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.

#5 lore raw
Quoted 26 lines · Matwey V. Kornilov

28.10.2014 16:12, Alexander Graf пишет:

Quoted 14 lines
Quoted 14 lines

Am 28.10.2014 um 13:47 schrieb Jonathan Corbet <[email protected]>:

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

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

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

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,

Quoted 8 lines

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

#6 lore raw

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]>:

Quoted 42 lines · Matwey V. Kornilov
Quoted 26 lines

28.10.2014 16:12, Alexander Graf пишет:

Quoted 14 lines
Quoted 14 lines

Am 28.10.2014 um 13:47 schrieb Jonathan Corbet <[email protected]>:

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

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

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

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,

Quoted 8 lines

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

Signature · 4 lines
With best regards,
Matwey V. Kornilov
http://blog.matwey.name
xmpp://[email protected]
#7 lore raw
Quoted 2 lines · Matwey V. Kornilov

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

#8 lore raw

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]>:

Quoted 28 lines · Matwey V. Kornilov
Quoted 2 lines

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

Signature · 4 lines
With best regards,
Matwey V. Kornilov
http://blog.matwey.name
xmpp://[email protected]