@@ -278,6 +278,7 @@ static int setup_hr_tick(void)
char path[MAX_PATH];
char buf[500];
static int set = 0;
+ int hrtick_dl = 0;
char *p;
int ret;
int len;
@@ -311,18 +312,34 @@ static int setup_hr_tick(void)
ret = 1;
- p = strstr(buf, "HRTICK");
- if (p + 3 >= buf) {
+ p = strstr(buf, "HRTICK_DL");
+ if (p && p - 3 >= buf) {
+ hrtick_dl = 1;
p -= 3;
- if (strncmp(p, "NO_HRTICK", 9) == 0) {
- ret = write(fd, "HRTICK", 6);
- if (ret != 6)
+ if (strncmp(p, "NO_HRTICK_DL", 12) == 0) {
+ ret = write(fd, "HRTICK_DL", 9);
+ if (ret != 9)
ret = 0;
else
ret = 1;
}
}
+ /* Backwards compatibility for kernel that only have HRTICK */
+ if (!hrtick_dl) {
+ p = strstr(buf, "HRTICK");
+ if (p && p - 3 >= buf) {
+ p -=3;
+ if (strncmp(p, "NO_HRTICK", 9) == 0) {
+ ret = write(fd, "HRTICK", 6);
+ if (ret != 6)
+ ret = 0;
+ else
+ ret = 1;
+ }
+ }
+ }
+
close(fd);
return ret;
}
@@ -427,6 +427,7 @@ static int setup_hr_tick(void)
char path[MAX_PATH];
char buf[500];
static int set = 0;
+ int hrtick_dl = 0;
char *p;
int ret;
int len;
@@ -461,18 +462,35 @@ static int setup_hr_tick(void)
ret = 1;
- p = strstr(buf, "HRTICK");
- if (p + 3 >= buf) {
+ p = strstr(buf, "HRTICK_DL");
+ if (p && p - 3 >= buf) {
+ hrtick_dl = 1;
p -= 3;
- if (strncmp(p, "NO_HRTICK", 9) == 0) {
- ret = write(fd, "HRTICK", 6);
- if (ret != 6)
+ if (strncmp(p, "NO_HRTICK_DL", 12) == 0) {
+ ret = write(fd, "HRTICK_DL", 9);
+ if (ret != 9)
ret = 0;
else
ret = 1;
}
}
+ /* Backwards compatibility for kernel that only have HRTICK */
+ if (!hrtick_dl) {
+ p = strstr(buf, "HRTICK");
+ if (p && p - 3 >= buf) {
+ p -=3;
+ if (strncmp(p, "NO_HRTICK", 9) == 0) {
+ ret = write(fd, "HRTICK", 6);
+ if (ret != 6)
+ ret = 0;
+ else
+ ret = 1;
+ }
+ }
+ }
+
+
close(fd);
return ret;
}
If the HRTICK_DL feature is available, use it for the sched_deadline tests, otherwise fall back to HRTICK This code is based on changes in stalld - which in turn was based on these sched_deadline tests Signed-off-by: John Kacur <jkacur@redhat.com> --- src/sched_deadline/cyclicdeadline.c | 27 ++++++++++++++++++++++----- src/sched_deadline/deadline_test.c | 28 +++++++++++++++++++++++----- 2 files changed, 45 insertions(+), 10 deletions(-)