Skip to contentSkip to conversation

xsave/xrstor compilation error

Xenomai Jean-Baptiste Tredez 3 participants 6 messages Oct 24, 2013 – Oct 25, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

I tried to upgrade to xenomai 2.6.3 and compilation failed with :

linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h: Assembler messages:
linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h:305: Error: no such instruction: xrstor (%ebx)' linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h:245: Error: no such instruction: xsave (%esi)' linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h:305: Error: no such instruction: xrstor (%ecx)' linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h:245: Error: no such instruction: xsave (%ecx)' linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h:245: Error: no such instruction: xsave (%ecx)' linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h:245: Error: no such instruction: xsave (%ebx)'

I am using kernel 2.6.38.8 with adeos-ipipe-2.6.38.8-x86-2.11-03.patch. I used binutils-2.18.1 and gcc-4.3.2.
With a more recent toolchain, there is no compilation failure. Is there a new minimal binutils/gcc version for xenomai 2.6.3 ?

Regards,

Jean-Baptiste

#1 lore raw
Quoted 18 lines · Jean-Baptiste Tredez

Hi,

I tried to upgrade to xenomai 2.6.3 and compilation failed with :

linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h: Assembler messages:
linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h:305: Error: no such instruction: xrstor (%ebx)' linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h:245: Error: no such instruction: xsave (%esi)' linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h:305: Error: no such instruction: xrstor (%ecx)' linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h:245: Error: no such instruction: xsave (%ecx)' linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h:245: Error: no such instruction: xsave (%ecx)' linux-2.6.38.8/arch/x86/include/asm/xenomai/bits/pod.h:245: Error: no such instruction: xsave (%ebx)'

Quoted 4 lines

I am using kernel 2.6.38.8 with adeos-ipipe-2.6.38.8-x86-2.11-03.patch. I used binutils-2.18.1 and gcc-4.3.2.
With a more recent toolchain, there is no compilation failure. Is there a new minimal binutils/gcc version for xenomai 2.6.3 ?

For x86, some binutils released about 5 years ago (2.20 should be fine, maybe even 2.19). Is upgrading the toolchain not feasible for you? We can, of course, replace the instructions with their obcodes (like the kernel does), just makes the code more ugly.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
#2 lore raw
Quoted 3 lines · Jan Kiszka

We
can, of course, replace the instructions with their obcodes (like the kernel does), just makes the code more ugly.

Jan, please do this, even if it makes the code more ugly, it makes sense for the 2.6.3 release to continue working with the tools it already supported. No question for -forge, but we try hard to keep ABI compatibility so that users can upgrade xenomai without even recompiling their application, it does not make sense to suddenly stop working with a toolchain which always worked before.

Signature · 1 line
					    Gilles.
#3 lore raw
Quoted 11 lines · Gilles Chanteperdrix
Quoted 3 lines · Jan Kiszka

We
can, of course, replace the instructions with their obcodes (like the kernel does), just makes the code more ugly.

Jan, please do this, even if it makes the code more ugly, it makes sense for the 2.6.3 release to continue working with the tools it already supported. No question for -forge, but we try hard to keep ABI compatibility so that users can upgrade xenomai without even recompiling their application, it does not make sense to suddenly stop working with a toolchain which always worked before.

In fact, we already have legacy gas support: all these new instructions are wrapped with CONFIG_AS_AVX, and only if that is set we use the new assembler instructions. Given that this CONFIG has to be set based on some test, something seems to go wrong in the kernel build over there. But that's outside of the Xenomai scope. I'm currently trying to find out if there was some related kernel issue back then.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
#4 lore raw
Quoted 13 lines · Jan Kiszka
Quoted 11 lines · Gilles Chanteperdrix
Quoted 3 lines · Jan Kiszka

We
can, of course, replace the instructions with their obcodes (like the kernel does), just makes the code more ugly.

Jan, please do this, even if it makes the code more ugly, it makes sense for the 2.6.3 release to continue working with the tools it already supported. No question for -forge, but we try hard to keep ABI compatibility so that users can upgrade xenomai without even recompiling their application, it does not make sense to suddenly stop working with a toolchain which always worked before.

Quoted 6 lines

In fact, we already have legacy gas support: all these new instructions are wrapped with CONFIG_AS_AVX, and only if that is set we use the new assembler instructions. Given that this CONFIG has to be set based on some test, something seems to go wrong in the kernel build over there. But that's outside of the Xenomai scope. I'm currently trying to find out if there was some related kernel issue back then.

OK, something likely went wrong in my brain back then while I tried to make this build for all the combinations. I can't recall what those CONFIG_X86_64 tests were for. This should build and in theory also work:

include/asm-x86/bits/pod.h +2 -2
index a32575f..c6fbcee 100644
@@ -241,7 +241,7 @@ static inline void __save_i387(x86_fpustate *fpup)
 {
 #ifdef cpu_has_xsave
 	if (cpu_has_xsave) {
-#if defined(CONFIG_AS_AVX) || !defined CONFIG_X86_64
+#if defined(CONFIG_AS_AVX)
 		asm volatile("xsave" XSAVE_SUFFIX " %0"
 			     : "=m" (fpup->xsave) : "a" (-1), "d" (-1)
 			     : "memory");
@@ -301,7 +301,7 @@ static inline void __restore_i387(x86_fpustate *fpup)
 {
 #ifdef cpu_has_xsave
 	if (cpu_has_xsave) {
-#if defined(CONFIG_AS_AVX) || !defined(CONFIG_X86_64)
+#if defined(CONFIG_AS_AVX)
 		asm volatile("xrstor" XSAVE_SUFFIX " %0"
 			     : : "m" (fpup->xsave), "a" (-1), "d" (-1)
 			     : "memory");

Jean-Baptiste, do you happen to have an xsave-capable box at hand to test this (/proc/cpuinfo shows the available features)? Xenomai's switchtest will stress the code.

Thanks,
Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
#5 lore raw
Quoted 45 lines · Jan Kiszka
Quoted 11 lines · Jan Kiszka
Quoted 10 lines · Gilles Chanteperdrix
Quoted 3 lines · Jan Kiszka

We
can, of course, replace the instructions with their obcodes (like the kernel does), just makes the code more ugly.

Jan, please do this, even if it makes the code more ugly, it makes sense for the 2.6.3 release to continue working with the tools it already supported. No question for -forge, but we try hard to keep ABI compatibility so that users can upgrade xenomai without even recompiling their application, it does not make sense to suddenly stop working with a toolchain which always worked before.

Quoted 6 lines

In fact, we already have legacy gas support: all these new instructions are wrapped with CONFIG_AS_AVX, and only if that is set we use the new assembler instructions. Given that this CONFIG has to be set based on some test, something seems to go wrong in the kernel build over there. But that's outside of the Xenomai scope. I'm currently trying to find out if there was some related kernel issue back then.

OK, something likely went wrong in my brain back then while I tried to make this build for all the combinations. I can't recall what those CONFIG_X86_64 tests were for. This should build and in theory also work:

include/asm-x86/bits/pod.h +2 -2
index a32575f..c6fbcee 100644
@@ -241,7 +241,7 @@ static inline void __save_i387(x86_fpustate *fpup)
  {
  #ifdef cpu_has_xsave
  	if (cpu_has_xsave) {
-#if defined(CONFIG_AS_AVX) || !defined CONFIG_X86_64
+#if defined(CONFIG_AS_AVX)
  		asm volatile("xsave" XSAVE_SUFFIX " %0"
  			     : "=m" (fpup->xsave) : "a" (-1), "d" (-1)
  			     : "memory");
@@ -301,7 +301,7 @@ static inline void __restore_i387(x86_fpustate *fpup)
  {
  #ifdef cpu_has_xsave
  	if (cpu_has_xsave) {
-#if defined(CONFIG_AS_AVX) || !defined(CONFIG_X86_64)
+#if defined(CONFIG_AS_AVX)
  		asm volatile("xrstor" XSAVE_SUFFIX " %0"
  			     : : "m" (fpup->xsave), "a" (-1), "d" (-1)
  			     : "memory");
Quoted 7 lines

Jean-Baptiste, do you happen to have an xsave-capable box at hand to test this (/proc/cpuinfo shows the available features)? Xenomai's switchtest will stress the code.

Thanks,
Jan

No, I do not have an xsave-capable box (no xsave or avx flag, only fxsr). This patch works fine here.

Jean-Baptiste