Skip to contentSkip to conversation

rt-tests: cyclicdeadline: Fix usage for duration

PATCH New John Kacur 1 participant 5 messages Apr 24, 2025 Kbuild

lore
Share & tools
lore

John Kacur

author
#0 lore raw

PATCH 1/5 rt-tests: cyclicdeadline: Fix usage for duration

Fix the usage message for the -D or --duration option to indicate that the default length is in seconds if you don't append 'm', 'h', or 'd' for minutes, hours or days.

---
 src/sched_deadline/cyclicdeadline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/sched_deadline/cyclicdeadline.c +1 -1
index 32fd0d0e280f..04e61edc68d8 100644
@@ -688,7 +688,7 @@ static void usage(int error)
 	       "-a [CPUSET] --affinity     Comma/hyphen separated list of CPUs to run deadline\n"
 	       "                           tasks on. An empty CPUSET runs on all CPUs a deadline\n"
 	       "                           task.\n"
-	       "-D TIME  --duration        Specify a length for the test run.\n"
+	       "-D TIME  --duration        Specify a length in seconds for the test run.\n"
 	       "                           Append 'm', 'h', or 'd' to specify minutes, hours or\n"
 	       "                           days\n"
 	       "-h       --help            Show this help menu.\n"
Signature · 1 line
2.49.0
author
#1 lore raw

PATCH 2/5 Revert "Fix rt-tests build with glibc-2.41"

This reverts commit d3a23a0cc76789c3083df3bad78982cd49bc4c5e.

When people backport the feature into earlier versions of glibc, then the patches fails.

---
 src/include/rt-sched.h | 2 --
 src/lib/rt-sched.c     | 2 --
 2 files changed, 4 deletions(-)
src/include/rt-sched.h +0 -2
index dfd7f45f51cc..80171c76e0ee 100644
@@ -42,7 +42,6 @@
 #define __NR_sched_getattr		275
 #endif
 
-#if ! __GLIBC_PREREQ(2, 41)
 struct sched_attr {
 	uint32_t size;
 	uint32_t sched_policy;
@@ -68,6 +67,5 @@ int sched_getattr(pid_t pid,
 		  struct sched_attr *attr,
 		  unsigned int size,
 		  unsigned int flags);
-#endif
 
 #endif /* __RT_SCHED_H__ */
src/lib/rt-sched.c +0 -2
index 2500abde26e4..8023bc70c473 100644
@@ -14,7 +14,6 @@
 
 #include "rt-sched.h"
 
-#if ! __GLIBC_PREREQ(2, 41)
 int sched_setattr(pid_t pid,
 		  const struct sched_attr *attr,
 		  unsigned int flags)
@@ -29,4 +28,3 @@ int sched_getattr(pid_t pid,
 {
 	return syscall(__NR_sched_getattr, pid, attr, size, flags);
 }
-#endif
Signature · 1 line
2.49.0
author
#2 lore raw

PATCH 3/5 sched_attr: Do not define for glibc >= 2.41

In reply to John Kacur

From: Khem Raj <[email protected]>

glibc 2.41+ has added [1] definitions for sched_setattr and sched_getattr functions and struct sched_attr. Therefore, it needs to be checked for here as well before defining sched_attr

Define sched_attr conditionally on SCHED_ATTR_SIZE_VER0

Fixes builds with glibc/trunk

[1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=21571ca0d70302909cf72707b2a7736cf12190a0;hp=298bc488fdc047da37482f4003023cb9adef78f8

Cc Clark Williams <[email protected]>
Cc John Kacur <[email protected]>
Cc rt-users <[email protected]>
---
 src/include/rt-sched.h | 4 ++++
 1 file changed, 4 insertions(+)
src/include/rt-sched.h +4 -0
index 80171c76e0ee..9cf0e3a937e5 100644
@@ -42,6 +42,8 @@
 #define __NR_sched_getattr		275
 #endif
 
+/* sched_attr is not defined in glibc < 2.41 */
+#ifndef SCHED_ATTR_SIZE_VER0
 struct sched_attr {
 	uint32_t size;
 	uint32_t sched_policy;
@@ -68,4 +70,6 @@ int sched_getattr(pid_t pid,
 		  unsigned int size,
 		  unsigned int flags);
 
+#endif /* SCHED_ATTR_SIZE_VER0 */
+
 #endif /* __RT_SCHED_H__ */
Signature · 1 line
2.49.0
author
#3 lore raw

PATCH 4/5 rteval: pi_stress: Change PRIu64 to llu to match upstream sched_attr

In reply to John Kacur

- Change from PRIu64 to llu to match upstream glibc sched_attr. This change is for when we are getting the definitions from upstream glibc

- Change our definition in rt-sched.h to match upstream glibc This change is for when we are using our own definition of struct
sched_attr

---
 src/include/rt-sched.h   | 6 +++---
 src/pi_tests/pi_stress.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
src/include/rt-sched.h +3 -3
index 9cf0e3a937e5..767b1d8df485 100644
@@ -56,9 +56,9 @@ struct sched_attr {
 	uint32_t sched_priority;
 
 	/* SCHED_DEADLINE */
-	uint64_t sched_runtime;
-	uint64_t sched_deadline;
-	uint64_t sched_period;
+	unsigned long long sched_runtime;
+	unsigned long long sched_deadline;
+	unsigned long long sched_period;
 };
 
 int sched_setattr(pid_t pid,
src/pi_tests/pi_stress.c +1 -1
index 6f8c5632bdd7..74e7bde0c21f 100644
@@ -1294,7 +1294,7 @@ void print_sched_attr(const char *name, struct sched_attr *sa)
 		printf(" priority %d\n", sa->sched_priority);
 		break;
 	case SCHED_DEADLINE:
-		printf(" runtime %" PRIu64 " deadline %" PRIu64 " period %" PRIu64 "\n",
+		printf(" runtime %llu deadline %llu period %llu\n",
 			sa->sched_runtime, sa->sched_deadline,
 			sa->sched_period);
 		break;
Signature · 1 line
2.49.0
author
#4 lore raw

PATCH 5/5 Makefile: Use -Wno-error=format-truncation=

In reply to John Kacur

Since compile warnings are now errors, use -Wno-error=format-truncation= at least until we can sort out MAXPATH MAX_PATH, PATH_MAX and determine what is needed.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 26acffed8114..6215541d2eb1 100644
@@ -33,7 +33,7 @@ prefix  ?= /usr/local
 bindir  ?= $(prefix)/bin
 mandir	?= $(prefix)/share/man
 
-CFLAGS ?= -Wall -Werror -Wno-nonnull -Wextra -Wno-sign-compare -Wno-unused-parameter
+CFLAGS ?= -Wall -Werror -Wno-nonnull -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-error=format-truncation=
 CPPFLAGS += -D_GNU_SOURCE -Isrc/include
 LDFLAGS ?=
 
Signature · 1 line
2.49.0