import rt-tests-1.8-3.el8

This commit is contained in:
CentOS Sources 2020-07-28 03:00:00 -04:00 committed by Stepan Oksanichenko
parent c0e88cc324
commit 5347a55959
20 changed files with 238 additions and 1960 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/rt-tests-1.5.tar.xz
SOURCES/rt-tests-1.8.tar.xz

View File

@ -1 +1 @@
13ef79a90a810103e8a0fa5da92544b5d31c3838 SOURCES/rt-tests-1.5.tar.xz
50737a762ff27d6440798f10a33f720f476e1438 SOURCES/rt-tests-1.8.tar.xz

View File

@ -0,0 +1,84 @@
From b07c57b33e4e24e873e680b8327f9be4f321caa9 Mon Sep 17 00:00:00 2001
From: Yunfeng Ye <yeyunfeng@huawei.com>
Date: Wed, 22 Apr 2020 10:19:52 +0800
Subject: [PATCH] cyclictest: Fix setaffinity error on large NUMA machines
An Error occurs when run: ./cyclictest -v -t 5 -p 80 -i 1000 -a 3
On large NUMA machines still getting the following error
WARN: Couldn't setaffinity in main thread: Invalid argument
Instead of calling numa_bitmask_alloc() with max_cpus, use
numa_allocate_cpumask() to fix this.
Also, make sure numa_available() is called before any other calls to the
numa library. Depending on how the options were invoked this could
happen in parse_cpumask for example. Note, this did not seem to cause
any problems in practice, but let's adhere to the library contract.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/cyclictest/cyclictest.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index c5f1fd46567a..79bb1cb71c68 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1135,7 +1135,7 @@ static void use_current_cpuset(const int max_cpus)
pid = getpid();
- curmask = numa_bitmask_alloc(sizeof(struct bitmask));
+ curmask = numa_allocate_cpumask();
numa_sched_getaffinity(pid, curmask);
/* Clear bits that are not set in both the cpuset from the environment,
@@ -1225,6 +1225,20 @@ enum option_values {
OPT_TRACEMARK, OPT_POSIX_TIMERS,
};
+/* numa_available() must be called before any other calls to the numa library */
+static void numa_initialize(void)
+{
+ static int is_initialized;
+
+ if (is_initialized == 1)
+ return;
+
+ if (numa_available() != -1)
+ numa = 1;
+
+ is_initialized = 1;
+}
+
/* Process commandline options */
static void process_options (int argc, char *argv[], int max_cpus)
{
@@ -1288,6 +1302,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
/* smp sets AFFINITY_USEALL in OPT_SMP */
if (smp)
break;
+ numa_initialize();
if (optarg != NULL) {
parse_cpumask(optarg, max_cpus);
setaffinity = AFFINITY_SPECIFIED;
@@ -1460,12 +1475,9 @@ static void process_options (int argc, char *argv[], int max_cpus)
/* if smp wasn't requested, test for numa automatically */
if (!smp) {
#ifdef NUMA
- if (numa_available() != -1) {
- numa = 1;
- if (setaffinity == AFFINITY_UNSPECIFIED) {
- setaffinity = AFFINITY_USEALL;
- }
- }
+ numa_initialize();
+ if (setaffinity == AFFINITY_UNSPECIFIED)
+ setaffinity = AFFINITY_USEALL;
#else
warn("cyclictest was not built with the numa option\n");
numa = 0;
--
2.21.3

View File

@ -1,42 +0,0 @@
From 33dff61afb032e5374c6ec60d4f88cdf57e83c53 Mon Sep 17 00:00:00 2001
From: Daniel Wagner <wagi@monom.org>
Date: Mon, 19 Aug 2019 08:43:04 +0200
Subject: [PATCH 04/10] deadline_test: Increase buffer to avoid overflow
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Increase the size of the char buffer. gcc 9.1.1 reports:
src/sched_deadline/deadline_test.c:1803:24: warning: %d directive writing between 1 and 11 bytes into a region of size 10 [-Wformat-overflow=]
1803 | sprintf(setcpu_buf, "%d", cpu_count - 1);
| ^~
src/sched_deadline/deadline_test.c:1803:23: note: directive argument in the range [-2147483648, 2147483646]
1803 | sprintf(setcpu_buf, "%d", cpu_count - 1);
| ^~~~
src/sched_deadline/deadline_test.c:1803:3: note: sprintf output between 2 and 12 bytes into a destination of size 10
1803 | sprintf(setcpu_buf, "%d", cpu_count - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Daniel Wagner <wagi@monom.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/sched_deadline/deadline_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
index e2898de328bb..5b5f40dbb74d 100644
--- a/src/sched_deadline/deadline_test.c
+++ b/src/sched_deadline/deadline_test.c
@@ -1795,7 +1795,7 @@ int main (int argc, char **argv)
/* -b has us bind to the last CPU. */
if (!all_cpus && !setcpu) {
- setcpu_buf = malloc(10);
+ setcpu_buf = malloc(12);
if (!setcpu_buf) {
perror("malloc");
exit(-1);
--
2.20.1

View File

@ -1,50 +0,0 @@
From f7c39616fe887f35abaa4b81466ab7f167e0a410 Mon Sep 17 00:00:00 2001
From: Daniel Wagner <wagi@monom.org>
Date: Mon, 19 Aug 2019 08:43:01 +0200
Subject: [PATCH 01/10] pmqtest: Increase buffer to avoid overflow
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Increase the size of the char buffer. gcc 9.1.1 reports:
src/pmqtest/pmqtest.c: In function main:
src/pmqtest/pmqtest.c:46:21: warning: %d directive writing between 1 and 10 bytes into a region of size 8 [-Wformat-overflow=]
46 | #define SYNCMQ_NAME "/syncmsg%d"
| ^~~~~~~~~~~~
src/pmqtest/pmqtest.c:445:3: note: sprintf output between 10 and 19 bytes into a destination of size 16
445 | sprintf(mqname, SYNCMQ_NAME, i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Daniel Wagner <wagi@monom.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/pmqtest/pmqtest.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
index a04fc49872bf..3ce799bd6319 100644
--- a/src/pmqtest/pmqtest.c
+++ b/src/pmqtest/pmqtest.c
@@ -440,7 +440,7 @@ int main(int argc, char *argv[])
goto nomem;
for (i = 0; i < num_threads; i++) {
- char mqname[16];
+ char mqname[19];
sprintf(mqname, SYNCMQ_NAME, i);
receiver[i].syncmq = mq_open(mqname, oflag, 0777, &mqstat);
@@ -567,7 +567,7 @@ int main(int argc, char *argv[])
}
nanosleep(&maindelay, NULL);
for (i = 0; i < num_threads; i++) {
- char mqname[16];
+ char mqname[19];
mq_close(receiver[i].syncmq);
sprintf(mqname, SYNCMQ_NAME, i);
--
2.20.1

View File

@ -1,701 +0,0 @@
From 19a30e151b65f42e74db2a97f79ce21ce23d7c7c Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Mon, 25 Nov 2019 15:06:12 +0100
Subject: [PATCH] rt-tests: Add SPDX tags V2
Add SPDX tags instead of having out-of-date and incomplete licences at
the top of files
Audited again to make sure that GPL-2.0-only is used where appropriate
and not GPL-2.0-or-later (and the other way around)
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/backfire/backfire.c | 17 +--------------
src/cyclictest/cyclictest.c | 5 +----
src/cyclictest/rt_numa.h | 1 +
src/hackbench/hackbench.c | 1 +
src/hwlatdetect/hwlatdetect.py | 8 ++-----
src/include/bionic.h | 1 +
src/include/error.h | 1 +
src/include/pip_stress.h | 1 +
src/include/rt-get_cpu.h | 1 +
src/include/rt-sched.h | 24 +++++----------------
src/include/rt-utils.h | 1 +
src/lib/error.c | 1 +
src/lib/rt-get_cpu.c | 1 +
src/lib/rt-sched.c | 25 ++++++----------------
src/lib/rt-utils.c | 1 +
src/pi_tests/classic_pi.c | 22 ++++---------------
src/pi_tests/pi_stress.c | 22 ++++---------------
src/pi_tests/pip_stress.c | 14 +-----------
src/pi_tests/sigtest.c | 22 ++++---------------
src/pi_tests/tst-mutexpi10.c | 27 ++++++------------------
src/pmqtest/pmqtest.c | 16 +-------------
src/ptsematest/ptsematest.c | 17 +--------------
src/queuelat/determine_maximum_mpps.sh | 3 +++
src/queuelat/get_cpuinfo_mhz.sh | 3 +++
src/queuelat/queuelat.c | 8 +++++++
src/queuelat/targeted-ipi/targeted-ipi.c | 7 ++++++
src/rt-migrate-test/rt-migrate-test.c | 19 +----------------
src/sched_deadline/cyclicdeadline.c | 8 +++++++
src/sched_deadline/deadline_test.c | 24 ++++++---------------
src/signaltest/signaltest.c | 2 ++
src/sigwaittest/sigwaittest.c | 2 ++
src/ssdd/ssdd.c | 12 +++++------
src/svsematest/svsematest.c | 16 ++------------
33 files changed, 95 insertions(+), 238 deletions(-)
diff --git a/src/backfire/backfire.c b/src/backfire/backfire.c
index a8ac9f5e2b28..81a31d49f47b 100644
--- a/src/backfire/backfire.c
+++ b/src/backfire/backfire.c
@@ -1,22 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* backfire - send signal back to caller
- *
* Copyright (C) 2007 Carsten Emde <C.Emde@osadl.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
- * USA.
*/
#include <linux/module.h>
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 1c515ae1354c..beac9a3ce946 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
/*
* High resolution timer test software
*
@@ -6,10 +7,6 @@
* (C) 2008-2012 Clark Williams <williams@redhat.com>
* (C) 2005-2007 Thomas Gleixner <tglx@linutronix.de>
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License Version
- * 2 as published by the Free Software Foundation.
- *
*/
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
index 983502d34c94..1f7c5a482150 100644
--- a/src/cyclictest/rt_numa.h
+++ b/src/cyclictest/rt_numa.h
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* A numa library for cyclictest.
* The functions here are designed to work whether cyclictest has been
diff --git a/src/hackbench/hackbench.c b/src/hackbench/hackbench.c
index ba804f519950..5a883d341f2e 100644
--- a/src/hackbench/hackbench.c
+++ b/src/hackbench/hackbench.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* This is the latest version of hackbench.c, that tests scheduler and
* unix-socket (or pipe) performance.
diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py
index c11a6f8ea5b1..12228f45f852 100755
--- a/src/hwlatdetect/hwlatdetect.py
+++ b/src/hwlatdetect/hwlatdetect.py
@@ -1,14 +1,10 @@
#!/usr/bin/python3
+# SPDX-License-Identifier: GPL-2.0-only
+
# (C) 2018,2019 Clark Williams <williams@redhat.com>
# (C) 2015,2016 Clark Williams <williams@redhat.com>
# (C) 2009 Clark Williams <williams@redhat.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License Version 2
-# as published by the Free Software Foundation.
-
-
import sys
import os
diff --git a/src/include/bionic.h b/src/include/bionic.h
index 54f9c54b0824..e0433437f5d2 100644
--- a/src/include/bionic.h
+++ b/src/include/bionic.h
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef BIONIC_H
#define BIONIC_H
diff --git a/src/include/error.h b/src/include/error.h
index 4acff4952dd6..d205e49ff041 100644
--- a/src/include/error.h
+++ b/src/include/error.h
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef __ERROR_H
#define __ERROR_H
diff --git a/src/include/pip_stress.h b/src/include/pip_stress.h
index 8ed24522851c..ee8b545ab117 100644
--- a/src/include/pip_stress.h
+++ b/src/include/pip_stress.h
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef __PIP_STRESS_H
#define __PIP_STRESS_H
diff --git a/src/include/rt-get_cpu.h b/src/include/rt-get_cpu.h
index 15d05fcb15fa..74bf8f0fac25 100644
--- a/src/include/rt-get_cpu.h
+++ b/src/include/rt-get_cpu.h
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef __RT_GET_CPU_H
#define __RT_GET_CPU_H
#include <stdio.h>
diff --git a/src/include/rt-sched.h b/src/include/rt-sched.h
index 679c4bd10ae2..80171c76e0ee 100644
--- a/src/include/rt-sched.h
+++ b/src/include/rt-sched.h
@@ -1,23 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
- rt-sched.h - sched_setattr() and sched_getattr() API
-
- (C) Dario Faggioli <raistlin@linux.it>, 2009, 2010
- Copyright (C) 2014 BMW Car IT GmbH, Daniel Wagner <daniel.wagner@bmw-carit.de
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- USA */
+ * rt-sched.h - sched_setattr() and sched_getattr() API
+ * (C) Dario Faggioli <raistlin@linux.it>, 2009, 2010
+ * Copyright (C) 2014 BMW Car IT GmbH, Daniel Wagner <daniel.wagner@bmw-carit.de
+ */
/* This file is based on Dario Faggioli's libdl. Eventually it will be
replaced by a proper implemenation of this API. */
diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
index 405fa7855346..6ec2b2011959 100644
--- a/src/include/rt-utils.h
+++ b/src/include/rt-utils.h
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef __RT_UTILS_H
#define __RT_UTILS_H
diff --git a/src/lib/error.c b/src/lib/error.c
index b32aa0270780..4434a842da17 100644
--- a/src/lib/error.c
+++ b/src/lib/error.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2009 John Kacur <jkacur@redhat.com>
*
diff --git a/src/lib/rt-get_cpu.c b/src/lib/rt-get_cpu.c
index 83430dd4d068..608cd9bb76e0 100644
--- a/src/lib/rt-get_cpu.c
+++ b/src/lib/rt-get_cpu.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2009 John Kacur <jkacur@redhat.com>
*/
diff --git a/src/lib/rt-sched.c b/src/lib/rt-sched.c
index 4a8e3c42b49f..2aaf02d42aee 100644
--- a/src/lib/rt-sched.c
+++ b/src/lib/rt-sched.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
- rt-sched.h - sched_setattr() and sched_getattr() API
-
- (C) Dario Faggioli <raistlin@linux.it>, 2009, 2010
- Copyright (C) 2014 BMW Car IT GmbH, Daniel Wagner <daniel.wagner@bmw-carit.de
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- USA */
+ * rt-sched.h - sched_setattr() and sched_getattr() API
+ *
+ * (C) Dario Faggioli <raistlin@linux.it>, 2009, 2010
+ * Copyright (C) 2014 BMW Car IT GmbH, Daniel Wagner <daniel.wagner@bmw-carit.de
+ */
/* This file is based on Dario Faggioli's libdl. Eventually it will be
replaced by a proper implemenation of this API. */
diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
index e1b166afcd6c..1998a327d036 100644
--- a/src/lib/rt-utils.c
+++ b/src/lib/rt-utils.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2009 Carsten Emde <carsten.emde@osadl.org>
* Copyright (C) 2010 Clark Williams <williams@redhat.com>
diff --git a/src/pi_tests/classic_pi.c b/src/pi_tests/classic_pi.c
index 695ee4c4bd03..64af8890276f 100644
--- a/src/pi_tests/classic_pi.c
+++ b/src/pi_tests/classic_pi.c
@@ -1,22 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
- classic_pi - Classic Priority Inversion deadlock test case
-
- Copyright (C) 2006, 2007 Clark Williams <williams@redhat.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- USA */
+ * classic_pi - Classic Priority Inversion deadlock test case
+ * Copyright (C) 2006, 2007 Clark Williams <williams@redhat.com>
+ */
/* This program tests Priority Inheritance mutexes and their ability
to avoid Priority Inversion deadlocks
diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
index 1286370c474b..7fa98dfb9ad4 100644
--- a/src/pi_tests/pi_stress.c
+++ b/src/pi_tests/pi_stress.c
@@ -1,22 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
- pi_stress - Priority Inheritance stress test
-
- Copyright (C) 2006, 2007 Clark Williams <williams@redhat.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- USA */
+ * pi_stress - Priority Inheritance stress test
+ * Copyright (C) 2006, 2007 Clark Williams <williams@redhat.com>
+ */
/* This program stress tests pthreads priority inheritance mutexes
diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
index e6cf0ce940ca..c9dbd992e15d 100644
--- a/src/pi_tests/pip_stress.c
+++ b/src/pi_tests/pip_stress.c
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
Pip stress - Priority Inheritance with processes
Copyright (C) 2009, John Kacur <jkacur@redhat.com>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
diff --git a/src/pi_tests/sigtest.c b/src/pi_tests/sigtest.c
index 0cf520c01335..17dd0d43bdc6 100644
--- a/src/pi_tests/sigtest.c
+++ b/src/pi_tests/sigtest.c
@@ -1,22 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
- sigtest - simple little program to verify signal behavior
-
- Copyright (C) 2006, 2007 Clark Williams <williams@redhat.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- USA */
+ * sigtest - simple little program to verify signal behavior
+ * Copyright (C) 2006, 2007 Clark Williams <williams@redhat.com>
+*/
#include <stdio.h>
#include <signal.h>
diff --git a/src/pi_tests/tst-mutexpi10.c b/src/pi_tests/tst-mutexpi10.c
index a63ea23ba621..97a345edd26e 100644
--- a/src/pi_tests/tst-mutexpi10.c
+++ b/src/pi_tests/tst-mutexpi10.c
@@ -1,25 +1,10 @@
+// SPDX-License-Identifier: LGPL-2.1-or-later
/*
- Classic Priority Inversion deadlock test case
-
- Copyright (C) 2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Clark Williams<williams@redhat.com>, 2006
-
- The GNU C 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.1 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
+ * Classic Priority Inversion deadlock test case
+ * Copyright (C) 2006 Free Software Foundation, Inc.
+ * This file is part of the GNU C Library.
+ * Contributed by Clark Williams<williams@redhat.com>, 2006
+ */
/* This program tests Priority Inheritance mutexes and their ability
to avoid Priority Inversion deadlocks
diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
index 3ce799bd6319..3ce29252b9a2 100644
--- a/src/pmqtest/pmqtest.c
+++ b/src/pmqtest/pmqtest.c
@@ -1,22 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* pmqtest.c
*
* Copyright (C) 2009 Carsten Emde <C.Emde@osadl.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
- * USA.
*/
#include <stdio.h>
diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
index 553759212ac9..78fa444c5578 100644
--- a/src/ptsematest/ptsematest.c
+++ b/src/ptsematest/ptsematest.c
@@ -1,22 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* ptsematest.c
- *
* Copyright (C) 2009 Carsten Emde <C.Emde@osadl.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
- * USA.
*/
#include <stdio.h>
diff --git a/src/queuelat/determine_maximum_mpps.sh b/src/queuelat/determine_maximum_mpps.sh
index 3acd6ba2e362..52d54c0f9065 100755
--- a/src/queuelat/determine_maximum_mpps.sh
+++ b/src/queuelat/determine_maximum_mpps.sh
@@ -1,5 +1,8 @@
#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2018 Marcelo Tosatti <mtosatti@redhat.com>
+
# A script to determine the maximum mpps. Logic:
# Increase mpps in 0.5 units
#
diff --git a/src/queuelat/get_cpuinfo_mhz.sh b/src/queuelat/get_cpuinfo_mhz.sh
index fb5158f31040..eafdd9577424 100755
--- a/src/queuelat/get_cpuinfo_mhz.sh
+++ b/src/queuelat/get_cpuinfo_mhz.sh
@@ -1,5 +1,8 @@
#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2018 Marcelo Tosatti <mtosatti@redhat.com>
+
mhz=`cat /proc/cpuinfo | grep "cpu MHz" | uniq | cut -f 3 -d " "`
echo $mhz
diff --git a/src/queuelat/queuelat.c b/src/queuelat/queuelat.c
index a5525e41776a..cccb50ef0cc4 100644
--- a/src/queuelat/queuelat.c
+++ b/src/queuelat/queuelat.c
@@ -1,3 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/*
+ * Copyright (C) 2018 Marcelo Tosatti <mtosatti@redhat.com>
+ * Copyright (C) 2019 John Kacur <jkacur@redhat.com>
+ * Copyright (C) 2019 Clark Williams <williams@redhat.com>
+ */
+
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
diff --git a/src/queuelat/targeted-ipi/targeted-ipi.c b/src/queuelat/targeted-ipi/targeted-ipi.c
index 4a10e0b24ecb..be2b153260c5 100644
--- a/src/queuelat/targeted-ipi/targeted-ipi.c
+++ b/src/queuelat/targeted-ipi/targeted-ipi.c
@@ -1,3 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2018 Marcelo Tosatti <mtosatti@redhat.com>
+ * Copyright (C) 2019 John Kacur <jkacur@redhat.com>
+ * Copyright (C) 2019 Clark Williams <williams@redhat.com>
+ */
+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
index f0a285d1d45f..4863238edeb4 100644
--- a/src/rt-migrate-test/rt-migrate-test.c
+++ b/src/rt-migrate-test/rt-migrate-test.c
@@ -1,24 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-only
/*
* rt-migrate-test.c
- *
* Copyright (C) 2007-2009 Steven Rostedt <srostedt@redhat.com>
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License (not later!)
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#include <stdio.h>
#ifndef __USE_XOPEN2K
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index 7b5e8b36c4ea..a08e28e73c42 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -1,3 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+/*
+ * Copyright (C) 2016 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
+ * Copyright (C) 2019 John Kacur <jkacur@redhat.com>
+ * Copyright (C) 2019 Clark Williams <williams@redhat.com>
+ */
+
#include <pthread.h>
#include <stdarg.h>
#include <stdlib.h>
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
index 5b5f40dbb74d..4cef2609912e 100644
--- a/src/sched_deadline/deadline_test.c
+++ b/src/sched_deadline/deadline_test.c
@@ -1,22 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
/*
* Copyright (C) 2016 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License (not later!)
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses>
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
+ * Copyright (C) 2019 John Kacur <jkacur@redhat.com>
+ * Copyright (C) 2019 Clark Williams <williams@redhat.com>
+ */
+
+/*
* deadline_test.c
*
* This program is used to test the deadline scheduler (SCHED_DEADLINE tasks).
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 4c952561d7f2..b5c86c5635cb 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
/*
* RT signal roundtrip test software
*
diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
index 2d0c04132fa7..4678b68675b2 100644
--- a/src/sigwaittest/sigwaittest.c
+++ b/src/sigwaittest/sigwaittest.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
/*
* sigwaittest.c
*
diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
index 080ed17107a8..f165da96e23a 100644
--- a/src/ssdd/ssdd.c
+++ b/src/ssdd/ssdd.c
@@ -1,3 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/*
+ * Copyright (C) 2019 Joe Korty <joe.korty@concurrent-rt.com>
+ */
+
/*
* Have a tracer do a bunch of PTRACE_SINGLESTEPs against
* a tracee as fast as possible. Create several of these
@@ -16,12 +22,6 @@
* The tracer waits on each PTRACE_SINGLESTEP with a waitpid(2)
* and checks that waitpid's return values for correctness.
*
- * This program was originally written by
- * Joe Korty <joe.korty@concurrent-rt.com>
- * This program is free software; you can redistribute it and / or modify
- * it under the terms of the GNU General Public License Version 2
- * of the licence, or (at your option) any later version
- * see COPYING for more information
*/
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
index 15e36af76288..7c15393fe1be 100644
--- a/src/svsematest/svsematest.c
+++ b/src/svsematest/svsematest.c
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
/*
* svsematest.c
*
* Copyright (C) 2009 Carsten Emde <C.Emde@osadl.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
- * USA.
*/
#include <stdio.h>
--
2.20.1

View File

@ -1,110 +0,0 @@
From e5f59a301e6585145c5b738a4e9327e943e16404 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Fri, 6 Sep 2019 20:59:42 +0200
Subject: [PATCH 1/8] rt-tests: Set affinity before applying numa
There are three changes here.
1. If affinity is not specified, but numa is available, then numa
implies AFFINITY_USEALL.
2. Move setting affinity before applying numa
We need to set the affinity before applying numa, so that we don't
apply numa settings to cpus we don't intend to run on.
3. Allow a greater number of threads than cpus to run in a round robin
fashion in the case of numa.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/cyclictest/cyclictest.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index d101e3d14854..52f93da7d074 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1349,8 +1349,12 @@ static void process_options (int argc, char *argv[], int max_cpus)
/* if smp wasn't requested, test for numa automatically */
if (!smp) {
#ifdef NUMA
- if (numa_available() != -1)
+ if (numa_available() != -1) {
numa = 1;
+ if (setaffinity == AFFINITY_UNSPECIFIED) {
+ setaffinity = AFFINITY_USEALL;
+ }
+ }
#else
warn("cyclictest was not built with the numa option\n");
numa = 0;
@@ -1716,6 +1720,7 @@ int main(int argc, char **argv)
sigset_t sigset;
int signum = SIGALRM;
int mode;
+ int cpu;
int max_cpus = sysconf(_SC_NPROCESSORS_ONLN);
int i, ret = -1;
int status;
@@ -1877,6 +1882,16 @@ int main(int argc, char **argv)
if (status != 0)
fatal("error from pthread_attr_init for thread %d: %s\n", i, strerror(status));
+ switch (setaffinity) {
+ case AFFINITY_UNSPECIFIED: cpu = -1; break;
+ case AFFINITY_SPECIFIED:
+ cpu = cpu_for_thread(i, max_cpus);
+ if (verbose)
+ printf("Thread %d using cpu %d.\n", i, cpu);
+ break;
+ case AFFINITY_USEALL: cpu = i % max_cpus; break;
+ }
+
node = -1;
if (numa) {
void *stack;
@@ -1884,7 +1899,7 @@ int main(int argc, char **argv)
size_t stksize;
/* find the memory node associated with the cpu i */
- node = rt_numa_numa_node_of_cpu(i);
+ node = rt_numa_numa_node_of_cpu(cpu);
/* get the stack size set for for this thread */
if (pthread_attr_getstack(&attr, &currstk, &stksize))
@@ -1895,7 +1910,7 @@ int main(int argc, char **argv)
stksize = PTHREAD_STACK_MIN * 2;
/* allocate memory for a stack on appropriate node */
- stack = rt_numa_numa_alloc_onnode(stksize, node, i);
+ stack = rt_numa_numa_alloc_onnode(stksize, node, cpu);
/* touch the stack pages to pre-fault them in */
memset(stack, 0, stksize);
@@ -1965,20 +1980,13 @@ int main(int argc, char **argv)
interval += distance;
if (verbose)
printf("Thread %d Interval: %d\n", i, interval);
+
par->max_cycles = max_cycles;
par->stats = stat;
par->node = node;
par->tnum = i;
- switch (setaffinity) {
- case AFFINITY_UNSPECIFIED: par->cpu = -1; break;
- case AFFINITY_SPECIFIED:
- par->cpu = cpu_for_thread(i, max_cpus);
- if (verbose)
- printf("Thread %d using cpu %d.\n", i,
- par->cpu);
- break;
- case AFFINITY_USEALL: par->cpu = i % max_cpus; break;
- }
+ par->cpu = cpu;
+
stat->min = 1000000;
stat->max = 0;
stat->avg = 0.0;
--
2.20.1

View File

@ -1,32 +0,0 @@
From bb93611dd8248c0a4c05b9ccd9a93a78432044d7 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Thu, 19 Sep 2019 20:19:17 +0200
Subject: [PATCH 7/8] rt-tests: cyclictest: Assume libnuma version 2 by default
Most distributions have used libnuma version 2 for awhile now, so make
it the default.
This doesn't prevent people from defining it as version 1, or compiling
without numa.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/cyclictest/rt_numa.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
index e0f4b2e9d8b2..7adeb3c01324 100644
--- a/src/cyclictest/rt_numa.h
+++ b/src/cyclictest/rt_numa.h
@@ -29,7 +29,7 @@ static int numa = 0;
#include <numa.h>
#ifndef LIBNUMA_API_VERSION
-#define LIBNUMA_API_VERSION 1
+#define LIBNUMA_API_VERSION 2
#endif
static void *
--
2.20.1

View File

@ -1,42 +0,0 @@
From 0bf35a2fb58177318353c3a2e02df5b20728d5b9 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Mon, 16 Sep 2019 23:43:32 +0200
Subject: [PATCH 5/8] rt-tests: cyclictest: Don't allow OPT_SYSTEM with
OPT_POSIX_TIMERS
OPT_SYSTEM means use sys_nanosleep and sys_setitimer
if you try to combine it with OPT_POSIX_TIMERS, it breaks.
cyclictest becomes unkillable with ctrl-C and only the first thread is
updated.
Fix this by issuing a warning if the user tries to combine the two
options and then use clock_nanosleep.
Reported-by: Tom Rix <trix@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/cyclictest/cyclictest.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 3a78912b34f8..6be0525822ca 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1353,6 +1353,13 @@ static void process_options (int argc, char *argv[], int max_cpus)
}
}
+ if ((use_system == MODE_SYS_OFFSET) && (use_nanosleep == MODE_CYCLIC)) {
+ warn("The system option requires clock_nanosleep\n");
+ warn("and is not compatible with posix_timers\n");
+ warn("Using clock_nanosleep\n");
+ use_nanosleep = MODE_CLOCK_NANOSLEEP;
+ }
+
/* if smp wasn't requested, test for numa automatically */
if (!smp) {
#ifdef NUMA
--
2.20.1

View File

@ -1,33 +0,0 @@
From f70d5f0de62114cfcd8d8b5032138111730665e6 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Mon, 16 Sep 2019 21:06:28 +0200
Subject: [PATCH 4/8] =?UTF-8?q?rt-tests:=20cyclictest:=20Fix=20=20warning:?=
=?UTF-8?q?=20=E2=80=98cpu=E2=80=99=20may=20be=20used=20uninitialized?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fix warning 'cpu' maybe uninitialized by giving it a default value in
the switch statement. Note, this is a false positive, but documenting
the default value in the switch statement isn't a bad thing.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/cyclictest/cyclictest.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 72fb35da3238..3a78912b34f8 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1897,6 +1897,7 @@ int main(int argc, char **argv)
printf("Thread %d using cpu %d.\n", i, cpu);
break;
case AFFINITY_USEALL: cpu = i % max_cpus; break;
+ default: cpu = -1;
}
node = -1;
--
2.20.1

View File

@ -1,294 +0,0 @@
From 26bd002f00753b3b6aa857eeee62c051a15b6fa5 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Fri, 6 Sep 2019 21:48:59 +0200
Subject: [PATCH] rt-tests: cyclictest: Get a snapshot of cyclictest without
interuppting it
Right now if you are running cyclictest you can send it SIGUSR1
and it will spill out the data at a moment in time, and keep running.
However, this can be problematic if you are using another program such
as rteval to consume the data.
This feature here lets you send SIGUSR2 to cyclictest and it dumps
status to shared memory so you can read it without interrupting
cyclictest and without interferring with the data it is outputing.
To use it, start cyclictest in one term, then in another term send it
SIGUSR2, and then you can just cat the results like this:
[jkacur@planxty rt-tests]$ ps ax | tail
14083 ? I 0:00 [kworker/1:0-events]
14108 ? I 0:01 [kworker/u16:3-events_unbound]
14150 ? I 0:00 [kworker/7:0-mm_percpu_wq]
14287 pts/9 SLl+ 0:14 ./cyclictest -t
14324 ? I 0:00 [kworker/1:2]
14341 ? I 0:00 [kworker/0:2]
14342 ? I 0:00 [kworker/2:1]
14363 ? I 0:00 [kworker/u16:0-events_unbound]
14381 pts/2 R+ 0:00 ps ax
14382 pts/2 S+ 0:00 tail
[jkacur@planxty rt-tests]$ cat /dev/shm/cyclictest_shm
[jkacur@planxty rt-tests]$ kill -s USR2 14287
[jkacur@planxty rt-tests]$ cat /dev/shm/cyclictest_shm
#---------------------------
# cyclictest current status:
T: 0 (14288) P: 0 I:1000 C: 124852 Min: 20 Act: 65 Avg: 104 Max: 354
T: 1 (14289) P: 0 I:1500 C: 83235 Min: 6 Act: 77 Avg: 82 Max: 330
T: 2 (14290) P: 0 I:2000 C: 62426 Min: 9 Act: 71 Avg: 110 Max: 358
T: 3 (14291) P: 0 I:2500 C: 49940 Min: 9 Act: 77 Avg: 111 Max: 453
T: 4 (14292) P: 0 I:3000 C: 41617 Min: 14 Act: 68 Avg: 69 Max: 815
T: 5 (14293) P: 0 I:3500 C: 35672 Min: 15 Act: 68 Avg: 105 Max: 360
T: 6 (14294) P: 0 I:4000 C: 31212 Min: 15 Act: 64 Avg: 103 Max: 372
T: 7 (14295) P: 0 I:4500 C: 27744 Min: 20 Act: 118 Avg: 93 Max: 681
#---------------------------
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/cyclictest/cyclictest.c | 184 ++++++++++++++++++++++++++++++++++++
1 file changed, 184 insertions(+)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index bca028fedffd..1c515ae1354c 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -231,10 +231,14 @@ static struct thread_param **parameters;
static struct thread_stat **statistics;
static void print_stat(FILE *fp, struct thread_param *par, int index, int verbose, int quiet);
+static void rstat_print_stat(struct thread_param *par, int index, int verbose, int quiet);
+static void rstat_setup(void);
static int latency_target_fd = -1;
static int32_t latency_target_value = 0;
+static int rstat_fd = -1;
+
/* Latency trick
* if the file /dev/cpu_dma_latency exists,
* open it and write a zero into it. This will tell
@@ -1475,6 +1479,22 @@ static void sighand(int sig)
fprintf(stderr, "#---------------------------\n");
quiet = oldquiet;
return;
+ } else if (sig == SIGUSR2) {
+ int i;
+ int oldquiet = quiet;
+
+ if (rstat_fd == -1) {
+ fprintf(stderr, "ERROR: rstat_fd not valid\n");
+ return;
+ }
+ quiet = 0;
+ dprintf(rstat_fd, "#---------------------------\n");
+ dprintf(rstat_fd, "# cyclictest current status:\n");
+ for (i = 0; i < num_threads; i++)
+ rstat_print_stat(parameters[i], i, 0, 0);
+ dprintf(rstat_fd, "#---------------------------\n");
+ quiet = oldquiet;
+ return;
}
shutdown = 1;
if (refresh_on_max)
@@ -1642,6 +1662,62 @@ static void print_stat(FILE *fp, struct thread_param *par, int index, int verbos
}
}
+static void rstat_print_stat(struct thread_param *par, int index, int verbose, int quiet)
+{
+ struct thread_stat *stat = par->stats;
+ int fd = rstat_fd;
+
+ if (!verbose) {
+ if (quiet != 1) {
+ char *fmt;
+ if (use_nsecs)
+ fmt = "T:%2d (%5d) P:%2d I:%ld C:%7lu "
+ "Min:%7ld Act:%8ld Avg:%8ld Max:%8ld";
+ else
+ fmt = "T:%2d (%5d) P:%2d I:%ld C:%7lu "
+ "Min:%7ld Act:%5ld Avg:%5ld Max:%8ld";
+
+ dprintf(fd, fmt, index, stat->tid, par->prio,
+ par->interval, stat->cycles, stat->min,
+ stat->act, stat->cycles ?
+ (long)(stat->avg/stat->cycles) : 0, stat->max);
+
+ if (smi)
+ dprintf(fd," SMI:%8ld", stat->smi_count);
+
+ dprintf(fd, "\n");
+ }
+ } else {
+ while (stat->cycles != stat->cyclesread) {
+ unsigned long diff_smi;
+ long diff = stat->values
+ [stat->cyclesread & par->bufmsk];
+
+ if (smi)
+ diff_smi = stat->smis
+ [stat->cyclesread & par->bufmsk];
+
+ if (diff > stat->redmax) {
+ stat->redmax = diff;
+ stat->cycleofmax = stat->cyclesread;
+ }
+ if (++stat->reduce == oscope_reduction) {
+ if (!smi)
+ dprintf(fd, "%8d:%8lu:%8ld\n", index,
+ stat->cycleofmax, stat->redmax);
+ else
+ dprintf(fd, "%8d:%8lu:%8ld%8ld\n",
+ index, stat->cycleofmax,
+ stat->redmax, diff_smi);
+
+ stat->reduce = 0;
+ stat->redmax = 0;
+ }
+ stat->cyclesread++;
+ }
+ }
+}
+
/*
* thread that creates a named fifo and hands out run stats when someone
@@ -1729,6 +1805,105 @@ static void trigger_update(struct thread_param *par, int diff, int64_t ts)
pthread_mutex_unlock(&trigger_lock);
}
+/* Running status shared memory open */
+static int rstat_shm_open(void)
+{
+ int fd;
+
+ errno = 0;
+ fd = shm_unlink("/cyclictest_shm");
+
+ if ((fd == -1) && (errno != ENOENT)) {
+ fprintf(stderr, "ERROR: shm_unlink %s\n", strerror(errno));
+ return fd;
+ }
+
+ errno = 9;
+ fd = shm_open("/cyclictest_shm", O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
+ if (fd == -1) {
+ fprintf(stderr, "ERROR: shm_open %s\n", strerror(errno));
+ }
+
+ rstat_fd = fd;
+
+ return fd;
+}
+
+static int rstat_ftruncate(int fd)
+{
+ int err;
+
+ errno = 0;
+ err = ftruncate(fd, _SC_PAGE_SIZE);
+ if (err) {
+ fprintf(stderr, "ftruncate error %s\n", strerror(errno));
+ }
+
+ return err;
+}
+
+static void *rstat_mmap(int fd)
+{
+ void *mptr;
+
+ errno = 0;
+ mptr = mmap(0, _SC_PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+
+ if (mptr == (void*)-1) {
+ fprintf(stderr, "ERROR: mmap, %s\n", strerror(errno));
+ }
+
+ return mptr;
+}
+
+static int rstat_mlock(void *mptr)
+{
+ int err;
+
+ err = mlock(mptr, _SC_PAGE_SIZE);
+
+ errno = 0;
+ if (err == -1) {
+ fprintf(stderr, "ERROR, mlock %s\n", strerror(errno));
+ }
+
+ return err;
+}
+
+static void rstat_setup(void)
+{
+ int res;
+ void *mptr = NULL;
+
+ int sfd = rstat_shm_open();
+ if (sfd < 0)
+ goto rstat_err;
+
+ res = rstat_ftruncate(sfd);
+ if (res)
+ goto rstat_err1;
+
+ mptr = rstat_mmap(sfd);
+ if (mptr == MAP_FAILED)
+ goto rstat_err1;
+
+ res = rstat_mlock(mptr);
+ if (res)
+ goto rstat_err2;
+
+ return;
+
+rstat_err2:
+ munmap(mptr, _SC_PAGE_SIZE);
+rstat_err1:
+ close(sfd);
+ shm_unlink("/cyclictest_shm");
+rstat_err:
+ rstat_fd = -1;
+ return;
+}
+
+
int main(int argc, char **argv)
{
sigset_t sigset;
@@ -1869,6 +2044,7 @@ int main(int argc, char **argv)
}
+
mode = use_nanosleep + use_system;
sigemptyset(&sigset);
@@ -1878,6 +2054,10 @@ int main(int argc, char **argv)
signal(SIGINT, sighand);
signal(SIGTERM, sighand);
signal(SIGUSR1, sighand);
+ signal(SIGUSR2, sighand);
+
+ /* Set-up shm */
+ rstat_setup();
parameters = calloc(num_threads, sizeof(struct thread_param *));
if (!parameters)
@@ -2138,5 +2318,9 @@ int main(int argc, char **argv)
if (affinity_mask)
rt_bitmask_free(affinity_mask);
+ /* Remove running status shared memory file if it exists */
+ if (rstat_fd >= 0)
+ shm_unlink("/cyclictest_shm");
+
exit(ret);
}
--
2.20.1

View File

@ -1,151 +0,0 @@
From 97632deddf783249e0e3d34630792c7696b7d5d5 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Tue, 24 Sep 2019 19:37:48 +0200
Subject: [PATCH 8/8] rt-tests: cyclictest: Just use LIBNUMA_API_VERSION 2
This removes support for LIBNUMA_API_VERSION 1.
You can still build without numa support by doing
make NUMA=0
You can also build with numa and run on machines without numa support.
Suggested-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/cyclictest/rt_numa.h | 98 +---------------------------------------
1 file changed, 1 insertion(+), 97 deletions(-)
diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
index 7adeb3c01324..983502d34c94 100644
--- a/src/cyclictest/rt_numa.h
+++ b/src/cyclictest/rt_numa.h
@@ -1,16 +1,7 @@
/*
* A numa library for cyclictest.
* The functions here are designed to work whether cyclictest has been
- * compiled with numa support or not, and whether the user uses the --numa
- * option or not.
- * They should also work correctly with older versions of the numactl lib
- * such as the one found on RHEL5, or with the newer version 2 and above.
- *
- * The difference in behavior hinges on whether LIBNUMA_API_VERSION >= 2,
- * in which case we will employ the bitmask affinity behavior -or-
- * either LIBNUMA_API_VERSION < 2 or NUMA support is missing altogether,
- * in which case we retain the older affinity behavior which can either
- * specify a single CPU core or else use all cores.
+ * compiled with numa support or not.
*
* (C) 2010 John Kacur <jkacur@redhat.com>
* (C) 2010 Clark Williams <williams@redhat.com>
@@ -28,10 +19,6 @@ static int numa = 0;
#ifdef NUMA
#include <numa.h>
-#ifndef LIBNUMA_API_VERSION
-#define LIBNUMA_API_VERSION 2
-#endif
-
static void *
threadalloc(size_t size, int node)
{
@@ -69,8 +56,6 @@ static void *rt_numa_numa_alloc_onnode(size_t size, int node, int cpu)
return stack;
}
-#if LIBNUMA_API_VERSION >= 2
-
/*
* Use new bit mask CPU affinity behavior
*/
@@ -110,87 +95,6 @@ static inline void rt_bitmask_free(struct bitmask *mask)
numa_bitmask_free(mask);
}
-#else /* LIBNUMA_API_VERSION == 1 */
-
-struct bitmask {
- unsigned long size; /* number of bits in the map */
- unsigned long *maskp;
-};
-#define BITS_PER_LONG (8*sizeof(long))
-
-/*
- * Map legacy CPU affinity behavior onto bit mask infrastructure
- */
-static int rt_numa_numa_node_of_cpu(int cpu)
-{
- unsigned char cpumask[256];
- int node, idx, bit;
- int max_node, max_cpus;
-
- max_node = numa_max_node();
- max_cpus = sysconf(_SC_NPROCESSORS_ONLN);
-
- if (cpu > max_cpus) {
- errno = EINVAL;
- return -1;
- }
-
- /* calculate bitmask index and relative bit position of cpu */
- idx = cpu / 8;
- bit = cpu % 8;
-
- for (node = 0; node <= max_node; node++) {
- if (numa_node_to_cpus(node, (void *) cpumask, sizeof(cpumask)))
- return -1;
-
- if (cpumask[idx] & (1<<bit))
- return node;
- }
- errno = EINVAL;
- return -1;
-}
-
-static inline unsigned int rt_numa_bitmask_isbitset( const struct bitmask *mask,
- unsigned long i)
-{
- long bit = mask->maskp[i/BITS_PER_LONG] & (1<<(i % BITS_PER_LONG));
- return (bit != 0);
-}
-
-static inline struct bitmask* rt_numa_parse_cpustring(const char* s,
- int max_cpus)
-{
- int cpu;
- struct bitmask *mask = NULL;
- cpu = atoi(s);
- if (0 <= cpu && cpu < max_cpus) {
- mask = malloc(sizeof(*mask));
- if (mask) {
- /* Round up to integral number of longs to contain
- * max_cpus bits */
- int nlongs = (max_cpus+BITS_PER_LONG-1)/BITS_PER_LONG;
-
- mask->maskp = calloc(nlongs, sizeof(long));
- if (mask->maskp) {
- mask->maskp[cpu/BITS_PER_LONG] |=
- (1UL << (cpu % BITS_PER_LONG));
- mask->size = max_cpus;
- } else {
- free(mask);
- mask = NULL;
- }
- }
- }
- return mask;
-}
-
-static inline void rt_bitmask_free(struct bitmask *mask)
-{
- free(mask->maskp);
- free(mask);
-}
-
-#endif /* LIBNUMA_API_VERSION */
#else /* ! NUMA */
--
2.20.1

View File

@ -1,68 +0,0 @@
From 33f07f6ee2053dc16dd667c763326515e87f19e3 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Mon, 16 Sep 2019 20:37:22 +0200
Subject: [PATCH] rt-tests: cyclictest: Make tracemark work correctly again
commit f5ccfbe4d6641e48f56152be135d901dd31cba7e
was a little too aggressive removing ftrace code.
We were able to remove ftrace code because this functionality is
available using trace-cmd, in conjunction with the tracemark option in
cyclictest. Put back the parts of tracemark needed to make this work
correctly.
After this patch you can get tracing info like this as an example.
trace-cmd record -p function ./cyclictest -t -b100 --tracemark
Signed-off-by: John Kacur <jkacur@redhat.com>
Corrected a typo
Reported-by: Kurt Kanzenbach <kurt.kanzenbach@linutronix.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/cyclictest/cyclictest.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 52f93da7d074..72fb35da3238 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -184,6 +184,7 @@ static void trigger_update(struct thread_param *par, int diff, int64_t ts);
static int shutdown;
static int tracelimit = 0;
+static int trace_marker = 0;
static int verbose = 0;
static int oscope_reduction = 1;
static int lockall = 0;
@@ -400,6 +401,9 @@ static void debugfs_prepare(void)
static void enable_trace_mark(void)
{
+ if (!trace_marker)
+ return;
+
debugfs_prepare();
open_tracemark_fd();
}
@@ -1167,6 +1171,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
{"spike", required_argument, NULL, OPT_TRIGGER },
{"spike-nodes", required_argument, NULL, OPT_TRIGGER_NODES },
{"threads", optional_argument, NULL, OPT_THREADS },
+ {"tracemark", no_argument, NULL, OPT_TRACEMARK },
{"unbuffered", no_argument, NULL, OPT_UNBUFFERED },
{"verbose", no_argument, NULL, OPT_VERBOSE },
{"dbg_cyclictest", no_argument, NULL, OPT_DBGCYCLIC },
@@ -1343,6 +1348,8 @@ static void process_options (int argc, char *argv[], int max_cpus)
fatal("--smi is not available on your arch\n");
#endif
break;
+ case OPT_TRACEMARK:
+ trace_marker = 1; break;
}
}
--
2.20.1

View File

@ -1,117 +0,0 @@
From abc74dca458bb81b81ad40efecda69a6fa28fd3c Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Sat, 14 Sep 2019 04:57:35 +0200
Subject: [PATCH] rt-tests: cyclictest.8: Remove invalid tracing options from
the manpage
Most tracing options have been removed from cyclictest since the
user can now use trace-cmd together with cyclictest to get the same
functionality. Update the manpage to reflect this.
Reported-by: Tom Rix <trix@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/cyclictest/cyclictest.8 | 35 -----------------------------------
1 file changed, 35 deletions(-)
diff --git a/src/cyclictest/cyclictest.8 b/src/cyclictest/cyclictest.8
index a05d1f4c9d4a..b64a16ae8bbb 100644
--- a/src/cyclictest/cyclictest.8
+++ b/src/cyclictest/cyclictest.8
@@ -52,9 +52,6 @@ Align thread wakeups to a specific offset in microseconds
.B \-b, \-\-breaktrace=USEC
Send break trace command when latency > USEC
.TP
-.B \-B, \-\-preemptirqs
-Both preempt and irqsoff tracing (used with -b)
-.TP
.B \-c, \-\-clock=CLOCK
select clock
.br
@@ -62,9 +59,6 @@ select clock
.br
1 = CLOCK_REALTIME
.TP
-.B \-C, \-\-context
-context switch tracing (used with \-b)
-.TP
.B \-d, \-\-distance=DIST
Distance of thread intervals in us, default = 500
.TP
@@ -73,12 +67,6 @@ Specify a length for the test run.
.br
Append 'm', 'h', or 'd' to specify minutes, hours or days.
.TP
-.B \-E, \-\-event
-event tracing (used with \-b)
-.TP
-.B \-f, \-\-ftrace
-Enable function tracing using ftrace as tracer. This option is available only with \-b.
-.TP
.B \-F, \-\-fifo=<path>
Create a named pipe at path and write stats to it
.TP
@@ -94,9 +82,6 @@ Dump the latency histogram to <path> instead of stdout.
.B \-i, \-\-interval=INTV
Set the base interval of the thread(s) in microseconds (default is 1000us). This sets the interval of the first thread. See also \-d.
.TP
-.B \-I, \-\-irqsoff
-Irgsoff tracing (used with \-b)
-.TP
.B \-l, \-\-loops=LOOPS
Set the number of loops. The default is 0 (endless). This option is useful for automated tests with a given number of test cycles. Cyclictest is stopped once the number of timer intervals has been reached.
.TP
@@ -113,26 +98,16 @@ running cyclictest on low-bandwidth connections)
.B \-n, \-\-nanosleep
Use clock_nanosleep instead of posix interval timers. Setting this option runs the tests with clock_nanosleep instead of posix interval timers.
.TP
-.B \-\-notrace
-suppress tracing
-.TP
.B \-N, \-\-nsecs
Show results in nanoseconds instead of microseconds, which is the default unit.
.TP
.B \-o, \-\-oscope=RED
Oscilloscope mode, reduce verbose output by RED.
.TP
-.B \-O, \-\-traceopt=TRACING_OPTION
-Used to pass tracing options to ftrace tracers. May be invoked multiple
-times for multiple trace options. For example trace options look at /sys/kernel/debug/tracing/trace_options
-.TP
.B \-p, \-\-prio=PRIO
Set the priority of the first thread. The given priority is set to the first test thread. Each further thread gets a lower priority:
Priority(Thread N) = max(Priority(Thread N\-1) \- 1, 0)
.TP
-.B \-P, \-\-preemptoff
-Preempt off tracing (used with -b)
-.TP
.B \-\-policy=NAME
set the scheduler policy of the measurement threads
where NAME is one of: other, normal, batch, idle, fifo, rr
@@ -178,10 +153,6 @@ the number of available CPUs. See \-d, \-i and \-p for further information.
.B \-\-tracemark
write a trace mark when \-b latency is exceeded.
.TP
-.B \-T, \-\-tracer=TRACEFUNC
-set the ftrace tracer function. Used with the \-b option. Must be one
-of the trace functions available from <debugfs-mountpoint>/kernel/debug/tracing/available_tracers
-.TP
.B \-u, \-\-unbuffered
force unbuffered output for live processing
.TP
@@ -192,12 +163,6 @@ n:c:v
where n=task number c=count v=latency value in us.
.TP
-.B \\-w, \-\-wakeup
-task wakeup tracing (used with \-b)
-.TP
-.B \\-W, \-\-wakeuprt
-rt-task wakeup tracing (used with \-b)
-.TP
.B \-\-dbg_cyclictest
Print info userful for debugging cyclictest
--
2.20.1

View File

@ -1,86 +0,0 @@
From 6a9f1f6d5a19beed45dd81f74a41c18dcd3bd3dc Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Mon, 11 Nov 2019 22:20:23 +0100
Subject: [PATCH] rt-tests: queuelat: Fix some warnings in
determine_maximum_mpps.sh
Coverity advises to quote some values to prevent word splitting and to
export variables separately after declaraing them to avoid masking
errors.
Fix these warnings
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/queuelat/determine_maximum_mpps.sh | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/queuelat/determine_maximum_mpps.sh b/src/queuelat/determine_maximum_mpps.sh
index cd45454720f7..3acd6ba2e362 100755
--- a/src/queuelat/determine_maximum_mpps.sh
+++ b/src/queuelat/determine_maximum_mpps.sh
@@ -18,7 +18,7 @@ for mpps in `seq 3 3 50`; do
echo testing $mpps Mpps
OUTFILE=`mktemp`
- $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p $mpps -t 30 > $OUTFILE
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
exceeded=`grep exceeded $OUTFILE`
if [ ! -z "$exceeded" ]; then
@@ -34,7 +34,7 @@ for mpps in `seq $first_mpps -1 3`; do
echo testing $mpps Mpps
OUTFILE=`mktemp`
- $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p $mpps -t 30 > $OUTFILE
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
exceeded=`grep exceeded $OUTFILE`
if [ -z "$exceeded" ]; then
@@ -51,7 +51,7 @@ for mpps in `seq $second_mpps 0.3 $first_mpps`; do
echo testing $mpps Mpps
OUTFILE=`mktemp`
- $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p $mpps -t 30 > $OUTFILE
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
exceeded=`grep exceeded $OUTFILE`
if [ ! -z "$exceeded" ]; then
@@ -68,7 +68,7 @@ for mpps in `seq $third_mpps -0.1 3`; do
echo testing $mpps Mpps
OUTFILE=`mktemp`
- $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p $mpps -t 30 > $OUTFILE
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
exceeded=`grep exceeded $OUTFILE`
if [ -z "$exceeded" ]; then
@@ -87,13 +87,14 @@ while [ $queuelat_failure == 1 ]; do
echo "$mpps Mpps"
for i in `seq 1 10`; do
- $PREAMBLE ./queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `get_cpuinfo_mhz.sh` -p $mpps -t 30 > $OUTFILE
+ $PREAMBLE ./queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
exceeded=`grep exceeded $OUTFILE`
if [ ! -z "$exceeded" ]; then
echo "mpps failure (run $i) $mpps"
export queuelat_failure=1
- export mpps=`echo $mpps - 0.1 | bc`
+ mpps=`echo $mpps - 0.1 | bc`
+ export mpps
break
fi
echo "run $i success"
@@ -109,7 +110,7 @@ while [ $queuelat_failure == 1 ]; do
echo -n "Starting 10 minutes run with "
echo "$mpps Mpps"
- $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `get_cpuinfo_mhz.sh` -p $mpps -t 600 > $OUTFILE
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `get_cpuinfo_mhz.sh` -p "$mpps" -t 600 > $OUTFILE
exceeded=`grep exceeded $OUTFILE`
if [ ! -z "$exceeded" ]; then
--
2.20.1

View File

@ -0,0 +1,111 @@
From 41a3f9e53920d50b48c04593bfa3eb0e87fcf49f Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Tue, 12 May 2020 11:02:39 -0400
Subject: [PATCH] rt-tests: queuelat: Fix storing unsigned long long in int
queuelat can occassionally hang because of overflow mixing
unsigned long long and int
Attaching to process 173912
Reading symbols from /root/rt-tests/queuelat...done.
Reading symbols from /lib64/librt.so.1...Reading symbols from /usr/lib/debug/usr/lib64/librt-2.28.so.debug...done.
done.
Reading symbols from /lib64/libpthread.so.0...Reading symbols from /usr/lib/debug/usr/lib64/libpthread-2.28.so.debug...done.
done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Reading symbols from /lib64/libc.so.6...Reading symbols from /usr/lib/debug/usr/lib64/libc-2.28.so.debug...done.
done.
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug/usr/lib64/ld-2.28.so.debug...done.
done.
__memmove_avx_unaligned_erms ()
at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:254
254 rep movsb
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x0000000000400c02 in account (val=18446744071562067968)
at src/queuelat/queuelat.c:93
93 buckets[bucket_nr]++;
(gdb) bt full
at src/queuelat/queuelat.c:93
bucket_nr = -193273529
a = 825932047802952
b = 825925371232340
dest = 0xf322b0
src = 0xf4e3f0
i = 45749
delta = -2147483648
loops = 50000
time = 6500
bucket_nr = 65
n = 115000
delta = 3500
at src/queuelat/queuelat.c:671
tsc_freq_mhz = 2398.5039999999999
max_queue_len_f = 159.900284
mvalue = 0x7ffc99d3021c "20000"
cvalue = 0x7ffc99d30225 "300"
pvalue = 0x7ffc99d30238 "6.1"
fvalue = 0x7ffc99d3022c "2398.504"
tvalue = 0x7ffc99d3023f "30"
qvalue = 0x0
index = 0
c = -1
Fix the above by declaring delta as an unsigned long long
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/queuelat/queuelat.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/queuelat/queuelat.c b/src/queuelat/queuelat.c
index 7e5e35768a8b..22b68a84d6ae 100644
--- a/src/queuelat/queuelat.c
+++ b/src/queuelat/queuelat.c
@@ -354,9 +354,9 @@ static void trace_write(char *buf, int len)
static void run_n(int n)
{
- u64 a, b;
+ u64 a, b, delta;
void *dest, *src;
- int i, delta, loops = 50000;
+ int i, loops = 50000;
init_buckets();
@@ -445,9 +445,8 @@ static void print_exit_info(void)
void main_loop(void)
{
- u64 a, b;
+ u64 a, b, delta;
void *dest, *src;
- int delta;
int queue_size = 0;
trace_open();
@@ -500,7 +499,7 @@ void main_loop(void)
continue;
ret = sprintf(buf, "memmove block queue_size=%d queue_dec=%d"
- " queue_inc=%d delta=%d ns\n", queue_size,
+ " queue_inc=%d delta=%llu ns\n", queue_size,
nr_packets_drain_per_block,
nr_packets_fill, delta);
trace_write(buf, ret);
@@ -536,7 +535,7 @@ static void install_signals(void)
int calculate_nr_packets_drain_per_block(void)
{
- int maxcount;
+ unsigned long long maxcount;
int i, time;
int found = 0;
int bucket_nr = find_highest_count_bucket();
--
2.21.3

View File

@ -1,123 +0,0 @@
From a6f1ab221f80e2f2e1d1f184710ab65c35ed5b36 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Tue, 12 Nov 2019 01:21:09 +0100
Subject: [PATCH] rt-tests: ssdd: Add short and long functions as well as help
Add short and long functions as well as help to make ssdd consistent
with the rest of the test suite. Add a help function as well
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/ssdd/ssdd.8 | 10 +++++++---
src/ssdd/ssdd.c | 45 +++++++++++++++++++++++++++++++++++++++------
2 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/src/ssdd/ssdd.8 b/src/ssdd/ssdd.8
index 44638489f0d1..99f30145d079 100644
--- a/src/ssdd/ssdd.8
+++ b/src/ssdd/ssdd.8
@@ -3,7 +3,7 @@
ssdd \- have a tracer do a bunch of PTRACE_SINGLESTEPs
.SH SYNOPSIS
.B ssdd
-.RI "[nforks] [niters]"
+.RI "<options>"
.SH DESCRIPTION
Have a tracer do a bunch of PTRACE_SINGLESTEPs against
a tracee as fast as possible. Create several of these
@@ -12,15 +12,19 @@ interfere with each other.
The tracer waits on each PTRACE_SINGLESTEP with a waitpid(2)
and checks that waitpid's return values for correctness.
.SH OPTIONS
-.B nforks
+.B \-f, \-\-forks
number of tracer/tracee pairs to fork off.
Default is 10.
.br
.TP
-.B niters
+.B \-i, \-\-iters
number of PTRACE_SINGLESTEP iterations to
do before declaring success, for each tracer/
tracee pair set up. Default is 10,000.
+.br
+.TP
+.B \-h, \-\-help
+Display usage
.SH AUTHOR
ssdd was written by Joe Korty <joe.korty@concurrent-rt.com>
diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
index 2c3a779be9f1..080ed17107a8 100644
--- a/src/ssdd/ssdd.c
+++ b/src/ssdd/ssdd.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
+#include <getopt.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
@@ -65,6 +66,17 @@ static const char *get_state_name(int state)
static int got_sigchld;
+enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP };
+
+static void usage()
+{
+ printf("ssdd <options>\n");
+ printf("\t-f --forks=<number of forks>\n");
+ printf("\t-i --iters=<number of iterations>\n");
+ printf("\t-h --help\n");
+ exit(0);
+}
+
static int do_wait(pid_t *wait_pid, int *ret_sig)
{
int status, child_status;
@@ -276,13 +288,34 @@ int main(int argc, char **argv)
setbuf(stdout, NULL);
- argc--, argv++;
- if (argc) {
- nforks = atoi(*argv);
- argc--, argv++;
- if (argc)
- nsteps = atoi(*argv);
+ for (;;) {
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"forks", required_argument, NULL, OPT_NFORKS},
+ {"iters", required_argument, NULL, OPT_NITERS},
+ {"help", no_argument, NULL, OPT_HELP},
+ {NULL, 0, NULL, 0},
+ };
+ int c = getopt_long(argc, argv, "f:i:h", long_options, &option_index);
+ if (c == -1)
+ break;
+ switch(c) {
+ case 'f':
+ case OPT_NFORKS:
+ nforks = atoi(optarg);
+ break;
+ case 'i':
+ case OPT_NITERS:
+ nsteps = atoi(optarg);
+ break;
+ case 'h':
+ case OPT_HELP:
+ usage();
+ break;
+ }
}
+
printf("#main : %d\n", getpid());
printf("#forks: %d\n", nforks);
printf("#steps: %d\n", nsteps);
--
2.20.1

View File

@ -1,39 +0,0 @@
From 2d101866365ac75e29cfc9800ca569802fee64c7 Mon Sep 17 00:00:00 2001
From: Daniel Wagner <wagi@monom.org>
Date: Mon, 19 Aug 2019 08:43:02 +0200
Subject: [PATCH 02/10] sigwaittest: Increase buffer to avoid overflow
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Increase the size of the char buffer. gcc 9.1.1 reports:
src/sigwaittest/sigwaittest.c:494:5: note: sprintf output between 5 and 14 bytes into a destination of size 8
494 | sprintf(f_opt, "-fr%d", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/sigwaittest/sigwaittest.c:522:24: warning: %d directive writing between 1 and 10 bytes into a region of size 5 [-Wformat-overflow=]
522 | sprintf(f_opt, "-fs%d", i);
| ^~
Signed-off-by: Daniel Wagner <wagi@monom.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/sigwaittest/sigwaittest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
index 59f28a5babcb..2d0c04132fa7 100644
--- a/src/sigwaittest/sigwaittest.c
+++ b/src/sigwaittest/sigwaittest.c
@@ -352,7 +352,7 @@ int main(int argc, char *argv[])
struct params *sender = NULL;
sigset_t sigset;
void *param = NULL;
- char f_opt[8];
+ char f_opt[14];
struct timespec launchdelay, maindelay;
process_options(argc, argv);
--
2.20.1

View File

@ -1,39 +0,0 @@
From 06519443224b7da5b336040f07bff8f929148426 Mon Sep 17 00:00:00 2001
From: Daniel Wagner <wagi@monom.org>
Date: Mon, 19 Aug 2019 08:43:03 +0200
Subject: [PATCH 03/10] svsematest: Increase buffer to avoid overflow
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Increase the size of the char buffer. gcc 9.1.1 reports:
rc/svsematest/svsematest.c:578:24: warning: %d directive writing between 1 and 10 bytes into a region of size 5 [-Wformat-overflow=]
578 | sprintf(f_opt, "-fr%d", i);
| ^~
src/svsematest/svsematest.c:606:5: note: sprintf output between 5 and 14 bytes into a destination of size 8
606 | sprintf(f_opt, "-fs%d", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Daniel Wagner <wagi@monom.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/svsematest/svsematest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
index 8f880786ec0f..15e36af76288 100644
--- a/src/svsematest/svsematest.c
+++ b/src/svsematest/svsematest.c
@@ -401,7 +401,7 @@ int main(int argc, char *argv[])
struct params *sender = NULL;
sigset_t sigset;
void *param = NULL;
- char f_opt[8];
+ char f_opt[14];
struct timespec launchdelay, maindelay;
myfile = getenv("_");
--
2.20.1

View File

@ -5,8 +5,8 @@ Name: rt-tests
# BuildRequires: numactl-devel
# Numa argument to make: NUMA=1
#
Version: 1.5
Release: 15%{?dist}
Version: 1.8
Release: 3%{?dist}
License: GPLv2
Group: Development/Tools
URL: git://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git
@ -20,21 +20,8 @@ BuildRequires: numactl-devel python3-devel
Requires: bash bc
#Patches
Patch1: rt-tests-cyclictest-Make-tracemark-work-correctly-ag.patch
Patch2: rt-tests-cyclictest.8-Remove-invalid-tracing-options.patch
Patch3: pmqtest-Increase-buffer-to-avoid-overflow.patch
Patch4: sigwaittest-Increase-buffer-to-avoid-overflow.patch
Patch5: svsematest-Increase-buffer-to-avoid-overflow.patch
Patch6: deadline_test-Increase-buffer-to-avoid-overflow.patch
Patch7: rt-tests-Set-affinity-before-applying-numa.patch
Patch8: rt-tests-cyclictest-Don-t-allow-OPT_SYSTEM-with-OPT_POSIX_TIMERS.patch
Patch9: rt-tests-cyclictest-Fix-warning-cpu-may-be-used-uninitialized.patch
Patch10: rt-tests-cyclictest-Assume-libnuma-version-2-by-defa.patch
Patch11: rt-tests-cyclictest-Just-use-LIBNUMA_API_VERSION-2.patch
Patch12: rt-tests-queuelat-Fix-some-warnings-in-determine_max.patch
Patch13: rt-tests-ssdd-Add-short-and-long-functions-and-help.patch
Patch14: rt-tests-cyclictest-Get-a-snapshot-of-cyclictest.patch
Patch15: rt-tests-Add-SPDX-tags.patch
Patch1: cyclictest-Fix-setaffinity-error-on-large-NUMA-machines.patch
Patch2: rt-tests-queuelat-Fix-storing-unsigned-long-long-int.patch
%description
rt-tests is a set of programs that test and measure various components of
@ -45,19 +32,6 @@ latency. It also tests the functioning of priority-inheritance mutexes.
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%build
make NUMA=1 HAVE_PARSE_CPUSTRING_ALL=1
@ -92,6 +66,9 @@ rm -rf $RPM_BUILD_ROOT
/usr/bin/ssdd
/usr/bin/determine_maximum_mpps.sh
/usr/bin/get_cpuinfo_mhz.sh
/usr/bin/get_cyclictest_snapshot
%{python3_sitelib}/get_cyclictest_snapshot.py*
%{python3_sitelib}/__pycache__/get_cyclictest_snapshot*
%doc
/usr/share/man/man8/cyclictest.8.gz
/usr/share/man/man8/hackbench.8.gz
@ -106,10 +83,43 @@ rm -rf $RPM_BUILD_ROOT
/usr/share/man/man8/pip_stress.8.gz
/usr/share/man/man8/queuelat.8.gz
/usr/share/man/man8/deadline_test.8.gz
/usr/share/man/man8/cyclicdeadline.8.gz
/usr/share/man/man8/ssdd.8.gz
%changelog
* Mon Nov 25 2019 John Kacur <jkacur@redhat.com> - 1.6-15
* Tue May 12 2020 John Kacur <jkacur@redhat.com> - 1.8-3
- Fix integer overflow in queuelat
Resolves: rhbz#1803862
* Mon May 04 2020 John Kacur <jkacur@redhat.com> - 1.8-2
- Fix setaffinity error on large numa machines
Resolves: rhbz#1831269
* Mon Apr 20 2020 John Kacur <jkacur@redhat.com> - 1.8-1
- Update to upstream rt-tests-1.8
Resolves: rhbz#1816370
* Thu Jan 23 2020 John Kacur <jkacur@redhat.com> - 1.5-18
- Add a man page for cyclicdeadline
- Sync cyclictest man page with the help option
- Sync pi_stress man page with the help option
- Add pi_stress short options to usage message
- Add -S --smp to svsematest man page
- Update ptsematest man page and add -h option
- queuelat man page and help fixes
- display svsematest help without an error message
Resolves: rhbz#1766656
* Fri Jan 17 2020 John Kacur <jkacur@redhat.com> - 1.5-17
- Fix more quoting problems to prevent work splitting
- get_cpuinfo_mhz.sh should print one value
Resolves: rhbz#1719493
* Wed Jan 15 2020 John Kacur <jkacur@redhat.com> - 1.5-16
- Fix hardcoded path to queuelat in determine_maximum_mpps.sh
Resolves: rhbz#1791403
* Mon Nov 25 2019 John Kacur <jkacur@redhat.com> - 1.5-15
- Respun Add SPDX tags patch to correct two incorrect licenes
Resolves: rhbz#1721215