30 May, 2018
1 commit
-
[ Upstream commit 6c59f64b7ecf2bccbe73931d7d573d66ed13b537 ]
Fixes a segfault occurring when e.g. is pressed multiple times in the
ncurses tmon application. The segfault is caused by incrementing
cur_thermal_record in the main function without checking if it's value reached
NR_THERMAL_RECORD immediately. Since the boundary check only occurred in
update_thermal_data a race condition existed, which lead to an attempted read
beyond the last element of the trec array.The fix was implemented by moving the cur_thermal_record incrementation to the
update_thermal_data function using a temporary variable on which the boundary
condition is checked before updating cur_thread_record, so that the variable is
never incremented beyond the trec array's boundary.It seems the segfault does not occur on every machine: On a HP EliteBook G4 the
segfault happens, while it does not happen on a Thinkpad T540p.Signed-off-by: Frank Asseg
Signed-off-by: Jiri Kosina
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman
02 Nov, 2017
1 commit
-
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.By default all files without license information are under the default
license of the kernel, which is GPL version 2.Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if
Reviewed-by: Philippe Ombredanne
Reviewed-by: Thomas Gleixner
Signed-off-by: Greg Kroah-Hartman
10 Oct, 2015
1 commit
-
The header might be in /usr/include/ncursesw, which is not
part of the standard include path. This fixes compile on openSUSE.Signed-off-by: Olaf Hering
Signed-off-by: Zhang Rui
09 May, 2015
1 commit
-
To install tmon we issue "make install" which produces bellow error.
root@odroidxu3:/usr/src/odroidxu3-4.y-testing/tools/thermal/tmon# make install
mkdir -p /usr/bin
install -m 755 -p "tmon" "/usr/bin/tmon"
mkdir -p /
install -m 644 -p "" "/"
install: cannot stat ‘’: No such file or directory
make: [install] Error 1 (ignored)Signed-off-by: Anand Moon
Acked-by: Jacob Pan
Signed-off-by: Zhang Rui
28 Feb, 2015
8 commits
-
gcc complains about the 'cols' variable being unused. This is
unavoidable, given the ncurses getmaxyx() macro-based API, which wants
to assign to a variable directly, even when we're not going to use it.Warning:
gcc -O1 -Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int -fstack-protector -D VERSION=\"1.0\" -c -o tui.o tui.c
tui.c: In function ‘show_dialogue’:
tui.c:288:12: warning: variable ‘cols’ set but not used [-Wunused-but-set-variable]
int rows, cols;
^So, add a hack to get rid of that warning.
Signed-off-by: Brian Norris
Acked-by: Jacob Pan
Reviewed-by: Florian Fainelli
Signed-off-by: Zhang Rui -
Some distros (e.g., Arch Linux) don't package the tinfo library
separately from ncurses, so don't unconditionally include it. Instead,
use pkg-config.The $(STATIC) ugliness is to handle the reported build case from commit
6b533269fb25 ("tools/thermal: tmon: fix compilation errors when building
statically"), where a developer wants to be able to build with:make LDFLAGS=-static
which requires an additional pkg-config flag.
Finally, support a lowest common denominator fallback (-lpanel
-lncurses) for build systems that don't have pkg-config entries for
ncurses.Signed-off-by: Brian Norris
Acked-by: Jacob Pan
Reviewed-by: Florian Fainelli
Signed-off-by: Zhang Rui -
We might want to prepare CFLAGS outside of this Makefile, so don't
overwrite its initial value.Then, support $(CROSS_COMPILE), so we can use a cross-compile toolchain.
Signed-off-by: Brian Norris
Acked-by: Jacob Pan
Reviewed-by: Florian Fainelli
Signed-off-by: Zhang Rui -
Signed-off-by: Brian Norris
Acked-by: Jacob Pan
Reviewed-by: Florian Fainelli
Signed-off-by: Zhang Rui -
The number of rows in the dialog vary according to the number of cooling
devices. However, some of the windowing computations were assuming a
fixed number of rows. This computation is OK when we have between 4 and
9 cooling devices (and they wrap to the next column), but with fewer
devices, we end up printing off the end of the window.This unifies the row computation into a single function and uses that
throughout the TUI code. This also accounts for increasing the number of
rows when there are more than 9 total cooling devices.Signed-off-by: Brian Norris
Acked-by: Jacob Pan
Reviewed-by: Florian Fainelli
Signed-off-by: Zhang Rui -
We can use the ncurses API to get the number of rows.
Signed-off-by: Brian Norris
Acked-by: Jacob Pan
Reviewed-by: Florian Fainelli
Signed-off-by: Zhang Rui -
Signed-off-by: Brian Norris
Acked-by: Jacob Pan
Reviewed-by: Florian Fainelli
Signed-off-by: Zhang Rui -
If we launch in daemon mode (--daemon), we don't have the ncurses UI,
but we might want to set the target temperature still. For example,
someone might stick the following in their boot script:tmon --control intel_powerclamp --target-temp 90 --log --daemon
This would turn on CPU idle injection when we're around 90 degrees
celsius, and would log temperature and throttling info to
/var/tmp/tmon.log.Signed-off-by: Brian Norris
Acked-by: Jacob Pan
Reviewed-by: Florian Fainelli
Signed-off-by: Zhang Rui
09 Dec, 2014
1 commit
-
The calloc() and xcalloc() functions takes @nmemb first and then @size. Fix all w/
pattern "calloc\s*(\s*sizeof".Signed-off-by: Arjun Sreedharan
Cc: "Yann E. MORIN"
Cc: Ingo Molnar
Cc: Paul Mackerras
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/1417866043-1877-1-git-send-email-arjun024@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo
01 Jul, 2014
3 commits
-
Currently, the tmon umask value is set to 0, which means whatever the permission
mask in the shell are when starting tmon in daemon mode are what the permissions
of any created files will be. We should likely set something more explicit, so
lets go with the usual 022Signed-off-by: Neil Horman
Acked-by: Jacob Pan
Signed-off-by: Zhang Rui -
The tmon logging system blindly opens its log file on a static path, making it
very easy for someone to redirect that log information to inappropriate places
or overwrite other users data. Do some easy checking to make sure we're not
logging to a symlink or a file owned by another user.Signed-off-by: Neil Horman
Acked-by: Jacob Pan
Signed-off-by: Zhang Rui -
tmon fails to build statically with the following error:
$ make LDFLAGS=-static
gcc -O1 -Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int -fstack-protector -D VERSION=\"1.0\" -static tmon.o tui.o sysfs.o pid.o -o tmon -lm -lpanel -lncursesw -lpthread
tmon.o: In function `tmon_sig_handler':
tmon.c:(.text+0x21): undefined reference to `stdscr'
tmon.o: In function `tmon_cleanup':
tmon.c:(.text+0xb9): undefined reference to `stdscr'
tmon.c:(.text+0x11e): undefined reference to `stdscr'
tmon.c:(.text+0x123): undefined reference to `keypad'
tmon.c:(.text+0x12d): undefined reference to `nocbreak'
tmon.o: In function `main':
tmon.c:(.text+0x785): undefined reference to `stdscr'
tmon.c:(.text+0x78a): undefined reference to `nodelay'
tui.o: In function `setup_windows':
tui.c:(.text+0x131): undefined reference to `stdscr'
tui.c:(.text+0x176): undefined reference to `stdscr'
tui.c:(.text+0x19f): undefined reference to `stdscr'
tui.c:(.text+0x1cc): undefined reference to `stdscr'
tui.c:(.text+0x1ff): undefined reference to `stdscr'
tui.o:tui.c:(.text+0x229): more undefined references to `stdscr' follow
tui.o: In function `show_cooling_device':
[...]stdscr() and friends are in libtinfo (part of ncurses) so add it to
the libraries that are linked in when compiling tmon to fix it.Cc: Jacob Pan
Cc: Zhang Rui
Signed-off-by: Javi Merino
Acked-by: Jacob Pan
07 Nov, 2013
1 commit
-
Increasingly, Linux is running on thermally constrained devices. The simple
thermal relationship between processor and fan has become past for modern
computers.As hardware vendors cope with the thermal constraints on their products,
more sensors are added, new cooling capabilities are introduced. The
complexity of the thermal relationship can grow exponentially among cooling
devices, zones, sensors, and trip points. They can also change dynamically.To expose such relationship to the userspace, Linux generic thermal layer
introduced sysfs entry at /sys/class/thermal with a matrix of symbolic
links, trip point bindings, and device instances. To traverse such
matrix by hand is not a trivial task. Testing is also difficult in that
thermal conditions are often exception cases that hard to reach in
normal operations.TMON is conceived as a tool to help visualize, tune, and test the
complex thermal subsystem.Signed-off-by: Jacob Pan
Signed-off-by: Zhang Rui