Clean up cyclictest formatting:
Change leading spaces to tabs.
Align function parameters.
Place type of function on same line as function name.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
V3: Use src/lib/error.c functions instead of fprintf.
Fix printf format warnings for 32 bit vs 64 bit systems with cast.
One issue with using warn() and info() instead of fprintf is that
the compiler no longer warns about format mismatches.
Fix bad continuation line white space prefix.
Remove unused variable zero_diff.
cyclictest: ARM panda clock resolution will be ~30 usec unless
CONFIG_OMAP_32K_TIMER=n, resulting in a poor latency report.
This patch does _not_ fix the problem, it merely provides the
instrumentation to make it visible. The value of measured
resolution is useful information for any system.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
- Fixed up minor white space problem.
Signed-off-by: John Kacur <jkacur@redhat.com>
V3: unchanged from V2
cyclictest getopt_long() parameter clean up.
Clean up before following patch which will add a new option.
Some elements of long_options were not in alphabetical order.
Some elements of optstring were not in alphabetical order.
'-e', '--latency' was missing help text
short form of --duration ('D') was missing from optstring
Change a few instances of leading spaces to tabs.
Add white space to long_options to improve readability.
Some cases of the switch processing the result of
getopt_long() were not in alphabetical order.
Did _not_ clean up option value parsing and processing.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Conflicts:
src/cyclictest/cyclictest.c
For compilation to work
-D_GNU_SOURCE -Isrc/include
is needed to be passed to the compiler. For Debian packaging several
things are added but not these two from above. So be a bit more friendly
and add them unconditionally. There is no harm if they are included in
the user supplied CFLAGS and so passed twice.
Moreover be a bit more correct about CFLAGS/CPPFLAGS. Both should be
passed to the compiler with CFLAGS taking options for the compiler and
CPPFLAGS taking options for the preprocessor. This is also needed for
Debian packaging where the helper scripts set CPPFLAGS.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Discovered while compiling with "hardening flags"
For Debian 7.0 (aka wheezy) packages it's recommended to use several
hardening flags, the default on amd64 being:
CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
CPPFLAGS=-D_FORTIFY_SOURCE=2
LDFLAGS=-Wl,-z,relro
This patch doesn't fix all warnings but at least makes all programs compile
again by not using char *variables as printf format strings.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: John Kacur <jkacur@redhat.com>
Minor fix to make working with git nicer.
Now that we're building a lib, we need to exclude it from git status output.
Do the same for patches we generate or apply.
Signed-off-by: John Kacur <jkacur@redhat.com>
Add back call to the tracemark function but only if we're
using the breaktrace option and only when we actually hit
the breaktrace threshold.
Signed-off-by: Clark Williams <williams@redhat.com>
Currently if a non-root user requests a priority higher than the soft limit in
/etc/security/limits.conf
the call to sched_setscheduler will silently fail and the user will be running
with priority of 0. Cyclictest will not complain, and display the
requested priority resulting in seemingly poor results.
The following patch fixes this by doing two things.
1. If the requested priority is higher than the soft limit but lower than the
hard limit, it will raise the soft limit to the requested priority.
2. If the requested priority is higher than the hard limit, it will fail with a
warning.
The patch should not affect privileged users.
Reported-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Clark Williams <williams@redhat.com>
V2: use type casting instead of ugly constant in format string
Fix printf format string to fix compile warning for ARM 32 bit target.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: Clark Williams <williams@redhat.com>
When the --verbose option is selected, the first value for each thread is
incorrectly reported as zero.
This is because when collecting the first value, the index into stat->values is
incremented from zero to one before storing the value. But when printing the
values, the first value printed is stat->values[0], which has been initialized
to zero.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: Clark Williams <williams@redhat.com>
Fix the machinetype check for cross-compiling.
This has been tested on an x86_64 Fedora host for an x86_64 target and
an ARM target. Additional testing would be greatly appreciated.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Tested-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Clark Williams <williams@redhat.com>
The '-a' option is always ignored if --smp or --numa is specified. Fix the
warning message to not depend on --smp or --numa occuring first.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Tested-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Clark Williams <williams@redhat.com>
Avoid annoying warning message when tracing is not requested and the debug
file system is not available.
The same test already protects against calling event_enable_all().
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Clark Williams <williams@redhat.com>
This fixes a segfault on ARM when the '-a' option is used.
man sched_setaffinity says to use pthread_setaffinity_np() when using the
POSIX threads API.
Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Tested-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Clark Williams <williams@redhat.com>
Start of an ongoing process to have error strategy where return is
checked and if error, exit with appropriate status.
Signed-off-by: Clark Williams <williams@redhat.com>
The following build error can occur if you have done a previous make install
if test -n "/usr/lib/python2.7/site-packages" ; then \
install -D -m 755 src/hwlatdetect/hwlatdetect.py /usr/lib/python2.7/site-packages/hwlatdetect.py ; \
ln -s /usr/lib/python2.7/site-packages/hwlatdetect.py "/usr/local/bin/hwlatdetect" ; \
fi
ln: failed to create symbolic link `/usr/local/bin/hwlatdetect': File exists
make: *** [install] Error 1
I initially wanted to fix the error by removing the symbolic link, with rm -rf
but Andrew Burgess pointed out that you can just use the
ln's -f (force) flag. I like that solution better.
Suggested-by: Andrew Burgess <aab@cichlid.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
The following build error can occur if you have done a previous make install
if test -n "/usr/lib/python2.7/site-packages" ; then \
install -D -m 755 src/hwlatdetect/hwlatdetect.py /usr/lib/python2.7/site-packages/hwlatdetect.py ; \
ln -s /usr/lib/python2.7/site-packages/hwlatdetect.py "/usr/local/bin/hwlatdetect" ; \
fi
ln: failed to create symbolic link `/usr/local/bin/hwlatdetect': File exists
make: *** [install] Error 1
Fix the error by removing the symbolic link.
Signed-off-by: John Kacur <jkacur@redhat.com>
Accept user supplied CFLAGS and LDFLAGS, overwriting the
Makefile supplied versions. This can cause the build to
fail if the user does not provide at least what the Makefile
defines, but so be it.
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
CC: Clark Williams <williams@redhat.com>
CC: John Kacur <jkacur@redhat.com>
CC: Denys Dmytriyenko <denis@denix.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
Check the status of sched_getaffinity and exit upon error.
CPU_ISSET only checks whether a cpu is in a mask, and not whether the
mask is valid. Checking the status ensures we aren't working with garbage
values.
This also removes the warning from gcc about the status variable being unused
as reported by Darren Hart.
Reported-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
The rt-migrate-test in the rt-tests is still using the old logdev
interface that requires the logdev patch. Ftrace has been introduced
into mainline Linux since 2.6.27 and has many more features than logdev.
The rt-migrate-test should interact with ftrace instead of logdev.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
Many rt-test programs including cyclictest have directories with the
same name as the generated binaries. Tell .gitignore to only ignore
the program names and not the directories by using a slash prefix.
Signed-off-by: John Kacur <jkacur@redhat.com>
HI !
minor bug in cyclictest but potential causing confusion on cyclictest
resuults when running as non-root user.
Setup:
if one sets the rtprio in /etc/security/limits.conf to something below
prio max - like:
@hofrat hard rtprio 10
@hofrat soft rtprio 10
but then starts cylictest with -p 80 cyclictest will not fuss and also
display priority 80 (as it uses par->prio in print_stat) but effectively
runs with prio 0 as the return value of sched_setscheduler is not being
checked in timerthread), resulting in semingly bad scheduling jitter values.
So maybe cyclictest should take the effective maximum schduling priority
of the user and not the scheduling policy maximum. Not sur if the check
in timerthread is actually really needed - but it should not hurt ither.
patch below (against current git) at "works for me" quality.
thx!
hofrat
Combined Uwe Kleine-König and Frank Rowand's suggestions into a
Makefile modification that tries to be smart about turning on
NUMA, while allowing it to be explicitly enabled/disabled via
command line options
Signed-off-by: Clark Williams <williams@redhat.com>
Changed function name to set_latency_target() and added a
command line argument to allow passing in values other than
the default of zero microseconds.
Signed-off-by: Clark Williams <williams@redhat.com>
Use the /dev/cpu_dma_latency power management interface to hold the
system in idle=poll state while cyclictest is running. Look in the
kernel documenation: Documentation/power/pm_qos_interface.txt for
more information.
Signed-off-by: Clark Williams <williams@redhat.com>
added a signal_worker routine to send individual SIGTERM's to
worker threads (since sending via pid=0 seems to have issues).
Also added the -F/--fifo option to change the main thread to a
SCHED_FIFO realtime thread after creating the workers. This will
allow the mangagement thread to run when there are tons of workers.
Signed-off-by: Clark Williams <williams@redhat.com>
Modify signal handling logic so main can't receive sigterm when
reaping children
Also added THREAD_MODE and PROCESS_MODE defines to use rather than
bare constants 0 and 1.
Signed-off-by: Clark Williams <williams@redhat.com>