tools: Add intel-lpmd to the kernel tools
cover tools: Add intel-lpmd to the kernel tools
LPMD (Low Power Mode Daemon) [1] is a program that helps increase mobile platform power efficiency based on current workload and user configuration. On newer systems hardware hints guide the decision making while on older ones software calculated system utilization can be used.
Depending on the workload LPMD manages active CPUs through cgroups, and if available balances different sysfs knobs and sliders to get the most power efficient result. Special emphasis is put on L-cores - low power CPUs management to get the most value out of newer hardware that supports such distinction.
Moving the development of LPMD to the kernel tree can increase it's effectiveness through maintaining higher quality standards and better community cooperation.
Notable differences between this patchset and the github version [1] are
- reformatting the whole codebase in kernel coding style
- the autogen system is dropped in favour of a simpler Makefile
Other than that no functional changes should be introduced in comparison.
[1] https://github.com/intel/intel-lpmd
Fabio M. De Francesco (3):
tools/LPMD: Add Intel Low Power Mode Daemon
tools/LPMD: Add Makefile
tools: Add LPMD entry to tools Makefile
MAINTAINERS | 6 + tools/Makefile | 13 +- tools/power/x86/intel-lpmd/Makefile | 155 ++++ tools/power/x86/intel-lpmd/README.md | 182 +++++ .../x86/intel-lpmd/data/intel_lpmd.service.in | 19 + .../x86/intel-lpmd/data/intel_lpmd_config.xml | 106 +++ .../data/intel_lpmd_config_F6_M170.xml | 166 ++++ .../data/intel_lpmd_config_F6_M189.xml | 188 +++++ .../data/intel_lpmd_config_F6_M204.xml | 213 +++++ .../data/intel_lpmd_config_examples.xml | 213 +++++ .../data/intel_lpmd_config_experimental.xml | 252 ++++++ .../data/org.freedesktop.intel_lpmd.conf | 20 + .../org.freedesktop.intel_lpmd.service.in | 5 + tools/power/x86/intel-lpmd/doc/WLT_proxy.md | 84 ++ .../intel-lpmd/lpmd-resource.gresource.xml | 6 + tools/power/x86/intel-lpmd/man/intel_lpmd.8 | 79 ++ .../intel-lpmd/man/intel_lpmd_config.xml.5 | 329 ++++++++ .../x86/intel-lpmd/man/intel_lpmd_control.8 | 44 ++ tools/power/x86/intel-lpmd/src/include/lpmd.h | 408 ++++++++++ .../x86/intel-lpmd/src/include/thermal.h | 94 +++ .../src/intel_lpmd_dbus_interface.xml | 27 + tools/power/x86/intel-lpmd/src/lpmd_cgroup.c | 213 +++++ tools/power/x86/intel-lpmd/src/lpmd_config.c | 493 ++++++++++++ tools/power/x86/intel-lpmd/src/lpmd_cpu.c | 481 +++++++++++ tools/power/x86/intel-lpmd/src/lpmd_cpumask.c | 479 +++++++++++ .../x86/intel-lpmd/src/lpmd_dbus_server.c | 274 +++++++ tools/power/x86/intel-lpmd/src/lpmd_helpers.c | 385 +++++++++ tools/power/x86/intel-lpmd/src/lpmd_hfi.c | 373 +++++++++ tools/power/x86/intel-lpmd/src/lpmd_irq.c | 262 ++++++ tools/power/x86/intel-lpmd/src/lpmd_main.c | 297 +++++++ tools/power/x86/intel-lpmd/src/lpmd_misc.c | 483 +++++++++++ tools/power/x86/intel-lpmd/src/lpmd_proc.c | 492 ++++++++++++ tools/power/x86/intel-lpmd/src/lpmd_socket.c | 149 ++++ .../x86/intel-lpmd/src/lpmd_state_machine.c | 747 ++++++++++++++++++ tools/power/x86/intel-lpmd/src/lpmd_uevent.c | 133 ++++ tools/power/x86/intel-lpmd/src/lpmd_util.c | 369 +++++++++ tools/power/x86/intel-lpmd/src/lpmd_wlt.c | 107 +++ .../src/wlt_proxy/include/state_common.h | 106 +++ .../src/wlt_proxy/include/wlt_proxy.h | 10 + .../x86/intel-lpmd/src/wlt_proxy/spike_mgmt.c | 202 +++++ .../intel-lpmd/src/wlt_proxy/state_machine.c | 314 ++++++++ .../intel-lpmd/src/wlt_proxy/state_manager.c | 302 +++++++ .../x86/intel-lpmd/src/wlt_proxy/state_util.c | 584 ++++++++++++++ .../x86/intel-lpmd/src/wlt_proxy/wlt_proxy.c | 31 + .../intel-lpmd/tests/lpm_test_interface.sh | 64 ++ .../x86/intel-lpmd/tools/intel_lpmd_control.c | 97 +++ 46 files changed, 10050 insertions(+), 6 deletions(-) create mode 100644 tools/power/x86/intel-lpmd/Makefile create mode 100644 tools/power/x86/intel-lpmd/README.md create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd.service.in create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd_config.xml create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd_config_F6_M170.xml create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd_config_F6_M189.xml create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd_config_F6_M204.xml create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd_config_examples.xml create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd_config_experimental.xml create mode 100644 tools/power/x86/intel-lpmd/data/org.freedesktop.intel_lpmd.conf create mode 100644 tools/power/x86/intel-lpmd/data/org.freedesktop.intel_lpmd.service.in create mode 100644 tools/power/x86/intel-lpmd/doc/WLT_proxy.md create mode 100644 tools/power/x86/intel-lpmd/lpmd-resource.gresource.xml create mode 100644 tools/power/x86/intel-lpmd/man/intel_lpmd.8 create mode 100644 tools/power/x86/intel-lpmd/man/intel_lpmd_config.xml.5 create mode 100644 tools/power/x86/intel-lpmd/man/intel_lpmd_control.8 create mode 100644 tools/power/x86/intel-lpmd/src/include/lpmd.h create mode 100644 tools/power/x86/intel-lpmd/src/include/thermal.h create mode 100644 tools/power/x86/intel-lpmd/src/intel_lpmd_dbus_interface.xml create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_cgroup.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_config.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_cpu.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_cpumask.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_dbus_server.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_helpers.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_hfi.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_irq.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_main.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_misc.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_proc.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_socket.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_state_machine.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_uevent.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_util.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_wlt.c create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/include/state_common.h create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/include/wlt_proxy.h create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/spike_mgmt.c create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/state_machine.c create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/state_manager.c create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/state_util.c create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/wlt_proxy.c create mode 100755 tools/power/x86/intel-lpmd/tests/lpm_test_interface.sh create mode 100644 tools/power/x86/intel-lpmd/tools/intel_lpmd_control.c
Signature · 1 line
2.53.0
PATCH 1/3 tools/LPMD: Add Intel Low Power Mode Daemon
From: Fabio M. De Francesco <[email protected]>
Add the Intel Low Power Mode Daemon (intel-lpmd) userspace tool. Intel LPMD monitors system activity and dynamically constrains tasks to the most power-efficient CPU cores during low utilization periods, reducing package power consumption.
--- MAINTAINERS | 6 + tools/power/x86/intel-lpmd/README.md | 182 +++++ .../x86/intel-lpmd/data/intel_lpmd.service.in | 19 + .../x86/intel-lpmd/data/intel_lpmd_config.xml | 106 +++ .../data/intel_lpmd_config_F6_M170.xml | 166 ++++ .../data/intel_lpmd_config_F6_M189.xml | 188 +++++ .../data/intel_lpmd_config_F6_M204.xml | 213 +++++ .../data/intel_lpmd_config_examples.xml | 213 +++++ .../data/intel_lpmd_config_experimental.xml | 252 ++++++ .../data/org.freedesktop.intel_lpmd.conf | 20 + .../org.freedesktop.intel_lpmd.service.in | 5 + tools/power/x86/intel-lpmd/doc/WLT_proxy.md | 84 ++ .../intel-lpmd/lpmd-resource.gresource.xml | 6 + tools/power/x86/intel-lpmd/man/intel_lpmd.8 | 79 ++ .../intel-lpmd/man/intel_lpmd_config.xml.5 | 329 ++++++++ .../x86/intel-lpmd/man/intel_lpmd_control.8 | 44 ++ tools/power/x86/intel-lpmd/src/include/lpmd.h | 408 ++++++++++ .../x86/intel-lpmd/src/include/thermal.h | 94 +++ .../src/intel_lpmd_dbus_interface.xml | 27 + tools/power/x86/intel-lpmd/src/lpmd_cgroup.c | 213 +++++ tools/power/x86/intel-lpmd/src/lpmd_config.c | 493 ++++++++++++ tools/power/x86/intel-lpmd/src/lpmd_cpu.c | 481 +++++++++++ tools/power/x86/intel-lpmd/src/lpmd_cpumask.c | 479 +++++++++++ .../x86/intel-lpmd/src/lpmd_dbus_server.c | 274 +++++++ tools/power/x86/intel-lpmd/src/lpmd_helpers.c | 385 +++++++++ tools/power/x86/intel-lpmd/src/lpmd_hfi.c | 373 +++++++++ tools/power/x86/intel-lpmd/src/lpmd_irq.c | 262 ++++++ tools/power/x86/intel-lpmd/src/lpmd_main.c | 297 +++++++ tools/power/x86/intel-lpmd/src/lpmd_misc.c | 483 +++++++++++ tools/power/x86/intel-lpmd/src/lpmd_proc.c | 492 ++++++++++++ tools/power/x86/intel-lpmd/src/lpmd_socket.c | 149 ++++ .../x86/intel-lpmd/src/lpmd_state_machine.c | 747 ++++++++++++++++++ tools/power/x86/intel-lpmd/src/lpmd_uevent.c | 133 ++++ tools/power/x86/intel-lpmd/src/lpmd_util.c | 369 +++++++++ tools/power/x86/intel-lpmd/src/lpmd_wlt.c | 107 +++ .../src/wlt_proxy/include/state_common.h | 106 +++ .../src/wlt_proxy/include/wlt_proxy.h | 10 + .../x86/intel-lpmd/src/wlt_proxy/spike_mgmt.c | 202 +++++ .../intel-lpmd/src/wlt_proxy/state_machine.c | 314 ++++++++ .../intel-lpmd/src/wlt_proxy/state_manager.c | 302 +++++++ .../x86/intel-lpmd/src/wlt_proxy/state_util.c | 584 ++++++++++++++ .../x86/intel-lpmd/src/wlt_proxy/wlt_proxy.c | 31 + .../intel-lpmd/tests/lpm_test_interface.sh | 64 ++ .../x86/intel-lpmd/tools/intel_lpmd_control.c | 97 +++ 44 files changed, 9888 insertions(+) create mode 100644 tools/power/x86/intel-lpmd/README.md create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd.service.in create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd_config.xml create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd_config_F6_M170.xml create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd_config_F6_M189.xml create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd_config_F6_M204.xml create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd_config_examples.xml create mode 100644 tools/power/x86/intel-lpmd/data/intel_lpmd_config_experimental.xml create mode 100644 tools/power/x86/intel-lpmd/data/org.freedesktop.intel_lpmd.conf create mode 100644 tools/power/x86/intel-lpmd/data/org.freedesktop.intel_lpmd.service.in create mode 100644 tools/power/x86/intel-lpmd/doc/WLT_proxy.md create mode 100644 tools/power/x86/intel-lpmd/lpmd-resource.gresource.xml create mode 100644 tools/power/x86/intel-lpmd/man/intel_lpmd.8 create mode 100644 tools/power/x86/intel-lpmd/man/intel_lpmd_config.xml.5 create mode 100644 tools/power/x86/intel-lpmd/man/intel_lpmd_control.8 create mode 100644 tools/power/x86/intel-lpmd/src/include/lpmd.h create mode 100644 tools/power/x86/intel-lpmd/src/include/thermal.h create mode 100644 tools/power/x86/intel-lpmd/src/intel_lpmd_dbus_interface.xml create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_cgroup.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_config.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_cpu.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_cpumask.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_dbus_server.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_helpers.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_hfi.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_irq.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_main.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_misc.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_proc.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_socket.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_state_machine.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_uevent.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_util.c create mode 100644 tools/power/x86/intel-lpmd/src/lpmd_wlt.c create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/include/state_common.h create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/include/wlt_proxy.h create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/spike_mgmt.c create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/state_machine.c create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/state_manager.c create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/state_util.c create mode 100644 tools/power/x86/intel-lpmd/src/wlt_proxy/wlt_proxy.c create mode 100755 tools/power/x86/intel-lpmd/tests/lpm_test_interface.sh create mode 100644 tools/power/x86/intel-lpmd/tools/intel_lpmd_control.c
MAINTAINERS +6 -0
@@ -13099,6 +13099,12 @@ F: drivers/spi/spi-ljca.c F: drivers/usb/misc/usb-ljca.c F: include/linux/usb/ljca.h +INTEL LOW POWER MODE DAEMON (intel-lpmd) +M: Srinivas Pandruvada <[email protected]> +L: [email protected] +S: Maintained +F: tools/power/x86/intel-lpmd/ + INTEL MANAGEMENT ENGINE (mei) M: Alexander Usyskin <[email protected]> L: [email protected]
tools/power/x86/intel-lpmd/README.md new file +182 -0
182 lines not on this page · raw message
tools/power/x86/intel-lpmd/data/intel_lpmd.service.in new file +19 -0
@@ -0,0 +1,19 @@ +[Unit] +Description= Intel Linux Energy Optimizer (lpmd) Service +Documentation=man:intel_lpmd(8) +ConditionVirtualization=no +StartLimitInterval=200 +StartLimitBurst=5 + +[Service] +Type=dbus +SuccessExitStatus=2 +BusName=org.freedesktop.intel_lpmd +ExecStart=@sbindir@/intel_lpmd --systemd --dbus-enable +Restart=on-failure +RestartSec=30 +PrivateTmp=yes + +[Install] +WantedBy=multi-user.target +Alias=org.freedesktop.intel_lpmd.service
tools/power/x86/intel-lpmd/data/intel_lpmd_config.xml new file +106 -0
106 lines not on this page · raw message
tools/power/x86/intel-lpmd/data/intel_lpmd_config_F6_M170.xml new file +166 -0
166 lines not on this page · raw message
tools/power/x86/intel-lpmd/data/intel_lpmd_config_F6_M189.xml new file +188 -0
188 lines not on this page · raw message
tools/power/x86/intel-lpmd/data/intel_lpmd_config_F6_M204.xml new file +213 -0
213 lines not on this page · raw message
tools/power/x86/intel-lpmd/data/intel_lpmd_config_examples.xml new file +213 -0
213 lines not on this page · raw message
tools/power/x86/intel-lpmd/data/intel_lpmd_config_experimental.xml new file +252 -0
252 lines not on this page · raw message
tools/power/x86/intel-lpmd/data/org.freedesktop.intel_lpmd.conf new file +20 -0
@@ -0,0 +1,20 @@ +<?xml version="1.0"?> <!--*-nxml-*--> +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> + +<busconfig> + + <policy user="root"> + <allow own="org.freedesktop.intel_lpmd"/> + <allow send_destination="org.freedesktop.intel_lpmd"/> + <allow receive_sender="org.freedesktop.intel_lpmd"/> + </policy> + + <!-- Only allow members of the power group to communicate + with the daemon --> + <policy context="default"> + <deny send_destination="org.freedesktop.intel_lpmd"/> + <allow receive_sender="org.freedesktop.intel_lpmd"/> + </policy> + +</busconfig>
tools/power/x86/intel-lpmd/data/org.freedesktop.intel_lpmd.service.in new file +5 -0
@@ -0,0 +1,5 @@ +[D-BUS Service] +Name=org.freedesktop.intel_lpmd +Exec=/bin/false +User=root +SystemdService=org.freedesktop.intel_lpmd.service
tools/power/x86/intel-lpmd/doc/WLT_proxy.md new file +84 -0
84 lines not on this page · raw message
tools/power/x86/intel-lpmd/lpmd-resource.gresource.xml new file +6 -0
@@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix="/org/freedesktop/intel_lpmd"> + <file preprocess="xml-stripblanks">src/intel_lpmd_dbus_interface.xml</file> + </gresource> +</gresources>
tools/power/x86/intel-lpmd/man/intel_lpmd.8 new file +79 -0
79 lines not on this page · raw message
tools/power/x86/intel-lpmd/man/intel_lpmd_config.xml.5 new file +329 -0
329 lines not on this page · raw message
tools/power/x86/intel-lpmd/man/intel_lpmd_control.8 new file +44 -0
44 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/include/lpmd.h new file +408 -0
408 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/include/thermal.h new file +94 -0
94 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/intel_lpmd_dbus_interface.xml new file +27 -0
@@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!DOCTYPE node PUBLIC + "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN" + "http://standards.freedesktop.org/dbus/1.0/introspect.dtd"> + +<node> + <interface name="org.freedesktop.intel_lpmd"> + + <method name="Terminate"> + </method> + + <method name="LPM_FORCE_ON"> + </method> + + <method name="LPM_FORCE_OFF"> + </method> + + <method name="LPM_AUTO"> + </method> + + <method name="GetState"> + <arg type="s" name="state" direction="out"/> + </method> + + </interface> +</node>
tools/power/x86/intel-lpmd/src/lpmd_cgroup.c new file +213 -0
213 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_config.c new file +493 -0
340 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_cpu.c new file +481 -0
481 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_cpumask.c new file +479 -0
479 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_dbus_server.c new file +274 -0
274 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_helpers.c new file +385 -0
385 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_hfi.c new file +373 -0
373 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_irq.c new file +262 -0
262 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_main.c new file +297 -0
297 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_misc.c new file +483 -0
483 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_proc.c new file +492 -0
492 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_socket.c new file +149 -0
149 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_state_machine.c new file +747 -0
747 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_uevent.c new file +133 -0
133 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_util.c new file +369 -0
369 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/lpmd_wlt.c new file +107 -0
107 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/wlt_proxy/include/state_common.h new file +106 -0
106 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/wlt_proxy/include/wlt_proxy.h new file +10 -0
Lines of this file are not shown. View the raw message.
tools/power/x86/intel-lpmd/src/wlt_proxy/spike_mgmt.c new file +202 -0
202 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/wlt_proxy/state_machine.c new file +314 -0
314 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/wlt_proxy/state_manager.c new file +302 -0
302 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/wlt_proxy/state_util.c new file +584 -0
584 lines not on this page · raw message
tools/power/x86/intel-lpmd/src/wlt_proxy/wlt_proxy.c new file +31 -0
Lines of this file are not shown. View the raw message.
tools/power/x86/intel-lpmd/tests/lpm_test_interface.sh new file +64 -0
64 lines not on this page · raw message
tools/power/x86/intel-lpmd/tools/intel_lpmd_control.c new file +97 -0
97 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.53.0
Part of the diff is not shown here. View the raw message.
PATCH 2/3 tools/LPMD: Add Makefile
In reply to Maciej Wieczor-RetmanFrom: Fabio M. De Francesco <[email protected]>
The Makefile builds both intel_lpmd and intel_lpmd_control, generates config.h and lpmd-resource.c at build time, and installs binaries, systemd unit, D-Bus policy, and XML configuration files.
The build warns and fails if the dependencies listed in tools/power/x86/intel-lpmd/README.md are not installed.
--- tools/power/x86/intel-lpmd/Makefile | 155 ++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 tools/power/x86/intel-lpmd/Makefile
tools/power/x86/intel-lpmd/Makefile new file +155 -0
@@ -0,0 +1,155 @@ +# SPDX-License-Identifier: GPL-2.0 +include ../../../scripts/Makefile.include + +# Install paths (matching automake defaults) +prefix ?= /usr/local +sbindir ?= $(prefix)/sbin +confdir ?= $(prefix)/etc/intel_lpmd +rundir ?= $(prefix)/var/run/intel_lpmd +systemd_unitdir ?= /usr/lib/systemd/system +dbus_sysdir ?= /etc/dbus-1/system.d + +ifeq ($(srctree),) +srctree := $(patsubst %/,%,$(dir $(CURDIR))) +srctree := $(patsubst %/,%,$(dir $(srctree))) +srctree := $(patsubst %/,%,$(dir $(srctree))) +srctree := $(patsubst %/,%,$(dir $(srctree))) +endif + +# Do not use make's built-in rules +MAKEFLAGS += -r + +VERSION = 0.1.0 + +# pkg-config dependencies +ifeq ($(shell pkg-config --exists glib-2.0 gio-2.0 gio-unix-2.0 gmodule-2.0 && echo yes),yes) + GLIB_CFLAGS := $(shell pkg-config --cflags glib-2.0 gio-2.0 gio-unix-2.0 gmodule-2.0) + GLIB_LIBS := $(shell pkg-config --libs glib-2.0 gio-2.0 gio-unix-2.0 gmodule-2.0) +else + $(error No glib-2.0 pkg-config found, please install libglib2.0-dev/glib2-devel) +endif + +ifeq ($(shell pkg-config --exists libxml-2.0 && echo yes),yes) + XML2_CFLAGS := $(shell pkg-config --cflags libxml-2.0) + XML2_LIBS := $(shell pkg-config --libs libxml-2.0) +else + $(error No libxml-2.0 pkg-config found, please install libxml2-dev/libxml2-devel) +endif + +ifeq ($(shell pkg-config --exists upower-glib && echo yes),yes) + UPOWER_CFLAGS := $(shell pkg-config --cflags upower-glib) + UPOWER_LIBS := $(shell pkg-config --libs upower-glib) +else + $(error No upower-glib pkg-config found, please install libupower-glib-dev/upower-devel) +endif + +ifeq ($(shell pkg-config --exists libnl-3.0 libnl-genl-3.0 && echo yes),yes) + NL3_CFLAGS := $(shell pkg-config --cflags libnl-3.0 libnl-genl-3.0) + NL3_LIBS := $(shell pkg-config --libs libnl-3.0 libnl-genl-3.0) +else + $(error No libnl-3.0 pkg-config found, please install libnl-3-dev libnl-genl-3-dev/libnl3-devel) +endif + +ifeq ($(shell pkg-config --exists libsystemd && echo yes),yes) + SYSTEMD_CFLAGS := $(shell pkg-config --cflags libsystemd) + SYSTEMD_LIBS := $(shell pkg-config --libs libsystemd) +else + $(error No libsystemd pkg-config found, please install libsystemd-dev/systemd-devel) +endif + +override CFLAGS += -O2 -Wall -g -DGDBUS=1 \ + -DGLIB_SUPPORT \ + -DGETTEXT_PACKAGE=\"intel_lpmd\" \ + -DPACKAGE_VERSION=\"$(VERSION)\" \ + -DTDCONFDIR=\"$(confdir)\" \ + -DTDRUNDIR=\"$(rundir)\" \ + -DTDLOCALEDIR=\"$(prefix)/share/locale\" \ + -I. -Isrc/include -Isrc/wlt_proxy/include \ + $(GLIB_CFLAGS) $(XML2_CFLAGS) $(UPOWER_CFLAGS) $(NL3_CFLAGS) $(SYSTEMD_CFLAGS) + +override LDFLAGS += \ + $(GLIB_LIBS) $(XML2_LIBS) $(UPOWER_LIBS) $(NL3_LIBS) $(SYSTEMD_LIBS) -lm + +# Source files +LPMD_SRCS = \ + src/lpmd_cgroup.c \ + src/lpmd_config.c \ + src/lpmd_cpu.c \ + src/lpmd_cpumask.c \ + src/lpmd_dbus_server.c \ + src/lpmd_helpers.c \ + src/lpmd_hfi.c \ + src/lpmd_irq.c \ + src/lpmd_main.c \ + src/lpmd_misc.c \ + src/lpmd_proc.c \ + src/lpmd_socket.c \ + src/lpmd_state_machine.c \ + src/lpmd_uevent.c \ + src/lpmd_util.c \ + src/lpmd_wlt.c \ + src/wlt_proxy/spike_mgmt.c \ + src/wlt_proxy/state_machine.c \ + src/wlt_proxy/state_manager.c \ + src/wlt_proxy/state_util.c \ + src/wlt_proxy/wlt_proxy.c + +LPMD_OBJS = $(LPMD_SRCS:.c=.o) lpmd-resource.o +CTRL_OBJS = tools/intel_lpmd_control.o + +ALL_TARGETS := intel_lpmd intel_lpmd_control +ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) + +all: $(ALL_PROGRAMS) + +# Generated files +config.h: FORCE + $(QUIET_GEN)echo '/* Auto-generated - do not edit */' > $@ && \ + echo '#define GDBUS 1' >> $@ && \ + echo '#define GETTEXT_PACKAGE "intel_lpmd"' >> $@ && \ + echo '#define PACKAGE_VERSION "$(VERSION)"' >> $@ + +lpmd-resource.c: lpmd-resource.gresource.xml src/intel_lpmd_dbus_interface.xml + $(QUIET_GEN)glib-compile-resources --sourcedir=. --generate-source \ + --target=$@ $< + +prepare: config.h lpmd-resource.c + +%.o: %.c | prepare + $(Q)mkdir -p $(dir $@) + $(QUIET_CC)$(CC) $(CFLAGS) -c -o $@ $< + +$(OUTPUT)intel_lpmd: $(LPMD_OBJS) + $(QUIET_LINK)$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@ + +$(OUTPUT)intel_lpmd_control: $(CTRL_OBJS) + $(QUIET_LINK)$(CC) $(CFLAGS) $< $(GLIB_LIBS) -o $@ + +DATA_CONFIGS = \ + data/intel_lpmd_config.xml \ + data/intel_lpmd_config_examples.xml \ + data/intel_lpmd_config_experimental.xml \ + data/intel_lpmd_config_F6_M170.xml \ + data/intel_lpmd_config_F6_M189.xml \ + data/intel_lpmd_config_F6_M204.xml + +install: $(ALL_PROGRAMS) + install -d -m 755 $(DESTDIR)$(sbindir) + install $(OUTPUT)intel_lpmd $(DESTDIR)$(sbindir) + install $(OUTPUT)intel_lpmd_control $(DESTDIR)$(sbindir) + install -d -m 755 $(DESTDIR)$(confdir) + install -m 644 $(DATA_CONFIGS) $(DESTDIR)$(confdir) + install -d -m 755 $(DESTDIR)$(rundir) + install -d -m 755 $(DESTDIR)$(systemd_unitdir) + sed 's|@sbindir@|$(sbindir)|g' data/intel_lpmd.service.in > \ + $(DESTDIR)$(systemd_unitdir)/intel_lpmd.service + install -d -m 755 $(DESTDIR)$(dbus_sysdir) + install -m 644 data/org.freedesktop.intel_lpmd.conf $(DESTDIR)$(dbus_sysdir) + +clean: + rm -f $(ALL_PROGRAMS) config.h lpmd-resource.c + find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete + +FORCE: + +.PHONY: all install clean FORCE prepare
Signature · 1 line
2.53.0
PATCH 3/3 tools: Add LPMD entry to tools Makefile
In reply to Maciej Wieczor-RetmanFrom: Fabio M. De Francesco <[email protected]>
Make LPMD buildable from the tools/power/x86/intel-lpmd directory.
--- tools/Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
tools/Makefile +7 -6
@@ -21,6 +21,7 @@ help: @echo ' gpio - GPIO tools' @echo ' hv - tools used when in Hyper-V clients' @echo ' iio - IIO tools' + @echo ' intel-lpmd - Intel Low Power Mode Daemon tool' @echo ' intel-speed-select - Intel Speed Select tool' @echo ' kvm_stat - top-like utility for displaying kvm statistics' @echo ' leds - LEDs tools'
@@ -102,7 +103,7 @@ selftests: FORCE thermal: FORCE $(call descend,lib/$@) -turbostat x86_energy_perf_policy intel-speed-select: FORCE +turbostat x86_energy_perf_policy intel-lpmd intel-speed-select: FORCE $(call descend,power/x86/$@) tmon: FORCE
@@ -144,7 +145,7 @@ selftests_install: thermal_install: $(call descend,lib/$(@:_install=),install) -turbostat_install x86_energy_perf_policy_install intel-speed-select_install: +turbostat_install x86_energy_perf_policy_install intel-lpmd_install intel-speed-select_install: $(call descend,power/x86/$(@:_install=),install) tmon_install:
@@ -170,7 +171,7 @@ install: acpi_install counter_install cpupower_install dma_install gpio_install perf_install selftests_install turbostat_install usb_install \ virtio_install mm_install bpf_install x86_energy_perf_policy_install \ tmon_install freefall_install objtool_install kvm_stat_install \ - wmi_install debugging_install intel-speed-select_install \ + wmi_install debugging_install intel-lpmd_install intel-speed-select_install \ tracing_install thermometer_install thermal-engine_install ynl_install acpi_clean:
@@ -204,7 +205,7 @@ selftests_clean: thermal_clean: $(call descend,lib/thermal,clean) -turbostat_clean x86_energy_perf_policy_clean intel-speed-select_clean: +turbostat_clean x86_energy_perf_policy_clean intel-lpmd_clean intel-speed-select_clean: $(call descend,power/x86/$(@:_clean=),clean) thermometer_clean:
@@ -230,7 +231,7 @@ clean: acpi_clean counter_clean cpupower_clean dma_clean hv_clean firewire_clean mm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \ freefall_clean build_clean libbpf_clean libsubcmd_clean \ gpio_clean objtool_clean leds_clean wmi_clean firmware_clean debugging_clean \ - intel-speed-select_clean tracing_clean thermal_clean thermometer_clean thermal-engine_clean \ - sched_ext_clean ynl_clean + intel-lpmd_clean intel-speed-select_clean tracing_clean thermal_clean \ + thermometer_clean thermal-engine_clean sched_ext_clean ynl_clean .PHONY: FORCE
Signature · 1 line
2.53.0