Skip to contentSkip to conversation

Fixes related to toolchain / libc update

PATCH New Jan Kiszka 1 participant 8 messages Oct 16, 2025

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

v2 cover Fixes related to toolchain / libc update

Changes in v2:
- added patch to make sched-quota test more reliable
- addressed review comments on v1 (commit message fixes, __always_inline)

Fixes that where found via the trixie update in xenomai-images and some cleanups. Most affect ARM 32-bit, the last-but-one also 32-bit x86.

While the patches do not change the ABI and would therefore be backport candidates, I will likely only pick patches 3, 5 and 7 for stable.

Which means that current stable versions of Xenomai should remain careful before updating their toolchains or libc versions for ARM and 32-bit x86.

Jan

Jan Kiszka (7):
testsuite/switchtest: Avoid including arch-specific syscall header lib/cobalt: arm: Avoid thumb mode in syscall-issuing modules
arm: fptest: Ensure that fp_regs_set/check functions are truly inline kernel/cobalt: Optimize xndebug_trace_relax implementation lib/cobalt: arm: Skip SIGSHADOW_ACTION_BACKTRACE over asynchronous
signals
lib/cobalt: x86: Fix and simplify 32-bit syscall argument setup testsuite/smokey/sched-quota: Make workload more predictable

 configure.ac                                  |  1 +
 .../arm/include/asm/xenomai/uapi/fptest.h     |  9 ++-
 kernel/cobalt/debug.c                         | 11 ++-
 kernel/cobalt/debug.h                         |  5 +-
 kernel/cobalt/thread.c                        |  2 +-
 .../arch/arm/include/asm/xenomai/Makefile.am  |  1 +
 .../arch/arm/include/asm/xenomai/debug.h      | 27 +++++++
 .../arch/arm/include/asm/xenomai/syscall.h    | 17 +++--
 .../arm64/include/asm/xenomai/Makefile.am     |  1 +
 .../arch/arm64/include/asm/xenomai/debug.h    | 18 +++++
 .../arch/x86/include/asm/xenomai/Makefile.am  |  1 +
 .../arch/x86/include/asm/xenomai/debug.h      | 18 +++++
 .../arch/x86/include/asm/xenomai/syscall.h    | 71 ++-----------------
 lib/cobalt/sigshadow.c                        | 12 ++--
 testsuite/smokey/sched-quota/sched-quota.c    |  2 +
 testsuite/switchtest/switchtest.c             |  2 +-
 16 files changed, 113 insertions(+), 85 deletions(-)
 create mode 100644 lib/cobalt/arch/arm/include/asm/xenomai/debug.h
 create mode 100644 lib/cobalt/arch/arm64/include/asm/xenomai/debug.h
 create mode 100644 lib/cobalt/arch/x86/include/asm/xenomai/debug.h
Signature · 1 line
2.51.0
author
#1 lore raw

PATCH v2 1/7 testsuite/switchtest: Avoid including arch-specific syscall header

From: Jan Kiszka <[email protected]>

We only need the generic one, and the arch-specific one will soon require non-thumb mode from its users.

---
 testsuite/switchtest/switchtest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testsuite/switchtest/switchtest.c +1 -1
index 434004450a..a2ff42dcfd 100644
@@ -37,8 +37,8 @@
 #include <getopt.h>
 #include <asm/unistd.h>
 #include <asm/xenomai/features.h>
-#include <asm/xenomai/syscall.h>
 #include <asm/xenomai/uapi/fptest.h>
+#include <cobalt/uapi/asm-generic/syscall.h>
 #include <cobalt/trace.h>
 #include <rtdm/testing.h>
 #include <sys/cobalt.h>
Signature · 1 line
2.51.0
author
#2 lore raw

PATCH v2 2/7 lib/cobalt: arm: Avoid thumb mode in syscall-issuing modules

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

In 4abd59b4e3e4, we noticed the clash between r7 usage for setting up Xenomai syscalls and the compiler suddenly refusing this. What was not clear at that point was the origin of the clash: if the compiler is configured to prefer thumb mode over regular 32-bit ARM instructions, it also starts to claim r7 as frame pointer.

Now, the solution taken back then turned out to have a problem: It broke stack unwinding. That is not only an issue when debugging, it is actually required for pthread_cancel and pthread_exit. The glibc will use unwinding to call destructors of the terminating context to call them before shutting down. This broke when we were inside a syscall because r7 was then pointing to the syscall number.

Most glibc versions detected the broken call chain and simply skipped the destructors - which was still a problem, just unnoticed. But with recent glibc from trixie, we are now even crashing while unwinding, and that is even less acceptable.

We could now either use the pattern of glibc to push the syscall invocation into an assembly function - or simply enforce ARM mode for libcobalt so that r7 become usable again. Take the latter approach as it is leaner.

Fixes 4abd59b4e3e4 ("lib/cobalt: arm: Account for register allocation clash")
---
 configure.ac                                    |  1 +
 .../arch/arm/include/asm/xenomai/syscall.h      | 17 +++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)
configure.ac +1 -0
index a28d80a5e0..c1214bda88 100644
@@ -937,6 +937,7 @@ if test $rtcore_type = cobalt; then
    XENO_COBALT_CFLAGS="$XENO_USER_CFLAGS"
    case "$build_for" in
     i*86*-*) XENO_COBALT_CFLAGS="$XENO_COBALT_CFLAGS -fno-omit-frame-pointer";;
+    arm*-*) XENO_COBALT_CFLAGS="$XENO_COBALT_CFLAGS -marm";;
     esac
 
 dnl Build wrapping information. XENO_POSIX_WRAPPERS lists all wrapping
lib/cobalt/arch/arm/include/asm/xenomai/syscall.h +11 -6
index 105bf9faf1..1fc605b1ba 100644
@@ -29,6 +29,10 @@
 #error "ARM OABI support has been removed with Xenomai 3.3.x"
 #endif
 
+#ifdef __thumb__
+#error "Xenomai syscalls cannot be issued in Thumb mode"
+#endif
+
 /*
  * Some of the following macros have been adapted from Linux's
  * implementation of the syscall mechanism in <asm-arm/unistd.h>:
@@ -54,8 +58,8 @@
 	LOADARGS_4(syscode, arg1, arg2, arg3, arg4);		\
 	__a4 = (unsigned long) (arg5)
 
-#define CLOBBER_REGS_0
-#define CLOBBER_REGS_1 "r0"
+#define CLOBBER_REGS_0 "r7"
+#define CLOBBER_REGS_1 CLOBBER_REGS_0, "r0"
 #define CLOBBER_REGS_2 CLOBBER_REGS_1, "r1"
 #define CLOBBER_REGS_3 CLOBBER_REGS_2, "r2"
 #define CLOBBER_REGS_4 CLOBBER_REGS_3, "r3"
@@ -69,7 +73,8 @@
 #define LOADREGS_5 LOADREGS_4; __r4 = __a4
 
 #define ASM_INDECL_0							\
-	register unsigned long __r0  __asm__ ("r0");
+	register unsigned long __r0  __asm__ ("r0");			\
+	register unsigned long __r7  __asm__ ("r7");
 #define ASM_INDECL_1 ASM_INDECL_0;					\
 	unsigned long __a0;
 #define ASM_INDECL_2 ASM_INDECL_1;					\
@@ -91,15 +96,15 @@
 #define XENOMAI_DO_SYSCALL(nr, op, args...)				\
 	({								\
 		ASM_INDECL_##nr;					\
-		unsigned long __r7 = __xn_syscode(op);			\
 		LOADARGS_##nr(__xn_syscode(op), args);			\
 		__asm__ __volatile__ ("" : /* */ : /* */ :		\
 				      CLOBBER_REGS_##nr);		\
 		LOADREGS_##nr;						\
+		__r7 = __xn_syscode(op);				\
 		__asm__ __volatile__ (					\
-			"push {r7}; mov %%r7,%[__r7]; swi\t0; pop {r7}"	\
+			"swi 0"						\
 			: "=r" (__r0)					\
-			: ASM_INPUT_##nr, [__r7] "r" (__r7)		\
+			: ASM_INPUT_##nr, "r" (__r7)			\
 			: "memory");					\
 		(int) __r0;						\
 	})
Signature · 1 line
2.51.0
author
#3 lore raw

PATCH v2 3/7 arm: fptest: Ensure that fp_regs_set/check functions are truly inline

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

If they aren't, d8-d15 will be saved/restored, and that is ruining our tests.

---
 kernel/cobalt/arch/arm/include/asm/xenomai/uapi/fptest.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/cobalt/arch/arm/include/asm/xenomai/uapi/fptest.h +6 -3
index d5c2c7515b..2559f3525d 100644
@@ -18,9 +18,11 @@
 #ifndef _COBALT_ARM_ASM_UAPI_FPTEST_H
 #define _COBALT_ARM_ASM_UAPI_FPTEST_H
 
+#include <linux/stddef.h>
+
 #define __COBALT_HAVE_VFP  0x1
 
-static inline void fp_regs_set(int features, unsigned int val)
+static __always_inline void fp_regs_set(int features, unsigned int val)
 {
 	unsigned long long e[16];
 	unsigned int i;
@@ -41,8 +43,9 @@ static inline void fp_regs_set(int features, unsigned int val)
 	}
 }
 
-static inline unsigned int fp_regs_check(int features, unsigned int val,
-					 int (*report)(const char *fmt, ...))
+static __always_inline unsigned int
+fp_regs_check(int features, unsigned int val,
+	      int (*report)(const char *fmt, ...))
 {
 	unsigned int result = val, i;
 	unsigned long long e[16];
Signature · 1 line
2.51.0
author
#4 lore raw

PATCH v2 4/7 kernel/cobalt: Optimize xndebug_trace_relax implementation

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

There is no need to use xnthread_signal with its irq_work_queue here because the only caller of xndebug_trace_relax is already relaxed, and it is invoked over the target thread as well.

---
 kernel/cobalt/debug.c  | 11 ++++++++---
 kernel/cobalt/debug.h  |  5 ++---
 kernel/cobalt/thread.c |  2 +-
 3 files changed, 11 insertions(+), 7 deletions(-)
kernel/cobalt/debug.c +8 -3
index 25b194c263..3c7696e5ad 100644
@@ -196,10 +196,15 @@ DEFINE_PRIVATE_XNLOCK(relax_lock);
  * executable mappings that could be involved).
  */
 
-void xndebug_notify_relax(struct xnthread *thread, int reason)
+void xndebug_notify_relax(int reason)
 {
-	xnthread_signal(thread, SIGSHADOW,
-			  sigshadow_int(SIGSHADOW_ACTION_BACKTRACE, reason));
+	kernel_siginfo_t si;
+
+	memset(&si, 0, sizeof(si));
+	si.si_signo = SIGSHADOW;
+	si.si_code = SI_QUEUE;
+	si.si_int = sigshadow_int(SIGSHADOW_ACTION_BACKTRACE, reason);
+	send_sig_info(SIGSHADOW, &si, current);
 }
 
 void xndebug_trace_relax(int nr, unsigned long *backtrace,
kernel/cobalt/debug.h +2 -3
index 24dc354aa5..b759c76f51 100644
@@ -52,13 +52,12 @@ static inline void xndebug_shadow_init(struct xnthread *thread)
 #endif  /* !XENO_OPT_DEBUG */
 
 #ifdef CONFIG_XENO_OPT_DEBUG_TRACE_RELAX
-void xndebug_notify_relax(struct xnthread *thread,
-			  int reason);
+void xndebug_notify_relax(int reason);
 void xndebug_trace_relax(int nr, unsigned long *backtrace,
 			 int reason);
 #else
 static inline
-void xndebug_notify_relax(struct xnthread *thread, int reason)
+void xndebug_notify_relax(int reason)
 {
 }
 static inline
kernel/cobalt/thread.c +1 -1
index bdd0531404..607f115a7b 100644
@@ -2116,7 +2116,7 @@ void xnthread_relax(int notify, int reason)
 	if (xnthread_test_state(thread, XNUSER) && notify) {
 		if (xnthread_test_state(thread, XNWARN)) {
 			/* Help debugging spurious relaxes. */
-			xndebug_notify_relax(thread, reason);
+			xndebug_notify_relax(reason);
 			memset(&si, 0, sizeof(si));
 			si.si_signo = SIGDEBUG;
 			si.si_code = SI_QUEUE;
Signature · 1 line
2.51.0
author
#5 lore raw

PATCH v2 5/7 lib/cobalt: arm: Skip SIGSHADOW_ACTION_BACKTRACE over asynchronous signals

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

The unwinders of libgcc and libunwind prefer the ARM exception handling table over debug information. Unwinding this way is not designed to handle asynchronous signals, causing wrong backtraces in the best case but also too often even crashes.

Avoid running into that trap by skipping the request to create a backtrace via SIGSHADOW on ARM in case either the migration reason was a signal, or PTHREAD_WARNSW is enabled for the current thread. In both cases, the SIGSHADOW could be raised over the first instruction of another signal handler, causing the unwinder to fail.

Improving the unwinding libraries themselves is likely no longer worth the effort for this phase-out architecture.

---
 .../arch/arm/include/asm/xenomai/Makefile.am  |  1 +
 .../arch/arm/include/asm/xenomai/debug.h      | 27 +++++++++++++++++++
 .../arm64/include/asm/xenomai/Makefile.am     |  1 +
 .../arch/arm64/include/asm/xenomai/debug.h    | 18 +++++++++++++
 .../arch/x86/include/asm/xenomai/Makefile.am  |  1 +
 .../arch/x86/include/asm/xenomai/debug.h      | 18 +++++++++++++
 lib/cobalt/sigshadow.c                        | 12 ++++++---
 7 files changed, 74 insertions(+), 4 deletions(-)
 create mode 100644 lib/cobalt/arch/arm/include/asm/xenomai/debug.h
 create mode 100644 lib/cobalt/arch/arm64/include/asm/xenomai/debug.h
 create mode 100644 lib/cobalt/arch/x86/include/asm/xenomai/debug.h
lib/cobalt/arch/arm/include/asm/xenomai/Makefile.am +1 -0
index a7dd090432..8cc767030f 100644
@@ -1,4 +1,5 @@
 
 noinst_HEADERS =	\
+	debug.h		\
 	features.h	\
 	syscall.h
lib/cobalt/arch/arm/include/asm/xenomai/debug.h new file +27 -0
new file mode 100644
index 0000000000..e49b928516
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) Siemens, 2025
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _LIB_COBALT_ARM_DEBUG_H
+#define _LIB_COBALT_ARM_DEBUG_H
+
+#include <signal.h>
+#include "current.h"
+
+static inline int cobalt_avoid_backtrace(int reason)
+{
+	if (reason == SIGDEBUG_MIGRATE_SIGNAL)
+		return 1;
+
+	if (cobalt_get_current_mode() & PTHREAD_WARNSW)
+		return 1;
+
+	return 0;
+}
+
+#endif /* !_LIB_COBALT_ARM_DEBUG_H */
lib/cobalt/arch/arm64/include/asm/xenomai/Makefile.am +1 -0
index a7dd090432..8cc767030f 100644
@@ -1,4 +1,5 @@
 
 noinst_HEADERS =	\
+	debug.h		\
 	features.h	\
 	syscall.h
lib/cobalt/arch/arm64/include/asm/xenomai/debug.h new file +18 -0
new file mode 100644
index 0000000000..6ca1d42a34
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) Siemens, 2025
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _LIB_COBALT_ARM64_DEBUG_H
+#define _LIB_COBALT_ARM64_DEBUG_H
+
+static inline int cobalt_avoid_backtrace(int reason)
+{
+	return 0;
+}
+
+#endif /* !_LIB_COBALT_ARM64_DEBUG_H */
lib/cobalt/arch/x86/include/asm/xenomai/Makefile.am +1 -0
index a7dd090432..8cc767030f 100644
@@ -1,4 +1,5 @@
 
 noinst_HEADERS =	\
+	debug.h		\
 	features.h	\
 	syscall.h
lib/cobalt/arch/x86/include/asm/xenomai/debug.h new file +18 -0
new file mode 100644
index 0000000000..9d39233d12
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) Siemens, 2025
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _LIB_COBALT_X86_DEBUG_H
+#define _LIB_COBALT_X86_DEBUG_H
+
+static inline int cobalt_avoid_backtrace(int reason)
+{
+	return 0;
+}
+
+#endif /* !_LIB_COBALT_X86_DEBUG_H */
lib/cobalt/sigshadow.c +8 -4
index 10736b113f..b98e4a1d55 100644
@@ -18,6 +18,7 @@
 
 #include <pthread.h>
 #include <signal.h>
+#include <asm/xenomai/debug.h>
 #include <asm/xenomai/syscall.h>
 #include "internal.h"
 
@@ -43,7 +44,7 @@ static bool past_constructors;
 int cobalt_sigshadow_handler(int sig, siginfo_t *si, void *ctxt)
 {
 	void *frames[SIGSHADOW_BACKTRACE_DEPTH];
-	int action, arg, nr, skip;
+	int action, reason, nr, skip;
 
 	if (si->si_code != SI_QUEUE)
 		return 0;
@@ -55,11 +56,14 @@ int cobalt_sigshadow_handler(int sig, siginfo_t *si, void *ctxt)
 		XENOMAI_SYSCALL1(sc_cobalt_migrate, COBALT_PRIMARY);
 		break;
 	case SIGSHADOW_ACTION_BACKTRACE:
-		arg = sigshadow_arg(si->si_int);
-		nr = backtrace(frames, ARRAY_SIZE(frames));
+		reason = sigshadow_arg(si->si_int);
+		nr = 0;
+		if (!cobalt_avoid_backtrace(reason))
+			nr = backtrace(frames, ARRAY_SIZE(frames));
 		/* Skip the sighandler context. */
 		skip = nr > 3 ? 3 : 0;
-		XENOMAI_SYSCALL3(sc_cobalt_backtrace, nr - skip, frames + skip, arg);
+		XENOMAI_SYSCALL3(sc_cobalt_backtrace, nr - skip, frames + skip,
+				 reason);
 		break;
 	case SIGSHADOW_ACTION_HOME:
 		/*
Signature · 1 line
2.51.0
author
#6 lore raw

PATCH v2 6/7 lib/cobalt: x86: Fix and simplify 32-bit syscall argument setup

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

This ancient code to constructing the argument setup of 32-bit syscalls now fail with recent compilers plus debug settings. Why the code was once designed in such a complex way is 20 years+ later no longer clear, but it seems that simply stating which register should contain which argument as assembler constraints is just working today.

Fixes assembly sequences like these (__cobalt_timer_gettime):
...

   1395d:       c7 45 f4 75 00 00 00    movl   $0x75,-0xc(%ebp)
   13964:       8b 45 f4                mov    -0xc(%ebp),%eax
   13967:       0d 00 00 00 10          or     $0x10000000,%eax
   1396c:       89 c3                   mov    %eax,%ebx
   1396e:       8b 45 08                mov    0x8(%ebp),%eax
   13971:       8b 4d 0c                mov    0xc(%ebp),%ecx
   13974:       53                      push   %ebx
   13975:       89 c3                   mov    %eax,%ebx
   13977:       89 d8                   mov    %ebx,%eax
   13979:       65 ff 15 10 00 00 00    call   *%gs:0x10
---
 .../arch/x86/include/asm/xenomai/syscall.h    | 71 ++-----------------
 1 file changed, 7 insertions(+), 64 deletions(-)
lib/cobalt/arch/x86/include/asm/xenomai/syscall.h +7 -64
index 79bf17ee75..d00bd287e3 100644
@@ -41,50 +41,13 @@
 /* The one that cannot fail. */
 #define DOSYSCALLSAFE  "int $0x80\n\t"
 
-asm (".L__X'%ebx = 1\n\t"
-     ".L__X'%ecx = 2\n\t"
-     ".L__X'%edx = 2\n\t"
-     ".L__X'%eax = 3\n\t"
-     ".L__X'%esi = 3\n\t"
-     ".L__X'%edi = 3\n\t"
-     ".L__X'%ebp = 3\n\t"
-     ".L__X'%esp = 3\n\t"
-     ".macro bpushl name reg\n\t"
-     ".if 1 - \\name\n\t"
-     ".if 2 - \\name\n\t"
-     "pushl %ebx\n\t"
-     ".else\n\t"
-     "xchgl \\reg, %ebx\n\t"
-     ".endif\n\t"
-     ".endif\n\t"
-     ".endm\n\t"
-     ".macro bpopl name reg\n\t"
-     ".if 1 - \\name\n\t"
-     ".if 2 - \\name\n\t"
-     "popl %ebx\n\t"
-     ".else\n\t"
-     "xchgl \\reg, %ebx\n\t"
-     ".endif\n\t"
-     ".endif\n\t"
-     ".endm\n\t"
-     ".macro bmovl name reg\n\t"
-     ".if 1 - \\name\n\t"
-     ".if 2 - \\name\n\t"
-     "movl \\reg, %ebx\n\t"
-     ".endif\n\t"
-     ".endif\n\t"
-     ".endm\n\t");
-
 #define XENOMAI_DO_SYSCALL(nr, op, args...)			\
 ({								\
 	unsigned __resultvar;					\
 	asm volatile (						\
-		LOADARGS_##nr					\
-		"movl %1, %%eax\n\t"				\
 		DOSYSCALL					\
-		RESTOREARGS_##nr				\
 		: "=a" (__resultvar)				\
-		: "g" (__xn_syscode(op)) ASMFMT_##nr(args)	\
+		: "a" (__xn_syscode(op)) ASMFMT_##nr(args)	\
 		: "memory", "cc");				\
 	(int) __resultvar;					\
 })
@@ -93,44 +56,24 @@ asm (".L__X'%ebx = 1\n\t"
 ({								\
 	unsigned __resultvar;					\
 	asm volatile (						\
-		LOADARGS_##nr					\
-		"movl %1, %%eax\n\t"				\
 		DOSYSCALLSAFE					\
-		RESTOREARGS_##nr				\
 		: "=a" (__resultvar)				\
-		: "g" (__xn_syscode(op)) ASMFMT_##nr(args)	\
+		: "a" (__xn_syscode(op)) ASMFMT_##nr(args)	\
 		: "memory", "cc");				\
 	(int) __resultvar;					\
 })
 
-#define LOADARGS_0
-#define LOADARGS_1 \
-	"bpushl .L__X'%k2, %k2\n\t" \
-	"bmovl .L__X'%k2, %k2\n\t"
-#define LOADARGS_2	LOADARGS_1
-#define LOADARGS_3	LOADARGS_1
-#define LOADARGS_4	LOADARGS_1
-#define LOADARGS_5	LOADARGS_1
-
-#define RESTOREARGS_0
-#define RESTOREARGS_1 \
-	"bpopl .L__X'%k2, %k2\n\t"
-#define RESTOREARGS_2	RESTOREARGS_1
-#define RESTOREARGS_3	RESTOREARGS_1
-#define RESTOREARGS_4	RESTOREARGS_1
-#define RESTOREARGS_5	RESTOREARGS_1
-
 #define ASMFMT_0()
 #define ASMFMT_1(arg1) \
-	, "acdSD" (arg1)
+	ASMFMT_0(), "b" (arg1)
 #define ASMFMT_2(arg1, arg2) \
-	, "adSD" (arg1), "c" (arg2)
+	ASMFMT_1(arg1), "c" (arg2)
 #define ASMFMT_3(arg1, arg2, arg3) \
-	, "aSD" (arg1), "c" (arg2), "d" (arg3)
+	ASMFMT_2(arg1, arg2), "d" (arg3)
 #define ASMFMT_4(arg1, arg2, arg3, arg4) \
-	, "aD" (arg1), "c" (arg2), "d" (arg3), "S" (arg4)
+	ASMFMT_3(arg1, arg2, arg3), "S" (arg4)
 #define ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \
-	, "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5)
+	ASMFMT_4(arg1, arg2, arg3, arg4), "D" (arg5)
 
 #define XENOMAI_SYSBIND(breq) \
 	XENOMAI_DO_SYSCALL_SAFE(1, sc_cobalt_bind, breq)
Signature · 1 line
2.51.0
author
#7 lore raw

PATCH v2 7/7 testsuite/smokey/sched-quota: Make workload more predictable

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Adding some time-based busy-waiting makes the workload way more predictable for the calibration and later on evaluation. This fixes rather frequent failures of this test on real hardware, since the update to a Debian 13 toolchain specifically on RPi4.

---
 testsuite/smokey/sched-quota/sched-quota.c | 2 ++
 1 file changed, 2 insertions(+)
testsuite/smokey/sched-quota/sched-quota.c +2 -0
index 5abe75d27e..f9e64e37f1 100644
@@ -17,6 +17,7 @@
 #include <sys/cobalt.h>
 #include <boilerplate/time.h>
 #include <boilerplate/ancillaries.h>
+#include <copperplate/threadobj.h>
 #include <smokey/smokey.h>
 
 smokey_test_plugin(sched_quota,
@@ -63,6 +64,7 @@ static volatile int throttle;
 static unsigned long __attribute__(( noinline ))
 __do_work(unsigned long count)
 {
+	threadobj_spin(1000);
 	return count + 1;
 }
 
Signature · 1 line
2.51.0