Skip to contentSkip to conversation

Revert "ptrace07: Fix compilation when not on x86"

PATCH Applied Richard Palethorpe via ltp 4 participants 5 messages Oct 24, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Revert "ptrace07: Fix compilation when not on x86"

Empty macro could lead to confusing tests failures. This needs to be handled differently.

This reverts commit acf485f199347fc270a7da7e33e7635f9e78b6c7.

---
 include/lapi/cpuid.h | 4 ----
 1 file changed, 4 deletions(-)
include/lapi/cpuid.h +0 -4
index 20e977093..cd0567f92 100644
@@ -16,15 +16,11 @@
  * have __cpuid_count().
  */
 #ifndef __cpuid_count
-#  if defined(__i386__) || defined(__x86_64__)
 #define __cpuid_count(level, count, a, b, c, d) ({			\
 	__asm__ __volatile__ ("cpuid\n\t"				\
 			      : "=a" (a), "=b" (b), "=c" (c), "=d" (d)	\
 			      : "0" (level), "2" (count));		\
 })
-#  else
-#define __cpuid_count(level, count, a, b, c, d)
-#  endif
 #endif
 
 #endif /* LAPI_CPUID_H__ */
Signature · 5 lines
2.36.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

PATCH 2/2 cpuid/ptrace07: Only compile on x86_64

Both cpuid.h and ptrace07 contain inline ASM for x86(_64). There is no need to compile any part of the test or cpuid.h

---
 include/lapi/cpuid.h                        |  4 ++++
 testcases/kernel/syscalls/ptrace/ptrace07.c | 11 ++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)
include/lapi/cpuid.h +4 -0
index cd0567f92..7ec785ecf 100644
@@ -1,5 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 
+#if !(defined(__i386__) || defined(__x86_64__))
+#  error "cpuid.h should only be included on x86"
+#endif
+
 #ifdef HAVE_CPUID_H
 #  include <cpuid.h>
 #endif
testcases/kernel/syscalls/ptrace/ptrace07.c +8 -3
index d1e68cbc6..362cee543 100644
@@ -24,6 +24,10 @@
  * know about the architecture-dependent FPU state.
  */
 
+#include "tst_test.h"
+
+#ifdef __x86_64__
+
 #include <errno.h>
 #include <inttypes.h>
 #include <sched.h>
@@ -34,7 +38,6 @@
 
 #include "config.h"
 #include "ptrace.h"
-#include "tst_test.h"
 #include "tst_safe_macros.h"
 #include "lapi/cpuid.h"
 
@@ -60,7 +63,6 @@ static void check_regs_loop(uint32_t initval)
 	uint32_t xmm0[4] = { initval, initval, initval, initval };
 	int status = 1;
 
-#ifdef __x86_64__
 	asm volatile("   movdqu %0, %%xmm0\n"
 		     "   mov %0, %%rbx\n"
 		     "1: dec %2\n"
@@ -74,7 +76,6 @@ static void check_regs_loop(uint32_t initval)
 		     "3:\n"
 		     : "+m" (xmm0), "+r" (status)
 		     : "r" (num_iters) : "rax", "rbx", "xmm0");
-#endif
 
 	if (status) {
 		tst_res(TFAIL,
@@ -212,3 +213,7 @@ static struct tst_test test = {
 	}
 
 };
+
+#else
+TST_TEST_TCONF("Tests an x86_64 feature");
+#endif	/* if x86 */
Signature · 5 lines
2.36.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Acked-by on v1 2/2
#2 lore raw

Re: [LTP] [PATCH 2/2] cpuid/ptrace07: Only compile on x86_64

Quoted 6 lines · Richard Palethorpe via ltp

Both cpuid.h and ptrace07 contain inline ASM for x86(_64). There is no need to compile any part of the test or cpuid.h

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Acked-by on v1 2/2
#3 lore raw

Re: [LTP] [PATCH 2/2] cpuid/ptrace07: Only compile on x86_64

In reply to Richard Palethorpe via ltp
Quoted 5 lines · Richard Palethorpe

Both cpuid.h and ptrace07 contain inline ASM for x86(_64). There is no need to compile any part of the test or cpuid.h

Hi,
for both patches:

Signature · 11 lines
Martin Doucha   [email protected]
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

Re: [LTP] [PATCH 2/2] cpuid/ptrace07: Only compile on x86_64

Hello,

Quoted 10 lines · Martin Doucha
Quoted 4 lines · Richard Palethorpe

Both cpuid.h and ptrace07 contain inline ASM for x86(_64). There is no need to compile any part of the test or cpuid.h

Hi,
for both patches:

Merged, Thanks!

Signature · 5 lines
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp