Skip to contentSkip to conversation

TMON thermal monitoring/tuning tool

PATCH New Jacob Pan 3 participants 5 messages Oct 14, 2013 – Oct 15, 2013 Thermal

lore
Share & tools
lore

Jacob Pan

author
#0 lore raw

PATCH 1/1 TMON thermal monitoring/tuning tool

Changes since v0
- fix seg fault on arm mvprintw() call
- give out warning to console instead of syslog when no thermal zones are detected
- draw sub window title on top of border line
- add entry to tools/Makefile
- change linking order to put libpanel before ncurses

Jacob Pan (1):
tools/thermal: Introduce tmon, a tool for thermal subsystem

 tools/Makefile              |   15 +-
 tools/thermal/tmon/Makefile |   47 ++++
 tools/thermal/tmon/README   |   50 ++++
 tools/thermal/tmon/pid.c    |  131 +++++++++
 tools/thermal/tmon/sysfs.c  |  596 ++++++++++++++++++++++++++++++++++++++++
 tools/thermal/tmon/tmon.8   |  142 ++++++++++
 tools/thermal/tmon/tmon.c   |  352 ++++++++++++++++++++++++
 tools/thermal/tmon/tmon.h   |  204 ++++++++++++++
 tools/thermal/tmon/tui.c    |  638 +++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 2173 insertions(+), 2 deletions(-)
 create mode 100644 tools/thermal/tmon/Makefile
 create mode 100644 tools/thermal/tmon/README
 create mode 100644 tools/thermal/tmon/pid.c
 create mode 100644 tools/thermal/tmon/sysfs.c
 create mode 100644 tools/thermal/tmon/tmon.8
 create mode 100644 tools/thermal/tmon/tmon.c
 create mode 100644 tools/thermal/tmon/tmon.h
 create mode 100644 tools/thermal/tmon/tui.c
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/1 tools/thermal: Introduce tmon, a tool for thermal subsystem

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.

---
 tools/Makefile              |   15 +-
 tools/thermal/tmon/Makefile |   47 ++++
 tools/thermal/tmon/README   |   50 ++++
 tools/thermal/tmon/pid.c    |  131 +++++++++
 tools/thermal/tmon/sysfs.c  |  596 ++++++++++++++++++++++++++++++++++++++++
 tools/thermal/tmon/tmon.8   |  142 ++++++++++
 tools/thermal/tmon/tmon.c   |  352 ++++++++++++++++++++++++
 tools/thermal/tmon/tmon.h   |  204 ++++++++++++++
 tools/thermal/tmon/tui.c    |  638 +++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 2173 insertions(+), 2 deletions(-)
 create mode 100644 tools/thermal/tmon/Makefile
 create mode 100644 tools/thermal/tmon/README
 create mode 100644 tools/thermal/tmon/pid.c
 create mode 100644 tools/thermal/tmon/sysfs.c
 create mode 100644 tools/thermal/tmon/tmon.8
 create mode 100644 tools/thermal/tmon/tmon.c
 create mode 100644 tools/thermal/tmon/tmon.h
 create mode 100644 tools/thermal/tmon/tui.c
tools/Makefile +13 -2
index 41067f3..a9b0200 100644
@@ -15,6 +15,7 @@ help:
 	@echo '  net        - misc networking tools'
 	@echo '  vm         - misc vm tools'
 	@echo '  x86_energy_perf_policy - Intel energy policy tool'
+	@echo '  tmon       - thermal monitoring and tuning tool'
 	@echo ''
 	@echo 'You can do:'
 	@echo ' $$ make -C tools/ <tool>_install'
@@ -50,6 +51,9 @@ selftests: FORCE
 turbostat x86_energy_perf_policy: FORCE
 	$(call descend,power/x86/$@)
 
+tmon: FORCE
+	$(call descend,thermal/$@)
+
 cpupower_install:
 	$(call descend,power/$(@:_install=),install)
 
@@ -62,9 +66,13 @@ selftests_install:
 turbostat_install x86_energy_perf_policy_install:
 	$(call descend,power/x86/$(@:_install=),install)
 
+tmon_install:
+	$(call descend,thermal/$(@:_install=),install)
+
 install: cgroup_install cpupower_install firewire_install lguest_install \
 		perf_install selftests_install turbostat_install usb_install \
-		virtio_install vm_install net_install x86_energy_perf_policy_install
+		virtio_install vm_install net_install x86_energy_perf_policy_install \
+	tmon
 
 cpupower_clean:
 	$(call descend,power/cpupower,clean)
@@ -84,8 +92,11 @@ selftests_clean:
 turbostat_clean x86_energy_perf_policy_clean:
 	$(call descend,power/x86/$(@:_clean=),clean)
 
+tmon_clean:
+	$(call descend,thermal/tmon,clean)
+
 clean: cgroup_clean cpupower_clean firewire_clean lguest_clean perf_clean \
 		selftests_clean turbostat_clean usb_clean virtio_clean \
-		vm_clean net_clean x86_energy_perf_policy_clean
+		vm_clean net_clean x86_energy_perf_policy_clean tmon_clean
 
 .PHONY: FORCE
tools/thermal/tmon/Makefile new file +47 -0

47 lines not on this page · raw message

tools/thermal/tmon/README new file +50 -0

50 lines not on this page · raw message

tools/thermal/tmon/pid.c new file +131 -0

131 lines not on this page · raw message

tools/thermal/tmon/sysfs.c new file +596 -0

596 lines not on this page · raw message

tools/thermal/tmon/tmon.8 new file +142 -0

142 lines not on this page · raw message

tools/thermal/tmon/tmon.c new file +352 -0

352 lines not on this page · raw message

tools/thermal/tmon/tmon.h new file +204 -0

204 lines not on this page · raw message

tools/thermal/tmon/tui.c new file +638 -0

638 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v1] tools/thermal: Introduce tmon, a tool for thermal subsystem

Quoted 31 lines · Jacob Pan

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.

---
 tools/Makefile              |   15 +-
 tools/thermal/tmon/Makefile |   47 ++++
 tools/thermal/tmon/README   |   50 ++++
 tools/thermal/tmon/pid.c    |  131 +++++++++
 tools/thermal/tmon/sysfs.c  |  596 ++++++++++++++++++++++++++++++++++++++++
 tools/thermal/tmon/tmon.8   |  142 ++++++++++
 tools/thermal/tmon/tmon.c   |  352 ++++++++++++++++++++++++
 tools/thermal/tmon/tmon.h   |  204 ++++++++++++++
 tools/thermal/tmon/tui.c    |  638 +++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 2173 insertions(+), 2 deletions(-)
Quoted 8 lines
 create mode 100644 tools/thermal/tmon/Makefile
 create mode 100644 tools/thermal/tmon/README
 create mode 100644 tools/thermal/tmon/pid.c
 create mode 100644 tools/thermal/tmon/sysfs.c
 create mode 100644 tools/thermal/tmon/tmon.8
 create mode 100644 tools/thermal/tmon/tmon.c
 create mode 100644 tools/thermal/tmon/tmon.h
 create mode 100644 tools/thermal/tmon/tui.c

Just a couple of notes/questions:

* Why does this have to be in the kernel src repo? I mean, it only needs stable sysfs interface but other than that, it can very well be a separate project on github or so. Or am I missing something?

* So I tried it and I can control the brightness and the target CPU temperature, cool! :) The question is: can I cook my box with it or there are protections like filtering values which might be detrimental to the system? After all, I'm running it as root.

* Also, please run this through checkpatch first:

total: 1 errors, 0 warnings, 91 checks, 2202 lines checked

Also, the manpage should be checked for typos and excessive spaces.

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author
#3 lore raw

Re: [PATCH v1] tools/thermal: Introduce tmon, a tool for thermal subsystem

Quoted 44 lines · On Tue, 15 Oct 2013 11:14:01 +0200 Borislav Petkov <[email protected]> wrote:
Quoted 32 lines · Jacob Pan

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.

---
 tools/Makefile              |   15 +-
 tools/thermal/tmon/Makefile |   47 ++++
 tools/thermal/tmon/README   |   50 ++++
 tools/thermal/tmon/pid.c    |  131 +++++++++
 tools/thermal/tmon/sysfs.c  |  596
++++++++++++++++++++++++++++++++++++++++
tools/thermal/tmon/tmon.8   |  142 ++++++++++
tools/thermal/tmon/tmon.c   |  352 ++++++++++++++++++++++++
tools/thermal/tmon/tmon.h   |  204 ++++++++++++++
tools/thermal/tmon/tui.c    |  638
Quoted 10 lines

+++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 2173 insertions(+), 2 deletions(-) create mode 100644 tools/thermal/tmon/Makefile create mode 100644 tools/thermal/tmon/README create mode 100644 tools/thermal/tmon/pid.c create mode 100644 tools/thermal/tmon/sysfs.c create mode 100644 tools/thermal/tmon/tmon.8 create mode 100644 tools/thermal/tmon/tmon.c create mode 100644 tools/thermal/tmon/tmon.h create mode 100644 tools/thermal/tmon/tui.c

Quoted 2 lines

Just a couple of notes/questions:

thanks for the review and feedback.

Quoted 4 lines

* Why does this have to be in the kernel src repo? I mean, it only needs stable sysfs interface but other than that, it can very well be a separate project on github or so. Or am I missing something?

the main customers of this tool are thermal driver developers and thermal subsystem maintainers. one of the features i will add is to automate the testing with temperature emulation, all these are tied with sysfs as well as some platform data.

Quoted 5 lines

* So I tried it and I can control the brightness and the target CPU temperature, cool! :) The question is: can I cook my box with it or there are protections like filtering values which might be detrimental to the system? After all, I'm running it as root.

the hardware/fw based protection is always there. If you choose to turn off your fan and try run your laptop fanless (passive cooling only) and see what happens it may reach some critical condition then shutdown. But the tool does not do anything more than what kernel ABI and BIOS already allow you to do as root.

Quoted 4 lines

* Also, please run this through checkpatch first:

total: 1 errors, 0 warnings, 91 checks, 2202 lines checked

hmm, i did that. what version of kernel did you use checkpatch?

jacob@ultegra:~/localDev/src/linux/tools$ cd ..
$ ./scripts/checkpatch.pl ../patches/tmon2/0001-tools-thermal-Introduce-tmon-a-tool-for-thermal-subs.patch 
total: 0 errors, 0 warnings, 2202 lines checked

../patches/tmon2/0001-tools-thermal-Introduce-tmon-a-tool-for-thermal-subs.patch has no obvious style problems and is ready for submission.

Quoted 2 lines

Also, the manpage should be checked for typos and excessive spaces.

ok, i will double check.

Quoted 2 lines

Thanks.

[Jacob Pan]

#4 lore raw

Re: [PATCH v1] tools/thermal: Introduce tmon, a tool for thermal subsystem

Quoted 1 line · Jacob Pan

hmm, i did that. what version of kernel did you use checkpatch?

Try ... checkpatch.pl --strict ...

Although they're only checks, some of them do make sense :).

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--