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

    Anand Moon
     

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

    Brian Norris
     
  • 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

    Brian Norris
     
  • 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

    Brian Norris
     
  • Signed-off-by: Brian Norris
    Acked-by: Jacob Pan
    Reviewed-by: Florian Fainelli
    Signed-off-by: Zhang Rui

    Brian Norris
     
  • 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

    Brian Norris
     
  • 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

    Brian Norris
     
  • Signed-off-by: Brian Norris
    Acked-by: Jacob Pan
    Reviewed-by: Florian Fainelli
    Signed-off-by: Zhang Rui

    Brian Norris
     
  • 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

    Brian Norris
     

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

    Arjun Sreedharan
     

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 022

    Signed-off-by: Neil Horman
    Acked-by: Jacob Pan
    Signed-off-by: Zhang Rui

    Neil Horman
     
  • 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

    Neil Horman
     
  • 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

    Javi Merino
     

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

    Jacob Pan