* [PATCH 00/16] Time for some new clean-ups
@ 2020-10-29 17:40 John Kacur
2020-10-29 17:40 ` [PATCH 01/16] rt-tests: remove pi_tests.spec John Kacur
` (15 more replies)
0 siblings, 16 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
After getting a series of patches from Daniel Wagner, I was reminded
that we try to follow suggestions from checkpatch.pl in the kernel where
applicable. We're not slavish about it, but I figured it was time for a
few clean-ups. I also removed an ancient and unused spec file.
John Kacur (16):
rt-tests: remove pi_tests.spec
rt-tests: cyclictest: A few style changes from checkpatch.pl
rt-tests: rt-sched.c: Style change
rt-tests: rt-utils.c: Correct mix of spaces and tabs in code
indentation
rt-tests: pi_stress.c: Change unsigned to unsigned int
rt-tests: pip_stress.c: Remove unnecessary brackets
rt-tests: pmqtest.c: Fix spacing around parentheses
rt-tests: ptsematest.c: Fix spacing around parentheses
rt-tests: queuelat.c: Fix various style problems
rt-tests: rt-migrate-test.c: Fix spacing around parentheses
rt-tests: cyclicdeadline.c: Fix spacing around commas
rt-tests: deadline_test.c: Fix spacing around commas
rt-tests: signaltest.c: Fix various style problems
rt-tests: sigwaittest.c: Fix spacing around brackets
rt-tests: ssdd.c: Remove unncessary "else"
rt-tests: svsematest.c: Fix various style problems
src/cyclictest/cyclictest.c | 86 ++++++++++++---------------
src/lib/rt-sched.c | 2 +-
src/lib/rt-utils.c | 10 ++--
src/pi_tests/pi_stress.c | 8 +--
src/pi_tests/pi_tests.spec | 81 -------------------------
src/pi_tests/pip_stress.c | 6 +-
src/pmqtest/pmqtest.c | 29 +++++----
src/ptsematest/ptsematest.c | 12 ++--
src/queuelat/queuelat.c | 58 +++++++++---------
src/rt-migrate-test/rt-migrate-test.c | 2 +-
src/sched_deadline/cyclicdeadline.c | 23 ++++---
src/sched_deadline/deadline_test.c | 25 ++++----
src/signaltest/signaltest.c | 15 ++---
src/sigwaittest/sigwaittest.c | 30 +++++-----
src/ssdd/ssdd.c | 4 +-
src/svsematest/svsematest.c | 50 ++++++++--------
16 files changed, 168 insertions(+), 273 deletions(-)
delete mode 100644 src/pi_tests/pi_tests.spec
--
2.26.2
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 01/16] rt-tests: remove pi_tests.spec
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 02/16] rt-tests: cyclictest: A few style changes from checkpatch.pl John Kacur
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
This is an ancient spec file from way back before this program was
included in the rt-tests suite. There is no need to keep it around
anymore.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/pi_tests/pi_tests.spec | 81 --------------------------------------
1 file changed, 81 deletions(-)
delete mode 100644 src/pi_tests/pi_tests.spec
diff --git a/src/pi_tests/pi_tests.spec b/src/pi_tests/pi_tests.spec
deleted file mode 100644
index 7526faaadff1..000000000000
--- a/src/pi_tests/pi_tests.spec
+++ /dev/null
@@ -1,81 +0,0 @@
-Summary: Programs used to test Priority Inheritance Mutexes
-Name: pi_tests
-Version: 1.17
-Release: 1%{?dist}
-License: GPL
-Group: Development/Tools
-URL: http://people.redhat.com/~williams/tests
-Source0: %{name}-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-
-%define mandir usr/share/man
-
-%description
-The pi_tests package contains programs used to test the functionality of
-the priority inheritance attribute of POSIX mutexes on the Linux kernel
-
-%prep
-%setup -q
-
-%build
-make all
-
-%install
-rm -rf $RPM_BUILD_ROOT
-mkdir $RPM_BUILD_ROOT
-install -D -m 755 classic_pi $RPM_BUILD_ROOT/usr/sbin/classic_pi
-install -D -m 755 pi_stress $RPM_BUILD_ROOT/usr/sbin/pi_stress
-install -D -m 644 pi_stress.8 $RPM_BUILD_ROOT/%{mandir}/man8/pi_stress.8
-gzip $RPM_BUILD_ROOT/%{mandir}/man8/pi_stress.8
-install -D -m 644 COPYING $RPM_BUILD_ROOT/usr/share/doc/%{name}-%{version}/COPYING
-install -D -m 644 README $RPM_BUILD_ROOT/usr/share/doc/%{name}-%{version}/README
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,root,root,-)
-/usr/sbin/classic_pi
-/usr/sbin/pi_stress
-%doc
-/usr/share/man/man8/pi_stress.8.gz
-/usr/share/doc/%{name}-%{version}/COPYING
-/usr/share/doc/%{name}-%{version}/README
-
-%changelog
-* Wed Jan 2 2008 Clark Williams <williams@redhat.com> - 1.17-1
-- fixed logic error with watchdog_check()
-
-* Wed Jul 11 2007 Clark Williams <williams@redhat.com> - 1.16-1
-- bumped version for packaging in RHEL-RT
-- added usage() to classic_pi
-- removed --signal option in pi_stress
-
-* Wed Jul 11 2007 Clark Williams <williams@redhat.com> - 1.15-1
-- added rpmlint target to Makefile
-- fixed rpmlint complaints in specfile
-
-* Wed Dec 12 2006 Clark Williams <williams@redhat.com> - 1.14-1
-- changed how pi_stress shutdown is handled
-- fixed dealing with --iterations shutdown
-
-* Thu Dec 7 2006 Clark Williams <williams@redhat.com> - 1.13-1
-- Added README and COPYING files
-
-* Wed Dec 6 2006 Clark Williams <williams@redhat.com> - 1.12-1
-- changed shutdown variable to volatile
-- bumped version
-
-* Mon Dec 4 2006 Clark Williams <williams@redhat.com> - 1.11-1
-- Modified priorities to be just above minimum (as opposed to just below max)
-
-* Thu Nov 30 2006 Clark Williams <williams@redhat.com> - 1.10-1
-- added timing logic to pi_stress.c
-- refactored function order in pi_stress.c
-
-* Wed Nov 29 2006 Clark Williams <williams@redhat.com> - 1.9-1
-- added --duration logic to pi_stress.c
-
-* Mon Nov 27 2006 Clark Williams <williams@redhat.com> - 1.8-1
-- Initial packaging.
-
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 02/16] rt-tests: cyclictest: A few style changes from checkpatch.pl
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
2020-10-29 17:40 ` [PATCH 01/16] rt-tests: remove pi_tests.spec John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 03/16] rt-tests: rt-sched.c: Style change John Kacur
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
A few style changes as suggested by checkpatch.pl
Please note not everything that checkpatch reports will be applicable to
rt-tests.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/cyclictest/cyclictest.c | 86 ++++++++++++++++---------------------
1 file changed, 38 insertions(+), 48 deletions(-)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index fda7b0f4280f..34aa9be583f8 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -62,12 +62,12 @@ static int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec
if (clock_id == CLOCK_THREAD_CPUTIME_ID)
return -EINVAL;
if (clock_id == CLOCK_PROCESS_CPUTIME_ID)
- clock_id = MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED);
+ clock_id = MAKE_PROCESS_CPUCLOCK(0, CPUCLOCK_SCHED);
return syscall(__NR_clock_nanosleep, clock_id, flags, req, rem);
}
-int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
+int sched_setaffinity(__pid_t __pid, size_t __cpusetsize,
__const cpu_set_t *__cpuset)
{
return -EINVAL;
@@ -292,7 +292,7 @@ static int tracemark_fd = -1;
* if a call fails, return the error
* if successful return 0
* if fails, return -1
-*/
+ */
static int raise_soft_prio(int policy, const struct sched_param *param)
{
int err;
@@ -352,7 +352,8 @@ try_again:
if (err == EPERM) {
int err1;
err1 = raise_soft_prio(policy, param);
- if (!err1) goto try_again;
+ if (!err1)
+ goto try_again;
}
}
@@ -551,7 +552,7 @@ static void *timerthread(void *param)
fatal("timerthread%d: failed to set priority to %d\n",
par->cpu, par->prio);
- if(smi) {
+ if (smi) {
par->msr_fd = open_msr_file(par->cpu);
if (par->msr_fd < 0)
fatal("Could not open MSR interface, errno: %d\n",
@@ -569,7 +570,7 @@ static void *timerthread(void *param)
clock_gettime(par->clock, &globalt);
if (secaligned) {
/* Ensure that the thread start timestamp is not
- in the past */
+ * in the past */
if (globalt.tv_nsec > 900000000)
globalt.tv_sec += 2;
else
@@ -709,10 +710,8 @@ static void *timerthread(void *param)
}
stat->avg += (double) diff;
- if (trigger && (diff > trigger)) {
+ if (trigger && (diff > trigger))
trigger_update(par, diff, calctime(now));
- }
-
if (duration && (calcdiff(now, stop) >= 0))
shutdown++;
@@ -831,7 +830,7 @@ static void display_help(int error)
" --latency=PM_QOS write PM_QOS to /dev/cpu_dma_latency\n"
"-F --fifo=<path> create a named pipe at path and write stats to it\n"
"-h --histogram=US dump a latency histogram to stdout after the run\n"
- " US is the max latency time to be be tracked in microseconds\n"
+ " US is the max latency time to be tracked in microseconds\n"
" This option runs all threads at the same priority.\n"
"-H --histofall=US same as -h except with an additional summary column\n"
" --histfile=<path> dump the latency histogram to <path> instead of stdout\n"
@@ -933,9 +932,8 @@ static int cpu_for_thread_sp(int thread_num, int max_cpus)
num_cpus = rt_numa_bitmask_count(affinity_mask);
- if (num_cpus == 0) {
+ if (num_cpus == 0)
fatal("No allowable cpus to run on\n");
- }
m = thread_num % num_cpus;
@@ -962,9 +960,8 @@ static int cpu_for_thread_ua(int thread_num, int max_cpus)
CPU_ZERO(&cpuset);
res = pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
- if (res != 0) {
+ if (res != 0)
fatal("pthread_getaffinity_np failed: %s\n", strerror(res));
- }
num_cpus = CPU_COUNT(&cpuset);
m = thread_num % num_cpus;
@@ -983,7 +980,8 @@ static int cpu_for_thread_ua(int thread_num, int max_cpus)
/* After this function is called, affinity_mask is the intersection of the user
- * supplied affinity mask and the affinity mask from the run time environment */
+ * supplied affinity mask and the affinity mask from the run time environment
+ */
static void use_current_cpuset(const int max_cpus)
{
int i;
@@ -996,11 +994,11 @@ static void use_current_cpuset(const int max_cpus)
numa_sched_getaffinity(pid, curmask);
/* Clear bits that are not set in both the cpuset from the environment,
- * and in the user specified affinity for cyclictest */
+ * and in the user specified affinity for cyclictest
+ */
for (i=0; i < max_cpus; i++) {
- if ((!rt_numa_bitmask_isbitset(affinity_mask, i)) || (!rt_numa_bitmask_isbitset(curmask, i))) {
+ if ((!rt_numa_bitmask_isbitset(affinity_mask, i)) || (!rt_numa_bitmask_isbitset(curmask, i)))
numa_bitmask_clearbit(affinity_mask, i);
- }
}
numa_bitmask_free(curmask);
@@ -1097,7 +1095,7 @@ static void numa_initialize(void)
}
/* Process commandline options */
-static void process_options (int argc, char *argv[], int max_cpus)
+static void process_options(int argc, char *argv[], int max_cpus)
{
int error = 0;
int option_affinity = 0;
@@ -1163,7 +1161,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
if (optarg != NULL) {
parse_cpumask(optarg, max_cpus);
setaffinity = AFFINITY_SPECIFIED;
- } else if (optind<argc && (atoi(argv[optind]) || argv[optind][0] == '0' || argv[optind][0] == '!')) {
+ } else if (optind < argc && (atoi(argv[optind]) || argv[optind][0] == '0' || argv[optind][0] == '!')) {
parse_cpumask(argv[optind], max_cpus);
setaffinity = AFFINITY_SPECIFIED;
} else {
@@ -1172,10 +1170,10 @@ static void process_options (int argc, char *argv[], int max_cpus)
break;
case 'A':
case OPT_ALIGNED:
- aligned=1;
+ aligned = 1;
if (optarg != NULL)
offset = atoi(optarg) * 1000;
- else if (optind<argc && atoi(argv[optind]))
+ else if (optind < argc && atoi(argv[optind]))
offset = atoi(argv[optind]) * 1000;
else
offset = 0;
@@ -1270,7 +1268,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
}
if (optarg != NULL)
num_threads = atoi(optarg);
- else if (optind<argc && atoi(argv[optind]))
+ else if (optind < argc && atoi(argv[optind]))
num_threads = atoi(argv[optind]);
else
num_threads = -1; /* update after parsing */
@@ -1590,7 +1588,7 @@ static void print_stat(FILE *fp, struct thread_param *par, int index, int verbos
(long)(stat->avg/stat->cycles) : 0, stat->max);
if (smi)
- fprintf(fp," SMI:%8ld", stat->smi_count);
+ fprintf(fp, " SMI:%8ld", stat->smi_count);
fprintf(fp, "\n");
}
@@ -1646,7 +1644,7 @@ static void rstat_print_stat(struct thread_param *par, int index, int verbose, i
(long)(stat->avg/stat->cycles) : 0, stat->max);
if (smi)
- dprintf(fd," SMI:%8ld", stat->smi_count);
+ dprintf(fd, " SMI:%8ld", stat->smi_count);
dprintf(fd, "\n");
}
@@ -1745,7 +1743,8 @@ static void trigger_print()
struct thread_trigger *trig = head;
char *fmt = "T:%2d Spike:%8ld: TS: %12ld\n";
- if (current == head) return;
+ if (current == head)
+ return;
printf("\n");
while (trig->next != current) {
fprintf(stdout, fmt, trig->tnum, trig->diff, trig->ts);
@@ -1788,9 +1787,8 @@ static int rstat_shm_open(void)
errno = 9;
fd = shm_open(shm_name, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
- if (fd == -1) {
+ if (fd == -1)
fprintf(stderr, "ERROR: shm_open %s\n", strerror(errno));
- }
rstat_fd = fd;
@@ -1803,9 +1801,8 @@ static int rstat_ftruncate(int fd, off_t len)
errno = 0;
err = ftruncate(fd, len);
- if (err) {
+ if (err)
fprintf(stderr, "ftruncate error %s\n", strerror(errno));
- }
return err;
}
@@ -1817,9 +1814,8 @@ static void *rstat_mmap(int fd)
errno = 0;
mptr = mmap(0, _SC_PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
- if (mptr == (void*)-1) {
+ if (mptr == (void*)-1)
fprintf(stderr, "ERROR: mmap, %s\n", strerror(errno));
- }
return mptr;
}
@@ -1830,9 +1826,8 @@ static int rstat_mlock(void *mptr)
errno = 0;
err = mlock(mptr, _SC_PAGE_SIZE);
- if (err == -1) {
+ if (err == -1)
fprintf(stderr, "ERROR, mlock %s\n", strerror(errno));
- }
return err;
}
@@ -1895,9 +1890,8 @@ int main(int argc, char **argv)
errno = 0;
res = numa_sched_setaffinity(getpid(), affinity_mask);
- if (res != 0) {
+ if (res != 0)
warn("Couldn't setaffinity in main thread: %s\n", strerror(errno));
- }
}
if (trigger) {
@@ -1939,11 +1933,10 @@ int main(int argc, char **argv)
clock = clocksources[clocksel];
- if (clock_getres(clock, &res)) {
+ if (clock_getres(clock, &res))
warn("clock_getres failed");
- } else {
+ else
reported_resolution = (NSEC_PER_SEC * res.tv_sec) + res.tv_nsec;
- }
/*
@@ -1954,9 +1947,8 @@ int main(int argc, char **argv)
*/
times = 1000;
clock_gettime(clock, &prev);
- for (k=0; k < times; k++) {
+ for (k=0; k < times; k++)
clock_gettime(clock, &now);
- }
diff = calcdiff_ns(now, prev);
if (diff == 0) {
@@ -1979,9 +1971,8 @@ int main(int argc, char **argv)
time = calloc(times, sizeof(*time));
- for (k=0; k < times; k++) {
+ for (k=0; k < times; k++)
clock_gettime(clock, &time[k]);
- }
if (ct_debug) {
info("For %d consecutive calls to clock_gettime():\n", times);
@@ -1994,9 +1985,8 @@ int main(int argc, char **argv)
diff = calcdiff_ns(time[k], prev);
prev = time[k];
- if (diff && (diff < min_non_zero_diff)) {
+ if (diff && (diff < min_non_zero_diff))
min_non_zero_diff = diff;
- }
if (ct_debug)
info("%ld.%06ld %5llu\n",
@@ -2027,7 +2017,7 @@ int main(int argc, char **argv)
sigemptyset(&sigset);
sigaddset(&sigset, signum);
- sigprocmask (SIG_BLOCK, &sigset, NULL);
+ sigprocmask(SIG_BLOCK, &sigset, NULL);
signal(SIGINT, sighand);
signal(SIGTERM, sighand);
@@ -2076,7 +2066,7 @@ int main(int argc, char **argv)
/* find the memory node associated with the cpu i */
node = rt_numa_numa_node_of_cpu(cpu);
- /* get the stack size set for for this thread */
+ /* get the stack size set for this thread */
if (pthread_attr_getstack(&attr, &currstk, &stksize))
fatal("failed to get stack size for thread %d\n", i);
@@ -2207,7 +2197,7 @@ int main(int argc, char **argv)
for (i = 0; i < num_threads; i++) {
print_stat(stdout, parameters[i], i, verbose, quiet);
- if(max_cycles && statistics[i]->cycles >= max_cycles)
+ if (max_cycles && statistics[i]->cycles >= max_cycles)
allstopped++;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 03/16] rt-tests: rt-sched.c: Style change
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
2020-10-29 17:40 ` [PATCH 01/16] rt-tests: remove pi_tests.spec John Kacur
2020-10-29 17:40 ` [PATCH 02/16] rt-tests: cyclictest: A few style changes from checkpatch.pl John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 04/16] rt-tests: rt-utils.c: Correct mix of spaces and tabs in code indentation John Kacur
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Style change from checkpatch.pl
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/lib/rt-sched.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/rt-sched.c b/src/lib/rt-sched.c
index 2aaf02d42aee..8023bc70c473 100644
--- a/src/lib/rt-sched.c
+++ b/src/lib/rt-sched.c
@@ -26,5 +26,5 @@ int sched_getattr(pid_t pid,
unsigned int size,
unsigned int flags)
{
- return syscall(__NR_sched_getattr, pid, attr, size, flags);
+ return syscall(__NR_sched_getattr, pid, attr, size, flags);
}
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 04/16] rt-tests: rt-utils.c: Correct mix of spaces and tabs in code indentation
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (2 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 03/16] rt-tests: rt-sched.c: Style change John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 05/16] rt-tests: pi_stress.c: Change unsigned to unsigned int John Kacur
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Fix the mix of spaces and tabs in the code indentation.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/lib/rt-utils.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
index f786588706cd..54a201661786 100644
--- a/src/lib/rt-utils.c
+++ b/src/lib/rt-utils.c
@@ -392,11 +392,11 @@ void open_tracemark_fd(void)
int trace_file_exists(char *name)
{
- struct stat sbuf;
- char *tracing_prefix = get_debugfileprefix();
- char path[MAX_PATH];
- strcat(strcpy(path, tracing_prefix), name);
- return stat(path, &sbuf) ? 0 : 1;
+ struct stat sbuf;
+ char *tracing_prefix = get_debugfileprefix();
+ char path[MAX_PATH];
+ strcat(strcpy(path, tracing_prefix), name);
+ return stat(path, &sbuf) ? 0 : 1;
}
void debugfs_prepare(void)
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 05/16] rt-tests: pi_stress.c: Change unsigned to unsigned int
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (3 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 04/16] rt-tests: rt-utils.c: Correct mix of spaces and tabs in code indentation John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 06/16] rt-tests: pip_stress.c: Remove unnecessary brackets John Kacur
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Change unsigned to unsigned int as suggested by checkpatch
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/pi_tests/pi_stress.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
index 84da241098af..538d12c975aa 100644
--- a/src/pi_tests/pi_stress.c
+++ b/src/pi_tests/pi_stress.c
@@ -211,8 +211,8 @@ unsigned long total_inversions(void);
void banner(void);
void summary(void);
void wait_for_termination(void);
-int barrier_init(pthread_barrier_t * b, const pthread_barrierattr_t * attr,
- unsigned count, const char *name);
+int barrier_init(pthread_barrier_t *b, const pthread_barrierattr_t *attr,
+ unsigned int count, const char *name);
void setup_sched_attr(struct sched_attr *attr, int policy, int prio);
void setup_sched_config(int policy);
@@ -1422,8 +1422,8 @@ void summary(void)
}
int
-barrier_init(pthread_barrier_t * b, const pthread_barrierattr_t * attr,
- unsigned count, const char *name)
+barrier_init(pthread_barrier_t *b, const pthread_barrierattr_t *attr,
+ unsigned int count, const char *name)
{
int status;
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 06/16] rt-tests: pip_stress.c: Remove unnecessary brackets
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (4 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 05/16] rt-tests: pi_stress.c: Change unsigned to unsigned int John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 07/16] rt-tests: pmqtest.c: Fix spacing around parentheses John Kacur
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Remove unnecessary brackets as suggested by checkpatch.pl
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/pi_tests/pip_stress.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
index 74cf53dcfa7a..4583aa40a6b8 100644
--- a/src/pi_tests/pip_stress.c
+++ b/src/pi_tests/pip_stress.c
@@ -216,9 +216,8 @@ void high(pid_t pid)
Pthread_mutex_lock(resource);
Pthread_mutex_lock(statep->mutex);
statep->high_owns_resource = 1;
- if (!statep->low_owns_resource || !statep->medium_started) {
+ if (!statep->low_owns_resource || !statep->medium_started)
statep->inversion = 0;
- }
Pthread_mutex_unlock(statep->mutex);
Pthread_mutex_unlock(resource);
kill(pid, SIGKILL); /* kill the medium thread */
@@ -228,9 +227,8 @@ void high(pid_t pid)
if (statep->inversion)
printf("Successfully used priority inheritance to handle an inversion\n");
- else {
+ else
printf("No inversion incurred\n");
- }
Pthread_mutex_unlock(statep->mutex);
}
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 07/16] rt-tests: pmqtest.c: Fix spacing around parentheses
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (5 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 06/16] rt-tests: pip_stress.c: Remove unnecessary brackets John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 08/16] rt-tests: ptsematest.c: " John Kacur
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Fix spacing around parentheses as suggestsed by checkpatch.pl
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/pmqtest/pmqtest.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
index 938dc8d93c3f..a1e487b85d2c 100644
--- a/src/pmqtest/pmqtest.c
+++ b/src/pmqtest/pmqtest.c
@@ -83,7 +83,7 @@ void *pmqthread(void *param)
if (par->cpu != -1) {
CPU_ZERO(&mask);
CPU_SET(par->cpu, &mask);
- if(sched_setaffinity(0, sizeof(mask), &mask) == -1)
+ if (sched_setaffinity(0, sizeof(mask), &mask) == -1)
fprintf(stderr, "WARNING: Could not set CPU affinity "
"to CPU #%d\n", par->cpu);
} else
@@ -97,7 +97,7 @@ void *pmqthread(void *param)
/* Optionally force receiver timeout */
if (par->forcetimeout) {
struct timespec senddelay;
-
+
senddelay.tv_sec = par->forcetimeout;
senddelay.tv_nsec = 0;
clock_nanosleep(CLOCK_MONOTONIC, 0, &senddelay, NULL);
@@ -110,7 +110,7 @@ void *pmqthread(void *param)
par->shutdown = 1;
}
par->samples++;
- if(par->max_cycles && par->samples >= par->max_cycles)
+ if (par->max_cycles && par->samples >= par->max_cycles)
par->shutdown = 1;
if (mustgetcpu)
par->cpu = get_cpu();
@@ -118,17 +118,17 @@ void *pmqthread(void *param)
if (par->timeout) {
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += par->timeout;
-
+
if (mq_timedreceive(par->syncmq, par->recvsyncmsg, MSG_SIZE, NULL, &ts)
!= strlen(syncmsg)) {
fprintf(stderr, "could not receive sync message\n");
- par->shutdown = 1;
+ par->shutdown = 1;
}
- }
+ }
if (mq_receive(par->syncmq, par->recvsyncmsg, MSG_SIZE, NULL) !=
strlen(syncmsg)) {
perror("could not receive sync message");
- par->shutdown = 1;
+ par->shutdown = 1;
}
if (!par->shutdown && strcmp(syncmsg, par->recvsyncmsg)) {
fprintf(stderr, "ERROR: Sync message mismatch detected\n");
@@ -156,8 +156,7 @@ void *pmqthread(void *param)
}
} else
break;
- }
- while (1);
+ } while (1);
} else {
if (mq_receive(par->testmq, par->recvtestmsg, MSG_SIZE, NULL) !=
strlen(testmsg)) {
@@ -261,7 +260,7 @@ static int sameprio;
static int timeout;
static int forcetimeout;
-static void process_options (int argc, char *argv[])
+static void process_options(int argc, char *argv[])
{
int error = 0;
int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
@@ -297,7 +296,7 @@ static void process_options (int argc, char *argv[])
if (optarg != NULL) {
affinity = atoi(optarg);
setaffinity = AFFINITY_SPECIFIED;
- } else if (optind<argc && atoi(argv[optind])) {
+ } else if (optind < argc && atoi(argv[optind])) {
affinity = atoi(argv[optind]);
setaffinity = AFFINITY_SPECIFIED;
} else {
@@ -325,7 +324,7 @@ static void process_options (int argc, char *argv[])
}
if (optarg != NULL)
num_threads = atoi(optarg);
- else if (optind<argc && atoi(argv[optind]))
+ else if (optind < argc && atoi(argv[optind]))
num_threads = atoi(argv[optind]);
else
num_threads = max_cpus;
@@ -366,7 +365,7 @@ static void process_options (int argc, char *argv[])
sameprio = 1;
if (error)
- display_help (error);
+ display_help(error);
}
@@ -523,7 +522,7 @@ int main(int argc, char *argv[])
if (minsamples < 1)
printf("Collecting ...\n\033[1A");
}
-
+
fflush(NULL);
oldsamples = 0;
@@ -564,7 +563,7 @@ int main(int argc, char *argv[])
mq_unlink(mqname);
}
- nomem:
+nomem:
return 0;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 08/16] rt-tests: ptsematest.c: Fix spacing around parentheses
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (6 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 07/16] rt-tests: pmqtest.c: Fix spacing around parentheses John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 09/16] rt-tests: queuelat.c: Fix various style problems John Kacur
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Fix spacing around parentheses as suggested by checkpatch.pl
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/ptsematest/ptsematest.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
index 02919e3f5eef..9cd5f34509a8 100644
--- a/src/ptsematest/ptsematest.c
+++ b/src/ptsematest/ptsematest.c
@@ -71,7 +71,7 @@ void *semathread(void *param)
if (par->cpu != -1) {
CPU_ZERO(&mask);
CPU_SET(par->cpu, &mask);
- if(sched_setaffinity(0, sizeof(mask), &mask) == -1)
+ if (sched_setaffinity(0, sizeof(mask), &mask) == -1)
fprintf(stderr, "WARNING: Could not set CPU affinity "
"to CPU #%d\n", par->cpu);
} else
@@ -87,7 +87,7 @@ void *semathread(void *param)
gettimeofday(&par->unblocked, NULL);
pthread_mutex_unlock(&testmutex[par->num]);
par->samples++;
- if(par->max_cycles && par->samples >= par->max_cycles)
+ if (par->max_cycles && par->samples >= par->max_cycles)
par->shutdown = 1;
if (mustgetcpu)
par->cpu = get_cpu();
@@ -181,7 +181,7 @@ static int distance = 500;
static int smp;
static int sameprio;
-static void process_options (int argc, char *argv[])
+static void process_options(int argc, char *argv[])
{
int error = 0;
int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
@@ -215,7 +215,7 @@ static void process_options (int argc, char *argv[])
if (optarg != NULL) {
affinity = atoi(optarg);
setaffinity = AFFINITY_SPECIFIED;
- } else if (optind<argc && atoi(argv[optind])) {
+ } else if (optind < argc && atoi(argv[optind])) {
affinity = atoi(argv[optind]);
setaffinity = AFFINITY_SPECIFIED;
} else {
@@ -242,7 +242,7 @@ static void process_options (int argc, char *argv[])
}
if (optarg != NULL)
num_threads = atoi(optarg);
- else if (optind<argc && atoi(argv[optind]))
+ else if (optind < argc && atoi(argv[optind]))
num_threads = atoi(argv[optind]);
else
num_threads = max_cpus;
@@ -436,7 +436,7 @@ int main(int argc, char *argv[])
pthread_mutex_destroy(&syncmutex[i]);
}
- nomem:
+nomem:
return 0;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 09/16] rt-tests: queuelat.c: Fix various style problems
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (7 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 08/16] rt-tests: ptsematest.c: " John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 10/16] rt-tests: rt-migrate-test.c: Fix spacing around parentheses John Kacur
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Fix various style problems such as spaces in indentation instead of
tabs, unsigned long long int, to just unsigned long long, and so on.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/queuelat/queuelat.c | 58 +++++++++++++++++++----------------------
1 file changed, 27 insertions(+), 31 deletions(-)
diff --git a/src/queuelat/queuelat.c b/src/queuelat/queuelat.c
index fbe5239ee81e..ead8ee5f4898 100644
--- a/src/queuelat/queuelat.c
+++ b/src/queuelat/queuelat.c
@@ -26,12 +26,12 @@
* mpps(million-packet-per-sec): million packets per second (float).
* tsc_freq_mhz: TSC frequency in MHz, as measured by TSC PIT calibration
* (search for "Detected XXX MHz processor" in dmesg, and use the integer part).
- *
+ *
* How it works
* ============
*
* The program in essence does:
- *
+ *
* b = rdtsc();
* memmove(dest, src, n);
* a = rdtsc();
@@ -44,8 +44,8 @@
* if (queue_size > max_queue_len)
* FAIL();
*
- * packets_processed is fixed, and is estimated as follows:
- * n is determined first, so that the stats bucket with highest count
+ * packets_processed is fixed, and is estimated as follows:
+ * n is determined first, so that the stats bucket with highest count
* takes max_latency/2.
* for max_latency/2, we calculate how many packets can be drained
* in that time (using cycles_per_packet).
@@ -74,17 +74,16 @@ int nr_packets_drain_per_block;
#define VALS_PER_BUCKET 100
#define NR_BUCKETS LAST_VAL/VALS_PER_BUCKET
-unsigned long long int buckets[NR_BUCKETS+1];
-unsigned long long int total_count;
+unsigned long long buckets[NR_BUCKETS+1];
+unsigned long long total_count;
#define OUTLIER_BUCKET NR_BUCKETS
static int val_to_bucket(unsigned long long val)
{
int bucket_nr = val / VALS_PER_BUCKET;
- if (bucket_nr >= NR_BUCKETS) {
+ if (bucket_nr >= NR_BUCKETS)
return OUTLIER_BUCKET;
- }
return bucket_nr;
}
@@ -100,9 +99,8 @@ static unsigned long long total_samples(void)
int i;
unsigned long long total = 0;
- for (i = 0; i <= OUTLIER_BUCKET; i++) {
+ for (i = 0; i <= OUTLIER_BUCKET; i++)
total += buckets[i];
- }
return total;
}
@@ -151,9 +149,8 @@ static void print_max_bucketsec(void)
bucket_nr = val_to_bucket(val);
- if (buckets[bucket_nr] != 0) {
+ if (buckets[bucket_nr] != 0)
highest_val = val;
- }
}
bucket_nr = val_to_bucket(highest_val);
@@ -196,7 +193,7 @@ static void print_avg_bucketsec(void)
for (i = 0; i <= OUTLIER_BUCKET; i++) {
unsigned long long val = i*VALS_PER_BUCKET;
- unsigned long long maxtime;
+ unsigned long long maxtime;
bucket_nr = val_to_bucket(val);
@@ -236,9 +233,9 @@ static void print_all_buckets_drainlength(void)
mindelta = val;
maxdelta = val + VALS_PER_BUCKET-1;
- nr_packets_minfill = mindelta * mpps * 1000000 / NSEC_PER_SEC;
- nr_packets_maxfill = maxdelta * mpps * 1000000 / NSEC_PER_SEC;
-
+ nr_packets_minfill = mindelta * mpps * 1000000 / NSEC_PER_SEC;
+ nr_packets_maxfill = maxdelta * mpps * 1000000 / NSEC_PER_SEC;
+
printf("[%lld - %lld] = %lld packetfillrates=[%d - %d]\n", val,
val + VALS_PER_BUCKET-1,
buckets[bucket_nr],
@@ -275,11 +272,11 @@ typedef unsigned long long u64;
static inline unsigned long long __rdtscll(void)
{
- DECLARE_ARGS(val, low, high);
+ DECLARE_ARGS(val, low, high);
- asm volatile("mfence; rdtsc" : EAX_EDX_RET(val, low, high));
+ asm volatile("mfence; rdtsc" : EAX_EDX_RET(val, low, high));
- return EAX_EDX_VAL(val, low, high);
+ return EAX_EDX_VAL(val, low, high);
}
#define gettick(val) do { (val) = __rdtscll(); } while (0)
@@ -316,7 +313,7 @@ static int find_highest_count_bucket(void)
{
int i;
int max_bucket = 0;
- unsigned long long int max_val = 0;
+ unsigned long long max_val = 0;
for (i=0; i <= NR_BUCKETS; i++) {
if (buckets[i] > max_val) {
@@ -335,7 +332,7 @@ static void trace_open(void)
fd = open("/sys/kernel/debug/tracing/trace_marker", O_RDWR);
- if (fd == -1) {
+ if (fd == -1) {
perror("open");
exit(0);
}
@@ -347,7 +344,7 @@ static void trace_write(char *buf, int len)
int ret;
ret = write(tracing_mark_fd, buf, len);
- if (ret == -1) {
+ if (ret == -1) {
perror("write");
exit(0);
}
@@ -487,10 +484,10 @@ void main_loop(void)
queue_size += nr_packets_fill;
/* decrease the queue by the amount of packets
- * processed in maxlatency/2 nanoseconds of
- * full processing.
- */
-
+ * processed in maxlatency/2 nanoseconds of
+ * full processing.
+ */
+
queue_size -= nr_packets_drain_per_block;
if (queue_size < 0)
@@ -641,9 +638,9 @@ int main(int argc, char **argv)
install_signals();
maxlatency = atoi(mvalue);
- cycles_per_packet = atoi(cvalue);
- mpps = atof(pvalue);
- tsc_freq_mhz = atof(fvalue);
+ cycles_per_packet = atoi(cvalue);
+ mpps = atof(pvalue);
+ tsc_freq_mhz = atof(fvalue);
if (tvalue) {
int alarm_secs;
@@ -651,9 +648,8 @@ int main(int argc, char **argv)
alarm(alarm_secs);
}
- if (qvalue) {
+ if (qvalue)
min_queue_size_to_print = atoi(qvalue);
- }
convert_to_ghz(tsc_freq_mhz);
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 10/16] rt-tests: rt-migrate-test.c: Fix spacing around parentheses
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (8 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 09/16] rt-tests: queuelat.c: Fix various style problems John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 11/16] rt-tests: cyclicdeadline.c: Fix spacing around commas John Kacur
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Fix improper spacing around parentheses
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/rt-migrate-test/rt-migrate-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
index 68824606faf1..f1b7e5e4fe8c 100644
--- a/src/rt-migrate-test/rt-migrate-test.c
+++ b/src/rt-migrate-test/rt-migrate-test.c
@@ -552,7 +552,7 @@ int main (int argc, char **argv)
nanosleep(&intv, NULL);
- print_progress_bar((loop * 100)/ nr_runs);
+ print_progress_bar((loop * 100)/nr_runs);
end = get_time();
ftrace_write("Loop %d end now=%lld diff=%lld\n", loop, end, end - now);
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 11/16] rt-tests: cyclicdeadline.c: Fix spacing around commas
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (9 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 10/16] rt-tests: rt-migrate-test.c: Fix spacing around parentheses John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 12/16] rt-tests: deadline_test.c: " John Kacur
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Fix spacing around commas and remove unnecessary brackets
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/sched_deadline/cyclicdeadline.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index 5f5cdfa08f14..a6309ded3c52 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -112,7 +112,7 @@ static int find_mount(const char *mount, char *debugfs)
char type[100];
FILE *fp;
- if ((fp = fopen("/proc/mounts","r")) == NULL)
+ if ((fp = fopen("/proc/mounts", "r")) == NULL)
return 0;
while (fscanf(fp, "%*s %"
@@ -139,7 +139,7 @@ static const char *find_debugfs(void)
if (!find_mount("debugfs", debugfs))
return "";
-
+
debugfs_found = 1;
return debugfs;
@@ -518,8 +518,8 @@ static const char *make_cpuset(const char *name, const char *cpus,
fd = open_cpuset(path, "tasks");
snprintf(path, MAXPATH - 1, "%s/tasks", CPUSET_PATH);
- if ((fp = fopen(path,"r")) == NULL) {
- close (fd);
+ if ((fp = fopen(path, "r")) == NULL) {
+ close(fd);
return "opening cpuset tasks";
}
@@ -565,7 +565,7 @@ static void destroy_cpuset(const char *name, int print)
again:
strncat(path, "/tasks", MAXPATH - 1);
- if ((fp = fopen(path,"r")) == NULL) {
+ if ((fp = fopen(path, "r")) == NULL) {
fprintf(stderr, "Failed opening %s\n", path);
perror("fopen");
return;
@@ -792,7 +792,7 @@ void *run_deadline(void *data)
sched_yield();
period = get_time_us();
-
+
while (!shutdown) {
period = do_runtime(tid, sd, period);
sched_yield();
@@ -997,19 +997,17 @@ static void loop(struct sched_data *sched_data, int nr_threads)
int i;
while (!shutdown) {
- for (i = 0; i < nr_threads; i++) {
+ for (i = 0; i < nr_threads; i++)
print_stat(stdout, &sched_data[i], i, 0, 0);
- }
usleep(10000);
printf("\033[%dA", nr_threads);
}
usleep(10000);
- for (i = 0; i < nr_threads; i++) {
+ for (i = 0; i < nr_threads; i++)
printf("\n");
- }
}
-int main (int argc, char **argv)
+int main(int argc, char **argv)
{
struct sched_data *sched_data;
struct sched_data *sd;
@@ -1111,9 +1109,8 @@ int main (int argc, char **argv)
if (setcpu)
make_other_cpu_list(setcpu, &allcpu_buf);
- if (mlockall(MCL_CURRENT|MCL_FUTURE) == -1) {
+ if (mlockall(MCL_CURRENT|MCL_FUTURE) == -1)
perror("mlockall");
- }
setup_ftrace_marker();
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 12/16] rt-tests: deadline_test.c: Fix spacing around commas
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (10 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 11/16] rt-tests: cyclicdeadline.c: Fix spacing around commas John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 13/16] rt-tests: signaltest.c: Fix various style problems John Kacur
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Fix spacing around commas and remove unnecessary brackets
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/sched_deadline/deadline_test.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
index 060ac896aef2..395c2370f69a 100644
--- a/src/sched_deadline/deadline_test.c
+++ b/src/sched_deadline/deadline_test.c
@@ -49,7 +49,7 @@
* @error: Exit error code to be used
*
* This is defined here to show peoplde looking at this code how
- * to use this program as well.
+ * to use this program as well.
*/
static void usage(int error)
{
@@ -185,7 +185,7 @@ static int find_mount(const char *mount, char *debugfs)
char type[100];
FILE *fp;
- if ((fp = fopen("/proc/mounts","r")) == NULL)
+ if ((fp = fopen("/proc/mounts", "r")) == NULL)
return 0;
while (fscanf(fp, "%*s %"
@@ -218,7 +218,7 @@ static const char *find_debugfs(void)
if (!find_mount("debugfs", debugfs))
return "";
-
+
debugfs_found = 1;
return debugfs;
@@ -705,8 +705,8 @@ static const char *make_cpuset(const char *name, const char *cpus,
fd = open_cpuset(path, "tasks");
snprintf(path, MAXPATH - 1, "%s/tasks", CPUSET_PATH);
- if ((fp = fopen(path,"r")) == NULL) {
- close (fd);
+ if ((fp = fopen(path, "r")) == NULL) {
+ close(fd);
return "opening cpuset tasks";
}
@@ -768,7 +768,7 @@ static void destroy_cpuset(const char *name, int print)
* in this cpuset, that must be moved before destroying the cpuset.
*/
strncat(path, "/tasks", MAXPATH - 1);
- if ((fp = fopen(path,"r")) == NULL) {
+ if ((fp = fopen(path, "r")) == NULL) {
fprintf(stderr, "Failed opening %s\n", path);
perror("fopen");
return;
@@ -1276,7 +1276,7 @@ void *run_deadline(void *data)
sched_yield();
period = get_time_us();
-
+
while (!done) {
period = do_runtime(tid, sched_data, period);
sched_yield();
@@ -1335,9 +1335,8 @@ void *run_rt_spin(void *data)
if (fail)
return NULL;
- while (!done) {
+ while (!done)
get_time_us();
- }
return NULL;
}
@@ -1689,7 +1688,7 @@ static u64 calculate_loops_per_ms(u64 *overhead)
return loops;
}
-int main (int argc, char **argv)
+int main(int argc, char **argv)
{
struct sched_data *sched_data;
struct sched_data *sd;
@@ -1819,9 +1818,8 @@ int main (int argc, char **argv)
exit(-1);
}
- if (mlockall(MCL_CURRENT|MCL_FUTURE) == -1) {
+ if (mlockall(MCL_CURRENT|MCL_FUTURE) == -1)
perror("mlockall");
- }
/*
* Run at prio 99 bound to the last CPU, and try to calculate
@@ -1920,9 +1918,8 @@ int main (int argc, char **argv)
pthread_barrier_wait(&barrier);
- if (fail) {
+ if (fail)
exit(-1);
- }
if (!all_cpus) {
int *pids;
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 13/16] rt-tests: signaltest.c: Fix various style problems
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (11 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 12/16] rt-tests: deadline_test.c: " John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 14/16] rt-tests: sigwaittest.c: Fix spacing around brackets John Kacur
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Fix various style problems suggested by checkpatch.pl
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/signaltest/signaltest.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index c718f8676b9f..1cc3236a8f37 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -61,8 +61,8 @@ struct thread_stat {
};
static int shutdown;
-static int tracelimit = 0;
-static int oldtrace = 0;
+static int tracelimit;
+static int oldtrace;
/*
@@ -107,7 +107,7 @@ void *signalthread(void *param)
if (tracelimit) {
if (oldtrace)
- gettimeofday(0,(struct timezone *)1);
+ gettimeofday(0, (struct timezone *)1);
else
prctl(0, 1);
}
@@ -153,7 +153,7 @@ void *signalthread(void *param)
if (!stopped && tracelimit && (diff > tracelimit)) {
stopped++;
if (oldtrace)
- gettimeofday(0,0);
+ gettimeofday(0, 0);
else
prctl(0, 0);
shutdown++;
@@ -207,12 +207,13 @@ static int max_cycles;
static int duration;
static int verbose;
static int quiet;
-static int lockall = 0;
+static int lockall;
/* Process commandline options */
static void process_options(int argc, char *argv[])
{
int error = 0;
+
for (;;) {
int option_index = 0;
/** Options for getopt */
@@ -326,7 +327,7 @@ int main(int argc, char **argv)
sigemptyset(&sigset);
sigaddset(&sigset, signum);
- sigprocmask (SIG_BLOCK, &sigset, NULL);
+ sigprocmask(SIG_BLOCK, &sigset, NULL);
signal(SIGINT, sighand);
signal(SIGTERM, sighand);
@@ -400,7 +401,7 @@ int main(int argc, char **argv)
}
print_stat(&par[0], 0, verbose);
- if(max_cycles && stat[0].cycles >= max_cycles)
+ if (max_cycles && stat[0].cycles >= max_cycles)
allstopped++;
usleep(10000);
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 14/16] rt-tests: sigwaittest.c: Fix spacing around brackets
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (12 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 13/16] rt-tests: signaltest.c: Fix various style problems John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 15/16] rt-tests: ssdd.c: Remove unncessary "else" John Kacur
2020-10-29 17:40 ` [PATCH 16/16] rt-tests: svsematest.c: Fix various style problems John Kacur
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Fix spacing around brackets, Fix indented lable, etc
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/sigwaittest/sigwaittest.c | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
index 12b55e901ce5..8a5d73b14fc2 100644
--- a/src/sigwaittest/sigwaittest.c
+++ b/src/sigwaittest/sigwaittest.c
@@ -93,15 +93,15 @@ void *semathread(void *param)
if (par->cpu != -1) {
CPU_ZERO(&mask);
CPU_SET(par->cpu, &mask);
- if(sched_setaffinity(0, sizeof(mask), &mask) == -1)
+ if (sched_setaffinity(0, sizeof(mask), &mask) == -1)
fprintf(stderr, "WARNING: Could not set CPU affinity "
"to CPU #%d\n", par->cpu);
} else {
- int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
+ int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
- if (max_cpus > 1)
- mustgetcpu = 1;
- else
+ if (max_cpus > 1)
+ mustgetcpu = 1;
+ else
par->cpu = 0;
}
@@ -133,12 +133,11 @@ void *semathread(void *param)
else
pthread_kill(neighbor->threadid, SIGUSR2);
par->samples++;
- if(par->max_cycles && par->samples >= par->max_cycles)
+ if (par->max_cycles && par->samples >= par->max_cycles)
par->shutdown = 1;
- if (mustgetcpu) {
+ if (mustgetcpu)
par->cpu = get_cpu();
- }
sigwait(&sigset, &sig);
} else {
/* Receiver */
@@ -160,9 +159,8 @@ void *semathread(void *param)
if (par->max_cycles && par->samples >= par->max_cycles)
par->shutdown = 1;
- if (mustgetcpu) {
+ if (mustgetcpu)
par->cpu = get_cpu();
- }
/*
* Latency is the time spent between sending and
* receiving the signal.
@@ -242,7 +240,7 @@ static int duration;
static int interval = 1000;
static int distance = 500;
-static void process_options (int argc, char *argv[])
+static void process_options(int argc, char *argv[])
{
int error = 0;
int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
@@ -273,7 +271,7 @@ static void process_options (int argc, char *argv[])
if (optarg != NULL) {
affinity = atoi(optarg);
setaffinity = AFFINITY_SPECIFIED;
- } else if (optind<argc && atoi(argv[optind])) {
+ } else if (optind < argc && atoi(argv[optind])) {
affinity = atoi(argv[optind]);
setaffinity = AFFINITY_SPECIFIED;
} else {
@@ -304,7 +302,7 @@ static void process_options (int argc, char *argv[])
case 't':
if (optarg != NULL)
num_threads = atoi(optarg);
- else if (optind<argc && atoi(argv[optind]))
+ else if (optind < argc && atoi(argv[optind]))
num_threads = atoi(argv[optind]);
else
num_threads = max_cpus;
@@ -339,7 +337,7 @@ static void process_options (int argc, char *argv[])
tracelimit = thistracelimit;
}
if (error)
- display_help (error);
+ display_help(error);
}
@@ -386,7 +384,7 @@ int main(int argc, char *argv[])
totalsize = num_threads * sizeof(struct params) * 2;
shm_unlink("/sigwaittest");
- shmem = shm_open("/sigwaittest", O_CREAT|O_EXCL|O_RDWR,
+ shmem = shm_open("/sigwaittest", O_CREAT|O_EXCL|O_RDWR,
S_IRUSR|S_IWUSR);
if (shmem < 0) {
fprintf(stderr, "Could not create shared memory\n");
@@ -629,7 +627,7 @@ int main(int argc, char *argv[])
}
}
- nomem:
+nomem:
if (mustfork) {
munmap(param, totalsize);
shm_unlink("/sigwaittest");
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 15/16] rt-tests: ssdd.c: Remove unncessary "else"
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (13 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 14/16] rt-tests: sigwaittest.c: Fix spacing around brackets John Kacur
@ 2020-10-29 17:40 ` John Kacur
2020-10-29 17:40 ` [PATCH 16/16] rt-tests: svsematest.c: Fix various style problems John Kacur
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
remove unnecessary "else" and also fix function header.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/ssdd/ssdd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
index 66d6009dc572..9fa61f39f6e3 100644
--- a/src/ssdd/ssdd.c
+++ b/src/ssdd/ssdd.c
@@ -147,7 +147,7 @@ static pid_t parent;
static int nforks = 10;
static int nsteps = 10000;
-static void sigchld(int sig, unused siginfo_t * info, unused void *arg)
+static void sigchld(int sig, unused siginfo_t *info, unused void *arg)
{
got_sigchld = 1;
}
@@ -218,7 +218,7 @@ static int forktests(int testid)
ret_sig);
exit(1);
}
- else if (!check_sigchld()) {
+ if (!check_sigchld()) {
printf("forktest#%d/%d: EXITING, ERROR: "
"wait on PTRACE_ATTACH saw a SIGCHLD count of %d, should be 1\n",
testid, getpid(), got_sigchld);
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 16/16] rt-tests: svsematest.c: Fix various style problems
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
` (14 preceding siblings ...)
2020-10-29 17:40 ` [PATCH 15/16] rt-tests: ssdd.c: Remove unncessary "else" John Kacur
@ 2020-10-29 17:40 ` John Kacur
15 siblings, 0 replies; 17+ messages in thread
From: John Kacur @ 2020-10-29 17:40 UTC (permalink / raw)
To: RT; +Cc: Clark Williams, John Kacur
Fix various style problems as reported by checkpatch.pl
For example, spacing around "<", indentation of a lable, and so on.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/svsematest/svsematest.c | 50 ++++++++++++++++++-------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
index 7412168bd98a..98efd930e63f 100644
--- a/src/svsematest/svsematest.c
+++ b/src/svsematest/svsematest.c
@@ -94,16 +94,16 @@ void *semathread(void *param)
if (par->cpu != -1) {
CPU_ZERO(&mask);
CPU_SET(par->cpu, &mask);
- if(sched_setaffinity(0, sizeof(mask), &mask) == -1)
+ if (sched_setaffinity(0, sizeof(mask), &mask) == -1)
snprintf(par->error, sizeof(par->error),
"WARNING: Could not set CPU affinity "
"to CPU #%d\n", par->cpu);
} else {
- int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
+ int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
- if (max_cpus > 1)
- mustgetcpu = 1;
- else
+ if (max_cpus > 1)
+ mustgetcpu = 1;
+ else
par->cpu = 0;
}
@@ -112,8 +112,8 @@ void *semathread(void *param)
while (!par->shutdown) {
if (par->sender) {
- sb.sem_num = SEM_WAIT_FOR_SENDER;
- sb.sem_op = SEM_UNLOCK;
+ sb.sem_num = SEM_WAIT_FOR_SENDER;
+ sb.sem_op = SEM_UNLOCK;
/*
* Unlocking the semaphore:
* Start of latency measurement ...
@@ -121,29 +121,29 @@ void *semathread(void *param)
gettimeofday(&par->unblocked, NULL);
semop(par->semid, &sb, 1);
par->samples++;
- if(par->max_cycles && par->samples >= par->max_cycles)
+ if (par->max_cycles && par->samples >= par->max_cycles)
par->shutdown = 1;
if (mustgetcpu)
par->cpu = get_cpu();
- sb.sem_num = SEM_WAIT_FOR_RECEIVER;
- sb.sem_op = SEM_LOCK;
+ sb.sem_num = SEM_WAIT_FOR_RECEIVER;
+ sb.sem_op = SEM_LOCK;
semop(par->semid, &sb, 1);
- sb.sem_num = SEM_WAIT_FOR_SENDER;
+ sb.sem_num = SEM_WAIT_FOR_SENDER;
sb.sem_op = SEM_LOCK;
semop(par->semid, &sb, 1);
} else {
/* Receiver */
struct params *neighbor;
- if (wasforked)
+ if (wasforked)
neighbor = par + par->num_threads;
else
neighbor = par->neighbor;
- sb.sem_num = SEM_WAIT_FOR_SENDER;
+ sb.sem_num = SEM_WAIT_FOR_SENDER;
sb.sem_op = SEM_LOCK;
semop(par->semid, &sb, 1);
@@ -185,13 +185,13 @@ void *semathread(void *param)
neighbor->shutdown = 1;
}
- sb.sem_num = SEM_WAIT_FOR_RECEIVER;
+ sb.sem_num = SEM_WAIT_FOR_RECEIVER;
sb.sem_op = SEM_UNLOCK;
semop(par->semid, &sb, 1);
nanosleep(&par->delay, NULL);
- sb.sem_num = SEM_WAIT_FOR_SENDER;
+ sb.sem_num = SEM_WAIT_FOR_SENDER;
sb.sem_op = SEM_UNLOCK;
semop(par->semid, &sb, 1);
}
@@ -211,10 +211,10 @@ void *semathread(void *param)
union semun {
- int val; /* Value for SETVAL */
- struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
- unsigned short *array; /* Array for GETALL, SETALL */
- struct seminfo *__buf; /* Buffer for IPC_INFO (Linux-specific) */
+ int val; /* Value for SETVAL */
+ struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
+ unsigned short *array; /* Array for GETALL, SETALL */
+ struct seminfo *__buf; /* Buffer for IPC_INFO (Linux-specific) */
};
@@ -293,7 +293,7 @@ static void process_options(int argc, char *argv[])
if (optarg != NULL) {
affinity = atoi(optarg);
setaffinity = AFFINITY_SPECIFIED;
- } else if (optind<argc && atoi(argv[optind])) {
+ } else if (optind < argc && atoi(argv[optind])) {
affinity = atoi(argv[optind]);
setaffinity = AFFINITY_SPECIFIED;
} else {
@@ -330,7 +330,7 @@ static void process_options(int argc, char *argv[])
}
if (optarg != NULL)
num_threads = atoi(optarg);
- else if (optind<argc && atoi(argv[optind]))
+ else if (optind < argc && atoi(argv[optind]))
num_threads = atoi(argv[optind]);
else
num_threads = max_cpus;
@@ -386,7 +386,7 @@ int main(int argc, char *argv[])
int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
int oldsamples = 1;
key_t key;
- union semun args;
+ union semun args;
struct params *receiver = NULL;
struct params *sender = NULL;
sigset_t sigset;
@@ -421,7 +421,7 @@ int main(int argc, char *argv[])
totalsize = num_threads * sizeof(struct params) * 2;
shm_unlink("/sigwaittest");
- shmem = shm_open("/sigwaittest", O_CREAT|O_EXCL|O_RDWR,
+ shmem = shm_open("/sigwaittest", O_CREAT|O_EXCL|O_RDWR,
S_IRUSR|S_IWUSR);
if (shmem < 0) {
fprintf(stderr, "Could not create shared memory\n");
@@ -696,11 +696,11 @@ int main(int argc, char *argv[])
}
}
- nosem:
+nosem:
for (i = 0; i < num_threads; i++)
semctl(receiver[i].semid, -1, IPC_RMID);
- nomem:
+nomem:
if (mustfork) {
munmap(param, totalsize);
shm_unlink("/sigwaittest");
--
2.26.2
^ permalink raw reply related [flat|nested] 17+ messages in thread
end of thread, other threads:[~2020-10-29 17:41 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 17:40 [PATCH 00/16] Time for some new clean-ups John Kacur
2020-10-29 17:40 ` [PATCH 01/16] rt-tests: remove pi_tests.spec John Kacur
2020-10-29 17:40 ` [PATCH 02/16] rt-tests: cyclictest: A few style changes from checkpatch.pl John Kacur
2020-10-29 17:40 ` [PATCH 03/16] rt-tests: rt-sched.c: Style change John Kacur
2020-10-29 17:40 ` [PATCH 04/16] rt-tests: rt-utils.c: Correct mix of spaces and tabs in code indentation John Kacur
2020-10-29 17:40 ` [PATCH 05/16] rt-tests: pi_stress.c: Change unsigned to unsigned int John Kacur
2020-10-29 17:40 ` [PATCH 06/16] rt-tests: pip_stress.c: Remove unnecessary brackets John Kacur
2020-10-29 17:40 ` [PATCH 07/16] rt-tests: pmqtest.c: Fix spacing around parentheses John Kacur
2020-10-29 17:40 ` [PATCH 08/16] rt-tests: ptsematest.c: " John Kacur
2020-10-29 17:40 ` [PATCH 09/16] rt-tests: queuelat.c: Fix various style problems John Kacur
2020-10-29 17:40 ` [PATCH 10/16] rt-tests: rt-migrate-test.c: Fix spacing around parentheses John Kacur
2020-10-29 17:40 ` [PATCH 11/16] rt-tests: cyclicdeadline.c: Fix spacing around commas John Kacur
2020-10-29 17:40 ` [PATCH 12/16] rt-tests: deadline_test.c: " John Kacur
2020-10-29 17:40 ` [PATCH 13/16] rt-tests: signaltest.c: Fix various style problems John Kacur
2020-10-29 17:40 ` [PATCH 14/16] rt-tests: sigwaittest.c: Fix spacing around brackets John Kacur
2020-10-29 17:40 ` [PATCH 15/16] rt-tests: ssdd.c: Remove unncessary "else" John Kacur
2020-10-29 17:40 ` [PATCH 16/16] rt-tests: svsematest.c: Fix various style problems John Kacur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).