import rt-tests-1.5-15.el8
This commit is contained in:
		
							parent
							
								
									6242d2d7ca
								
							
						
					
					
						commit
						c0e88cc324
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1 +1 @@ | |||||||
| SOURCES/rt-tests-1.3.tar.gz | SOURCES/rt-tests-1.5.tar.xz | ||||||
|  | |||||||
| @ -1 +1 @@ | |||||||
| 0df302aeb536bbc4fc64922815bbd2426efb3184 SOURCES/rt-tests-1.3.tar.gz | 13ef79a90a810103e8a0fa5da92544b5d31c3838 SOURCES/rt-tests-1.5.tar.xz | ||||||
|  | |||||||
| @ -1,83 +0,0 @@ | |||||||
| From f234e04e76e24d497754876f5e7c896dc9693f3e Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Marcelo Tosatti <mtosatti@redhat.com> |  | ||||||
| Date: Tue, 4 Sep 2018 08:56:35 -0300 |  | ||||||
| Subject: [PATCH 2/2] Add queuelat manpage |  | ||||||
| 
 |  | ||||||
| Add a man page for queuelat, with a short introduction |  | ||||||
| and description for each option. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/queuelat/queuelat.8 | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ |  | ||||||
|  1 file changed, 59 insertions(+) |  | ||||||
|  create mode 100644 src/queuelat/queuelat.8 |  | ||||||
| 
 |  | ||||||
| diff --git a/src/queuelat/queuelat.8 b/src/queuelat/queuelat.8
 |  | ||||||
| new file mode 100644 |  | ||||||
| index 000000000000..d68beb98bff7
 |  | ||||||
| --- /dev/null
 |  | ||||||
| +++ b/src/queuelat/queuelat.8
 |  | ||||||
| @@ -0,0 +1,59 @@
 |  | ||||||
| +.\"                                      Hey, EMACS: -*- nroff -*-
 |  | ||||||
| +.TH QUEUELAT 8 "Sept 3, 2018"
 |  | ||||||
| +.\" Please adjust this date whenever revising the manpage.
 |  | ||||||
| +.\"
 |  | ||||||
| +.\" Some roff macros, for reference:
 |  | ||||||
| +.\" .nh        disable hyphenation
 |  | ||||||
| +.\" .hy        enable hyphenation
 |  | ||||||
| +.\" .ad l      left justify
 |  | ||||||
| +.\" .ad b      justify to both left and right margins
 |  | ||||||
| +.\" .nf        disable filling
 |  | ||||||
| +.\" .fi        enable filling
 |  | ||||||
| +.\" .br        insert line break
 |  | ||||||
| +.\" .sp <n>    insert n+1 empty lines
 |  | ||||||
| +.\" for manpage-specific macros, see man(7)
 |  | ||||||
| +.SH NAME
 |  | ||||||
| +queuelat \- Queue latency test program
 |  | ||||||
| +.SH SYNOPSIS
 |  | ||||||
| +.B queuelat
 |  | ||||||
| +.RI "[\-h] [\-m " max-queue-len "] [\-c " cycles-per-packet "] [\-p " mpps "] [\-f " tsc-freq "] [\-t " timeout "] \
 |  | ||||||
| +
 |  | ||||||
| +.SH DESCRIPTION
 |  | ||||||
| +queuelat simulates a network queue checking for latency
 |  | ||||||
| +violations in packet processing.
 |  | ||||||
| +
 |  | ||||||
| +.SH OPTIONS
 |  | ||||||
| +A summary of options is included below.
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-h
 |  | ||||||
| +Show help
 |  | ||||||
| +.br
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-m max-queue-len
 |  | ||||||
| +Maximum allowed latency, in nanoseconds. If latency to process
 |  | ||||||
| +.br
 |  | ||||||
| +any packet exceeds this value, the program quits,
 |  | ||||||
| +writing
 |  | ||||||
| +.br
 |  | ||||||
| +a message to the trace buffer.
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-c cycles-per-packet
 |  | ||||||
| +Estimated number of cycles it takes to process one packet.
 |  | ||||||
| +.br
 |  | ||||||
| +This value should come from the envisioned packet
 |  | ||||||
| +.br
 |  | ||||||
| +forwarding application being simulated.
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-p mpps
 |  | ||||||
| +Million packets per second that arrive for processing.
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-f tsc-freq-mhz
 |  | ||||||
| +TSC frequency in MHz.
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-t timeout
 |  | ||||||
| +Timeout in seconds to quit the program.
 |  | ||||||
| +
 |  | ||||||
| +
 |  | ||||||
| +.SH AUTHOR
 |  | ||||||
| +queuelat was written by Marcelo Tosatti <mtosatti@redhat.com>
 |  | ||||||
| +.br
 |  | ||||||
| -- 
 |  | ||||||
| 2.14.4 |  | ||||||
| 
 |  | ||||||
| @ -1,373 +0,0 @@ | |||||||
| From 88b17cb724c653391a92be00b48378432a1036a5 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Joe Korty <joe.korty@concurrent-rt.com> |  | ||||||
| Date: Mon, 14 Jan 2019 17:29:26 +0100 |  | ||||||
| Subject: [PATCH 1/5] Add ssdd test to the rt-tests suite |  | ||||||
| 
 |  | ||||||
| The following program might make a good addition to the rt |  | ||||||
| test suite.  It tests the reliability of PTRACE_SINGLESTEP. |  | ||||||
| It does by default 10,000 ssteps against a simple, |  | ||||||
| spinner tracee.  Also by default, it spins off ten of these |  | ||||||
| tracer/tracee pairs, all of which are to run concurrently. |  | ||||||
| 
 |  | ||||||
| Starting with 4.13-rt, this test occasionally encounters a |  | ||||||
| sstep whose waitpid returns a WIFSIGNALED (signal SIGTRAP) |  | ||||||
| rather than a WIFSTOPPED.  This usually happens after |  | ||||||
| thousands of ssteps have executed.  Having multiple |  | ||||||
| tracer/tracee pairs running dramatically increases the |  | ||||||
| chances of failure. |  | ||||||
| 
 |  | ||||||
| The is what the test output looks like for a good run: |  | ||||||
| 
 |  | ||||||
| forktest#0/22872: STARTING |  | ||||||
| forktest#7/22879: STARTING |  | ||||||
| forktest#8/22880: STARTING |  | ||||||
| forktest#6/22878: STARTING |  | ||||||
| forktest#5/22877: STARTING |  | ||||||
| forktest#3/22875: STARTING |  | ||||||
| forktest#4/22876: STARTING |  | ||||||
| forktest#9/22882: STARTING |  | ||||||
| forktest#2/22874: STARTING |  | ||||||
| forktest#1/22873: STARTING |  | ||||||
| forktest#0/22872: EXITING, no error |  | ||||||
| forktest#8/22880: EXITING, no error |  | ||||||
| forktest#3/22875: EXITING, no error |  | ||||||
| forktest#7/22879: EXITING, no error |  | ||||||
| forktest#6/22878: EXITING, no error |  | ||||||
| forktest#5/22877: EXITING, no error |  | ||||||
| forktest#2/22874: EXITING, no error |  | ||||||
| forktest#4/22876: EXITING, no error |  | ||||||
| forktest#9/22882: EXITING, no error |  | ||||||
| forktest#1/22873: EXITING, no error |  | ||||||
| All tests PASSED. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Joe Korty <joe.korty@concurrent-rt.com> |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/ssdd/ssdd.c | 315 ++++++++++++++++++++++++++++++++++++++++++++++++ |  | ||||||
|  1 file changed, 315 insertions(+) |  | ||||||
|  create mode 100644 src/ssdd/ssdd.c |  | ||||||
| 
 |  | ||||||
| diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
 |  | ||||||
| new file mode 100644 |  | ||||||
| index 000000000000..6d09d54e34e1
 |  | ||||||
| --- /dev/null
 |  | ||||||
| +++ b/src/ssdd/ssdd.c
 |  | ||||||
| @@ -0,0 +1,315 @@
 |  | ||||||
| +/*
 |  | ||||||
| + * Have a tracer do a bunch of PTRACE_SINGLESTEPs against
 |  | ||||||
| + * a tracee as fast as possible.  Create several of these
 |  | ||||||
| + * tracer/tracee pairs and see if they can be made to
 |  | ||||||
| + * interfere with each other.
 |  | ||||||
| + *
 |  | ||||||
| + * Usage:
 |  | ||||||
| + *   ssdd nforks niters
 |  | ||||||
| + * Where:
 |  | ||||||
| + *   nforks - number of tracer/tracee pairs to fork off.
 |  | ||||||
| + *            default 10.
 |  | ||||||
| + *   niters - number of PTRACE_SINGLESTEP iterations to
 |  | ||||||
| + *            do before declaring success, for each tracer/
 |  | ||||||
| + *            tracee pair set up.  Default 10,000.
 |  | ||||||
| + *
 |  | ||||||
| + * The tracer waits on each PTRACE_SINGLESTEP with a waitpid(2)
 |  | ||||||
| + * and checks that waitpid's return values for correctness.
 |  | ||||||
| + */
 |  | ||||||
| +#include <stdio.h>
 |  | ||||||
| +#include <stdlib.h>
 |  | ||||||
| +#include <stddef.h>
 |  | ||||||
| +#include <unistd.h>
 |  | ||||||
| +#include <string.h>
 |  | ||||||
| +#include <signal.h>
 |  | ||||||
| +#include <errno.h>
 |  | ||||||
| +
 |  | ||||||
| +#include <sys/types.h>
 |  | ||||||
| +#include <sys/wait.h>
 |  | ||||||
| +#include <sys/ptrace.h>
 |  | ||||||
| +
 |  | ||||||
| +/* do_wait return values */
 |  | ||||||
| +#define STATE_EXITED	1
 |  | ||||||
| +#define STATE_STOPPED	2
 |  | ||||||
| +#define STATE_SIGNALED	3
 |  | ||||||
| +#define STATE_UNKNOWN	4
 |  | ||||||
| +#define STATE_ECHILD	5
 |  | ||||||
| +#define STATE_EXITED_TSIG	6	/* exited with termination signal */
 |  | ||||||
| +#define STATE_EXITED_ERRSTAT	7	/* exited with non-zero status */
 |  | ||||||
| +
 |  | ||||||
| +char *state_name[] = {
 |  | ||||||
| +	[STATE_EXITED] = "STATE_EXITED",
 |  | ||||||
| +	[STATE_STOPPED] = "STATE_STOPPED",
 |  | ||||||
| +	[STATE_SIGNALED] = "STATE_SIGNALED",
 |  | ||||||
| +	[STATE_UNKNOWN] = "STATE_UNKNOWN",
 |  | ||||||
| +	[STATE_ECHILD] = "STATE_ECHILD",
 |  | ||||||
| +	[STATE_EXITED_TSIG] = "STATE_EXITED_TSIG",
 |  | ||||||
| +	[STATE_EXITED_ERRSTAT] = "STATE_EXITED_ERRSTAT"
 |  | ||||||
| +};
 |  | ||||||
| +
 |  | ||||||
| +const char *get_state_name(int state)
 |  | ||||||
| +{
 |  | ||||||
| +	if (state < STATE_EXITED || state > STATE_EXITED_ERRSTAT)
 |  | ||||||
| +		return "?";
 |  | ||||||
| +	return state_name[state];
 |  | ||||||
| +}
 |  | ||||||
| +
 |  | ||||||
| +#define unused __attribute__((unused))
 |  | ||||||
| +
 |  | ||||||
| +static int got_sigchld;
 |  | ||||||
| +
 |  | ||||||
| +static int do_wait(pid_t *wait_pid, int *ret_sig)
 |  | ||||||
| +{
 |  | ||||||
| +	int status, child_status;
 |  | ||||||
| +
 |  | ||||||
| +	*ret_sig = -1; /* initially mark 'nothing returned' */
 |  | ||||||
| +
 |  | ||||||
| +	while (1) {
 |  | ||||||
| +		status = waitpid(-1, &child_status, WUNTRACED | __WALL);
 |  | ||||||
| +		if (status == -1) {
 |  | ||||||
| +			if (errno == EINTR)
 |  | ||||||
| +				continue;
 |  | ||||||
| +			if (errno == ECHILD) {
 |  | ||||||
| +				*wait_pid = (pid_t)0;
 |  | ||||||
| +				return STATE_ECHILD;
 |  | ||||||
| +			}
 |  | ||||||
| +			printf("do_wait/%d: EXITING, ERROR: "
 |  | ||||||
| +			       "waitpid() returned errno %d\n",
 |  | ||||||
| +			       getpid(), errno);
 |  | ||||||
| +			exit(1);
 |  | ||||||
| +		}
 |  | ||||||
| +		break;
 |  | ||||||
| +	}
 |  | ||||||
| +	*wait_pid = (pid_t)status;
 |  | ||||||
| +
 |  | ||||||
| +	if (WIFEXITED(child_status)) {
 |  | ||||||
| +		if (WIFSIGNALED(child_status))
 |  | ||||||
| +			return STATE_EXITED_TSIG;
 |  | ||||||
| +		if (WEXITSTATUS(child_status))
 |  | ||||||
| +			return STATE_EXITED_ERRSTAT;
 |  | ||||||
| +		return STATE_EXITED;
 |  | ||||||
| +	}
 |  | ||||||
| +	if (WIFSTOPPED(child_status)) {
 |  | ||||||
| +		*ret_sig = WSTOPSIG(child_status);
 |  | ||||||
| +		return STATE_STOPPED;
 |  | ||||||
| +	}
 |  | ||||||
| +	if (WIFSIGNALED(child_status)) {
 |  | ||||||
| +		*ret_sig = WTERMSIG(child_status);
 |  | ||||||
| +		return STATE_SIGNALED;
 |  | ||||||
| +	}
 |  | ||||||
| +	return STATE_UNKNOWN;
 |  | ||||||
| +}
 |  | ||||||
| +
 |  | ||||||
| +int check_sigchld(void)
 |  | ||||||
| +{
 |  | ||||||
| +	int i;
 |  | ||||||
| +	/*
 |  | ||||||
| +	 * The signal is asynchronous so give it some
 |  | ||||||
| +	 * time to arrive.
 |  | ||||||
| +	 */
 |  | ||||||
| +	for (i = 0; i < 10 && !got_sigchld; i++)
 |  | ||||||
| +		usleep(1000); /* 10 msecs */
 |  | ||||||
| +	for (i = 0; i < 10 && !got_sigchld; i++)
 |  | ||||||
| +		usleep(2000); /* 20 + 10 = 30 msecs */
 |  | ||||||
| +	for (i = 0; i < 10 && !got_sigchld; i++)
 |  | ||||||
| +		usleep(4000); /* 40 + 30 = 70 msecs */
 |  | ||||||
| +	for (i = 0; i < 10 && !got_sigchld; i++)
 |  | ||||||
| +		usleep(8000); /* 80 + 70 = 150 msecs */
 |  | ||||||
| +	for (i = 0; i < 10 && !got_sigchld; i++)
 |  | ||||||
| +		usleep(16000); /* 160 + 150 = 310 msecs */
 |  | ||||||
| +
 |  | ||||||
| +	return got_sigchld;
 |  | ||||||
| +}
 |  | ||||||
| +
 |  | ||||||
| +pid_t parent;
 |  | ||||||
| +int nforks = 10;
 |  | ||||||
| +int nsteps = 10000;
 |  | ||||||
| +
 |  | ||||||
| +static void sigchld(int sig, unused siginfo_t * info, unused void *arg)
 |  | ||||||
| +{
 |  | ||||||
| +	got_sigchld = 1;
 |  | ||||||
| +}
 |  | ||||||
| +
 |  | ||||||
| +static void child_process(void)
 |  | ||||||
| +{
 |  | ||||||
| +	unused volatile int i;
 |  | ||||||
| +
 |  | ||||||
| +	/* wait for ptrace attach */
 |  | ||||||
| +	usleep(100000);
 |  | ||||||
| +	while (1)
 |  | ||||||
| +		i = 0;
 |  | ||||||
| +}
 |  | ||||||
| +
 |  | ||||||
| +static int forktests(int testid)
 |  | ||||||
| +{
 |  | ||||||
| +	int i, status, ret_sig;
 |  | ||||||
| +	long pstatus;
 |  | ||||||
| +	pid_t child, wait_pid;
 |  | ||||||
| +	struct sigaction act, oact;
 |  | ||||||
| +
 |  | ||||||
| +	parent = getpid();
 |  | ||||||
| +	printf("forktest#%d/%d: STARTING\n", testid, parent);
 |  | ||||||
| +
 |  | ||||||
| +	child = fork();
 |  | ||||||
| +	if (child == -1) {
 |  | ||||||
| +		printf("forktest#%d/%d: EXITING, ERROR: "
 |  | ||||||
| +		       "fork returned errno %d\n", testid, parent, errno);
 |  | ||||||
| +		exit(1);
 |  | ||||||
| +	}
 |  | ||||||
| +	if (!child)
 |  | ||||||
| +		child_process();
 |  | ||||||
| +
 |  | ||||||
| +	act.sa_sigaction = sigchld;
 |  | ||||||
| +	sigemptyset(&act.sa_mask);
 |  | ||||||
| +	act.sa_flags = SA_SIGINFO;
 |  | ||||||
| +	status = sigaction(SIGCHLD, &act, &oact);
 |  | ||||||
| +	if (status) {
 |  | ||||||
| +		printf("forktest#%d/%d: EXITING, ERROR: "
 |  | ||||||
| +		       "sigaction returned %d, errno %d\n",
 |  | ||||||
| +		       testid, parent, status, errno);
 |  | ||||||
| +		exit(1);
 |  | ||||||
| +	}
 |  | ||||||
| +
 |  | ||||||
| +	/* give both our child and parent time to set things up */
 |  | ||||||
| +	usleep(125000);
 |  | ||||||
| +
 |  | ||||||
| +	/*
 |  | ||||||
| +	 * Attach to the child.
 |  | ||||||
| +	 */
 |  | ||||||
| +	pstatus = ptrace(PTRACE_ATTACH, child, NULL, NULL);
 |  | ||||||
| +	if (pstatus == ~0l) {
 |  | ||||||
| +		printf("forktest#%d/%d: EXITING, ERROR: "
 |  | ||||||
| +		       "attach failed.  errno %d\n",
 |  | ||||||
| +		       testid, getpid(), errno);
 |  | ||||||
| +		exit(1);
 |  | ||||||
| +	}
 |  | ||||||
| +
 |  | ||||||
| +	/*
 |  | ||||||
| +	 * The attach should cause the child to receive a signal.
 |  | ||||||
| +	 */
 |  | ||||||
| +	status = do_wait(&wait_pid, &ret_sig);
 |  | ||||||
| +	if (wait_pid != child) {
 |  | ||||||
| +		printf("forktest#%d/%d: EXITING, ERROR: "
 |  | ||||||
| +		       "attach: Unexpected wait pid %d\n",
 |  | ||||||
| +		       testid, getpid(), wait_pid);
 |  | ||||||
| +		exit(1);
 |  | ||||||
| +	}
 |  | ||||||
| +	if (status != STATE_STOPPED) {
 |  | ||||||
| +		printf("forktest#%d/%d: EXITING, ERROR: "
 |  | ||||||
| +		       "attach: wait on PTRACE_ATTACH returned %d "
 |  | ||||||
| +		       "[%s, wanted STATE_STOPPED], signo %d\n",
 |  | ||||||
| +		       testid, getpid(), status, get_state_name(status),
 |  | ||||||
| +		       ret_sig);
 |  | ||||||
| +		exit(1);
 |  | ||||||
| +	}
 |  | ||||||
| +	else 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);
 |  | ||||||
| +		exit(1);
 |  | ||||||
| +	}
 |  | ||||||
| +	got_sigchld = 0;
 |  | ||||||
| +
 |  | ||||||
| +
 |  | ||||||
| +	/*
 |  | ||||||
| +	 * Generate 'nsteps' PTRACE_SINGLESTEPs, make sure they all actually
 |  | ||||||
| +	 * step the tracee.
 |  | ||||||
| +	 */
 |  | ||||||
| +	for (i = 0; i < nsteps; i++) {
 |  | ||||||
| +		pstatus = ptrace(PTRACE_SINGLESTEP, child, NULL, NULL);
 |  | ||||||
| +
 |  | ||||||
| +		if (pstatus) {
 |  | ||||||
| +			printf("forktest#%d/%d: EXITING, ERROR: "
 |  | ||||||
| +			       "PTRACE_SINGLESTEP #%d: returned status %ld, "
 |  | ||||||
| +			       "errno %d, signo %d\n",
 |  | ||||||
| +			       testid, getpid(), i, pstatus, errno, ret_sig);
 |  | ||||||
| +			exit(1);
 |  | ||||||
| +		}
 |  | ||||||
| +
 |  | ||||||
| +		status = do_wait(&wait_pid, &ret_sig);
 |  | ||||||
| +		if (wait_pid != child) {
 |  | ||||||
| +			printf("forktest#%d/%d: EXITING, ERROR: "
 |  | ||||||
| +			       "wait on PTRACE_SINGLESTEP #%d: returned wrong pid %d, "
 |  | ||||||
| +			       "expected %d\n",
 |  | ||||||
| +			       testid, getpid(), i, wait_pid, child);
 |  | ||||||
| +			exit(1);
 |  | ||||||
| +		}
 |  | ||||||
| +		if (status != STATE_STOPPED) {
 |  | ||||||
| +			printf("forktest#%d/%d: EXITING, ERROR: "
 |  | ||||||
| +			       "wait on PTRACE_SINGLESTEP #%d: wanted STATE_STOPPED, "
 |  | ||||||
| +			       "saw %s instead (and saw signo %d too)\n",
 |  | ||||||
| +			       testid, getpid(), i,
 |  | ||||||
| +			       get_state_name(status), ret_sig);
 |  | ||||||
| +			exit(1);
 |  | ||||||
| +		}
 |  | ||||||
| +		if (ret_sig != SIGTRAP) {
 |  | ||||||
| +			printf("forktest#%d/%d: EXITING, ERROR: "
 |  | ||||||
| +			       "wait on PTRACE_SINGLESTEP #%d: returned signal %d, "
 |  | ||||||
| +			       "wanted SIGTRAP\n",
 |  | ||||||
| +			       testid, getpid(), i, ret_sig);
 |  | ||||||
| +			exit(1);
 |  | ||||||
| +		}
 |  | ||||||
| +		if (!check_sigchld()) {
 |  | ||||||
| +			printf("forktest#%d/%d: EXITING, ERROR: "
 |  | ||||||
| +			       "wait on PTRACE_SINGLESTEP #%d: no SIGCHLD seen "
 |  | ||||||
| +			       "(signal count == 0), signo %d\n",
 |  | ||||||
| +			       testid, getpid(), i, ret_sig);
 |  | ||||||
| +			exit(1);
 |  | ||||||
| +		}
 |  | ||||||
| +		got_sigchld = 0;
 |  | ||||||
| +	}
 |  | ||||||
| +
 |  | ||||||
| +	/* There is no need for the tracer to kill the tracee. It will
 |  | ||||||
| +	 * automatically exit when its owner, ie, us, exits.
 |  | ||||||
| +	 */
 |  | ||||||
| +
 |  | ||||||
| +	printf("forktest#%d/%d: EXITING, no error\n", testid, parent);
 |  | ||||||
| +	exit(0);
 |  | ||||||
| +}
 |  | ||||||
| +
 |  | ||||||
| +int main(int argc, char **argv)
 |  | ||||||
| +{
 |  | ||||||
| +	int i, ret_sig, status;
 |  | ||||||
| +	pid_t child = 0, wait_pid;
 |  | ||||||
| +	int error = 0;
 |  | ||||||
| +
 |  | ||||||
| +	setbuf(stdout, NULL);
 |  | ||||||
| +
 |  | ||||||
| +	argc--, argv++;
 |  | ||||||
| +	if (argc) {
 |  | ||||||
| +		nforks = atoi(*argv);
 |  | ||||||
| +		argc--, argv++;
 |  | ||||||
| +		if (argc)
 |  | ||||||
| +			nsteps = atoi(*argv);
 |  | ||||||
| +	}
 |  | ||||||
| +	printf("#forks: %d\n", nforks);
 |  | ||||||
| +	printf("#steps: %d\n", nsteps);
 |  | ||||||
| +	printf("\n");
 |  | ||||||
| +
 |  | ||||||
| +	for (i = 0; i < nforks; i++) {
 |  | ||||||
| +		child = fork();
 |  | ||||||
| +		if (child == -1) {
 |  | ||||||
| +			printf("main: fork returned errno %d\n", errno);
 |  | ||||||
| +			exit(1);
 |  | ||||||
| +		}
 |  | ||||||
| +		if (!child)
 |  | ||||||
| +			forktests(i);
 |  | ||||||
| +	}
 |  | ||||||
| +
 |  | ||||||
| +	for (i = 0; i < nforks; i++) {
 |  | ||||||
| +		status = do_wait(&wait_pid, &ret_sig);
 |  | ||||||
| +		if (status != STATE_EXITED) {
 |  | ||||||
| +			if (0) printf("main/%d: ERROR: "
 |  | ||||||
| +			       "forktest#%d unexpected do_wait status %d "
 |  | ||||||
| +			       "[%s, wanted STATE_EXITED]\n",
 |  | ||||||
| +			       getpid(), wait_pid, status,
 |  | ||||||
| +			       get_state_name(status));
 |  | ||||||
| +			error = 1;
 |  | ||||||
| +		}
 |  | ||||||
| +	}
 |  | ||||||
| +
 |  | ||||||
| +	printf("%s.\n", error ?
 |  | ||||||
| +		"One or more tests FAILED" :
 |  | ||||||
| +		"All tests PASSED");
 |  | ||||||
| +	exit(error);
 |  | ||||||
| +}
 |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
| @ -1,93 +0,0 @@ | |||||||
| From be3ef7f9d228c3753ba805a9d25ee4dd26171d67 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Tue, 19 Jun 2018 01:38:48 +0200 |  | ||||||
| Subject: [PATCH] Remove --numa option |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/cyclictest/cyclictest.c | 30 ++++++++++++++---------------- |  | ||||||
|  src/cyclictest/rt_numa.h    |  6 ------ |  | ||||||
|  2 files changed, 14 insertions(+), 22 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
 |  | ||||||
| index 1dce8fc2bb64..484ea7fa3130 100644
 |  | ||||||
| --- a/src/cyclictest/cyclictest.c
 |  | ||||||
| +++ b/src/cyclictest/cyclictest.c
 |  | ||||||
| @@ -1207,7 +1207,6 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  			{"spike-nodes",	     required_argument, NULL, OPT_TRIGGER_NODES }, |  | ||||||
|  			{"threads",          optional_argument, NULL, OPT_THREADS }, |  | ||||||
|  			{"unbuffered",       no_argument,       NULL, OPT_UNBUFFERED }, |  | ||||||
| -			{"numa",             no_argument,       NULL, OPT_NUMA },
 |  | ||||||
|  			{"verbose",          no_argument,       NULL, OPT_VERBOSE }, |  | ||||||
|  			{"dbg_cyclictest",   no_argument,       NULL, OPT_DBGCYCLIC }, |  | ||||||
|  			{"policy",           required_argument, NULL, OPT_POLICY }, |  | ||||||
| @@ -1215,7 +1214,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  			{"posix_timers",     no_argument,	NULL, OPT_POSIX_TIMERS }, |  | ||||||
|  			{NULL, 0, NULL, 0 }, |  | ||||||
|  		}; |  | ||||||
| -		int c = getopt_long(argc, argv, "a::A::b:c:d:D:h:H:i:l:MNo:p:mqrRsSt::uUvD:x",
 |  | ||||||
| +		int c = getopt_long(argc, argv, "a::A::b:c:d:D:h:H:i:l:MNo:p:mqrRsSt::uvD:x",
 |  | ||||||
|  				    long_options, &option_index); |  | ||||||
|  		if (c == -1) |  | ||||||
|  			break; |  | ||||||
| @@ -1350,20 +1349,6 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  		case 'u': |  | ||||||
|  		case OPT_UNBUFFERED: |  | ||||||
|  			setvbuf(stdout, NULL, _IONBF, 0); break; |  | ||||||
| -		case 'U':
 |  | ||||||
| -		case OPT_NUMA: /* NUMA testing */
 |  | ||||||
| -			numa = 1;	/* Turn numa on */
 |  | ||||||
| -			if (smp)
 |  | ||||||
| -				fatal("numa and smp options are mutually exclusive\n");
 |  | ||||||
| -			numa_on_and_available();
 |  | ||||||
| -#ifdef NUMA
 |  | ||||||
| -			num_threads = max_cpus;
 |  | ||||||
| -			setaffinity = AFFINITY_USEALL;
 |  | ||||||
| -#else
 |  | ||||||
| -			warn("cyclictest was not built with the numa option\n");
 |  | ||||||
| -			warn("ignoring --numa or -U\n");
 |  | ||||||
| -#endif
 |  | ||||||
| -			break;
 |  | ||||||
|  		case 'v': |  | ||||||
|  		case OPT_VERBOSE: verbose = 1; break; |  | ||||||
|  		case 'x': |  | ||||||
| @@ -1399,6 +1384,19 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  		} |  | ||||||
|  	} |  | ||||||
|   |  | ||||||
| +	if (!smp) {	/* if smp wasn't requested, test for numa automatically */
 |  | ||||||
| +#ifdef NUMA
 |  | ||||||
| +		if (numa_available() != -1) {
 |  | ||||||
| +			numa = 1;
 |  | ||||||
| +			num_threads = max_cpus;
 |  | ||||||
| +			setaffinity = AFFINITY_USEALL;
 |  | ||||||
| +#else
 |  | ||||||
| +			warn("cyclictest was not built with the numa option\n");
 |  | ||||||
| +			numa = 0;
 |  | ||||||
| +#endif
 |  | ||||||
| +		}
 |  | ||||||
| +	}
 |  | ||||||
| +
 |  | ||||||
|  	if (option_affinity) { |  | ||||||
|  		if (smp) { |  | ||||||
|  			warn("-a ignored due to --smp\n"); |  | ||||||
| diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
 |  | ||||||
| index ec2994314e80..3970e681fe7b 100644
 |  | ||||||
| --- a/src/cyclictest/rt_numa.h
 |  | ||||||
| +++ b/src/cyclictest/rt_numa.h
 |  | ||||||
| @@ -192,12 +192,6 @@ static inline void rt_bitmask_free(struct bitmask *mask)
 |  | ||||||
|   |  | ||||||
|  #endif	/* LIBNUMA_API_VERSION */ |  | ||||||
|   |  | ||||||
| -static void numa_on_and_available()
 |  | ||||||
| -{
 |  | ||||||
| -	if (numa && (numa_available() == -1))
 |  | ||||||
| -		fatal("--numa specified and numa functions not available.\n");
 |  | ||||||
| -}
 |  | ||||||
| -
 |  | ||||||
|  #else /* ! NUMA */ |  | ||||||
|   |  | ||||||
|  struct bitmask { |  | ||||||
| -- 
 |  | ||||||
| 2.14.4 |  | ||||||
| 
 |  | ||||||
| @ -1,72 +0,0 @@ | |||||||
| From 05a1ceb9b490b2cb0aff2f10c4753849df05dec0 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Marcelo Tosatti <mtosatti@redhat.com> |  | ||||||
| Date: Tue, 4 Sep 2018 08:56:34 -0300 |  | ||||||
| Subject: [PATCH 1/2] add -h option to queuelat |  | ||||||
| 
 |  | ||||||
| Add -h (help) option to queuelat, which lists all |  | ||||||
| options. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/queuelat/README     |  1 + |  | ||||||
|  src/queuelat/queuelat.c | 17 ++++++++++++++++- |  | ||||||
|  2 files changed, 17 insertions(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/queuelat/README b/src/queuelat/README
 |  | ||||||
| index 790de3e13c17..4ffdb3753bbd 100644
 |  | ||||||
| --- a/src/queuelat/README
 |  | ||||||
| +++ b/src/queuelat/README
 |  | ||||||
| @@ -51,6 +51,7 @@ cycles_per_packet: number of cycles to process one packet (int).
 |  | ||||||
|  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). |  | ||||||
| +timeout: timeout (in seconds).
 |  | ||||||
|   |  | ||||||
|  How it works |  | ||||||
|  ============ |  | ||||||
| diff --git a/src/queuelat/queuelat.c b/src/queuelat/queuelat.c
 |  | ||||||
| index 8bfed274ccab..2230d04bf391 100644
 |  | ||||||
| --- a/src/queuelat/queuelat.c
 |  | ||||||
| +++ b/src/queuelat/queuelat.c
 |  | ||||||
| @@ -532,6 +532,18 @@ int calculate_nr_packets_drain_per_block(void)
 |  | ||||||
|  	return nr_packets_drain_per_block; |  | ||||||
|  } |  | ||||||
|   |  | ||||||
| +
 |  | ||||||
| +void print_help(void)
 |  | ||||||
| +{
 |  | ||||||
| +	printf("usage: queuelat [options]\n");
 |  | ||||||
| +	printf("-h show this help menu\n");
 |  | ||||||
| +	printf("-m max-queue-len (maximum latency allowed, in nanoseconds) (int)\n");
 |  | ||||||
| +	printf("-c cycles-per-packet (number of cycles to process one packet (int)\n");
 |  | ||||||
| +	printf("-p million-packet-per-sec (million packets per second) (float)\n");
 |  | ||||||
| +	printf("-f tsc-freq-mhz (TSC frequency in MHz) (float)\n");
 |  | ||||||
| +	printf("-t timeout (timeout, in seconds) (int)\n");
 |  | ||||||
| +}
 |  | ||||||
| +
 |  | ||||||
|  int main(int argc, char **argv) |  | ||||||
|  { |  | ||||||
|  	double tsc_freq_mhz; |  | ||||||
| @@ -549,7 +561,7 @@ int main(int argc, char **argv)
 |  | ||||||
|   |  | ||||||
|  	opterr = 0; |  | ||||||
|   |  | ||||||
| -	while ((c = getopt (argc, argv, "m:c:p:f:t:q:")) != -1)
 |  | ||||||
| +	while ((c = getopt (argc, argv, "m:c:p:f:t:q:h")) != -1)
 |  | ||||||
|  		switch (c) |  | ||||||
|  		{ |  | ||||||
|  		case 'm': |  | ||||||
| @@ -570,6 +582,9 @@ int main(int argc, char **argv)
 |  | ||||||
|  		case 'q': |  | ||||||
|  			qvalue = optarg; |  | ||||||
|  			break; |  | ||||||
| +		case 'h':
 |  | ||||||
| +			print_help();
 |  | ||||||
| +			return 0;
 |  | ||||||
|  		case '?': |  | ||||||
|  			if (optopt == 'm' || optopt == 'c' || optopt == 'p' || |  | ||||||
|  			    optopt == 'f' || optopt == 't' || optopt == 'q') |  | ||||||
| -- 
 |  | ||||||
| 2.14.4 |  | ||||||
| 
 |  | ||||||
| @ -1,41 +0,0 @@ | |||||||
| From 2b126beda6e76f89fb95c14bc421bc13a376cf2e Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Clark Williams <williams@redhat.com> |  | ||||||
| Date: Tue, 19 Feb 2019 16:10:38 +0100 |  | ||||||
| Subject: [PATCH] cyclictest: Fix compiler warning about srncpy output |  | ||||||
|  truncated |  | ||||||
| 
 |  | ||||||
| Fix compiler warning about strncpy output truncated before terminating |  | ||||||
| nul copying as many bytes from a string as its length |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Clark Williams <williams@redhat.com> |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| Extracted from a patch from Clark |  | ||||||
| ---
 |  | ||||||
|  src/cyclictest/cyclictest.c | 4 ++-- |  | ||||||
|  1 file changed, 2 insertions(+), 2 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
 |  | ||||||
| index 68b3836405c1..1bd63fd93dce 100644
 |  | ||||||
| --- a/src/cyclictest/cyclictest.c
 |  | ||||||
| +++ b/src/cyclictest/cyclictest.c
 |  | ||||||
| @@ -1257,7 +1257,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  		case 'F': |  | ||||||
|  		case OPT_FIFO: |  | ||||||
|  			use_fifo = 1; |  | ||||||
| -			strncpy(fifopath, optarg, strlen(optarg));
 |  | ||||||
| +			strncpy(fifopath, optarg, strnlen(optarg, MAX_PATH-1));
 |  | ||||||
|  			break; |  | ||||||
|  		case 'H': |  | ||||||
|  		case OPT_HISTOFALL: |  | ||||||
| @@ -1267,7 +1267,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  			histogram = atoi(optarg); break; |  | ||||||
|  		case OPT_HISTFILE: |  | ||||||
|  			use_histfile = 1; |  | ||||||
| -			strncpy(histfile, optarg, strlen(optarg));
 |  | ||||||
| +			strncpy(histfile, optarg, strnlen(optarg, MAX_PATH-1));
 |  | ||||||
|  			break; |  | ||||||
|  		case 'i': |  | ||||||
|  		case OPT_INTERVAL: |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
| @ -1,56 +0,0 @@ | |||||||
| From 966b4eeda61b4c623a5ef423236dc710b31c1532 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Wed, 20 Feb 2019 23:16:34 +0100 |  | ||||||
| Subject: [PATCH] cyclictest: Make sure affinity is respected when numa is |  | ||||||
|  detected |  | ||||||
| 
 |  | ||||||
| Make sure affinity is respected when numa is automatically detected and |  | ||||||
| when smp is not specified. Don't break the way smp currently works. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/cyclictest/cyclictest.c | 13 ++++++------- |  | ||||||
|  1 file changed, 6 insertions(+), 7 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
 |  | ||||||
| index 1bd63fd93dce..ed59edefbf97 100644
 |  | ||||||
| --- a/src/cyclictest/cyclictest.c
 |  | ||||||
| +++ b/src/cyclictest/cyclictest.c
 |  | ||||||
| @@ -1218,7 +1218,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  		case 'a': |  | ||||||
|  		case OPT_AFFINITY: |  | ||||||
|  			option_affinity = 1; |  | ||||||
| -			if (smp || numa)
 |  | ||||||
| +			if (smp)
 |  | ||||||
|  				break; |  | ||||||
|  			if (optarg != NULL) { |  | ||||||
|  				parse_cpumask(optarg, max_cpus); |  | ||||||
| @@ -1384,8 +1384,10 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  #ifdef NUMA |  | ||||||
|  		if (numa_available() != -1) { |  | ||||||
|  			numa = 1; |  | ||||||
| -			num_threads = max_cpus;
 |  | ||||||
| -			setaffinity = AFFINITY_USEALL;
 |  | ||||||
| +			if (setaffinity == AFFINITY_UNSPECIFIED) {
 |  | ||||||
| +				num_threads = max_cpus;
 |  | ||||||
| +				setaffinity = AFFINITY_USEALL;
 |  | ||||||
| +			}
 |  | ||||||
|  		} |  | ||||||
|  #else |  | ||||||
|  		warn("cyclictest was not built with the numa option\n"); |  | ||||||
| @@ -1394,11 +1396,8 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  	} |  | ||||||
|   |  | ||||||
|  	if (option_affinity) { |  | ||||||
| -		if (smp) {
 |  | ||||||
| +		if (smp)
 |  | ||||||
|  			warn("-a ignored due to smp mode\n"); |  | ||||||
| -		} else if (numa) {
 |  | ||||||
| -			warn("-a ignored due to numa mode\n");
 |  | ||||||
| -		}
 |  | ||||||
|  	} |  | ||||||
|   |  | ||||||
|  	if (smi) { |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
| @ -1,44 +0,0 @@ | |||||||
| From e1fa2cda6a6cc2e5eb916638e0325b3d334adbe4 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Li Xiaoming <lixm.fnst@cn.fujitsu.com> |  | ||||||
| Date: Thu, 10 Jan 2019 10:21:59 +0800 |  | ||||||
| Subject: [PATCH] cyclictest: fix_with_expected_identifier_in_latest |  | ||||||
| 
 |  | ||||||
| An error occurred during the build process: |  | ||||||
| src/cyclictest/cyclictest.c:1396:2: error: expected identifier or '(' before 'if' |  | ||||||
|   if (option_affinity) { |  | ||||||
| 
 |  | ||||||
| The expected identifier "}"  for  "if (option_affinity){" occurs in another place. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com> |  | ||||||
| Signed-off-by: Zhong Lu <zhongl.fnst@cn.fujitsu.com> |  | ||||||
| 
 |  | ||||||
| - Fixed the indentation of the bracket
 |  | ||||||
| - Fixed the indentation of the block where NUMA is not defined
 |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/cyclictest/cyclictest.c | 6 +++--- |  | ||||||
|  1 file changed, 3 insertions(+), 3 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
 |  | ||||||
| index 188a202c5171..68b3836405c1 100644
 |  | ||||||
| --- a/src/cyclictest/cyclictest.c
 |  | ||||||
| +++ b/src/cyclictest/cyclictest.c
 |  | ||||||
| @@ -1386,11 +1386,11 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  			numa = 1; |  | ||||||
|  			num_threads = max_cpus; |  | ||||||
|  			setaffinity = AFFINITY_USEALL; |  | ||||||
| +		}
 |  | ||||||
|  #else |  | ||||||
| -			warn("cyclictest was not built with the numa option\n");
 |  | ||||||
| -			numa = 0;
 |  | ||||||
| +		warn("cyclictest was not built with the numa option\n");
 |  | ||||||
| +		numa = 0;
 |  | ||||||
|  #endif |  | ||||||
| -		}
 |  | ||||||
|  	} |  | ||||||
|   |  | ||||||
|  	if (option_affinity) { |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
| @ -1,881 +0,0 @@ | |||||||
| From f5ccfbe4d6641e48f56152be135d901dd31cba7e Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Clark Williams <williams@redhat.com> |  | ||||||
| Date: Tue, 16 Jan 2018 15:37:17 -0600 |  | ||||||
| Subject: [PATCH 1/3] cyclictest: remove ftrace code |  | ||||||
| 
 |  | ||||||
| Remove all the code that manipulates tracing values with the exception |  | ||||||
| of the breaktrace logic. Cyclictest now presumes that any tracing |  | ||||||
| will be done by the trace-cmd command and will only *stop* tracing |  | ||||||
| if the breaktrace value is hit. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Clark Williams <williams@redhat.com> |  | ||||||
| (cherry picked from commit 26838f86d54e3ff74223165cbbcc2d211becdaf2) |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/cyclictest/cyclictest.c | 537 +++----------------------------------------- |  | ||||||
|  1 file changed, 32 insertions(+), 505 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
 |  | ||||||
| index 8d9ec80fc239..1dce8fc2bb64 100644
 |  | ||||||
| --- a/src/cyclictest/cyclictest.c
 |  | ||||||
| +++ b/src/cyclictest/cyclictest.c
 |  | ||||||
| @@ -118,23 +118,8 @@ extern int clock_nanosleep(clockid_t __clock_id, int __flags,
 |  | ||||||
|  #define MSR_SMI_COUNT		0x00000034 |  | ||||||
|  #define MSR_SMI_COUNT_MASK	0xFFFFFFFF |  | ||||||
|   |  | ||||||
| -int enable_events;
 |  | ||||||
| -
 |  | ||||||
|  static char *policyname(int policy); |  | ||||||
|   |  | ||||||
| -enum {
 |  | ||||||
| -	NOTRACE,
 |  | ||||||
| -	CTXTSWITCH,
 |  | ||||||
| -	IRQSOFF,
 |  | ||||||
| -	PREEMPTOFF,
 |  | ||||||
| -	PREEMPTIRQSOFF,
 |  | ||||||
| -	WAKEUP,
 |  | ||||||
| -	WAKEUPRT,
 |  | ||||||
| -	LATENCY,
 |  | ||||||
| -	FUNCTION,
 |  | ||||||
| -	CUSTOM,
 |  | ||||||
| -};
 |  | ||||||
| -
 |  | ||||||
|  /* Struct to transfer parameters to the thread */ |  | ||||||
|  struct thread_param { |  | ||||||
|  	int prio; |  | ||||||
| @@ -201,14 +186,9 @@ static void trigger_update(struct thread_param *par, int diff, int64_t ts);
 |  | ||||||
|   |  | ||||||
|  static int shutdown; |  | ||||||
|  static int tracelimit = 0; |  | ||||||
| -static int notrace = 0;
 |  | ||||||
| -static int trace_marker = 0;
 |  | ||||||
| -static int ftrace = 0;
 |  | ||||||
| -static int kernelversion;
 |  | ||||||
|  static int verbose = 0; |  | ||||||
|  static int oscope_reduction = 1; |  | ||||||
|  static int lockall = 0; |  | ||||||
| -static int tracetype = NOTRACE;
 |  | ||||||
|  static int histogram = 0; |  | ||||||
|  static int histofall = 0; |  | ||||||
|  static int duration = 0; |  | ||||||
| @@ -243,20 +223,10 @@ static pthread_barrier_t align_barr;
 |  | ||||||
|  static pthread_barrier_t globalt_barr; |  | ||||||
|  static struct timespec globalt; |  | ||||||
|   |  | ||||||
| -/* Backup of kernel variables that we modify */
 |  | ||||||
| -static struct kvars {
 |  | ||||||
| -	char name[KVARNAMELEN];
 |  | ||||||
| -	char value[KVALUELEN];
 |  | ||||||
| -} kv[KVARS];
 |  | ||||||
| -
 |  | ||||||
|  static char *procfileprefix = "/proc/sys/kernel/"; |  | ||||||
|  static char *fileprefix; |  | ||||||
| -static char tracer[MAX_PATH];
 |  | ||||||
|  static char fifopath[MAX_PATH]; |  | ||||||
|  static char histfile[MAX_PATH]; |  | ||||||
| -static char **traceptr;
 |  | ||||||
| -static int traceopt_count;
 |  | ||||||
| -static int traceopt_size;
 |  | ||||||
|   |  | ||||||
|  static struct thread_param **parameters; |  | ||||||
|  static struct thread_stat **statistics; |  | ||||||
| @@ -311,101 +281,14 @@ static void set_latency_target(void)
 |  | ||||||
|  } |  | ||||||
|   |  | ||||||
|   |  | ||||||
| -enum kernelversion {
 |  | ||||||
| -	KV_NOT_SUPPORTED,
 |  | ||||||
| -	KV_26_LT18,
 |  | ||||||
| -	KV_26_LT24,
 |  | ||||||
| -	KV_26_33,
 |  | ||||||
| -	KV_30
 |  | ||||||
| -};
 |  | ||||||
| -
 |  | ||||||
|  enum { |  | ||||||
|  	ERROR_GENERAL	= -1, |  | ||||||
|  	ERROR_NOTFOUND	= -2, |  | ||||||
|  }; |  | ||||||
|   |  | ||||||
| -static char functiontracer[MAX_PATH];
 |  | ||||||
| -static char traceroptions[MAX_PATH];
 |  | ||||||
| -
 |  | ||||||
|  static int trace_fd     = -1; |  | ||||||
|  static int tracemark_fd = -1; |  | ||||||
|   |  | ||||||
| -static int kernvar(int mode, const char *name, char *value, size_t sizeofvalue)
 |  | ||||||
| -{
 |  | ||||||
| -	char filename[128];
 |  | ||||||
| -	int retval = 1;
 |  | ||||||
| -	int path;
 |  | ||||||
| -	size_t len_prefix = strlen(fileprefix), len_name = strlen(name);
 |  | ||||||
| -
 |  | ||||||
| -	if (len_prefix + len_name + 1 > sizeof(filename)) {
 |  | ||||||
| -		errno = ENOMEM;
 |  | ||||||
| -		return 1;
 |  | ||||||
| -	}
 |  | ||||||
| -
 |  | ||||||
| -	memcpy(filename, fileprefix, len_prefix);
 |  | ||||||
| -	memcpy(filename + len_prefix, name, len_name + 1);
 |  | ||||||
| -
 |  | ||||||
| -	path = open(filename, mode);
 |  | ||||||
| -	if (path >= 0) {
 |  | ||||||
| -		if (mode == O_RDONLY) {
 |  | ||||||
| -			int got;
 |  | ||||||
| -			if ((got = read(path, value, sizeofvalue)) > 0) {
 |  | ||||||
| -				retval = 0;
 |  | ||||||
| -				value[got-1] = '\0';
 |  | ||||||
| -			}
 |  | ||||||
| -		} else if (mode == O_WRONLY) {
 |  | ||||||
| -			if (write(path, value, sizeofvalue) == sizeofvalue)
 |  | ||||||
| -				retval = 0;
 |  | ||||||
| -		}
 |  | ||||||
| -		close(path);
 |  | ||||||
| -	}
 |  | ||||||
| -	return retval;
 |  | ||||||
| -}
 |  | ||||||
| -
 |  | ||||||
| -static void setkernvar(const char *name, char *value)
 |  | ||||||
| -{
 |  | ||||||
| -	int i;
 |  | ||||||
| -	char oldvalue[KVALUELEN];
 |  | ||||||
| -
 |  | ||||||
| -	if (kernelversion < KV_26_33) {
 |  | ||||||
| -		if (kernvar(O_RDONLY, name, oldvalue, sizeof(oldvalue)))
 |  | ||||||
| -			fprintf(stderr, "could not retrieve %s\n", name);
 |  | ||||||
| -		else {
 |  | ||||||
| -			for (i = 0; i < KVARS; i++) {
 |  | ||||||
| -				if (!strcmp(kv[i].name, name))
 |  | ||||||
| -					break;
 |  | ||||||
| -				if (kv[i].name[0] == '\0') {
 |  | ||||||
| -					strncpy(kv[i].name, name,
 |  | ||||||
| -						sizeof(kv[i].name));
 |  | ||||||
| -					strncpy(kv[i].value, oldvalue,
 |  | ||||||
| -					    sizeof(kv[i].value));
 |  | ||||||
| -					break;
 |  | ||||||
| -				}
 |  | ||||||
| -			}
 |  | ||||||
| -			if (i == KVARS)
 |  | ||||||
| -				fprintf(stderr, "could not backup %s (%s)\n",
 |  | ||||||
| -					name, oldvalue);
 |  | ||||||
| -		}
 |  | ||||||
| -	}
 |  | ||||||
| -	if (kernvar(O_WRONLY, name, value, strlen(value)))
 |  | ||||||
| -		fprintf(stderr, "could not set %s to %s\n", name, value);
 |  | ||||||
| -
 |  | ||||||
| -}
 |  | ||||||
| -
 |  | ||||||
| -static void restorekernvars(void)
 |  | ||||||
| -{
 |  | ||||||
| -	int i;
 |  | ||||||
| -
 |  | ||||||
| -	for (i = 0; i < KVARS; i++) {
 |  | ||||||
| -		if (kv[i].name[0] != '\0') {
 |  | ||||||
| -			if (kernvar(O_WRONLY, kv[i].name, kv[i].value,
 |  | ||||||
| -			    strlen(kv[i].value)))
 |  | ||||||
| -				fprintf(stderr, "could not restore %s to %s\n",
 |  | ||||||
| -					kv[i].name, kv[i].value);
 |  | ||||||
| -		}
 |  | ||||||
| -	}
 |  | ||||||
| -}
 |  | ||||||
| -
 |  | ||||||
|  static inline void tsnorm(struct timespec *ts) |  | ||||||
|  { |  | ||||||
|  	while (ts->tv_nsec >= NSEC_PER_SEC) { |  | ||||||
| @@ -422,8 +305,7 @@ static inline int tsgreater(struct timespec *a, struct timespec *b)
 |  | ||||||
|   |  | ||||||
|  static inline int64_t calcdiff(struct timespec t1, struct timespec t2) |  | ||||||
|  { |  | ||||||
| -	int64_t diff;
 |  | ||||||
| -	diff = USEC_PER_SEC * (long long)((int) t1.tv_sec - (int) t2.tv_sec);
 |  | ||||||
| +	int64_t diff = USEC_PER_SEC * (long long)((int) t1.tv_sec - (int) t2.tv_sec);
 |  | ||||||
|  	diff += ((int) t1.tv_nsec - (int) t2.tv_nsec) / 1000; |  | ||||||
|  	return diff; |  | ||||||
|  } |  | ||||||
| @@ -444,32 +326,13 @@ static inline int64_t calctime(struct timespec t)
 |  | ||||||
|  	return time; |  | ||||||
|  } |  | ||||||
|   |  | ||||||
| -static void traceopt(char *option)
 |  | ||||||
| -{
 |  | ||||||
| -	char *ptr;
 |  | ||||||
| -	if (traceopt_count + 1 > traceopt_size) {
 |  | ||||||
| -		traceopt_size += 16;
 |  | ||||||
| -		printf("expanding traceopt buffer to %d entries\n", traceopt_size);
 |  | ||||||
| -		traceptr = realloc(traceptr, sizeof(char*) * traceopt_size);
 |  | ||||||
| -		if (traceptr == NULL)
 |  | ||||||
| -			fatal ("Error allocating space for %d trace options\n",
 |  | ||||||
| -			       traceopt_count+1);
 |  | ||||||
| -	}
 |  | ||||||
| -	ptr = malloc(strlen(option)+1);
 |  | ||||||
| -	if (ptr == NULL)
 |  | ||||||
| -		fatal("error allocating space for trace option %s\n", option);
 |  | ||||||
| -	printf("adding traceopt %s\n", option);
 |  | ||||||
| -	strcpy(ptr, option);
 |  | ||||||
| -	traceptr[traceopt_count++] = ptr;
 |  | ||||||
| -}
 |  | ||||||
| -
 |  | ||||||
|  static 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;
 |  | ||||||
|  } |  | ||||||
|   |  | ||||||
|  #define TRACEBUFSIZ 1024 |  | ||||||
| @@ -483,7 +346,7 @@ static void tracemark(char *fmt, ...)
 |  | ||||||
|   |  | ||||||
|  	/* bail out if we're not tracing */ |  | ||||||
|  	/* or if the kernel doesn't support trace_mark */ |  | ||||||
| -	if (tracemark_fd < 0)
 |  | ||||||
| +	if (tracemark_fd < 0 || trace_fd < 0)
 |  | ||||||
|  		return; |  | ||||||
|   |  | ||||||
|  	va_start(ap, fmt); |  | ||||||
| @@ -497,45 +360,6 @@ static void tracemark(char *fmt, ...)
 |  | ||||||
|  	write(trace_fd, "0\n", 2); |  | ||||||
|  } |  | ||||||
|   |  | ||||||
| -
 |  | ||||||
| -
 |  | ||||||
| -static void tracing(int on)
 |  | ||||||
| -{
 |  | ||||||
| -	if (notrace)
 |  | ||||||
| -		return;
 |  | ||||||
| -
 |  | ||||||
| -	if (on) {
 |  | ||||||
| -		switch (kernelversion) {
 |  | ||||||
| -		case KV_26_LT18: gettimeofday(0,(struct timezone *)1); break;
 |  | ||||||
| -		case KV_26_LT24: prctl(0, 1); break;
 |  | ||||||
| -		case KV_26_33:
 |  | ||||||
| -		case KV_30:
 |  | ||||||
| -			write(trace_fd, "1", 1);
 |  | ||||||
| -			break;
 |  | ||||||
| -		default:	 break;
 |  | ||||||
| -		}
 |  | ||||||
| -	} else {
 |  | ||||||
| -		switch (kernelversion) {
 |  | ||||||
| -		case KV_26_LT18: gettimeofday(0,0); break;
 |  | ||||||
| -		case KV_26_LT24: prctl(0, 0); break;
 |  | ||||||
| -		case KV_26_33:
 |  | ||||||
| -		case KV_30:
 |  | ||||||
| -			write(trace_fd, "0", 1);
 |  | ||||||
| -			break;
 |  | ||||||
| -		default:	break;
 |  | ||||||
| -		}
 |  | ||||||
| -	}
 |  | ||||||
| -}
 |  | ||||||
| -
 |  | ||||||
| -static int settracer(char *tracer)
 |  | ||||||
| -{
 |  | ||||||
| -	if (valid_tracer(tracer)) {
 |  | ||||||
| -		setkernvar("current_tracer", tracer);
 |  | ||||||
| -		return 0;
 |  | ||||||
| -	}
 |  | ||||||
| -	return -1;
 |  | ||||||
| -}
 |  | ||||||
| -
 |  | ||||||
|  static void open_tracemark_fd(void) |  | ||||||
|  { |  | ||||||
|  	char path[MAX_PATH]; |  | ||||||
| @@ -557,7 +381,7 @@ static void open_tracemark_fd(void)
 |  | ||||||
|  	 * open the tracing_on file so that we can stop the trace |  | ||||||
|  	 * if we hit a breaktrace threshold |  | ||||||
|  	 */ |  | ||||||
| -	if (notrace && trace_fd < 0) {
 |  | ||||||
| +	if (trace_fd < 0) {
 |  | ||||||
|  		sprintf(path, "%s/%s", fileprefix, "tracing_on"); |  | ||||||
|  		if ((trace_fd = open(path, O_WRONLY)) < 0) |  | ||||||
|  			warn("unable to open tracing_on file: %s\n", path); |  | ||||||
| @@ -569,166 +393,19 @@ static void debugfs_prepare(void)
 |  | ||||||
|  	if (mount_debugfs(NULL)) |  | ||||||
|  		fatal("could not mount debugfs"); |  | ||||||
|   |  | ||||||
| -	if (kernelversion >= KV_26_33) {
 |  | ||||||
| -		char testname[MAX_PATH];
 |  | ||||||
| -
 |  | ||||||
| -		fileprefix = get_debugfileprefix();
 |  | ||||||
| -		if (!trace_file_exists("tracing_enabled") &&
 |  | ||||||
| -		    !trace_file_exists("tracing_on"))
 |  | ||||||
| -			warn("tracing_enabled or tracing_on not found\n"
 |  | ||||||
| -			    "debug fs not mounted, "
 |  | ||||||
| -			    "TRACERs not configured?\n", testname);
 |  | ||||||
| -	} else
 |  | ||||||
| -		fileprefix = procfileprefix;
 |  | ||||||
| +	fileprefix = get_debugfileprefix();
 |  | ||||||
| +	if (!trace_file_exists("tracing_enabled") &&
 |  | ||||||
| +	    !trace_file_exists("tracing_on"))
 |  | ||||||
| +		warn("tracing_enabled or tracing_on not found\n"
 |  | ||||||
| +		     "debug fs not mounted");
 |  | ||||||
|  } |  | ||||||
|   |  | ||||||
|  static void enable_trace_mark(void) |  | ||||||
|  { |  | ||||||
| -	if (!trace_marker)
 |  | ||||||
| -		return;
 |  | ||||||
| -
 |  | ||||||
| -	if (!tracelimit)
 |  | ||||||
| -		fatal("--tracemark requires -b\n");
 |  | ||||||
| -
 |  | ||||||
|  	debugfs_prepare(); |  | ||||||
|  	open_tracemark_fd(); |  | ||||||
|  } |  | ||||||
|   |  | ||||||
| -static void setup_tracer(void)
 |  | ||||||
| -{
 |  | ||||||
| -	if (!tracelimit || notrace)
 |  | ||||||
| -		return;
 |  | ||||||
| -
 |  | ||||||
| -	debugfs_prepare();
 |  | ||||||
| -
 |  | ||||||
| -	if (kernelversion >= KV_26_33) {
 |  | ||||||
| -		int ret;
 |  | ||||||
| -
 |  | ||||||
| -		if (trace_file_exists("tracing_enabled") &&
 |  | ||||||
| -		    !trace_file_exists("tracing_on"))
 |  | ||||||
| -			setkernvar("tracing_enabled", "1");
 |  | ||||||
| -
 |  | ||||||
| -		/* ftrace_enabled is a sysctl variable */
 |  | ||||||
| -		/* turn it on if you're doing anything but nop or event tracing */
 |  | ||||||
| -
 |  | ||||||
| -		fileprefix = procfileprefix;
 |  | ||||||
| -		if (tracetype)
 |  | ||||||
| -			setkernvar("ftrace_enabled", "1");
 |  | ||||||
| -		else
 |  | ||||||
| -			setkernvar("ftrace_enabled", "0");
 |  | ||||||
| -		fileprefix = get_debugfileprefix();
 |  | ||||||
| -
 |  | ||||||
| -		/*
 |  | ||||||
| -		 * Set default tracer to nop.
 |  | ||||||
| -		 * this also has the nice side effect of clearing out
 |  | ||||||
| -		 * old traces.
 |  | ||||||
| -		 */
 |  | ||||||
| -		ret = settracer("nop");
 |  | ||||||
| -
 |  | ||||||
| -		switch (tracetype) {
 |  | ||||||
| -		case NOTRACE:
 |  | ||||||
| -			/* no tracer specified, use events */
 |  | ||||||
| -			enable_events = 1;
 |  | ||||||
| -			break;
 |  | ||||||
| -		case FUNCTION:
 |  | ||||||
| -			ret = settracer("function");
 |  | ||||||
| -			break;
 |  | ||||||
| -		case IRQSOFF:
 |  | ||||||
| -			ret = settracer("irqsoff");
 |  | ||||||
| -			break;
 |  | ||||||
| -		case PREEMPTOFF:
 |  | ||||||
| -			ret = settracer("preemptoff");
 |  | ||||||
| -			break;
 |  | ||||||
| -		case PREEMPTIRQSOFF:
 |  | ||||||
| -			ret = settracer("preemptirqsoff");
 |  | ||||||
| -			break;
 |  | ||||||
| -		case CTXTSWITCH:
 |  | ||||||
| -			if (valid_tracer("sched_switch"))
 |  | ||||||
| -			    ret = settracer("sched_switch");
 |  | ||||||
| -			else {
 |  | ||||||
| -				if ((ret = event_enable("sched/sched_wakeup")))
 |  | ||||||
| -					break;
 |  | ||||||
| -				ret = event_enable("sched/sched_switch");
 |  | ||||||
| -			}
 |  | ||||||
| -			break;
 |  | ||||||
| -		case WAKEUP:
 |  | ||||||
| -			ret = settracer("wakeup");
 |  | ||||||
| -			break;
 |  | ||||||
| -		case WAKEUPRT:
 |  | ||||||
| -			ret = settracer("wakeup_rt");
 |  | ||||||
| -			break;
 |  | ||||||
| -		default:
 |  | ||||||
| -			if (strlen(tracer)) {
 |  | ||||||
| -				ret = settracer(tracer);
 |  | ||||||
| -				if (strcmp(tracer, "events") == 0 && ftrace)
 |  | ||||||
| -					ret = settracer(functiontracer);
 |  | ||||||
| -			}
 |  | ||||||
| -			else {
 |  | ||||||
| -				printf("cyclictest: unknown tracer!\n");
 |  | ||||||
| -				ret = 0;
 |  | ||||||
| -			}
 |  | ||||||
| -			break;
 |  | ||||||
| -		}
 |  | ||||||
| -
 |  | ||||||
| -		if (enable_events)
 |  | ||||||
| -			/* turn on all events */
 |  | ||||||
| -			event_enable_all();
 |  | ||||||
| -
 |  | ||||||
| -		if (ret)
 |  | ||||||
| -			fprintf(stderr, "Requested tracer '%s' not available\n", tracer);
 |  | ||||||
| -
 |  | ||||||
| -		setkernvar(traceroptions, "print-parent");
 |  | ||||||
| -		setkernvar(traceroptions, "latency-format");
 |  | ||||||
| -		if (verbose) {
 |  | ||||||
| -			setkernvar(traceroptions, "sym-offset");
 |  | ||||||
| -			setkernvar(traceroptions, "sym-addr");
 |  | ||||||
| -			setkernvar(traceroptions, "verbose");
 |  | ||||||
| -		} else {
 |  | ||||||
| -			setkernvar(traceroptions, "nosym-offset");
 |  | ||||||
| -			setkernvar(traceroptions, "nosym-addr");
 |  | ||||||
| -			setkernvar(traceroptions, "noverbose");
 |  | ||||||
| -		}
 |  | ||||||
| -		if (traceopt_count) {
 |  | ||||||
| -			int i;
 |  | ||||||
| -			for (i = 0; i < traceopt_count; i++)
 |  | ||||||
| -				setkernvar(traceroptions, traceptr[i]);
 |  | ||||||
| -		}
 |  | ||||||
| -		setkernvar("tracing_max_latency", "0");
 |  | ||||||
| -		if (trace_file_exists("latency_hist"))
 |  | ||||||
| -			setkernvar("latency_hist/wakeup/reset", "1");
 |  | ||||||
| -
 |  | ||||||
| -		/* open the tracing on file descriptor */
 |  | ||||||
| -		if (trace_fd == -1) {
 |  | ||||||
| -			char path[MAX_PATH];
 |  | ||||||
| -			strcpy(path, fileprefix);
 |  | ||||||
| -			if (trace_file_exists("tracing_on"))
 |  | ||||||
| -				strcat(path, "tracing_on");
 |  | ||||||
| -			else
 |  | ||||||
| -				strcat(path, "tracing_enabled");
 |  | ||||||
| -			if ((trace_fd = open(path, O_WRONLY)) == -1)
 |  | ||||||
| -				fatal("unable to open %s for tracing", path);
 |  | ||||||
| -		}
 |  | ||||||
| -
 |  | ||||||
| -		open_tracemark_fd();
 |  | ||||||
| -	} else {
 |  | ||||||
| -		setkernvar("trace_all_cpus", "1");
 |  | ||||||
| -		setkernvar("trace_freerunning", "1");
 |  | ||||||
| -		setkernvar("trace_print_on_crash", "0");
 |  | ||||||
| -		setkernvar("trace_user_triggered", "1");
 |  | ||||||
| -		setkernvar("trace_user_trigger_irq", "-1");
 |  | ||||||
| -		setkernvar("trace_verbose", "0");
 |  | ||||||
| -		setkernvar("preempt_thresh", "0");
 |  | ||||||
| -		setkernvar("wakeup_timing", "0");
 |  | ||||||
| -		setkernvar("preempt_max_latency", "0");
 |  | ||||||
| -		if (ftrace)
 |  | ||||||
| -			setkernvar("mcount_enabled", "1");
 |  | ||||||
| -		setkernvar("trace_enabled", "1");
 |  | ||||||
| -		setkernvar("latency_hist/wakeup_latency/reset", "1");
 |  | ||||||
| -	}
 |  | ||||||
| -
 |  | ||||||
| -	tracing(1);
 |  | ||||||
| -}
 |  | ||||||
| -
 |  | ||||||
|  /* |  | ||||||
|   * parse an input value as a base10 value followed by an optional |  | ||||||
|   * suffix. The input value is presumed to be in seconds, unless |  | ||||||
| @@ -987,7 +664,9 @@ static void *timerthread(void *param)
 |  | ||||||
|  	int stopped = 0; |  | ||||||
|  	cpu_set_t mask; |  | ||||||
|  	pthread_t thread; |  | ||||||
| -	unsigned long smi_now, smi_old;
 |  | ||||||
| +	unsigned long smi_now, smi_old = 0;
 |  | ||||||
| +
 |  | ||||||
| +	memset(&stop, 0, sizeof(stop));
 |  | ||||||
|   |  | ||||||
|  	/* if we're running in numa mode, set our memory node */ |  | ||||||
|  	if (par->node != -1) |  | ||||||
| @@ -1195,7 +874,6 @@ static void *timerthread(void *param)
 |  | ||||||
|  			stopped++; |  | ||||||
|  			tracemark("hit latency threshold (%llu > %d)", |  | ||||||
|  				  (unsigned long long) diff, tracelimit); |  | ||||||
| -			tracing(0);
 |  | ||||||
|  			shutdown++; |  | ||||||
|  			pthread_mutex_lock(&break_thread_id_lock); |  | ||||||
|  			if (break_thread_id == 0) |  | ||||||
| @@ -1281,18 +959,6 @@ out:
 |  | ||||||
|  /* Print usage information */ |  | ||||||
|  static void display_help(int error) |  | ||||||
|  { |  | ||||||
| -	char tracers[MAX_PATH];
 |  | ||||||
| -	char *prefix;
 |  | ||||||
| -
 |  | ||||||
| -	prefix = get_debugfileprefix();
 |  | ||||||
| -	if (prefix[0] == '\0')
 |  | ||||||
| -		strcpy(tracers, "unavailable (debugfs not mounted)");
 |  | ||||||
| -	else {
 |  | ||||||
| -		fileprefix = prefix;
 |  | ||||||
| -		if (kernvar(O_RDONLY, "available_tracers", tracers, sizeof(tracers)))
 |  | ||||||
| -			strcpy(tracers, "none");
 |  | ||||||
| -	}
 |  | ||||||
| -
 |  | ||||||
|  	printf("cyclictest V %1.2f\n", VERSION); |  | ||||||
|  	printf("Usage:\n" |  | ||||||
|  	       "cyclictest <options>\n\n" |  | ||||||
| @@ -1309,17 +975,13 @@ static void display_help(int error)
 |  | ||||||
|  #endif |  | ||||||
|  	       "-A USEC  --aligned=USEC    align thread wakeups to a specific offset\n" |  | ||||||
|  	       "-b USEC  --breaktrace=USEC send break trace command when latency > USEC\n" |  | ||||||
| -	       "-B       --preemptirqs     both preempt and irqsoff tracing (used with -b)\n"
 |  | ||||||
|  	       "-c CLOCK --clock=CLOCK     select clock\n" |  | ||||||
|  	       "                           0 = CLOCK_MONOTONIC (default)\n" |  | ||||||
|  	       "                           1 = CLOCK_REALTIME\n" |  | ||||||
| -	       "-C       --context         context switch tracing (used with -b)\n"
 |  | ||||||
|  	       "-d DIST  --distance=DIST   distance of thread intervals in us, default=500\n" |  | ||||||
|  	       "-D       --duration=TIME   specify a length for the test run.\n" |  | ||||||
|  	       "                           Append 'm', 'h', or 'd' to specify minutes, hours or days.\n" |  | ||||||
|  	       "	 --latency=PM_QOS  write PM_QOS to /dev/cpu_dma_latency\n" |  | ||||||
| -	       "-E       --event           event tracing (used with -b)\n"
 |  | ||||||
| -	       "-f       --ftrace          function trace (when -b is active)\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" |  | ||||||
| @@ -1327,7 +989,6 @@ static void display_help(int error)
 |  | ||||||
|  	       "-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" |  | ||||||
|  	       "-i INTV  --interval=INTV   base interval of thread in us default=1000\n" |  | ||||||
| -	       "-I       --irqsoff         Irqsoff tracing (used with -b)\n"
 |  | ||||||
|  	       "-l LOOPS --loops=LOOPS     number of loops: default=0(endless)\n" |  | ||||||
|  	       "	 --laptop	   Save battery when running cyclictest\n" |  | ||||||
|  	       "			   This will give you poorer realtime results\n" |  | ||||||
| @@ -1335,12 +996,9 @@ static void display_help(int error)
 |  | ||||||
|  	       "-m       --mlockall        lock current and future memory allocations\n" |  | ||||||
|  	       "-M       --refresh_on_max  delay updating the screen until a new max\n" |  | ||||||
|  	       "			   latency is hit. Userful for low bandwidth.\n" |  | ||||||
| -	       "	 --notrace	   suppress tracing\n"
 |  | ||||||
|  	       "-N       --nsecs           print results in ns instead of us (default us)\n" |  | ||||||
|  	       "-o RED   --oscope=RED      oscilloscope mode, reduce verbose output by RED\n" |  | ||||||
| -	       "-O TOPT  --traceopt=TOPT   trace option\n"
 |  | ||||||
|  	       "-p PRIO  --priority=PRIO   priority of highest prio thread\n" |  | ||||||
| -	       "-P       --preemptoff      Preempt off tracing (used with -b)\n"
 |  | ||||||
|  	       "	 --policy=NAME     policy of measurement thread, where NAME may be one\n" |  | ||||||
|  	       "                           of: other, normal, batch, idle, fifo or rr.\n" |  | ||||||
|  	       "	 --priospread      spread priority levels starting at specified value\n" |  | ||||||
| @@ -1366,8 +1024,6 @@ static void display_help(int error)
 |  | ||||||
|  	       "                           without NUM, threads = max_cpus\n" |  | ||||||
|  	       "                           without -t default = 1\n" |  | ||||||
|  	       "         --tracemark       write a trace mark when -b latency is exceeded\n" |  | ||||||
| -	       "-T TRACE --tracer=TRACER   set tracing function\n"
 |  | ||||||
| -	       "    configured tracers: %s\n"
 |  | ||||||
|  	       "-u       --unbuffered      force unbuffered output for live processing\n" |  | ||||||
|  #ifdef NUMA |  | ||||||
|  	       "-U       --numa            Standard NUMA testing (similar to SMP option)\n" |  | ||||||
| @@ -1375,11 +1031,8 @@ static void display_help(int error)
 |  | ||||||
|  #endif |  | ||||||
|  	       "-v       --verbose         output values on stdout for statistics\n" |  | ||||||
|  	       "                           format: n:c:v n=tasknum c=count v=value in us\n" |  | ||||||
| -	       "-w       --wakeup          task wakeup tracing (used with -b)\n"
 |  | ||||||
| -	       "-W       --wakeuprt        rt task wakeup tracing (used with -b)\n"
 |  | ||||||
|  	       "	 --dbg_cyclictest  print info useful for debugging cyclictest\n" |  | ||||||
| -	       "-x	 --posix_timers    use POSIX timers instead of clock_nanosleep.\n",
 |  | ||||||
| -	       tracers
 |  | ||||||
| +	       "-x	 --posix_timers    use POSIX timers instead of clock_nanosleep.\n"
 |  | ||||||
|  		); |  | ||||||
|  	if (error) |  | ||||||
|  		exit(EXIT_FAILURE); |  | ||||||
| @@ -1497,17 +1150,17 @@ static char *policyname(int policy)
 |  | ||||||
|   |  | ||||||
|   |  | ||||||
|  enum option_values { |  | ||||||
| -	OPT_AFFINITY=1, OPT_NOTRACE, OPT_BREAKTRACE, OPT_PREEMPTIRQ, OPT_CLOCK,
 |  | ||||||
| -	OPT_CONTEXT, OPT_DISTANCE, OPT_DURATION, OPT_LATENCY, OPT_EVENT,
 |  | ||||||
| -	OPT_FTRACE, OPT_FIFO, OPT_HISTOGRAM, OPT_HISTOFALL, OPT_HISTFILE,
 |  | ||||||
| -	OPT_INTERVAL, OPT_IRQSOFF, OPT_LOOPS, OPT_MLOCKALL, OPT_REFRESH,
 |  | ||||||
| -	OPT_NANOSLEEP, OPT_NSECS, OPT_OSCOPE, OPT_TRACEOPT, OPT_PRIORITY,
 |  | ||||||
| -	OPT_PREEMPTOFF, OPT_QUIET, OPT_PRIOSPREAD, OPT_RELATIVE, OPT_RESOLUTION,
 |  | ||||||
| -	OPT_SYSTEM, OPT_SMP, OPT_THREADS, OPT_TRACER, OPT_TRIGGER,
 |  | ||||||
| -	OPT_TRIGGER_NODES, OPT_UNBUFFERED, OPT_NUMA, OPT_VERBOSE, OPT_WAKEUP,
 |  | ||||||
| -	OPT_WAKEUPRT, OPT_DBGCYCLIC, OPT_POLICY, OPT_HELP, OPT_NUMOPTS,
 |  | ||||||
| -	OPT_ALIGNED, OPT_SECALIGNED, OPT_LAPTOP, OPT_SMI, OPT_TRACEMARK,
 |  | ||||||
| -	OPT_POSIX_TIMERS,
 |  | ||||||
| +	OPT_AFFINITY=1, OPT_BREAKTRACE, OPT_CLOCK,
 |  | ||||||
| +	OPT_DISTANCE, OPT_DURATION, OPT_LATENCY,
 |  | ||||||
| +	OPT_FIFO, OPT_HISTOGRAM, OPT_HISTOFALL, OPT_HISTFILE,
 |  | ||||||
| +	OPT_INTERVAL, OPT_LOOPS, OPT_MLOCKALL, OPT_REFRESH,
 |  | ||||||
| +	OPT_NANOSLEEP, OPT_NSECS, OPT_OSCOPE, OPT_PRIORITY,
 |  | ||||||
| +	OPT_QUIET, OPT_PRIOSPREAD, OPT_RELATIVE, OPT_RESOLUTION,
 |  | ||||||
| +	OPT_SYSTEM, OPT_SMP, OPT_THREADS, OPT_TRIGGER,
 |  | ||||||
| +	OPT_TRIGGER_NODES, OPT_UNBUFFERED, OPT_NUMA, OPT_VERBOSE,
 |  | ||||||
| +	OPT_DBGCYCLIC, OPT_POLICY, OPT_HELP, OPT_NUMOPTS,
 |  | ||||||
| +	OPT_ALIGNED, OPT_SECALIGNED, OPT_LAPTOP, OPT_SMI,
 |  | ||||||
| +	OPT_TRACEMARK, OPT_POSIX_TIMERS,
 |  | ||||||
|  }; |  | ||||||
|   |  | ||||||
|  /* Process commandline options */ |  | ||||||
| @@ -1524,32 +1177,24 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  		 */ |  | ||||||
|  		static struct option long_options[] = { |  | ||||||
|  			{"affinity",         optional_argument, NULL, OPT_AFFINITY}, |  | ||||||
| -			{"notrace",          no_argument,       NULL, OPT_NOTRACE },
 |  | ||||||
|  			{"aligned",          optional_argument, NULL, OPT_ALIGNED }, |  | ||||||
|  			{"breaktrace",       required_argument, NULL, OPT_BREAKTRACE }, |  | ||||||
| -			{"preemptirqs",      no_argument,       NULL, OPT_PREEMPTIRQ },
 |  | ||||||
|  			{"clock",            required_argument, NULL, OPT_CLOCK }, |  | ||||||
| -			{"context",          no_argument,       NULL, OPT_CONTEXT },
 |  | ||||||
|  			{"distance",         required_argument, NULL, OPT_DISTANCE }, |  | ||||||
|  			{"duration",         required_argument, NULL, OPT_DURATION }, |  | ||||||
|  			{"latency",          required_argument, NULL, OPT_LATENCY }, |  | ||||||
| -			{"event",            no_argument,       NULL, OPT_EVENT },
 |  | ||||||
| -			{"ftrace",           no_argument,       NULL, OPT_FTRACE },
 |  | ||||||
|  			{"fifo",             required_argument, NULL, OPT_FIFO }, |  | ||||||
|  			{"histogram",        required_argument, NULL, OPT_HISTOGRAM }, |  | ||||||
|  			{"histofall",        required_argument, NULL, OPT_HISTOFALL }, |  | ||||||
|  			{"histfile",	     required_argument, NULL, OPT_HISTFILE }, |  | ||||||
|  			{"interval",         required_argument, NULL, OPT_INTERVAL }, |  | ||||||
| -			{"irqsoff",          no_argument,       NULL, OPT_IRQSOFF },
 |  | ||||||
|  			{"laptop",	     no_argument,	NULL, OPT_LAPTOP }, |  | ||||||
|  			{"loops",            required_argument, NULL, OPT_LOOPS }, |  | ||||||
|  			{"mlockall",         no_argument,       NULL, OPT_MLOCKALL }, |  | ||||||
|  			{"refresh_on_max",   no_argument,       NULL, OPT_REFRESH }, |  | ||||||
|  			{"nsecs",            no_argument,       NULL, OPT_NSECS }, |  | ||||||
|  			{"oscope",           required_argument, NULL, OPT_OSCOPE }, |  | ||||||
| -			{"traceopt",         required_argument, NULL, OPT_TRACEOPT },
 |  | ||||||
|  			{"priority",         required_argument, NULL, OPT_PRIORITY }, |  | ||||||
| -			{"preemptoff",       no_argument,       NULL, OPT_PREEMPTOFF },
 |  | ||||||
|  			{"quiet",            no_argument,       NULL, OPT_QUIET }, |  | ||||||
|  			{"priospread",       no_argument,       NULL, OPT_PRIOSPREAD }, |  | ||||||
|  			{"relative",         no_argument,       NULL, OPT_RELATIVE }, |  | ||||||
| @@ -1561,20 +1206,16 @@ 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 },
 |  | ||||||
| -			{"tracer",           required_argument, NULL, OPT_TRACER },
 |  | ||||||
|  			{"unbuffered",       no_argument,       NULL, OPT_UNBUFFERED }, |  | ||||||
|  			{"numa",             no_argument,       NULL, OPT_NUMA }, |  | ||||||
|  			{"verbose",          no_argument,       NULL, OPT_VERBOSE }, |  | ||||||
| -			{"wakeup",           no_argument,       NULL, OPT_WAKEUP },
 |  | ||||||
| -			{"wakeuprt",         no_argument,       NULL, OPT_WAKEUPRT },
 |  | ||||||
|  			{"dbg_cyclictest",   no_argument,       NULL, OPT_DBGCYCLIC }, |  | ||||||
|  			{"policy",           required_argument, NULL, OPT_POLICY }, |  | ||||||
|  			{"help",             no_argument,       NULL, OPT_HELP }, |  | ||||||
|  			{"posix_timers",     no_argument,	NULL, OPT_POSIX_TIMERS }, |  | ||||||
| -			{NULL, 0, NULL, 0}
 |  | ||||||
| +			{NULL, 0, NULL, 0 },
 |  | ||||||
|  		}; |  | ||||||
| -		int c = getopt_long(argc, argv, "a::A::b:Bc:Cd:D:Efh:H:i:Il:MNo:O:p:PmqrRsSt::uUvD:wWT:x",
 |  | ||||||
| +		int c = getopt_long(argc, argv, "a::A::b:c:d:D:h:H:i:l:MNo:p:mqrRsSt::uUvD:x",
 |  | ||||||
|  				    long_options, &option_index); |  | ||||||
|  		if (c == -1) |  | ||||||
|  			break; |  | ||||||
| @@ -1607,15 +1248,10 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  		case 'b': |  | ||||||
|  		case OPT_BREAKTRACE: |  | ||||||
|  			tracelimit = atoi(optarg); break; |  | ||||||
| -		case 'B':
 |  | ||||||
| -		case OPT_PREEMPTIRQ:
 |  | ||||||
| -			tracetype = PREEMPTIRQSOFF; break;
 |  | ||||||
|  		case 'c': |  | ||||||
|  		case OPT_CLOCK: |  | ||||||
|  			clocksel = atoi(optarg); break; |  | ||||||
|  		case 'C': |  | ||||||
| -		case OPT_CONTEXT:
 |  | ||||||
| -			tracetype = CTXTSWITCH; break;
 |  | ||||||
|  		case 'd': |  | ||||||
|  		case OPT_DISTANCE: |  | ||||||
|  			distance = atoi(optarg); break; |  | ||||||
| @@ -1623,17 +1259,11 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  		case OPT_DURATION: |  | ||||||
|  			duration = parse_time_string(optarg); break; |  | ||||||
|  		case 'E': |  | ||||||
| -		case OPT_EVENT:
 |  | ||||||
| -			enable_events = 1; break;
 |  | ||||||
| -		case 'f':
 |  | ||||||
| -		case OPT_FTRACE:
 |  | ||||||
| -			tracetype = FUNCTION; ftrace = 1; break;
 |  | ||||||
|  		case 'F': |  | ||||||
|  		case OPT_FIFO: |  | ||||||
|  			use_fifo = 1; |  | ||||||
|  			strncpy(fifopath, optarg, strlen(optarg)); |  | ||||||
|  			break; |  | ||||||
| -
 |  | ||||||
|  		case 'H': |  | ||||||
|  		case OPT_HISTOFALL: |  | ||||||
|  			histofall = 1; /* fall through */ |  | ||||||
| @@ -1647,16 +1277,6 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  		case 'i': |  | ||||||
|  		case OPT_INTERVAL: |  | ||||||
|  			interval = atoi(optarg); break; |  | ||||||
| -		case 'I':
 |  | ||||||
| -		case OPT_IRQSOFF:
 |  | ||||||
| -			if (tracetype == PREEMPTOFF) {
 |  | ||||||
| -				tracetype = PREEMPTIRQSOFF;
 |  | ||||||
| -				strncpy(tracer, "preemptirqsoff", sizeof(tracer));
 |  | ||||||
| -			} else {
 |  | ||||||
| -				tracetype = IRQSOFF;
 |  | ||||||
| -				strncpy(tracer, "irqsoff", sizeof(tracer));
 |  | ||||||
| -			}
 |  | ||||||
| -			break;
 |  | ||||||
|  		case 'l': |  | ||||||
|  		case OPT_LOOPS: |  | ||||||
|  			max_cycles = atoi(optarg); break; |  | ||||||
| @@ -1672,25 +1292,12 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  		case 'o': |  | ||||||
|  		case OPT_OSCOPE: |  | ||||||
|  			oscope_reduction = atoi(optarg); break; |  | ||||||
| -		case 'O':
 |  | ||||||
| -		case OPT_TRACEOPT:
 |  | ||||||
| -			traceopt(optarg); break;
 |  | ||||||
|  		case 'p': |  | ||||||
|  		case OPT_PRIORITY: |  | ||||||
|  			priority = atoi(optarg); |  | ||||||
|  			if (policy != SCHED_FIFO && policy != SCHED_RR) |  | ||||||
|  				policy = SCHED_FIFO; |  | ||||||
|  			break; |  | ||||||
| -		case 'P':
 |  | ||||||
| -		case OPT_PREEMPTOFF:
 |  | ||||||
| -			if (tracetype == IRQSOFF) {
 |  | ||||||
| -				tracetype = PREEMPTIRQSOFF;
 |  | ||||||
| -				strncpy(tracer, "preemptirqsoff", sizeof(tracer));
 |  | ||||||
| -			} else {
 |  | ||||||
| -				tracetype = PREEMPTOFF;
 |  | ||||||
| -				strncpy(tracer, "preemptoff", sizeof(tracer));
 |  | ||||||
| -			}
 |  | ||||||
| -			break;
 |  | ||||||
|  		case 'q': |  | ||||||
|  		case OPT_QUIET: |  | ||||||
|  			quiet = 1; break; |  | ||||||
| @@ -1740,11 +1347,6 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  			if (trigger) |  | ||||||
|  				trigger_list_size = atoi(optarg); |  | ||||||
|  			break; |  | ||||||
| -		case 'T':
 |  | ||||||
| -		case OPT_TRACER:
 |  | ||||||
| -			tracetype = CUSTOM;
 |  | ||||||
| -			strncpy(tracer, optarg, sizeof(tracer));
 |  | ||||||
| -			break;
 |  | ||||||
|  		case 'u': |  | ||||||
|  		case OPT_UNBUFFERED: |  | ||||||
|  			setvbuf(stdout, NULL, _IONBF, 0); break; |  | ||||||
| @@ -1764,12 +1366,6 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  			break; |  | ||||||
|  		case 'v': |  | ||||||
|  		case OPT_VERBOSE: verbose = 1; break; |  | ||||||
| -		case 'w':
 |  | ||||||
| -		case OPT_WAKEUP:
 |  | ||||||
| -			tracetype = WAKEUP; break;
 |  | ||||||
| -		case 'W':
 |  | ||||||
| -		case OPT_WAKEUPRT:
 |  | ||||||
| -			tracetype = WAKEUPRT; break;
 |  | ||||||
|  		case 'x': |  | ||||||
|  		case OPT_POSIX_TIMERS: |  | ||||||
|  			use_nanosleep = MODE_CYCLIC; break; |  | ||||||
| @@ -1787,8 +1383,6 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  			if (latency_target_value < 0) |  | ||||||
|  				latency_target_value = 0; |  | ||||||
|  			break; |  | ||||||
| -		case OPT_NOTRACE:
 |  | ||||||
| -			notrace = 1; break;
 |  | ||||||
|  		case OPT_POLICY: |  | ||||||
|  			handlepolicy(optarg); break; |  | ||||||
|  		case OPT_DBGCYCLIC: |  | ||||||
| @@ -1802,9 +1396,6 @@ 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:
 |  | ||||||
| -			notrace = 1; /* using --tracemark implies --notrace */
 |  | ||||||
| -			trace_marker = 1; break;
 |  | ||||||
|  		} |  | ||||||
|  	} |  | ||||||
|   |  | ||||||
| @@ -1887,43 +1478,6 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  	} |  | ||||||
|  } |  | ||||||
|   |  | ||||||
| -static int check_kernel(void)
 |  | ||||||
| -{
 |  | ||||||
| -	struct utsname kname;
 |  | ||||||
| -	int maj, min, sub, kv, ret;
 |  | ||||||
| -
 |  | ||||||
| -	ret = uname(&kname);
 |  | ||||||
| -	if (ret) {
 |  | ||||||
| -		fprintf(stderr, "uname failed: %s. Assuming not 2.6\n",
 |  | ||||||
| -				strerror(errno));
 |  | ||||||
| -		return KV_NOT_SUPPORTED;
 |  | ||||||
| -	}
 |  | ||||||
| -	sscanf(kname.release, "%d.%d.%d", &maj, &min, &sub);
 |  | ||||||
| -	if (maj == 2 && min == 6) {
 |  | ||||||
| -		if (sub < 18)
 |  | ||||||
| -			kv = KV_26_LT18;
 |  | ||||||
| -		else if (sub < 24)
 |  | ||||||
| -			kv = KV_26_LT24;
 |  | ||||||
| -		else if (sub < 28) {
 |  | ||||||
| -			kv = KV_26_33;
 |  | ||||||
| -			strcpy(functiontracer, "ftrace");
 |  | ||||||
| -			strcpy(traceroptions, "iter_ctrl");
 |  | ||||||
| -		} else {
 |  | ||||||
| -			kv = KV_26_33;
 |  | ||||||
| -			strcpy(functiontracer, "function");
 |  | ||||||
| -			strcpy(traceroptions, "trace_options");
 |  | ||||||
| -		}
 |  | ||||||
| -	} else if (maj >= 3) {
 |  | ||||||
| -		kv = KV_30;
 |  | ||||||
| -		strcpy(functiontracer, "function");
 |  | ||||||
| -		strcpy(traceroptions, "trace_options");
 |  | ||||||
| -
 |  | ||||||
| -	} else
 |  | ||||||
| -		kv = KV_NOT_SUPPORTED;
 |  | ||||||
| -
 |  | ||||||
| -	return kv;
 |  | ||||||
| -}
 |  | ||||||
| -
 |  | ||||||
|  static int check_timer(void) |  | ||||||
|  { |  | ||||||
|  	struct timespec ts; |  | ||||||
| @@ -1952,8 +1506,6 @@ static void sighand(int sig)
 |  | ||||||
|  	shutdown = 1; |  | ||||||
|  	if (refresh_on_max) |  | ||||||
|  		pthread_cond_signal(&refresh_on_max_cond); |  | ||||||
| -	if (tracelimit)
 |  | ||||||
| -		tracing(0);
 |  | ||||||
|  } |  | ||||||
|   |  | ||||||
|  static void print_tids(struct thread_param *par[], int nthreads) |  | ||||||
| @@ -2240,14 +1792,8 @@ int main(int argc, char **argv)
 |  | ||||||
|  	/* use the /dev/cpu_dma_latency trick if it's there */ |  | ||||||
|  	set_latency_target(); |  | ||||||
|   |  | ||||||
| -	kernelversion = check_kernel();
 |  | ||||||
| -
 |  | ||||||
| -	if (kernelversion == KV_NOT_SUPPORTED)
 |  | ||||||
| -		warn("Running on unknown kernel version...YMMV\n");
 |  | ||||||
| -
 |  | ||||||
| -	setup_tracer();
 |  | ||||||
| -
 |  | ||||||
| -	enable_trace_mark();
 |  | ||||||
| +	if (tracelimit)
 |  | ||||||
| +		enable_trace_mark();
 |  | ||||||
|   |  | ||||||
|  	if (check_timer()) |  | ||||||
|  		warn("High resolution timers not available\n"); |  | ||||||
| @@ -2597,35 +2143,16 @@ int main(int argc, char **argv)
 |  | ||||||
|  		threadfree(parameters[i], sizeof(struct thread_param), parameters[i]->node); |  | ||||||
|  	} |  | ||||||
|   out: |  | ||||||
| -	/* ensure that the tracer is stopped */
 |  | ||||||
| -	if (tracelimit)
 |  | ||||||
| -		tracing(0);
 |  | ||||||
| -
 |  | ||||||
| -
 |  | ||||||
|  	/* close any tracer file descriptors */ |  | ||||||
|  	if (tracemark_fd >= 0) |  | ||||||
|  		close(tracemark_fd); |  | ||||||
|  	if (trace_fd >= 0) |  | ||||||
|  		close(trace_fd); |  | ||||||
|   |  | ||||||
| -	if (enable_events)
 |  | ||||||
| -		/* turn off all events */
 |  | ||||||
| -		event_disable_all();
 |  | ||||||
| -
 |  | ||||||
| -	/* turn off the function tracer */
 |  | ||||||
| -	fileprefix = procfileprefix;
 |  | ||||||
| -	if (tracetype && !notrace)
 |  | ||||||
| -		setkernvar("ftrace_enabled", "0");
 |  | ||||||
| -	fileprefix = get_debugfileprefix();
 |  | ||||||
| -
 |  | ||||||
|  	/* unlock everything */ |  | ||||||
|  	if (lockall) |  | ||||||
|  		munlockall(); |  | ||||||
|   |  | ||||||
| -	/* Be a nice program, cleanup */
 |  | ||||||
| -	if (kernelversion < KV_26_33)
 |  | ||||||
| -		restorekernvars();
 |  | ||||||
| -
 |  | ||||||
|  	/* close the latency_target_fd if it's open */ |  | ||||||
|  	if (latency_target_fd >= 0) |  | ||||||
|  		close(latency_target_fd); |  | ||||||
| -- 
 |  | ||||||
| 2.14.3 |  | ||||||
| 
 |  | ||||||
| @ -0,0 +1,42 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
| @ -1,77 +0,0 @@ | |||||||
| From ef49ccfab821010319d4ff6b1332fa890889aeac Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Clark Williams <williams@redhat.com> |  | ||||||
| Date: Mon, 6 May 2019 14:40:46 -0500 |  | ||||||
| Subject: [PATCH 1/2] hwlatdetect: disable/enable c-state transitions during |  | ||||||
|  detection |  | ||||||
| 
 |  | ||||||
| Recent performance tuning problems led me to realize that just running |  | ||||||
| at fifo:99 and turning off interrupts isn't enough while looking for |  | ||||||
| BIOS induced latencies. Power savings logic is built into most modern |  | ||||||
| cpus and so must be disabled while looking for BIOS induced (SMI/NMI) |  | ||||||
| latencies. |  | ||||||
| 
 |  | ||||||
| Use the /dev/cpu_dma_latency mechanism to disable c-state transitions |  | ||||||
| while running the hardware latency detector. Open the file |  | ||||||
| /dev/cpu_dma_latency and write a 32-bit zero to it, which will prevent |  | ||||||
| c-state transitions while the file is open. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Clark Williams <williams@redhat.com> |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/hwlatdetect/hwlatdetect.py | 20 +++++++++++++++++++- |  | ||||||
|  1 file changed, 19 insertions(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py
 |  | ||||||
| index 2c8f9f160419..368079a158b1 100755
 |  | ||||||
| --- a/src/hwlatdetect/hwlatdetect.py
 |  | ||||||
| +++ b/src/hwlatdetect/hwlatdetect.py
 |  | ||||||
| @@ -1,6 +1,6 @@
 |  | ||||||
|  #!/usr/bin/python3 |  | ||||||
|   |  | ||||||
| -# (C) 2018 Clark Williams <williams@redhat.com>
 |  | ||||||
| +# (C) 2018,2019 Clark Williams <williams@redhat.com>
 |  | ||||||
|  # (C) 2015,2016 Clark Williams <williams@redhat.com> |  | ||||||
|  # (C) 2009 Clark Williams <williams@redhat.com> |  | ||||||
|  # |  | ||||||
| @@ -213,6 +213,22 @@ class Detector(object):
 |  | ||||||
|              counts = [ int(x.strip()) for x in p.stdout.readlines()] |  | ||||||
|          return counts |  | ||||||
|   |  | ||||||
| +    # methods for preventing/enabling c-state transitions
 |  | ||||||
| +    # openinging /dev/cpu_dma_latency and writeing a 32-bit zero to that file will prevent
 |  | ||||||
| +    # c-state transitions while the file descriptor is open.
 |  | ||||||
| +    # use c_states_off() to disable c-state transitions
 |  | ||||||
| +    # use c_states_on() to close the file descriptor and re-enable c-states
 |  | ||||||
| +    #
 |  | ||||||
| +    def c_states_off(self):
 |  | ||||||
| +        self.dma_latency_handle = os.open("/dev/cpu_dma_latency", os.O_WRONLY)
 |  | ||||||
| +        os.write(self.dma_latency_handle, b'\x00\x00\x00\x00')
 |  | ||||||
| +        debug("c-states disabled")
 |  | ||||||
| +
 |  | ||||||
| +    def c_states_on(self):
 |  | ||||||
| +        if self.dma_latency_handle:
 |  | ||||||
| +            os.close(self.dma_latency_handle)
 |  | ||||||
| +        debug("c-states enabled")
 |  | ||||||
| +
 |  | ||||||
|      def cleanup(self): |  | ||||||
|          raise RuntimeError("must override base method 'cleanup'!") |  | ||||||
|   |  | ||||||
| @@ -235,6 +251,7 @@ class Detector(object):
 |  | ||||||
|      def start(self): |  | ||||||
|          count = 0 |  | ||||||
|          threshold = int(self.get("threshold")) |  | ||||||
| +        self.c_states_off()
 |  | ||||||
|          debug("enabling detector module (threshold: %d)" % threshold) |  | ||||||
|          self.set("enable", 1) |  | ||||||
|          while self.get("enable") == 0: |  | ||||||
| @@ -258,6 +275,7 @@ class Detector(object):
 |  | ||||||
|              time.sleep(0.1) |  | ||||||
|              debug("retrying disable of detector module(%d)" % count) |  | ||||||
|              self.set("enable", 0) |  | ||||||
| +        self.c_states_on()
 |  | ||||||
|          debug("detector module disabled") |  | ||||||
|   |  | ||||||
|      def detect(self): |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
							
								
								
									
										50
									
								
								SOURCES/pmqtest-Increase-buffer-to-avoid-overflow.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								SOURCES/pmqtest-Increase-buffer-to-avoid-overflow.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,50 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
| @ -1,115 +0,0 @@ | |||||||
| From 59c7b5e334940fff29ea49aa722d1c43c88a436b Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Tue, 7 May 2019 15:26:38 +0200 |  | ||||||
| Subject: [PATCH 1/2] queuelat: Assume queuelat and queuelat scripts are in the |  | ||||||
|  path |  | ||||||
| 
 |  | ||||||
| Assume queuelat and queuelat scripts are in the path. Don't hardcode |  | ||||||
| their location. |  | ||||||
| 
 |  | ||||||
| Write the temporary data to /usr/tmp/outfile |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/queuelat/determine_maximum_mpps.sh | 35 +++++++++++++------------- |  | ||||||
|  1 file changed, 17 insertions(+), 18 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/queuelat/determine_maximum_mpps.sh b/src/queuelat/determine_maximum_mpps.sh
 |  | ||||||
| index cf7a8cab9cc4..cd45454720f7 100755
 |  | ||||||
| --- a/src/queuelat/determine_maximum_mpps.sh
 |  | ||||||
| +++ b/src/queuelat/determine_maximum_mpps.sh
 |  | ||||||
| @@ -8,6 +8,7 @@
 |  | ||||||
|  PREAMBLE="taskset -c 2 chrt -f 1" |  | ||||||
|  MAXLAT="20000" |  | ||||||
|  CYCLES_PER_PACKET="300" |  | ||||||
| +OUTFILE=/usr/tmp/outfile
 |  | ||||||
|   |  | ||||||
|  echo "Determining maximum mpps the machine can handle" |  | ||||||
|  echo "Will take a few minutes to determine mpps value" |  | ||||||
| @@ -16,10 +17,10 @@ echo "And 10 minutes run to confirm the final mpps value is stable"
 |  | ||||||
|  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
 |  | ||||||
| +	OUTFILE=`mktemp`
 |  | ||||||
| +	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p $mpps -t 30 > $OUTFILE
 |  | ||||||
|   |  | ||||||
| -	exceeded=`grep exceeded $outfile`
 |  | ||||||
| +	exceeded=`grep exceeded $OUTFILE`
 |  | ||||||
|  	if [ ! -z "$exceeded" ]; then |  | ||||||
|  		echo mpps failed: $mpps |  | ||||||
|  		break; |  | ||||||
| @@ -32,10 +33,10 @@ first_mpps=$(($mpps - 1))
 |  | ||||||
|  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
 |  | ||||||
| +	OUTFILE=`mktemp`
 |  | ||||||
| +	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p $mpps -t 30 > $OUTFILE
 |  | ||||||
|   |  | ||||||
| -	exceeded=`grep exceeded $outfile`
 |  | ||||||
| +	exceeded=`grep exceeded $OUTFILE`
 |  | ||||||
|  	if [ -z "$exceeded" ]; then |  | ||||||
|  		echo mpps success $mpps |  | ||||||
|  		break; |  | ||||||
| @@ -49,10 +50,10 @@ echo second loop mpps: $mpps
 |  | ||||||
|  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
 |  | ||||||
| +	OUTFILE=`mktemp`
 |  | ||||||
| +	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p $mpps -t 30 > $OUTFILE
 |  | ||||||
|   |  | ||||||
| -	exceeded=`grep exceeded $outfile`
 |  | ||||||
| +	exceeded=`grep exceeded $OUTFILE`
 |  | ||||||
|  	if [ ! -z "$exceeded" ]; then |  | ||||||
|  		echo mpps failure $mpps |  | ||||||
|  		break; |  | ||||||
| @@ -66,10 +67,10 @@ third_mpps=`echo "$mpps -0.1" | bc`
 |  | ||||||
|  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
 |  | ||||||
| +	OUTFILE=`mktemp`
 |  | ||||||
| +	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p $mpps -t 30 > $OUTFILE
 |  | ||||||
|   |  | ||||||
| -	exceeded=`grep exceeded $outfile`
 |  | ||||||
| +	exceeded=`grep exceeded $OUTFILE`
 |  | ||||||
|  	if [ -z "$exceeded" ]; then |  | ||||||
|  		echo mpps success $mpps |  | ||||||
|  		break; |  | ||||||
| @@ -86,8 +87,8 @@ 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
 |  | ||||||
| -		exceeded=`grep exceeded $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" |  | ||||||
| @@ -108,8 +109,8 @@ 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
 |  | ||||||
| -	exceeded=`grep exceeded $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 |  | ||||||
|  		echo "mpps failure (run $i) $mpps" |  | ||||||
| @@ -124,5 +125,3 @@ echo Final mpps is: $mpps
 |  | ||||||
|   |  | ||||||
|  unset queuelat_failure |  | ||||||
|  unset mpps |  | ||||||
| -
 |  | ||||||
| -
 |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
| @ -1,29 +0,0 @@ | |||||||
| From 38e7eb899ffbf23773f8c396c7195e6af0dad099 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Tue, 7 May 2019 15:47:55 +0200 |  | ||||||
| Subject: [PATCH 2/2] queuelat: Install queuelat helper scripts from the |  | ||||||
|  rt-tests Makefile |  | ||||||
| 
 |  | ||||||
| Install queuelat helper scripts from the rt-tests Makefile |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  Makefile | 2 ++ |  | ||||||
|  1 file changed, 2 insertions(+) |  | ||||||
| 
 |  | ||||||
| diff --git a/Makefile b/Makefile
 |  | ||||||
| index 16cd2f9bdd03..ea80923918f7 100644
 |  | ||||||
| --- a/Makefile
 |  | ||||||
| +++ b/Makefile
 |  | ||||||
| @@ -180,6 +180,8 @@ install: all install_hwlatdetect
 |  | ||||||
|  	mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(mandir)/man4" |  | ||||||
|  	mkdir -p "$(DESTDIR)$(srcdir)" "$(DESTDIR)$(mandir)/man8" |  | ||||||
|  	cp $(TARGETS) "$(DESTDIR)$(bindir)" |  | ||||||
| +	install src/queuelat/get_cpuinfo_mhz.sh "$(DESTDIR)$(bindir)"
 |  | ||||||
| +	install src/queuelat/determine_maximum_mpps.sh "${DESTDIR}${bindir}"
 |  | ||||||
|  	gzip -c src/cyclictest/cyclictest.8 >"$(DESTDIR)$(mandir)/man8/cyclictest.8.gz" |  | ||||||
|  	gzip -c src/pi_tests/pi_stress.8 >"$(DESTDIR)$(mandir)/man8/pi_stress.8.gz" |  | ||||||
|  	gzip -c src/ptsematest/ptsematest.8 >"$(DESTDIR)$(mandir)/man8/ptsematest.8.gz" |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
| @ -1,31 +0,0 @@ | |||||||
| From 5c7ee5d6a0444f785a96811b88e604954a1f1ef4 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Marcelo Tosatti <mtosatti@redhat.com> |  | ||||||
| Date: Mon, 7 Jan 2019 15:35:56 -0200 |  | ||||||
| Subject: [PATCH] queuelat: use mfence for rdtsc ordering |  | ||||||
| 
 |  | ||||||
| cpuid is causing register corruption: use mfence instead. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> |  | ||||||
| 
 |  | ||||||
| v2: fix signed-off-by line |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/queuelat/queuelat.c | 2 +- |  | ||||||
|  1 file changed, 1 insertion(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/queuelat/queuelat.c b/src/queuelat/queuelat.c
 |  | ||||||
| index 2230d04bf391..3b291f168768 100644
 |  | ||||||
| --- a/src/queuelat/queuelat.c
 |  | ||||||
| +++ b/src/queuelat/queuelat.c
 |  | ||||||
| @@ -265,7 +265,7 @@ static inline unsigned long long __rdtscll(void)
 |  | ||||||
|  { |  | ||||||
|          DECLARE_ARGS(val, low, high); |  | ||||||
|   |  | ||||||
| -        asm volatile("cpuid; rdtsc" : EAX_EDX_RET(val, low, high));
 |  | ||||||
| +        asm volatile("mfence; rdtsc" : EAX_EDX_RET(val, low, high));
 |  | ||||||
|   |  | ||||||
|          return EAX_EDX_VAL(val, low, high); |  | ||||||
|  } |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
							
								
								
									
										701
									
								
								SOURCES/rt-tests-Add-SPDX-tags.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										701
									
								
								SOURCES/rt-tests-Add-SPDX-tags.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,701 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
| @ -1,29 +0,0 @@ | |||||||
| From 026f2a31c505b244bbb4a811ba5329225e3f66f1 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Wed, 13 Jun 2018 01:53:11 +0200 |  | ||||||
| Subject: [PATCH] rt-tests: Makefile: Change syntax for python3 |  | ||||||
| 
 |  | ||||||
| When testing for the PYLIB version, we need to explicitly |  | ||||||
| specify python3 and fix the print syntax |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  Makefile | 2 +- |  | ||||||
|  1 file changed, 1 insertion(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/Makefile b/Makefile
 |  | ||||||
| index cffb255d96d1..8b08385890fe 100644
 |  | ||||||
| --- a/Makefile
 |  | ||||||
| +++ b/Makefile
 |  | ||||||
| @@ -33,7 +33,7 @@ CFLAGS ?= -Wall -Wno-nonnull
 |  | ||||||
|  CPPFLAGS += -D_GNU_SOURCE -Isrc/include |  | ||||||
|  LDFLAGS ?= |  | ||||||
|   |  | ||||||
| -PYLIB  ?= $(shell python -c 'import distutils.sysconfig;  print distutils.sysconfig.get_python_lib()')
 |  | ||||||
| +PYLIB  ?= $(shell python3 -c 'import distutils.sysconfig;  print (distutils.sysconfig.get_python_lib())')
 |  | ||||||
|   |  | ||||||
|  ifndef DEBUG |  | ||||||
|  	CFLAGS	+= -O2 -g |  | ||||||
| -- 
 |  | ||||||
| 2.14.4 |  | ||||||
| 
 |  | ||||||
| @ -1,48 +0,0 @@ | |||||||
| From 524aebc39039e0035a768b423ad66c4d03098a35 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Mon, 14 Jan 2019 21:39:47 +0100 |  | ||||||
| Subject: [PATCH 2/5] rt-tests: Makefile: ssdd: Incoroporate ssdd into the |  | ||||||
|  rt-tests Makefile |  | ||||||
| 
 |  | ||||||
| Incoroporate ssdd into the rt-tests build |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  Makefile | 7 ++++++- |  | ||||||
|  1 file changed, 6 insertions(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/Makefile b/Makefile
 |  | ||||||
| index 06f399cc629d..16cd2f9bdd03 100644
 |  | ||||||
| --- a/Makefile
 |  | ||||||
| +++ b/Makefile
 |  | ||||||
| @@ -16,7 +16,8 @@ sources = cyclictest.c \
 |  | ||||||
|  	  svsematest.c  \ |  | ||||||
|  	  cyclicdeadline.c \ |  | ||||||
|  	  deadline_test.c \ |  | ||||||
| -	  queuelat.c 
 |  | ||||||
| +	  queuelat.c \
 |  | ||||||
| +	  ssdd.c
 |  | ||||||
|   |  | ||||||
|  TARGETS = $(sources:.c=) |  | ||||||
|  LIBS	= -lrt -lpthread |  | ||||||
| @@ -86,6 +87,7 @@ VPATH	+= src/lib:
 |  | ||||||
|  VPATH	+= src/hackbench: |  | ||||||
|  VPATH	+= src/sched_deadline: |  | ||||||
|  VPATH	+= src/queuelat:	 |  | ||||||
| +VPATH	+= src/ssdd:
 |  | ||||||
|   |  | ||||||
|  $(OBJDIR)/%.o: %.c | $(OBJDIR) |  | ||||||
|  	$(CC) -D VERSION=$(VERSION) -c $< $(CFLAGS) $(CPPFLAGS) -o $@ |  | ||||||
| @@ -146,6 +148,9 @@ hackbench: $(OBJDIR)/hackbench.o
 |  | ||||||
|  queuelat: $(OBJDIR)/queuelat.o $(OBJDIR)/librttest.a |  | ||||||
|  	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) |  | ||||||
|   |  | ||||||
| +ssdd: $(OBJDIR)/ssdd.o $(OBJDIR)/librttest.a
 |  | ||||||
| +	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB)
 |  | ||||||
| +
 |  | ||||||
|  LIBOBJS =$(addprefix $(OBJDIR)/,error.o rt-get_cpu.o rt-sched.o rt-utils.o) |  | ||||||
|  $(OBJDIR)/librttest.a: $(LIBOBJS) |  | ||||||
|  	$(AR) rcs $@ $^ |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
| @ -1,64 +0,0 @@ | |||||||
| From 1b68647387067fea4779a1c80d4155be2187ed21 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Mon, 8 Oct 2018 15:11:43 +0200 |  | ||||||
| Subject: [PATCH] rt-tests: Remove install and build of backfire and sendme |  | ||||||
| 
 |  | ||||||
| Leave the source code in place but remove the install and build of |  | ||||||
| backfire and sendme for now as it is broken |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  Makefile | 9 --------- |  | ||||||
|  1 file changed, 9 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/Makefile b/Makefile
 |  | ||||||
| index 5447ca9de108..26dd96f0c5fd 100644
 |  | ||||||
| --- a/Makefile
 |  | ||||||
| +++ b/Makefile
 |  | ||||||
| @@ -11,7 +11,6 @@ sources = cyclictest.c \
 |  | ||||||
|  	  pmqtest.c \ |  | ||||||
|  	  ptsematest.c \ |  | ||||||
|  	  rt-migrate-test.c \ |  | ||||||
| -	  sendme.c \
 |  | ||||||
|  	  signaltest.c \ |  | ||||||
|  	  sigwaittest.c \ |  | ||||||
|  	  svsematest.c  \ |  | ||||||
| @@ -83,7 +82,6 @@ VPATH	+= src/ptsematest:
 |  | ||||||
|  VPATH	+= src/sigwaittest: |  | ||||||
|  VPATH	+= src/svsematest: |  | ||||||
|  VPATH	+= src/pmqtest: |  | ||||||
| -VPATH	+= src/backfire:
 |  | ||||||
|  VPATH	+= src/lib: |  | ||||||
|  VPATH	+= src/hackbench: |  | ||||||
|  VPATH	+= src/sched_deadline: |  | ||||||
| @@ -139,9 +137,6 @@ svsematest: $(OBJDIR)/svsematest.o $(OBJDIR)/librttest.a
 |  | ||||||
|  pmqtest: $(OBJDIR)/pmqtest.o $(OBJDIR)/librttest.a |  | ||||||
|  	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(EXTRA_LIBS) |  | ||||||
|   |  | ||||||
| -sendme: $(OBJDIR)/sendme.o $(OBJDIR)/librttest.a
 |  | ||||||
| -	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(EXTRA_LIBS)
 |  | ||||||
| -
 |  | ||||||
|  pip_stress: $(OBJDIR)/pip_stress.o $(OBJDIR)/librttest.a |  | ||||||
|  	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) |  | ||||||
|   |  | ||||||
| @@ -180,9 +175,6 @@ install: all install_hwlatdetect
 |  | ||||||
|  	mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(mandir)/man4" |  | ||||||
|  	mkdir -p "$(DESTDIR)$(srcdir)" "$(DESTDIR)$(mandir)/man8" |  | ||||||
|  	cp $(TARGETS) "$(DESTDIR)$(bindir)" |  | ||||||
| -	install -D -m 644 src/backfire/backfire.c "$(DESTDIR)$(srcdir)/backfire/backfire.c"
 |  | ||||||
| -	install -m 644 src/backfire/Makefile "$(DESTDIR)$(srcdir)/backfire/Makefile"
 |  | ||||||
| -	gzip -c src/backfire/backfire.4 >"$(DESTDIR)$(mandir)/man4/backfire.4.gz"
 |  | ||||||
|  	gzip -c src/cyclictest/cyclictest.8 >"$(DESTDIR)$(mandir)/man8/cyclictest.8.gz" |  | ||||||
|  	gzip -c src/pi_tests/pi_stress.8 >"$(DESTDIR)$(mandir)/man8/pi_stress.8.gz" |  | ||||||
|  	gzip -c src/ptsematest/ptsematest.8 >"$(DESTDIR)$(mandir)/man8/ptsematest.8.gz" |  | ||||||
| @@ -190,7 +182,6 @@ install: all install_hwlatdetect
 |  | ||||||
|  	gzip -c src/sigwaittest/sigwaittest.8 >"$(DESTDIR)$(mandir)/man8/sigwaittest.8.gz" |  | ||||||
|  	gzip -c src/svsematest/svsematest.8 >"$(DESTDIR)$(mandir)/man8/svsematest.8.gz" |  | ||||||
|  	gzip -c src/pmqtest/pmqtest.8 >"$(DESTDIR)$(mandir)/man8/pmqtest.8.gz" |  | ||||||
| -	gzip -c src/backfire/sendme.8 >"$(DESTDIR)$(mandir)/man8/sendme.8.gz"
 |  | ||||||
|  	gzip -c src/hackbench/hackbench.8 >"$(DESTDIR)$(mandir)/man8/hackbench.8.gz" |  | ||||||
|  	gzip -c src/signaltest/signaltest.8 >"$(DESTDIR)$(mandir)/man8/signaltest.8.gz" |  | ||||||
|  	gzip -c src/pi_tests/pip_stress.8 >"$(DESTDIR)$(mandir)/man8/pip_stress.8.gz" |  | ||||||
| -- 
 |  | ||||||
| 2.14.4 |  | ||||||
| 
 |  | ||||||
							
								
								
									
										110
									
								
								SOURCES/rt-tests-Set-affinity-before-applying-numa.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								SOURCES/rt-tests-Set-affinity-before-applying-numa.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,110 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,32 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,42 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,33 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
							
								
								
									
										294
									
								
								SOURCES/rt-tests-cyclictest-Get-a-snapshot-of-cyclictest.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										294
									
								
								SOURCES/rt-tests-cyclictest-Get-a-snapshot-of-cyclictest.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,294 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
							
								
								
									
										151
									
								
								SOURCES/rt-tests-cyclictest-Just-use-LIBNUMA_API_VERSION-2.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										151
									
								
								SOURCES/rt-tests-cyclictest-Just-use-LIBNUMA_API_VERSION-2.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,151 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,68 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
| @ -1,85 +0,0 @@ | |||||||
| From 7ea837b01d7e75e403a935bb40b11824f8568d4a Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Mon, 5 Nov 2018 15:11:31 +0100 |  | ||||||
| Subject: [PATCH] rt-tests: cyclictest: Remove numa from help |  | ||||||
| 
 |  | ||||||
| The numa mode is invoked automatically now, and not from the commandline. |  | ||||||
| Remove it from help and the man page as well. |  | ||||||
| Clean-up messages to refer to "numa" or "numa" mode instead of "--numa" |  | ||||||
| 
 |  | ||||||
| Even though --smp can still be invoked, change messages to "smp mode" |  | ||||||
| for consistency. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/cyclictest/cyclictest.8 |  3 --- |  | ||||||
|  src/cyclictest/cyclictest.c | 10 +++------- |  | ||||||
|  src/cyclictest/rt_numa.h    |  2 +- |  | ||||||
|  3 files changed, 4 insertions(+), 11 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/cyclictest/cyclictest.8 b/src/cyclictest/cyclictest.8
 |  | ||||||
| index 36edacc3209f..a05d1f4c9d4a 100644
 |  | ||||||
| --- a/src/cyclictest/cyclictest.8
 |  | ||||||
| +++ b/src/cyclictest/cyclictest.8
 |  | ||||||
| @@ -185,9 +185,6 @@ of the trace functions available from <debugfs-mountpoint>/kernel/debug/tracing/
 |  | ||||||
|  .B \-u, \-\-unbuffered |  | ||||||
|  force unbuffered output for live processing |  | ||||||
|  .TP |  | ||||||
| -.B \-U, --numa
 |  | ||||||
| -Standard NUMA testing (similar to SMP option) thread data structures allocated from local node.
 |  | ||||||
| -.TP
 |  | ||||||
|  .B \-v, \-\-verbose |  | ||||||
|  Output values on stdout for statistics. This option is used to gather statistical information about the latency distribution. The output is sent to stdout. The output format is: |  | ||||||
|   |  | ||||||
| diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
 |  | ||||||
| index 8bba9fc63ee3..188a202c5171 100644
 |  | ||||||
| --- a/src/cyclictest/cyclictest.c
 |  | ||||||
| +++ b/src/cyclictest/cyclictest.c
 |  | ||||||
| @@ -1025,10 +1025,6 @@ static void display_help(int error)
 |  | ||||||
|  	       "                           without -t default = 1\n" |  | ||||||
|  	       "         --tracemark       write a trace mark when -b latency is exceeded\n" |  | ||||||
|  	       "-u       --unbuffered      force unbuffered output for live processing\n" |  | ||||||
| -#ifdef NUMA
 |  | ||||||
| -	       "-U       --numa            Standard NUMA testing (similar to SMP option)\n"
 |  | ||||||
| -	       "                           thread data structures allocated from local node\n"
 |  | ||||||
| -#endif
 |  | ||||||
|  	       "-v       --verbose         output values on stdout for statistics\n" |  | ||||||
|  	       "                           format: n:c:v n=tasknum c=count v=value in us\n" |  | ||||||
|  	       "	 --dbg_cyclictest  print info useful for debugging cyclictest\n" |  | ||||||
| @@ -1329,7 +1325,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|  		case 't': |  | ||||||
|  		case OPT_THREADS: |  | ||||||
|  			if (smp) { |  | ||||||
| -				warn("-t ignored due to --smp\n");
 |  | ||||||
| +				warn("-t ignored due to smp mode\n");
 |  | ||||||
|  				break; |  | ||||||
|  			} |  | ||||||
|  			if (optarg != NULL) |  | ||||||
| @@ -1399,9 +1395,9 @@ static void process_options (int argc, char *argv[], int max_cpus)
 |  | ||||||
|   |  | ||||||
|  	if (option_affinity) { |  | ||||||
|  		if (smp) { |  | ||||||
| -			warn("-a ignored due to --smp\n");
 |  | ||||||
| +			warn("-a ignored due to smp mode\n");
 |  | ||||||
|  		} else if (numa) { |  | ||||||
| -			warn("-a ignored due to --numa\n");
 |  | ||||||
| +			warn("-a ignored due to numa mode\n");
 |  | ||||||
|  		} |  | ||||||
|  	} |  | ||||||
|   |  | ||||||
| diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
 |  | ||||||
| index 3970e681fe7b..e8cd7f481baa 100644
 |  | ||||||
| --- a/src/cyclictest/rt_numa.h
 |  | ||||||
| +++ b/src/cyclictest/rt_numa.h
 |  | ||||||
| @@ -253,7 +253,7 @@ static inline void rt_bitmask_free(struct bitmask *mask)
 |  | ||||||
|  static void numa_on_and_available() |  | ||||||
|  { |  | ||||||
|  	if (numa) /* NUMA is not defined here */ |  | ||||||
| -		fatal("--numa specified and numa functions not available.\n");
 |  | ||||||
| +		fatal("numa mode and numa functions not available.\n");
 |  | ||||||
|  } |  | ||||||
|   |  | ||||||
|  #endif	/* NUMA */ |  | ||||||
| -- 
 |  | ||||||
| 2.14.5 |  | ||||||
| 
 |  | ||||||
| @ -0,0 +1,117 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
| @ -1,30 +0,0 @@ | |||||||
| From ed58e7ad038f11a8e5f194fb9314ebc791e21b99 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Thu, 15 Nov 2018 13:00:06 +0100 |  | ||||||
| Subject: [PATCH] rt-tests: deadline_test: Add NULL check before freeing |  | ||||||
|  setcpu_buf |  | ||||||
| 
 |  | ||||||
| setcpu_buf doesn't always call malloc, so NULL check it before freeing |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/sched_deadline/deadline_test.c | 4 +++- |  | ||||||
|  1 file changed, 3 insertions(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
 |  | ||||||
| index 2a63c5f91639..b213c206559c 100644
 |  | ||||||
| --- a/src/sched_deadline/deadline_test.c
 |  | ||||||
| +++ b/src/sched_deadline/deadline_test.c
 |  | ||||||
| @@ -2092,6 +2092,8 @@ int main (int argc, char **argv)
 |  | ||||||
|  		printf("\n"); |  | ||||||
|  	} |  | ||||||
|   |  | ||||||
| -	free(setcpu_buf);
 |  | ||||||
| +	if (!setcpu_buf)
 |  | ||||||
| +		free(setcpu_buf);
 |  | ||||||
| +
 |  | ||||||
|  	return 0; |  | ||||||
|  } |  | ||||||
| -- 
 |  | ||||||
| 2.14.5 |  | ||||||
| 
 |  | ||||||
| @ -1,101 +0,0 @@ | |||||||
| From 803c33cfe83a8e215bdb4f393f90d1e175f78318 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Fri, 2 Nov 2018 16:16:45 +0100 |  | ||||||
| Subject: [PATCH] rt-tests: deadline_test: Add a manpage |  | ||||||
| 
 |  | ||||||
| Add an initial manpage for deadline_test. |  | ||||||
| Modify the Makefile to install it too. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  Makefile                           |  1 + |  | ||||||
|  src/sched_deadline/deadline_test.8 | 65 ++++++++++++++++++++++++++++++++++++++ |  | ||||||
|  2 files changed, 66 insertions(+) |  | ||||||
|  create mode 100644 src/sched_deadline/deadline_test.8 |  | ||||||
| 
 |  | ||||||
| diff --git a/Makefile b/Makefile
 |  | ||||||
| index 26dd96f0c5fd..06f399cc629d 100644
 |  | ||||||
| --- a/Makefile
 |  | ||||||
| +++ b/Makefile
 |  | ||||||
| @@ -186,6 +186,7 @@ install: all install_hwlatdetect
 |  | ||||||
|  	gzip -c src/signaltest/signaltest.8 >"$(DESTDIR)$(mandir)/man8/signaltest.8.gz" |  | ||||||
|  	gzip -c src/pi_tests/pip_stress.8 >"$(DESTDIR)$(mandir)/man8/pip_stress.8.gz" |  | ||||||
|  	gzip -c src/queuelat/queuelat.8 >"$(DESTDIR)$(mandir)/man8/queuelat.8.gz" |  | ||||||
| +	gzip -c src/sched_deadline/deadline_test.8 >"$(DESTDIR)$(mandir)/man8/deadline_test.8.gz"
 |  | ||||||
|   |  | ||||||
|  .PHONY: install_hwlatdetect |  | ||||||
|  install_hwlatdetect: hwlatdetect |  | ||||||
| diff --git a/src/sched_deadline/deadline_test.8 b/src/sched_deadline/deadline_test.8
 |  | ||||||
| new file mode 100644 |  | ||||||
| index 000000000000..5dc99c0bfc63
 |  | ||||||
| --- /dev/null
 |  | ||||||
| +++ b/src/sched_deadline/deadline_test.8
 |  | ||||||
| @@ -0,0 +1,65 @@
 |  | ||||||
| +.\"                                      Hey, EMACS: -*- nroff -*-
 |  | ||||||
| +.TH DEADLINE_TEST 8 "November 1, 2018"
 |  | ||||||
| +.\" Please adjust this date whenever revising the manpage.
 |  | ||||||
| +.\"
 |  | ||||||
| +.\" Some roff macros, for reference:
 |  | ||||||
| +.\" .nh        disable hyphenation
 |  | ||||||
| +.\" .hy        enable hyphenation
 |  | ||||||
| +.\" .ad l      left justify
 |  | ||||||
| +.\" .ad b      justify to both left and right margins
 |  | ||||||
| +.\" .nf        disable filling
 |  | ||||||
| +.\" .fi        enable filling
 |  | ||||||
| +.\" .br        insert line break
 |  | ||||||
| +.\" .sp <n>    insert n+1 empty lines
 |  | ||||||
| +.\" for manpage-specific macros, see man(7)
 |  | ||||||
| +.SH NAME
 |  | ||||||
| +deadline_test \- High resolution test program
 |  | ||||||
| +.SH DESCRIPTION
 |  | ||||||
| +.PP
 |  | ||||||
| +This program is used to test the deadline scheduler (SCHED_DEADLINE tasks)
 |  | ||||||
| +.SH SYNOPSIS
 |  | ||||||
| +.B deadline_test
 |  | ||||||
| +.RI "[ \-hb ] [ \-r prio ] [ \-c cpulist ] [ \-i interval ] [ \-p percent ] [ \-P percent ] [ \-t threads ] [ \-s step[us) ]"
 |  | ||||||
| +
 |  | ||||||
| +.SH OPTIONS
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-h
 |  | ||||||
| +Show this help menu
 |  | ||||||
| +.br
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-b
 |  | ||||||
| +Bind on the last cpu. (shortcut for -c <lastcpu>)
 |  | ||||||
| +.br
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-r prio
 |  | ||||||
| +Add an RT task with given prio to stress system
 |  | ||||||
| +.br
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-c cpulist
 |  | ||||||
| +Comma/hyphen separated list of CPUs to run deadline tasks on
 |  | ||||||
| +.br
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-i interval
 |  | ||||||
| +The shortest deadline for the tasks
 |  | ||||||
| +.br
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-p percent
 |  | ||||||
| +The percent of bandwidth to use (1-90%)
 |  | ||||||
| +.br
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-P percent
 |  | ||||||
| +The percent of runtime for execution completion
 |  | ||||||
| +              (Default 100%)
 |  | ||||||
| +.br
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-t threads
 |  | ||||||
| +The number of threads to run as deadline (default 1)
 |  | ||||||
| +.br
 |  | ||||||
| +.TP
 |  | ||||||
| +.B \-s step(us)
 |  | ||||||
| +The amount to increase the deadline for each task (default 500us)
 |  | ||||||
| +.br
 |  | ||||||
| +.SH AUTHOR
 |  | ||||||
| +Deadline test was written by Steven Rostedt <rostedt@goodmis.org>
 |  | ||||||
| +.PP
 |  | ||||||
| +This manual page was written by John Kacur <jkacur@redhat.com>
 |  | ||||||
| -- 
 |  | ||||||
| 2.14.5 |  | ||||||
| 
 |  | ||||||
| @ -1,97 +0,0 @@ | |||||||
| From bbf4d5adf23fa2b81a1cdb92c40c3451376ac672 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Fri, 10 May 2019 15:58:39 +0200 |  | ||||||
| Subject: [PATCH 2/2] rt-tests: hwlatdetect.py: Code clean-up |  | ||||||
| 
 |  | ||||||
| - Remove obsolete from __future__
 |  | ||||||
| - Fix spacing around calls to print, open and brackets
 |  | ||||||
| - Fix spacing around assignments
 |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/hwlatdetect/hwlatdetect.py | 18 +++++++++--------- |  | ||||||
|  1 file changed, 9 insertions(+), 9 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py
 |  | ||||||
| index 368079a158b1..b72bdc3aa930 100755
 |  | ||||||
| --- a/src/hwlatdetect/hwlatdetect.py
 |  | ||||||
| +++ b/src/hwlatdetect/hwlatdetect.py
 |  | ||||||
| @@ -8,7 +8,7 @@
 |  | ||||||
|  # modify it under the terms of the GNU General Public License Version 2 |  | ||||||
|  # as published by the Free Software Foundation. |  | ||||||
|   |  | ||||||
| -from __future__ import print_function
 |  | ||||||
| +
 |  | ||||||
|   |  | ||||||
|  import sys |  | ||||||
|  import os |  | ||||||
| @@ -84,7 +84,7 @@ class DebugFS(object):
 |  | ||||||
|              try: |  | ||||||
|                  val = f.readline() |  | ||||||
|              except OSError as e: |  | ||||||
| -                print ("errno: %s" % e)
 |  | ||||||
| +                print("errno: %s" % e)
 |  | ||||||
|                  if e.errno == errno.EAGAIN: |  | ||||||
|                      val = None |  | ||||||
|                  else: |  | ||||||
| @@ -159,7 +159,7 @@ class Kmod(object):
 |  | ||||||
|              return |  | ||||||
|   |  | ||||||
|          # now look for already loaded module |  | ||||||
| -        for l in open ('/proc/modules'):
 |  | ||||||
| +        for l in open('/proc/modules'):
 |  | ||||||
|              field = l.split() |  | ||||||
|              if self.name in field[0]: |  | ||||||
|                  self.preloaded = True |  | ||||||
| @@ -210,7 +210,7 @@ class Detector(object):
 |  | ||||||
|          if self.have_msr: |  | ||||||
|              p = subprocess.Popen(['/usr/sbin/rdmsr', '-a', '-d', '0x34'], stdout=subprocess.PIPE) |  | ||||||
|              p.wait() |  | ||||||
| -            counts = [ int(x.strip()) for x in p.stdout.readlines()]
 |  | ||||||
| +            counts = [int(x.strip()) for x in p.stdout.readlines()]
 |  | ||||||
|          return counts |  | ||||||
|   |  | ||||||
|      # methods for preventing/enabling c-state transitions |  | ||||||
| @@ -295,11 +295,11 @@ class Tracer(Detector):
 |  | ||||||
|   |  | ||||||
|      class Sample(object): |  | ||||||
|          'private class for tracer sample data' |  | ||||||
| -        __slots__= 'timestamp', 'inner', 'outer',
 |  | ||||||
| +        __slots__ = 'timestamp', 'inner', 'outer',
 |  | ||||||
|          def __init__(self, line): |  | ||||||
|              fields = line.split() |  | ||||||
|              i,o = fields[6].split('/') |  | ||||||
| -            ts=fields[7][3:]
 |  | ||||||
| +            ts = fields[7][3:]
 |  | ||||||
|              self.timestamp = str(ts) |  | ||||||
|              self.inner = int(i) |  | ||||||
|              self.outer = int(o) |  | ||||||
| @@ -332,14 +332,14 @@ class Tracer(Detector):
 |  | ||||||
|          self.set('current_tracer', 'hwlat') |  | ||||||
|   |  | ||||||
|      def set(self, field, val): |  | ||||||
| -        path=self.translate(field)
 |  | ||||||
| +        path = self.translate(field)
 |  | ||||||
|          self.debugfs.putval(path, str(val)) |  | ||||||
|   |  | ||||||
|      def get(self, field): |  | ||||||
|          if field == "count": |  | ||||||
|              return len(self.samples) |  | ||||||
|          elif field == "max": |  | ||||||
| -            max=0
 |  | ||||||
| +            max = 0
 |  | ||||||
|              for values in self.samples: |  | ||||||
|                  s = int(values.largest()) |  | ||||||
|                  if s > max: |  | ||||||
| @@ -435,7 +435,7 @@ class Hwlat(Detector):
 |  | ||||||
|   |  | ||||||
|      def display(self): |  | ||||||
|          for s in self.samples: |  | ||||||
| -            print (s)
 |  | ||||||
| +            print(s)
 |  | ||||||
|   |  | ||||||
|      def save(self, output=None): |  | ||||||
|          if output: |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
| @ -1,30 +0,0 @@ | |||||||
| From 77be335d8b09afa662eb0965b9b18a6105fa9dcc Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Tue, 18 Sep 2018 02:30:00 +0200 |  | ||||||
| Subject: [PATCH] rt-tests: manpages: Modify makefile for queuelat.8 and |  | ||||||
|  pip_stress.8 |  | ||||||
| 
 |  | ||||||
| Modify the manpage to include queuelat.8 and pip_stress.8 for the |  | ||||||
| install |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  Makefile | 2 ++ |  | ||||||
|  1 file changed, 2 insertions(+) |  | ||||||
| 
 |  | ||||||
| diff --git a/Makefile b/Makefile
 |  | ||||||
| index 8b08385890fe..5447ca9de108 100644
 |  | ||||||
| --- a/Makefile
 |  | ||||||
| +++ b/Makefile
 |  | ||||||
| @@ -193,6 +193,8 @@ install: all install_hwlatdetect
 |  | ||||||
|  	gzip -c src/backfire/sendme.8 >"$(DESTDIR)$(mandir)/man8/sendme.8.gz" |  | ||||||
|  	gzip -c src/hackbench/hackbench.8 >"$(DESTDIR)$(mandir)/man8/hackbench.8.gz" |  | ||||||
|  	gzip -c src/signaltest/signaltest.8 >"$(DESTDIR)$(mandir)/man8/signaltest.8.gz" |  | ||||||
| +	gzip -c src/pi_tests/pip_stress.8 >"$(DESTDIR)$(mandir)/man8/pip_stress.8.gz"
 |  | ||||||
| +	gzip -c src/queuelat/queuelat.8 >"$(DESTDIR)$(mandir)/man8/queuelat.8.gz"
 |  | ||||||
|   |  | ||||||
|  .PHONY: install_hwlatdetect |  | ||||||
|  install_hwlatdetect: hwlatdetect |  | ||||||
| -- 
 |  | ||||||
| 2.14.4 |  | ||||||
| 
 |  | ||||||
| @ -1,32 +0,0 @@ | |||||||
| From 4b58d4277496b5ad61b66cbc6fb4aea91ceec6dd Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Juri Lelli <juri.lelli@redhat.com> |  | ||||||
| Date: Fri, 14 Sep 2018 12:04:48 +0200 |  | ||||||
| Subject: [PATCH 1/5] rt-tests: pi_stress: remove unused report option from |  | ||||||
|  help |  | ||||||
| 
 |  | ||||||
| Command line --report option is not actually implemented (even if |  | ||||||
| advertised on --help). |  | ||||||
| 
 |  | ||||||
| Remove it from the help banner. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Juri Lelli <juri.lelli@redhat.com> |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/pi_tests/pi_stress.c | 1 - |  | ||||||
|  1 file changed, 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
 |  | ||||||
| index 36b64ca1672c..ac7646cd2613 100644
 |  | ||||||
| --- a/src/pi_tests/pi_stress.c
 |  | ||||||
| +++ b/src/pi_tests/pi_stress.c
 |  | ||||||
| @@ -1032,7 +1032,6 @@ void usage(void)
 |  | ||||||
|  	       ngroups); |  | ||||||
|  	printf |  | ||||||
|  	    ("\t--inversions=<n>- number of inversions per group [infinite]\n"); |  | ||||||
| -	printf("\t--report=<path>\t- output to file [/dev/null]\n");
 |  | ||||||
|  	printf("\t--rr\t\t- use SCHED_RR for test threads [SCHED_FIFO]\n"); |  | ||||||
|  	printf("\t--sched\t\t- scheduling options per thread type:\n"); |  | ||||||
|  	printf("\t\tid=[high|med|low]\t\t\t- select thread\n"); |  | ||||||
| -- 
 |  | ||||||
| 2.14.4 |  | ||||||
| 
 |  | ||||||
| @ -1,70 +0,0 @@ | |||||||
| From 2342d8be62a510569f8cbc9fe41574b6bc370073 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Mon, 17 Sep 2018 23:13:53 +0200 |  | ||||||
| Subject: [PATCH 3/5] rt-tests: pip_stress: Add an initial man page for |  | ||||||
|  pip_stress |  | ||||||
| 
 |  | ||||||
| This adds a man page for pip_stress |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/pi_tests/pip_stress.8 | 47 +++++++++++++++++++++++++++++++++++++++++++++++ |  | ||||||
|  1 file changed, 47 insertions(+) |  | ||||||
|  create mode 100644 src/pi_tests/pip_stress.8 |  | ||||||
| 
 |  | ||||||
| diff --git a/src/pi_tests/pip_stress.8 b/src/pi_tests/pip_stress.8
 |  | ||||||
| new file mode 100644 |  | ||||||
| index 000000000000..1808330b2e17
 |  | ||||||
| --- /dev/null
 |  | ||||||
| +++ b/src/pi_tests/pip_stress.8
 |  | ||||||
| @@ -0,0 +1,47 @@
 |  | ||||||
| +.\"
 |  | ||||||
| +.TH PIP\ STRESS 8 "September 17, 2018"
 |  | ||||||
| +.SH NAME
 |  | ||||||
| +.B pip_stress \- Priority Inheritance with processes
 |  | ||||||
| +.SH SYNOPSIS
 |  | ||||||
| +.B pip_stress
 |  | ||||||
| +
 |  | ||||||
| +.SH DESCRIPTION
 |  | ||||||
| +This program demonstrates the technique of using priority inheritance (PI)
 |  | ||||||
| +mutexes with processes instead of threads.
 |  | ||||||
| +The way to do this is to obtain some shared memory - in this case with
 |  | ||||||
| +mmap that backs a pthread_mutex_t since this will support PI.
 |  | ||||||
| +Pay particular attention to how this is intialized to support processes.
 |  | ||||||
| +Function init_shared_pthread_mutex() does this by setting the
 |  | ||||||
| +pthread_mutexattr to PTHREAD_PROCESS_SHARED and the mutex protocol to
 |  | ||||||
| +PTHREAD_PRIO_INHERIT.
 |  | ||||||
| +In this program we purposely try to invoke a classic priority inversion.
 |  | ||||||
| +A low priority process grabs the mutex and does some work.
 |  | ||||||
| +A high priority process comes a long and is blocked since the mutex is taken.
 |  | ||||||
| +A medium priority process that doesn't require the mutex then takes the
 |  | ||||||
| +processor. Because the processes are restricted to one cpu, the low priority
 |  | ||||||
| +processes never makes any progress because the medium priority process
 |  | ||||||
| +runs in an infinite loop. This is a priority inversion because the
 |  | ||||||
| +medium priority process is running at the expensive of the high priority
 |  | ||||||
| +process. However, since we have used PRIO_INHERIT and are running on a
 |  | ||||||
| +machine that supports preemption, the high priority process will lend it's
 |  | ||||||
| +priority to the low priority process which will preempt the medium priority
 |  | ||||||
| +process. The low priority process will then release the mutex which the
 |  | ||||||
| +high priority process can obtain. When the high priority process gets to run
 |  | ||||||
| +it kills the medium priority process.
 |  | ||||||
| +The state structure keeps track of the progress. Although this program
 |  | ||||||
| +is set up to likely trigger an inversion, there is no guarantee that
 |  | ||||||
| +scheduling will make that happen. After the program completes it reports
 |  | ||||||
| +whether a priority inversion occurred or not. In either case this program
 |  | ||||||
| +demonstrates how to use priority inheritance mutexes with processes.
 |  | ||||||
| +In fact, you would be better off to avoid scenarios in which a priority
 |  | ||||||
| +inversion occurs if possible - this program tries to trigger them just
 |  | ||||||
| +to show that it works. If you are having difficulty triggering an inversion,
 |  | ||||||
| +merely increase the time that the low priority process sleeps while
 |  | ||||||
| +holding the lock. (usleep);
 |  | ||||||
| +Also note that you have to run as a user with permission to change
 |  | ||||||
| +scheduling priorities.
 |  | ||||||
| +.BR
 |  | ||||||
| +.SH AUTHOR
 |  | ||||||
| +pip_stress was written by John Kacur <jkacur at redhat.com>
 |  | ||||||
| +.PP
 |  | ||||||
| +This manual page was also written by John Kacur
 |  | ||||||
| -- 
 |  | ||||||
| 2.14.4 |  | ||||||
| 
 |  | ||||||
| @ -0,0 +1,86 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
| @ -1,65 +0,0 @@ | |||||||
| From e86709cd38349514dddbef0bf2b43c1d459797d3 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: John Kacur <jkacur@redhat.com> |  | ||||||
| Date: Fri, 14 Jun 2019 15:03:26 +0200 |  | ||||||
| Subject: [PATCH] rt-tests: ssdd: Add a simple manpage for ssdd |  | ||||||
| 
 |  | ||||||
| Add a simple manpage to rt-tests for ssdd, and modify the manpage to |  | ||||||
| install it |  | ||||||
| 
 |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  Makefile        |  1 + |  | ||||||
|  src/ssdd/ssdd.8 | 29 +++++++++++++++++++++++++++++ |  | ||||||
|  2 files changed, 30 insertions(+) |  | ||||||
|  create mode 100644 src/ssdd/ssdd.8 |  | ||||||
| 
 |  | ||||||
| diff --git a/Makefile b/Makefile
 |  | ||||||
| index ea80923918f7..0258fe9b6dfd 100644
 |  | ||||||
| --- a/Makefile
 |  | ||||||
| +++ b/Makefile
 |  | ||||||
| @@ -194,6 +194,7 @@ install: all install_hwlatdetect
 |  | ||||||
|  	gzip -c src/pi_tests/pip_stress.8 >"$(DESTDIR)$(mandir)/man8/pip_stress.8.gz" |  | ||||||
|  	gzip -c src/queuelat/queuelat.8 >"$(DESTDIR)$(mandir)/man8/queuelat.8.gz" |  | ||||||
|  	gzip -c src/sched_deadline/deadline_test.8 >"$(DESTDIR)$(mandir)/man8/deadline_test.8.gz" |  | ||||||
| +	gzip -c src/ssdd/ssdd.8 >"$(DESTDIR)$(mandir)/man8/ssdd.8.gz"
 |  | ||||||
|   |  | ||||||
|  .PHONY: install_hwlatdetect |  | ||||||
|  install_hwlatdetect: hwlatdetect |  | ||||||
| diff --git a/src/ssdd/ssdd.8 b/src/ssdd/ssdd.8
 |  | ||||||
| new file mode 100644 |  | ||||||
| index 000000000000..44638489f0d1
 |  | ||||||
| --- /dev/null
 |  | ||||||
| +++ b/src/ssdd/ssdd.8
 |  | ||||||
| @@ -0,0 +1,29 @@
 |  | ||||||
| +.TH SSDD 8 "June 13, 2019"
 |  | ||||||
| +.SH NAME
 |  | ||||||
| +ssdd \- have a tracer do a bunch of PTRACE_SINGLESTEPs
 |  | ||||||
| +.SH SYNOPSIS
 |  | ||||||
| +.B ssdd
 |  | ||||||
| +.RI "[nforks] [niters]"
 |  | ||||||
| +.SH DESCRIPTION
 |  | ||||||
| +Have a tracer do a bunch of PTRACE_SINGLESTEPs against
 |  | ||||||
| +a tracee as fast as possible.  Create several of these
 |  | ||||||
| +tracer/tracee pairs and see if they can be made to
 |  | ||||||
| +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
 |  | ||||||
| +number of tracer/tracee pairs to fork off.
 |  | ||||||
| +Default is 10.
 |  | ||||||
| +.br
 |  | ||||||
| +.TP
 |  | ||||||
| +.B niters
 |  | ||||||
| +number of PTRACE_SINGLESTEP iterations to
 |  | ||||||
| +do before declaring success, for each tracer/
 |  | ||||||
| +tracee pair set up. Default is 10,000.
 |  | ||||||
| +
 |  | ||||||
| +.SH AUTHOR
 |  | ||||||
| +ssdd was written by Joe Korty <joe.korty@concurrent-rt.com>
 |  | ||||||
| +.PP
 |  | ||||||
| +This manual page was written by John Kacur <jkacur@redhat.com>
 |  | ||||||
| +
 |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
| @ -0,0 +1,123 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
							
								
								
									
										39
									
								
								SOURCES/sigwaittest-Increase-buffer-to-avoid-overflow.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								SOURCES/sigwaittest-Increase-buffer-to-avoid-overflow.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,39 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
| @ -1,48 +0,0 @@ | |||||||
| From 153c8171e07d88260b4d40fc7894eca220bbee5b Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> |  | ||||||
| Date: Tue, 15 Jan 2019 11:32:26 +0100 |  | ||||||
| Subject: [PATCH 5/5] ssdd: change the written pid |  | ||||||
| 
 |  | ||||||
| During debugging it turned out to be helpful to see the parent pid |  | ||||||
| and mostly the two tasks interact with each other: the tracer and |  | ||||||
| tracee. |  | ||||||
| Add this information it can searched for it. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/ssdd/ssdd.c | 4 +++- |  | ||||||
|  1 file changed, 3 insertions(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
 |  | ||||||
| index 68a426266dd9..4e293586526e 100644
 |  | ||||||
| --- a/src/ssdd/ssdd.c
 |  | ||||||
| +++ b/src/ssdd/ssdd.c
 |  | ||||||
| @@ -144,7 +144,6 @@ static int forktests(int testid)
 |  | ||||||
|  	struct sigaction act, oact; |  | ||||||
|   |  | ||||||
|  	parent = getpid(); |  | ||||||
| -	printf("forktest#%d/%d: STARTING\n", testid, parent);
 |  | ||||||
|   |  | ||||||
|  	child = fork(); |  | ||||||
|  	if (child == -1) { |  | ||||||
| @@ -155,6 +154,8 @@ static int forktests(int testid)
 |  | ||||||
|  	if (!child) |  | ||||||
|  		child_process(); |  | ||||||
|   |  | ||||||
| +	printf("forktest#%d/%d/%d: STARTING\n", testid, parent, child);
 |  | ||||||
| +
 |  | ||||||
|  	act.sa_sigaction = sigchld; |  | ||||||
|  	sigemptyset(&act.sa_mask); |  | ||||||
|  	act.sa_flags = SA_SIGINFO; |  | ||||||
| @@ -275,6 +276,7 @@ int main(int argc, char **argv)
 |  | ||||||
|  		if (argc) |  | ||||||
|  			nsteps = atoi(*argv); |  | ||||||
|  	} |  | ||||||
| +	printf("#main : %d\n", getpid());
 |  | ||||||
|  	printf("#forks: %d\n", nforks); |  | ||||||
|  	printf("#steps: %d\n", nsteps); |  | ||||||
|  	printf("\n"); |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
| @ -1,61 +0,0 @@ | |||||||
| From c3521e2c81e99078e7d32c43ddbd2287c67ff859 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> |  | ||||||
| Date: Tue, 15 Jan 2019 11:32:24 +0100 |  | ||||||
| Subject: [PATCH 3/5] ssdd: make every function static |  | ||||||
| 
 |  | ||||||
| Those functions and variables are not used outside of main so they can |  | ||||||
| be static. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/ssdd/ssdd.c | 12 ++++++------ |  | ||||||
|  1 file changed, 6 insertions(+), 6 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
 |  | ||||||
| index 6d09d54e34e1..9b85dfa9d223 100644
 |  | ||||||
| --- a/src/ssdd/ssdd.c
 |  | ||||||
| +++ b/src/ssdd/ssdd.c
 |  | ||||||
| @@ -37,7 +37,7 @@
 |  | ||||||
|  #define STATE_EXITED_TSIG	6	/* exited with termination signal */ |  | ||||||
|  #define STATE_EXITED_ERRSTAT	7	/* exited with non-zero status */ |  | ||||||
|   |  | ||||||
| -char *state_name[] = {
 |  | ||||||
| +static char *state_name[] = {
 |  | ||||||
|  	[STATE_EXITED] = "STATE_EXITED", |  | ||||||
|  	[STATE_STOPPED] = "STATE_STOPPED", |  | ||||||
|  	[STATE_SIGNALED] = "STATE_SIGNALED", |  | ||||||
| @@ -47,7 +47,7 @@ char *state_name[] = {
 |  | ||||||
|  	[STATE_EXITED_ERRSTAT] = "STATE_EXITED_ERRSTAT" |  | ||||||
|  }; |  | ||||||
|   |  | ||||||
| -const char *get_state_name(int state)
 |  | ||||||
| +static const char *get_state_name(int state)
 |  | ||||||
|  { |  | ||||||
|  	if (state < STATE_EXITED || state > STATE_EXITED_ERRSTAT) |  | ||||||
|  		return "?"; |  | ||||||
| @@ -100,7 +100,7 @@ static int do_wait(pid_t *wait_pid, int *ret_sig)
 |  | ||||||
|  	return STATE_UNKNOWN; |  | ||||||
|  } |  | ||||||
|   |  | ||||||
| -int check_sigchld(void)
 |  | ||||||
| +static int check_sigchld(void)
 |  | ||||||
|  { |  | ||||||
|  	int i; |  | ||||||
|  	/* |  | ||||||
| @@ -121,9 +121,9 @@ int check_sigchld(void)
 |  | ||||||
|  	return got_sigchld; |  | ||||||
|  } |  | ||||||
|   |  | ||||||
| -pid_t parent;
 |  | ||||||
| -int nforks = 10;
 |  | ||||||
| -int nsteps = 10000;
 |  | ||||||
| +static pid_t parent;
 |  | ||||||
| +static int nforks = 10;
 |  | ||||||
| +static int nsteps = 10000;
 |  | ||||||
|   |  | ||||||
|  static void sigchld(int sig, unused siginfo_t * info, unused void *arg) |  | ||||||
|  { |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
| @ -1,53 +0,0 @@ | |||||||
| From b9f812a0c49584d82c37582c7523a5808628b985 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> |  | ||||||
| Date: Tue, 15 Jan 2019 11:32:25 +0100 |  | ||||||
| Subject: [PATCH 4/5] ssdd: remove sleeps |  | ||||||
| MIME-Version: 1.0 |  | ||||||
| Content-Type: text/plain; charset=UTF-8 |  | ||||||
| Content-Transfer-Encoding: 8bit |  | ||||||
| 
 |  | ||||||
| There two sleep functions which ensure that the forked function sleeps |  | ||||||
| and does not spin until everything is setup. There is no need for that, |  | ||||||
| the scheduler will take care of that anyway. Also that sleep may |  | ||||||
| complete before or after the testcase starts. If it completes afterwards |  | ||||||
| then the testcase waits to start so… |  | ||||||
| 
 |  | ||||||
| Remove the sleep, it does change the outcome of the testcase. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> |  | ||||||
| Signed-off-by: John Kacur <jkacur@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  src/ssdd/ssdd.c | 9 +-------- |  | ||||||
|  1 file changed, 1 insertion(+), 8 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
 |  | ||||||
| index 9b85dfa9d223..68a426266dd9 100644
 |  | ||||||
| --- a/src/ssdd/ssdd.c
 |  | ||||||
| +++ b/src/ssdd/ssdd.c
 |  | ||||||
| @@ -132,12 +132,8 @@ static void sigchld(int sig, unused siginfo_t * info, unused void *arg)
 |  | ||||||
|   |  | ||||||
|  static void child_process(void) |  | ||||||
|  { |  | ||||||
| -	unused volatile int i;
 |  | ||||||
| -
 |  | ||||||
| -	/* wait for ptrace attach */
 |  | ||||||
| -	usleep(100000);
 |  | ||||||
|  	while (1) |  | ||||||
| -		i = 0;
 |  | ||||||
| +		;
 |  | ||||||
|  } |  | ||||||
|   |  | ||||||
|  static int forktests(int testid) |  | ||||||
| @@ -170,9 +166,6 @@ static int forktests(int testid)
 |  | ||||||
|  		exit(1); |  | ||||||
|  	} |  | ||||||
|   |  | ||||||
| -	/* give both our child and parent time to set things up */
 |  | ||||||
| -	usleep(125000);
 |  | ||||||
| -
 |  | ||||||
|  	/* |  | ||||||
|  	 * Attach to the child. |  | ||||||
|  	 */ |  | ||||||
| -- 
 |  | ||||||
| 2.20.1 |  | ||||||
| 
 |  | ||||||
							
								
								
									
										39
									
								
								SOURCES/svsematest-Increase-buffer-to-avoid-overflow.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								SOURCES/svsematest-Increase-buffer-to-avoid-overflow.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,39 @@ | |||||||
|  | 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 | ||||||
|  | 
 | ||||||
| @ -5,45 +5,36 @@ Name: rt-tests | |||||||
| # BuildRequires: numactl-devel | # BuildRequires: numactl-devel | ||||||
| # Numa argument to make:  NUMA=1 | # Numa argument to make:  NUMA=1 | ||||||
| # | # | ||||||
| Version: 1.3 | Version: 1.5 | ||||||
| Release: 20%{?dist} | Release: 15%{?dist} | ||||||
| License: GPLv2 | License: GPLv2 | ||||||
| Group: Development/Tools | Group: Development/Tools | ||||||
| URL: git://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git | URL: git://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git | ||||||
| Source0: https://www.kernel.org/pub/linux/utils/rt-tests/%{name}-%{version}.tar.gz | Source0: https://www.kernel.org/pub/linux/utils/rt-tests/%{name}-%{version}.tar.xz | ||||||
| 
 |  | ||||||
| Patch1: cyclictest-remove-ftrace-code.patch |  | ||||||
| Patch2: rt-tests-Makefile-Change-syntax-for-python3.patch |  | ||||||
| Patch3: Remove-numa-option.patch |  | ||||||
| Patch4: rt-tests-pi_stress-remove-unused-report-options.patch |  | ||||||
| Patch5: rt-tests-pip_stress-Add-an-initial-man-page-for-pip_stress.patch |  | ||||||
| Patch6: add-h-option-to-queuelat.patch |  | ||||||
| Patch7: Add-queuelat-manpage.patch |  | ||||||
| Patch8: rt-tests-manpages-Modify-makefile-for-queuelat.8-and.patch |  | ||||||
| Patch9: rt-tests-Remove-install-and-build-of-backfire-and-sendme.patch |  | ||||||
| Patch10: rt-tests-deadline_test-Add-a-manpage.patch |  | ||||||
| Patch11: rt-tests-cyclictest-Remove-numa-from-help.patch |  | ||||||
| Patch12: rt-tests-deadline_test-Add-NULL-check-before-freeing.patch |  | ||||||
| Patch13: queuelat-use-mfence-for-rdtsc-ordering.patch |  | ||||||
| Patch14: cyclictest-fix_with_expected_identifier_in_latest.patch |  | ||||||
| Patch15: cyclictest-Fix-compiler-warning-about-srncpy-output.patch |  | ||||||
| Patch16: cyclictest-Make-sure-affinity-is-respected-when-numa.patch |  | ||||||
| Patch17: Add-ssdd-test-to-the-rt-tests-suite.patch |  | ||||||
| Patch18: rt-tests-Makefile-ssdd-Incoroporate-ssdd-into-the-rt.patch |  | ||||||
| Patch19: ssdd-make-every-function-static.patch |  | ||||||
| Patch20: ssdd-remove-sleeps.patch |  | ||||||
| Patch21: ssdd-change-the-written-pid.patch |  | ||||||
| Patch22: queuelat-Assume-queuelat-and-queuelat-scripts-in-path.patch |  | ||||||
| Patch23: queuelat-Install-queuelat-helper-scripts-from-make.patch |  | ||||||
| Patch24: hwlatdetect-disable-enable-c-state-transitions.patch |  | ||||||
| Patch25: rt-tests-hwlatdetect-Code-clean-up.patch |  | ||||||
| Patch26: rt-tests-ssdd-Add-a-simple-manpage-for-ssdd.patch |  | ||||||
| 
 | 
 | ||||||
| BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root | ||||||
| Obsoletes: cyclictest signaltest pi_tests | Obsoletes: cyclictest signaltest pi_tests | ||||||
| ExclusiveArch: x86_64 | ExclusiveArch: x86_64 | ||||||
| BuildRequires: numactl-devel python3-devel | BuildRequires: numactl-devel python3-devel | ||||||
| %{?__python3:Requires: %{__python3}} | %{?__python3:Requires: %{__python3}} | ||||||
|  | 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 | ||||||
| 
 | 
 | ||||||
| %description | %description | ||||||
| rt-tests is a set of programs that test and measure various components of | rt-tests is a set of programs that test and measure various components of | ||||||
| @ -67,17 +58,6 @@ latency. It also tests the functioning of priority-inheritance mutexes. | |||||||
| %patch13 -p1 | %patch13 -p1 | ||||||
| %patch14 -p1 | %patch14 -p1 | ||||||
| %patch15 -p1 | %patch15 -p1 | ||||||
| %patch16 -p1 |  | ||||||
| %patch17 -p1 |  | ||||||
| %patch18 -p1 |  | ||||||
| %patch19 -p1 |  | ||||||
| %patch20 -p1 |  | ||||||
| %patch21 -p1 |  | ||||||
| %patch22 -p1 |  | ||||||
| %patch23 -p1 |  | ||||||
| %patch24 -p1 |  | ||||||
| %patch25 -p1 |  | ||||||
| %patch26 -p1 |  | ||||||
| 
 | 
 | ||||||
| %build | %build | ||||||
| make NUMA=1 HAVE_PARSE_CPUSTRING_ALL=1 | make NUMA=1 HAVE_PARSE_CPUSTRING_ALL=1 | ||||||
| @ -129,6 +109,71 @@ rm -rf $RPM_BUILD_ROOT | |||||||
| /usr/share/man/man8/ssdd.8.gz | /usr/share/man/man8/ssdd.8.gz | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
|  | * Mon Nov 25 2019 John Kacur <jkacur@redhat.com> - 1.6-15 | ||||||
|  | - Respun Add SPDX tags patch to correct two incorrect licenes | ||||||
|  | Resolves: rhbz#1721215 | ||||||
|  | 
 | ||||||
|  | * Mon Nov 25 2019 John Kacur <jkacur@redhat.com> - 1.5-14 | ||||||
|  | - Add SPDX tags | ||||||
|  | Resolves: rhbz#1721215 | ||||||
|  | 
 | ||||||
|  | * Fri Nov 22 2019 John Kacur <jkacur@redhat.com> - 1.5-13 | ||||||
|  | - Improved version of getting a snapshot of cyclictest without interrupting | ||||||
|  | - Fixes some problems uncovered by covscan | ||||||
|  | Resolves: rhbz#1469185 | ||||||
|  | 
 | ||||||
|  | * Tue Nov 19 2019 John Kacur <jkacur@redhat.com> - 1.5-12 | ||||||
|  | - Get a running snapshot of cyclictest without interrupting it | ||||||
|  | Resolves: rhbz#1469185 | ||||||
|  | 
 | ||||||
|  | * Tue Nov 12 2019 John Kacur <jkacur@redhat.com> - 1.5-11 | ||||||
|  | - Add short and long options and help to ssdd | ||||||
|  | Resolves: rhbz#1720360 | ||||||
|  | 
 | ||||||
|  | * Mon Nov 11 2019 John Kacur <jkacur@redhat.com> - 1.5-10 | ||||||
|  | - Fix some warnings in determine_maximum_mpps.sh | ||||||
|  | Resolves: rhbz#1719493 | ||||||
|  | 
 | ||||||
|  | * Wed Oct 30 2019 John Kacur <jkacur@redhat.com> - 1.5-9 | ||||||
|  | -Use libnuma version 2 by default | ||||||
|  | Resolves: rhbz#1753758 | ||||||
|  | 
 | ||||||
|  | * Wed Oct 30 2019 John Kacur <jkacur@redhat.com> - 1.5-8 | ||||||
|  | - Don't allow OPT_SYSTEM with OPT_POSIX_TIMERS | ||||||
|  | Resolves: rhbz#1753026 | ||||||
|  | 
 | ||||||
|  | * Wed Oct 30 2019 John Kacur <jkacur@redhat.com> - 1.5-7 | ||||||
|  | - Set affinity before applying numa | ||||||
|  | Resolves: rhbz#1749958 | ||||||
|  | 
 | ||||||
|  | * Tue Oct 29 2019 John Kacur <jkacur@redhat.com> - 1.5-6 | ||||||
|  | - Increase buffers to avoid overflow | ||||||
|  | Resolves: rhbz#1753317 | ||||||
|  | 
 | ||||||
|  | * Fri Oct 25 2019 John Kacur <jkacur@redhat.com> - 1.5-5 | ||||||
|  | - Remove invalid / obsolete tracing options from cyclictest manpage | ||||||
|  | Resolves: rhbz#1749238 | ||||||
|  | 
 | ||||||
|  | * Fri Oct 25 2019 John Kacur <jkacur@redhat.com> - 1.5-4 | ||||||
|  | - Make tracemark work correctly again | ||||||
|  | Resolves: rhbz#1725134 | ||||||
|  | 
 | ||||||
|  | * Wed Oct 23 2019 John Kacur <jkacur@redhat.com> - 1.5-3 | ||||||
|  | - Add Requires bc for queuelat | ||||||
|  | Resolves: rhbz#1764290 | ||||||
|  | 
 | ||||||
|  | * Tue Oct 15 2019 John Kacur <jkacur@redhat.com> - 1.5-2 | ||||||
|  | - Add bash as a Require in the spec file, since the suite contains some scripts | ||||||
|  | Resolves: rhbz#1744983 | ||||||
|  | 
 | ||||||
|  | * Tue Oct 15 2019 John Kacur <jkacur@redhat.com> - 1.5-1 | ||||||
|  | - Rebase to upstream rt-tests-1.5 | ||||||
|  | Resolves: rhbz#1722521 | ||||||
|  | 
 | ||||||
|  | * Wed Jul 31 2019 John Kacur <jkacur@redhat.com> - 1.3-21 | ||||||
|  | - Fix problem when tests use tracing_enabled which is no longer supported | ||||||
|  | Resolves: rhbz#1731336 | ||||||
|  | 
 | ||||||
| * Fri Jun 14 2019 John Kacur <jkacur@redhat.com> - 1.3-20 | * Fri Jun 14 2019 John Kacur <jkacur@redhat.com> - 1.3-20 | ||||||
| - Add a manpage for ssdd | - Add a manpage for ssdd | ||||||
| Resolves: rhbz#1718735 | Resolves: rhbz#1718735 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user