public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] Revert "ptrace07: Fix compilation when not on x86"
@ 2022-10-24 10:38 Richard Palethorpe via ltp
  2022-10-24 10:38 ` [LTP] [PATCH 2/2] cpuid/ptrace07: Only compile on x86_64 Richard Palethorpe via ltp
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Palethorpe via ltp @ 2022-10-24 10:38 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe, Martin Doucha

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

This reverts commit acf485f199347fc270a7da7e33e7635f9e78b6c7.

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
Suggested-by: Martin Doucha <martin.doucha@suse.com>
---
 include/lapi/cpuid.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/lapi/cpuid.h b/include/lapi/cpuid.h
index 20e977093..cd0567f92 100644
--- a/include/lapi/cpuid.h
+++ b/include/lapi/cpuid.h
@@ -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__ */
-- 
2.36.1


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

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

* [LTP] [PATCH 2/2] cpuid/ptrace07: Only compile on x86_64
  2022-10-24 10:38 [LTP] [PATCH 1/2] Revert "ptrace07: Fix compilation when not on x86" Richard Palethorpe via ltp
@ 2022-10-24 10:38 ` Richard Palethorpe via ltp
  2022-10-24 10:44   ` Jan Stancek
  2022-10-24 13:41   ` Martin Doucha
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Palethorpe via ltp @ 2022-10-24 10:38 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe, Martin Doucha

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

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
Suggested-by: Martin Doucha <martin.doucha@suse.com>
---
 include/lapi/cpuid.h                        |  4 ++++
 testcases/kernel/syscalls/ptrace/ptrace07.c | 11 ++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/lapi/cpuid.h b/include/lapi/cpuid.h
index cd0567f92..7ec785ecf 100644
--- a/include/lapi/cpuid.h
+++ b/include/lapi/cpuid.h
@@ -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
diff --git a/testcases/kernel/syscalls/ptrace/ptrace07.c b/testcases/kernel/syscalls/ptrace/ptrace07.c
index d1e68cbc6..362cee543 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace07.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace07.c
@@ -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 */
-- 
2.36.1


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

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

* Re: [LTP] [PATCH 2/2] cpuid/ptrace07: Only compile on x86_64
  2022-10-24 10:38 ` [LTP] [PATCH 2/2] cpuid/ptrace07: Only compile on x86_64 Richard Palethorpe via ltp
@ 2022-10-24 10:44   ` Jan Stancek
  2022-10-24 13:41   ` Martin Doucha
  1 sibling, 0 replies; 5+ messages in thread
From: Jan Stancek @ 2022-10-24 10:44 UTC (permalink / raw)
  To: Richard Palethorpe; +Cc: Martin Doucha, ltp

On Mon, Oct 24, 2022 at 12:39 PM Richard Palethorpe via ltp
<ltp@lists.linux.it> wrote:
>
> 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
>
> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
> Suggested-by: Martin Doucha <martin.doucha@suse.com>

Acked-by: Jan Stancek <jstancek@redhat.com>


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

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

* Re: [LTP] [PATCH 2/2] cpuid/ptrace07: Only compile on x86_64
  2022-10-24 10:38 ` [LTP] [PATCH 2/2] cpuid/ptrace07: Only compile on x86_64 Richard Palethorpe via ltp
  2022-10-24 10:44   ` Jan Stancek
@ 2022-10-24 13:41   ` Martin Doucha
  2022-10-24 14:25     ` Richard Palethorpe
  1 sibling, 1 reply; 5+ messages in thread
From: Martin Doucha @ 2022-10-24 13:41 UTC (permalink / raw)
  To: Richard Palethorpe, ltp; +Cc: Martin Doucha

On 24. 10. 22 12:38, Richard Palethorpe wrote:
> 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
> 
> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
> Suggested-by: Martin Doucha <martin.doucha@suse.com>

Hi,
for both patches:

Acked-by: Martin Doucha <martin.doucha@suse.com>

-- 
Martin Doucha   mdoucha@suse.cz
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

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

* Re: [LTP] [PATCH 2/2] cpuid/ptrace07: Only compile on x86_64
  2022-10-24 13:41   ` Martin Doucha
@ 2022-10-24 14:25     ` Richard Palethorpe
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Palethorpe @ 2022-10-24 14:25 UTC (permalink / raw)
  To: Martin Doucha; +Cc: Martin Doucha, ltp

Hello,

Martin Doucha <mdoucha@suse.cz> writes:

> On 24. 10. 22 12:38, Richard Palethorpe wrote:
>> 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
>> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
>> Suggested-by: Martin Doucha <martin.doucha@suse.com>
>
> Hi,
> for both patches:
>
> Acked-by: Martin Doucha <martin.doucha@suse.com>

Merged, Thanks!
-- 
Thank you,
Richard.

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

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

end of thread, other threads:[~2022-10-24 14:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-24 10:38 [LTP] [PATCH 1/2] Revert "ptrace07: Fix compilation when not on x86" Richard Palethorpe via ltp
2022-10-24 10:38 ` [LTP] [PATCH 2/2] cpuid/ptrace07: Only compile on x86_64 Richard Palethorpe via ltp
2022-10-24 10:44   ` Jan Stancek
2022-10-24 13:41   ` Martin Doucha
2022-10-24 14:25     ` Richard Palethorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox