From 592a90bb8e0d733b55790bc6f05cca2f51f17f24 Mon Sep 17 00:00:00 2001 From: Kate Hsuan Date: Mon, 5 May 2025 15:17:19 +0800 Subject: [PATCH] Update to the upstream version 0.0.9 Update to the upstream version 0.0.9. This work included the fix patches to resolve the unused variables and functions issue. Resolves: RHEL-87018 RHEL-87020 --- ...Fix-compiler-above-array-bound-error.patch | 51 ------------------- 0001-lpmd_util-Remove-unused-variables.patch | 37 ++++++++++++++ ...roxy-state_manager-Fix-Werror-switch.patch | 26 ++++++++++ ...y-state_util-Remove-unused-variables.patch | 29 +++++++++++ ...util-Drop-unused-function-read_tsc_c.patch | 33 ++++++++++++ intel-lpmd.spec | 17 +++++-- sources | 2 +- 7 files changed, 140 insertions(+), 55 deletions(-) delete mode 100644 0001-lpmd_cpu-Fix-compiler-above-array-bound-error.patch create mode 100644 0001-lpmd_util-Remove-unused-variables.patch create mode 100644 0002-wlt_proxy-state_manager-Fix-Werror-switch.patch create mode 100644 0003-wlt_proxy-state_util-Remove-unused-variables.patch create mode 100644 0004-wlt_proxy-state_util-Drop-unused-function-read_tsc_c.patch diff --git a/0001-lpmd_cpu-Fix-compiler-above-array-bound-error.patch b/0001-lpmd_cpu-Fix-compiler-above-array-bound-error.patch deleted file mode 100644 index e24985d..0000000 --- a/0001-lpmd_cpu-Fix-compiler-above-array-bound-error.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 1918cd77f5f26eeb4f9288ed45072068e1b4da34 Mon Sep 17 00:00:00 2001 -From: Kate Hsuan -Date: Tue, 16 Jul 2024 11:31:00 +0800 -Subject: [PATCH] lpmd_cpu: Fix compiler above array bound error -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -n file included from /usr/include/glib-2.0/glib.h:64, - from src/lpmd.h:48, - from src/lpmd_cpu.c:52: -src/lpmd_cpu.c: In function ‘add_cpu’: -src/lpmd_cpu.c:408:66: error: array subscript 8 is above array bounds of ‘struct lpm_cpus[7]’ [-Werror=array-bounds=] - 408 | lpmd_log_debug ("\tDetected %s CPU%d\n", cpumasks[idx].name, cpu); - | ~~~~~~~~^~~~~ -src/lpmd_cpu.c:67:24: note: while referencing ‘cpumasks’ - 67 | static struct lpm_cpus cpumasks[CPUMASK_MAX] = { - | ^~~~~~~~ -cc1: all warnings being treated as errors -make[2]: *** [Makefile:686: src/intel_lpmd-lpmd_cpu.o] Error 1 -make[1]: *** [Makefile:868: all-recursive] Error 1 -make: *** [Makefile:459: all] Error 2 ---- - src/lpmd_cpu.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/src/lpmd_cpu.c b/src/lpmd_cpu.c -index 310bf65..808ae4b 100644 ---- a/src/lpmd_cpu.c -+++ b/src/lpmd_cpu.c -@@ -402,10 +402,14 @@ int add_cpu(int cpu, enum cpumask_idx idx) - if (idx & (CPUMASK_HFI | CPUMASK_HFI_SUV | CPUMASK_HFI_BANNED)) - return 0; - -- if (idx == CPUMASK_LPM_DEFAULT) -+ if (idx == CPUMASK_LPM_DEFAULT) { - lpmd_log_info ("\tDetected %s CPU%d\n", cpumasks[idx].name, cpu); -- else -- lpmd_log_debug ("\tDetected %s CPU%d\n", cpumasks[idx].name, cpu); -+ } else { -+ if (idx < CPUMASK_MAX) -+ lpmd_log_debug ("\tDetected %s CPU%d\n", cpumasks[idx].name, cpu); -+ else -+ lpmd_log_debug ("\tIncorrect CPU ID for CPU%d\n", cpu); -+ } - - return 0; - } --- -2.45.2 - diff --git a/0001-lpmd_util-Remove-unused-variables.patch b/0001-lpmd_util-Remove-unused-variables.patch new file mode 100644 index 0000000..75a4766 --- /dev/null +++ b/0001-lpmd_util-Remove-unused-variables.patch @@ -0,0 +1,37 @@ +From c2cea33c873146f1b6186c02fe79d1a2bb1c7867 Mon Sep 17 00:00:00 2001 +From: Kate Hsuan +Date: Fri, 2 May 2025 16:49:00 +0800 +Subject: [PATCH 1/4] lpmd_util: Remove unused variables + +Remove unused variables. +--- + src/lpmd_util.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/src/lpmd_util.c b/src/lpmd_util.c +index cd3123a..55f7874 100644 +--- a/src/lpmd_util.c ++++ b/src/lpmd_util.c +@@ -83,7 +83,6 @@ static int probe_gfx_util_sysfs(void) + { + FILE *fp; + char buf[8]; +- bool gt0_is_gt; + + if (access("/sys/class/drm/card0/device/tile0/gt0/gtidle/idle_residency_ms", R_OK)) + return 1; +@@ -119,11 +118,9 @@ static int get_gfx_util_sysfs(unsigned long long time_ms) + { + static unsigned long long gfx_rc6_prev = ULLONG_MAX, sam_mc6_prev = ULLONG_MAX; + unsigned long long gfx_rc6, sam_mc6; +- unsigned long long val; + FILE *fp; + int gfx_util, sam_util; + int ret; +- int i; + + gfx_util = sam_util = -1; + +-- +2.49.0 + diff --git a/0002-wlt_proxy-state_manager-Fix-Werror-switch.patch b/0002-wlt_proxy-state_manager-Fix-Werror-switch.patch new file mode 100644 index 0000000..19537c7 --- /dev/null +++ b/0002-wlt_proxy-state_manager-Fix-Werror-switch.patch @@ -0,0 +1,26 @@ +From 311b7929d4c821630fabf5293ec5b4bec5411162 Mon Sep 17 00:00:00 2001 +From: Kate Hsuan +Date: Fri, 2 May 2025 16:49:42 +0800 +Subject: [PATCH 2/4] wlt_proxy: state_manager: Fix -Werror=switch + +Fix the swicth expression to avoid -Werror=switch warnning. +--- + src/wlt_proxy/state_manager.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/wlt_proxy/state_manager.c b/src/wlt_proxy/state_manager.c +index 7841135..9753442 100644 +--- a/src/wlt_proxy/state_manager.c ++++ b/src/wlt_proxy/state_manager.c +@@ -285,6 +285,8 @@ int staytime_to_staycount(enum state_idx state) + case PERF_MODE: + stay_count = (int)PERF_MODE_STAY/get_poll_ms(PERF_MODE); + break; ++ default: ++ break; + } + return stay_count; + } +-- +2.49.0 + diff --git a/0003-wlt_proxy-state_util-Remove-unused-variables.patch b/0003-wlt_proxy-state_util-Remove-unused-variables.patch new file mode 100644 index 0000000..15151a8 --- /dev/null +++ b/0003-wlt_proxy-state_util-Remove-unused-variables.patch @@ -0,0 +1,29 @@ +From 4277f3496dc51f89ed0815e0f51659338f7a6ba9 Mon Sep 17 00:00:00 2001 +From: Kate Hsuan +Date: Fri, 2 May 2025 16:52:16 +0800 +Subject: [PATCH 3/4] wlt_proxy: state_util: Remove unused variables + +Remove unused variables. +--- + src/wlt_proxy/state_util.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/wlt_proxy/state_util.c b/src/wlt_proxy/state_util.c +index 95422c8..9d633d5 100644 +--- a/src/wlt_proxy/state_util.c ++++ b/src/wlt_proxy/state_util.c +@@ -381,10 +381,9 @@ static int read_aperf_mperf_tsc_perf(struct thread_data *t, int cpu) { + /*Calc perf [cpu utilization per core] difference from MSR registers */ + int update_perf_diffs(float *sum_norm_perf, int stat_init_only) { + +- int fd, maxed_cpu = -1; ++ int maxed_cpu = -1; + float min_load = 100.0, min_s0 = 1.0, next_s0 = 1.0; + float max_load = 0, max_2nd_load = 0, max_3rd_load = 0, next_load = 0; +- uint64_t aperf_raw, mperf_raw, pperf_raw, tsc_raw, poll_cpu_us = 0; + int t, min_s0_cpu = 0, first_pass = 1; + + for (t = 0; t < get_max_online_cpu(); t++) { +-- +2.49.0 + diff --git a/0004-wlt_proxy-state_util-Drop-unused-function-read_tsc_c.patch b/0004-wlt_proxy-state_util-Drop-unused-function-read_tsc_c.patch new file mode 100644 index 0000000..39d03c8 --- /dev/null +++ b/0004-wlt_proxy-state_util-Drop-unused-function-read_tsc_c.patch @@ -0,0 +1,33 @@ +From af6d8f93a0a1041bd936b8901707e1253c5e5279 Mon Sep 17 00:00:00 2001 +From: Kate Hsuan +Date: Fri, 2 May 2025 17:07:21 +0800 +Subject: [PATCH 4/4] wlt_proxy: state_util: Drop unused function + read_tsc_config() + +Drop the unused function read_tsc_config(). +--- + src/wlt_proxy/state_util.c | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/src/wlt_proxy/state_util.c b/src/wlt_proxy/state_util.c +index 9d633d5..f35242e 100644 +--- a/src/wlt_proxy/state_util.c ++++ b/src/wlt_proxy/state_util.c +@@ -268,14 +268,6 @@ static unsigned int read_mperf_config(void) { + return read_perf_counter_info_n(path, format); + } + +-/*helper - pperf reading */ +-static unsigned int read_tsc_config(void) { +- const char *const path = "/sys/bus/event_source/devices/msr/events/tsc"; +- const char *const format = "event=%x"; +- +- return read_perf_counter_info_n(path, format); +-} +- + /*helper - pperf reading */ + static unsigned int read_msr_type(void) { + const char *const path = "/sys/bus/event_source/devices/msr/type"; +-- +2.49.0 + diff --git a/intel-lpmd.spec b/intel-lpmd.spec index 26e0b7e..f3dad33 100644 --- a/intel-lpmd.spec +++ b/intel-lpmd.spec @@ -1,7 +1,7 @@ %global daemon_name intel_lpmd Name: intel-lpmd -Version: 0.0.6 +Version: 0.0.9 Release: %autorelease Summary: Intel Low Power Mode Daemon @@ -9,8 +9,15 @@ License: GPL-2.0-or-later URL: https://github.com/intel/intel-lpmd Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz -# Fix compiler error -Patch0: 0001-lpmd_cpu-Fix-compiler-above-array-bound-error.patch +# Drop unused variables https://github.com/intel/intel-lpmd/pull/93 +# https://github.com/intel/intel-lpmd/commit/c2cea33c873146f1b6186c02fe79d1a2bb1c7867.patch +Patch1001: 0001-lpmd_util-Remove-unused-variables.patch +# https://github.com/intel/intel-lpmd/commit/311b7929d4c821630fabf5293ec5b4bec5411162.patch +Patch1002: 0002-wlt_proxy-state_manager-Fix-Werror-switch.patch +# https://github.com/intel/intel-lpmd/commit/4277f3496dc51f89ed0815e0f51659338f7a6ba9.patch +Patch1003: 0003-wlt_proxy-state_util-Remove-unused-variables.patch +# https://github.com/intel/intel-lpmd/commit/af6d8f93a0a1041bd936b8901707e1253c5e5279.patch +Patch1004: 0004-wlt_proxy-state_util-Drop-unused-function-read_tsc_c.patch ExclusiveArch: x86_64 @@ -24,6 +31,7 @@ BuildRequires: libxml2-devel BuildRequires: libtool BuildRequires: systemd-devel BuildRequires: systemd-units +BuildRequires: upower-devel %description Intel Low Power Model Daemon is a Linux daemon used to optimize active idle @@ -66,12 +74,15 @@ install -D -p -m 644 src/%{daemon_name}_dbus_interface.xml %{buildroot}/%{_datad %{_sbindir}/%{daemon_name} %dir %{_sysconfdir}/%{daemon_name} %config(noreplace) %{_sysconfdir}/%{daemon_name}/%{daemon_name}_config.xml +%config(noreplace) %{_sysconfdir}/%{daemon_name}/intel_lpmd_config_F6_M170.xml +%config(noreplace) %{_sysconfdir}/%{daemon_name}/intel_lpmd_config_F6_M189.xml %{_datadir}/dbus-1/interfaces/org.freedesktop.%{daemon_name}.xml %{_datadir}/dbus-1/system.d/org.freedesktop.%{daemon_name}.conf %{_datadir}/dbus-1/system-services/org.freedesktop.%{daemon_name}.service %{_unitdir}/%{daemon_name}.service %{_mandir}/man5/%{daemon_name}_config.xml.5* %{_mandir}/man8/%{daemon_name}.8* +%{_mandir}/man8/%{daemon_name}_control.8* %changelog %autochangelog diff --git a/sources b/sources index 9d90131..201dd6b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (intel-lpmd-0.0.6.tar.gz) = b29e4525aa76b169f4d246903f8b3d500d936e14085ba12ce3f31a0c6dfb80bebdd9adfd92ef5db9a5d2ee772c7fe8d6c9662f19de6346ef5354a082b4cb63dc +SHA512 (intel-lpmd-0.0.9.tar.gz) = ed7977960b9794e0fd9ba46f37f3aaaee4082ad4c884a69855faa75b6b3b2c1ac13992bbc808c88460717455144ef54da89b21de58773283259752ad88f1f03b