|
|
0d4f16 |
From de3cdf92834bc600d5806f959e8d78d48f7f9775 Mon Sep 17 00:00:00 2001
|
|
|
0d4f16 |
From: John Kacur <jkacur@redhat.com>
|
|
|
0d4f16 |
Date: Fri, 23 Jul 2021 14:52:43 -0400
|
|
|
0d4f16 |
Subject: [PATCH 2/2] sched_deadline: Use HRTICK_DL for sched_deadline tests
|
|
|
0d4f16 |
|
|
|
0d4f16 |
If the HRTICK_DL feature is available, use it for the sched_deadline
|
|
|
0d4f16 |
tests, otherwise fall back to HRTICK
|
|
|
0d4f16 |
|
|
|
0d4f16 |
This code is based on changes in stalld - which in turn was based on
|
|
|
0d4f16 |
these sched_deadline tests
|
|
|
0d4f16 |
|
|
|
0d4f16 |
Signed-off-by: John Kacur <jkacur@redhat.com>
|
|
|
0d4f16 |
---
|
|
|
0d4f16 |
src/sched_deadline/cyclicdeadline.c | 27 ++++++++++++++++++++++-----
|
|
|
0d4f16 |
src/sched_deadline/deadline_test.c | 28 +++++++++++++++++++++++-----
|
|
|
0d4f16 |
2 files changed, 45 insertions(+), 10 deletions(-)
|
|
|
0d4f16 |
|
|
|
0d4f16 |
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
|
|
|
0d4f16 |
index 4a38ec2274c9..4860a40f5e6b 100644
|
|
|
0d4f16 |
--- a/src/sched_deadline/cyclicdeadline.c
|
|
|
0d4f16 |
+++ b/src/sched_deadline/cyclicdeadline.c
|
|
|
0d4f16 |
@@ -278,6 +278,7 @@ static int setup_hr_tick(void)
|
|
|
0d4f16 |
char path[MAX_PATH];
|
|
|
0d4f16 |
char buf[500];
|
|
|
0d4f16 |
static int set = 0;
|
|
|
0d4f16 |
+ int hrtick_dl = 0;
|
|
|
0d4f16 |
char *p;
|
|
|
0d4f16 |
int ret;
|
|
|
0d4f16 |
int len;
|
|
|
0d4f16 |
@@ -311,18 +312,34 @@ static int setup_hr_tick(void)
|
|
|
0d4f16 |
|
|
|
0d4f16 |
ret = 1;
|
|
|
0d4f16 |
|
|
|
0d4f16 |
- p = strstr(buf, "HRTICK");
|
|
|
0d4f16 |
- if (p + 3 >= buf) {
|
|
|
0d4f16 |
+ p = strstr(buf, "HRTICK_DL");
|
|
|
0d4f16 |
+ if (p && p - 3 >= buf) {
|
|
|
0d4f16 |
+ hrtick_dl = 1;
|
|
|
0d4f16 |
p -= 3;
|
|
|
0d4f16 |
- if (strncmp(p, "NO_HRTICK", 9) == 0) {
|
|
|
0d4f16 |
- ret = write(fd, "HRTICK", 6);
|
|
|
0d4f16 |
- if (ret != 6)
|
|
|
0d4f16 |
+ if (strncmp(p, "NO_HRTICK_DL", 12) == 0) {
|
|
|
0d4f16 |
+ ret = write(fd, "HRTICK_DL", 9);
|
|
|
0d4f16 |
+ if (ret != 9)
|
|
|
0d4f16 |
ret = 0;
|
|
|
0d4f16 |
else
|
|
|
0d4f16 |
ret = 1;
|
|
|
0d4f16 |
}
|
|
|
0d4f16 |
}
|
|
|
0d4f16 |
|
|
|
0d4f16 |
+ /* Backwards compatibility for kernel that only have HRTICK */
|
|
|
0d4f16 |
+ if (!hrtick_dl) {
|
|
|
0d4f16 |
+ p = strstr(buf, "HRTICK");
|
|
|
0d4f16 |
+ if (p && p - 3 >= buf) {
|
|
|
0d4f16 |
+ p -=3;
|
|
|
0d4f16 |
+ if (strncmp(p, "NO_HRTICK", 9) == 0) {
|
|
|
0d4f16 |
+ ret = write(fd, "HRTICK", 6);
|
|
|
0d4f16 |
+ if (ret != 6)
|
|
|
0d4f16 |
+ ret = 0;
|
|
|
0d4f16 |
+ else
|
|
|
0d4f16 |
+ ret = 1;
|
|
|
0d4f16 |
+ }
|
|
|
0d4f16 |
+ }
|
|
|
0d4f16 |
+ }
|
|
|
0d4f16 |
+
|
|
|
0d4f16 |
close(fd);
|
|
|
0d4f16 |
return ret;
|
|
|
0d4f16 |
}
|
|
|
0d4f16 |
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
|
|
|
0d4f16 |
index c1e890319895..a48c231c1281 100644
|
|
|
0d4f16 |
--- a/src/sched_deadline/deadline_test.c
|
|
|
0d4f16 |
+++ b/src/sched_deadline/deadline_test.c
|
|
|
0d4f16 |
@@ -427,6 +427,7 @@ static int setup_hr_tick(void)
|
|
|
0d4f16 |
char path[MAX_PATH];
|
|
|
0d4f16 |
char buf[500];
|
|
|
0d4f16 |
static int set = 0;
|
|
|
0d4f16 |
+ int hrtick_dl = 0;
|
|
|
0d4f16 |
char *p;
|
|
|
0d4f16 |
int ret;
|
|
|
0d4f16 |
int len;
|
|
|
0d4f16 |
@@ -461,18 +462,35 @@ static int setup_hr_tick(void)
|
|
|
0d4f16 |
|
|
|
0d4f16 |
ret = 1;
|
|
|
0d4f16 |
|
|
|
0d4f16 |
- p = strstr(buf, "HRTICK");
|
|
|
0d4f16 |
- if (p + 3 >= buf) {
|
|
|
0d4f16 |
+ p = strstr(buf, "HRTICK_DL");
|
|
|
0d4f16 |
+ if (p && p - 3 >= buf) {
|
|
|
0d4f16 |
+ hrtick_dl = 1;
|
|
|
0d4f16 |
p -= 3;
|
|
|
0d4f16 |
- if (strncmp(p, "NO_HRTICK", 9) == 0) {
|
|
|
0d4f16 |
- ret = write(fd, "HRTICK", 6);
|
|
|
0d4f16 |
- if (ret != 6)
|
|
|
0d4f16 |
+ if (strncmp(p, "NO_HRTICK_DL", 12) == 0) {
|
|
|
0d4f16 |
+ ret = write(fd, "HRTICK_DL", 9);
|
|
|
0d4f16 |
+ if (ret != 9)
|
|
|
0d4f16 |
ret = 0;
|
|
|
0d4f16 |
else
|
|
|
0d4f16 |
ret = 1;
|
|
|
0d4f16 |
}
|
|
|
0d4f16 |
}
|
|
|
0d4f16 |
|
|
|
0d4f16 |
+ /* Backwards compatibility for kernel that only have HRTICK */
|
|
|
0d4f16 |
+ if (!hrtick_dl) {
|
|
|
0d4f16 |
+ p = strstr(buf, "HRTICK");
|
|
|
0d4f16 |
+ if (p && p - 3 >= buf) {
|
|
|
0d4f16 |
+ p -=3;
|
|
|
0d4f16 |
+ if (strncmp(p, "NO_HRTICK", 9) == 0) {
|
|
|
0d4f16 |
+ ret = write(fd, "HRTICK", 6);
|
|
|
0d4f16 |
+ if (ret != 6)
|
|
|
0d4f16 |
+ ret = 0;
|
|
|
0d4f16 |
+ else
|
|
|
0d4f16 |
+ ret = 1;
|
|
|
0d4f16 |
+ }
|
|
|
0d4f16 |
+ }
|
|
|
0d4f16 |
+ }
|
|
|
0d4f16 |
+
|
|
|
0d4f16 |
+
|
|
|
0d4f16 |
close(fd);
|
|
|
0d4f16 |
return ret;
|
|
|
0d4f16 |
}
|
|
|
0d4f16 |
--
|
|
|
0d4f16 |
2.31.1
|
|
|
0d4f16 |
|