diff --git a/.gitignore b/.gitignore index 7c5444e..e7cf50c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /intel-lpmd-0.0.2.tar.gz +/intel-lpmd-0.0.3.tar.gz diff --git a/13.patch b/13.patch deleted file mode 100644 index dca1468..0000000 --- a/13.patch +++ /dev/null @@ -1,241 +0,0 @@ -From 5ba48f7215b94dc43a28d2b5264c6fa65989add9 Mon Sep 17 00:00:00 2001 -From: Ali Erdinc Koroglu -Date: Tue, 17 Oct 2023 15:16:22 +0300 -Subject: [PATCH 1/2] Werror fixes - ---- - src/lpmd_config.c | 28 ++++++++++++++-------------- - src/lpmd_cpu.c | 2 +- - src/lpmd_main.c | 2 -- - src/lpmd_proc.c | 5 ----- - src/lpmd_util.c | 2 -- - 5 files changed, 15 insertions(+), 24 deletions(-) - -diff --git a/src/lpmd_config.c b/src/lpmd_config.c -index e360b29..a3c5bcf 100644 ---- a/src/lpmd_config.c -+++ b/src/lpmd_config.c -@@ -54,7 +54,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co - if (tmp_value) { - lpmd_log_info ("node type: Element, name: %s, value: %s\n", cur_node->name, - tmp_value); -- if (!strncmp (cur_node->name, "Mode", strlen ("Mode"))) { -+ if (!strncmp((const char*)cur_node->name, "Mode", strlen("Mode"))) { - errno = 0; - lpmd_config->mode = strtol (tmp_value, &pos, 10); - lpmd_log_info ("mode %d, errno %d, tmp_value %p, pos %p\n", lpmd_config->mode, -@@ -64,21 +64,21 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co - || lpmd_config->mode < 0) - goto err; - } -- else if (!strncmp (cur_node->name, "HfiLpmEnable", strlen ("HfiEnable"))) { -+ else if (!strncmp((const char*)cur_node->name, "HfiLpmEnable", strlen("HfiEnable"))) { - errno = 0; - lpmd_config->hfi_lpm_enable = strtol (tmp_value, &pos, 10); - if (errno || *pos != '\0' - || (lpmd_config->hfi_lpm_enable != 1 && lpmd_config->hfi_lpm_enable != 0)) - goto err; - } -- else if (!strncmp (cur_node->name, "HfiSuvEnable", strlen ("HfiEnable"))) { -+ else if (!strncmp((const char*)cur_node->name, "HfiSuvEnable", strlen("HfiEnable"))) { - errno = 0; - lpmd_config->hfi_suv_enable = strtol (tmp_value, &pos, 10); - if (errno || *pos != '\0' - || (lpmd_config->hfi_suv_enable != 1 && lpmd_config->hfi_suv_enable != 0)) - goto err; - } -- else if (!strncmp (cur_node->name, "EntryDelayMS", strlen ("EntryDelayMS"))) { -+ else if (!strncmp((const char*)cur_node->name, "EntryDelayMS", strlen ("EntryDelayMS"))) { - errno = 0; - lpmd_config->util_entry_delay = strtol (tmp_value, &pos, 10); - if (errno -@@ -86,7 +86,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co - != '\0'|| lpmd_config->util_entry_delay < 0 || lpmd_config->util_entry_delay > UTIL_DELAY_MAX) - goto err; - } -- else if (!strncmp (cur_node->name, "ExitDelayMS", strlen ("ExitDelayMS"))) { -+ else if (!strncmp((const char*)cur_node->name, "ExitDelayMS", strlen ("ExitDelayMS"))) { - errno = 0; - lpmd_config->util_exit_delay = strtol (tmp_value, &pos, 10); - if (errno -@@ -94,7 +94,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co - != '\0'|| lpmd_config->util_exit_delay < 0 || lpmd_config->util_exit_delay > UTIL_DELAY_MAX) - goto err; - } -- else if (!strncmp (cur_node->name, "util_entry_threshold", -+ else if (!strncmp((const char*)cur_node->name, "util_entry_threshold", - strlen ("util_entry_threshold"))) { - errno = 0; - lpmd_config->util_entry_threshold = strtol (tmp_value, &pos, 10); -@@ -102,7 +102,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co - || lpmd_config->util_entry_threshold > 100) - goto err; - } -- else if (!strncmp (cur_node->name, "util_exit_threshold", -+ else if (!strncmp((const char*)cur_node->name, "util_exit_threshold", - strlen ("util_exit_threshold"))) { - errno = 0; - lpmd_config->util_exit_threshold = strtol (tmp_value, &pos, 10); -@@ -110,7 +110,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co - || lpmd_config->util_exit_threshold > 100) - goto err; - } -- else if (!strncmp (cur_node->name, "EntryHystMS", strlen ("EntryHystMS"))) { -+ else if (!strncmp((const char*)cur_node->name, "EntryHystMS", strlen ("EntryHystMS"))) { - errno = 0; - lpmd_config->util_entry_hyst = strtol (tmp_value, &pos, 10); - if (errno -@@ -118,7 +118,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co - != '\0'|| lpmd_config->util_entry_hyst < 0 || lpmd_config->util_entry_hyst > UTIL_HYST_MAX) - goto err; - } -- else if (!strncmp (cur_node->name, "ExitHystMS", strlen ("ExitHystMS"))) { -+ else if (!strncmp((const char*)cur_node->name, "ExitHystMS", strlen ("ExitHystMS"))) { - errno = 0; - lpmd_config->util_exit_hyst = strtol (tmp_value, &pos, 10); - if (errno -@@ -126,7 +126,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co - != '\0'|| lpmd_config->util_exit_hyst < 0 || lpmd_config->util_exit_hyst > UTIL_HYST_MAX) - goto err; - } -- else if (!strncmp (cur_node->name, "IgnoreITMT", strlen ("IgnoreITMT"))) { -+ else if (!strncmp((const char*)cur_node->name, "IgnoreITMT", strlen ("IgnoreITMT"))) { - errno = 0; - lpmd_config->ignore_itmt = strtol (tmp_value, &pos, 10); - if (errno -@@ -134,14 +134,14 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co - != '\0'|| lpmd_config->ignore_itmt < 0 || lpmd_config->ignore_itmt > 1) - goto err; - } -- else if (!strncmp (cur_node->name, "lp_mode_cpus", strlen ("lp_mode_cpus"))) { -+ else if (!strncmp((const char*)cur_node->name, "lp_mode_cpus", strlen ("lp_mode_cpus"))) { - if (!strncmp (tmp_value, "-1", strlen ("-1"))) - lpmd_config->lp_mode_cpus[0] = '\0'; - else - snprintf (lpmd_config->lp_mode_cpus, sizeof(lpmd_config->lp_mode_cpus), - "%s", tmp_value); - } -- else if (!strncmp (cur_node->name, "PerformanceDef", strlen ("PerformanceDef"))) { -+ else if (!strncmp((const char*)cur_node->name, "PerformanceDef", strlen ("PerformanceDef"))) { - errno = 0; - lpmd_config->performance_def = strtol (tmp_value, &pos, 10); - if (errno || *pos != '\0') -@@ -155,7 +155,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co - else - goto err; - } -- else if (!strncmp (cur_node->name, "BalancedDef", strlen ("BalancedDef"))) { -+ else if (!strncmp((const char*)cur_node->name, "BalancedDef", strlen ("BalancedDef"))) { - errno = 0; - lpmd_config->balanced_def = strtol (tmp_value, &pos, 10); - if (errno || *pos != '\0') -@@ -169,7 +169,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co - else - goto err; - } -- else if (!strncmp (cur_node->name, "PowersaverDef", strlen ("PowersaverDef"))) { -+ else if (!strncmp((const char*)cur_node->name, "PowersaverDef", strlen ("PowersaverDef"))) { - errno = 0; - lpmd_config->powersaver_def = strtol (tmp_value, &pos, 10); - if (errno || *pos != '\0') -diff --git a/src/lpmd_cpu.c b/src/lpmd_cpu.c -index 04b47fc..703baea 100644 ---- a/src/lpmd_cpu.c -+++ b/src/lpmd_cpu.c -@@ -161,7 +161,7 @@ static int cpumask_to_hexstr(cpu_set_t *mask, char *str, int size) - int cpu; - int i; - int pos = 0; -- char c; -+ char c = 0; - - for (cpu = 0; cpu < topo_max_cpus; cpu++) { - i = cpu % 4; -diff --git a/src/lpmd_main.c b/src/lpmd_main.c -index 94bcc5b..fc671e9 100644 ---- a/src/lpmd_main.c -+++ b/src/lpmd_main.c -@@ -157,9 +157,7 @@ int main(int argc, char *argv[]) - gboolean log_info = FALSE; - gboolean log_debug = FALSE; - gboolean no_daemon = FALSE; -- gboolean ignore_itmt = FALSE; - gboolean systemd = FALSE; -- gchar *conf_file = NULL; - gboolean success; - GOptionContext *opt_ctx; - int ret; -diff --git a/src/lpmd_proc.c b/src/lpmd_proc.c -index 88ced8a..6361ee9 100644 ---- a/src/lpmd_proc.c -+++ b/src/lpmd_proc.c -@@ -151,8 +151,6 @@ enum lpm_state { - /* Force off by default */ - int lpm_state = LPM_USER_OFF; - --static pthread_mutex_t lpm_mutex; -- - /* - * 1: request valid and already satisfied. 0: respond valid and need to continue to process. -1: request invalid - */ -@@ -488,8 +486,6 @@ static void connect_to_power_profile_daemon(void) - /* Poll time out default */ - #define POLL_TIMEOUT_DEFAULT_SECONDS 1 - --static int poll_timeout_sec = POLL_TIMEOUT_DEFAULT_SECONDS; -- - static bool main_loop_terminate; - - // called from LPMD main thread to process user and system messages -@@ -540,7 +536,6 @@ static int proc_message(message_capsul_t *msg) - static void* lpmd_core_main_loop(void *arg) - { - int interval, n; -- unsigned int i; - static int first_try = 1; - - for (;;) { -diff --git a/src/lpmd_util.c b/src/lpmd_util.c -index d8e1543..8210cb7 100644 ---- a/src/lpmd_util.c -+++ b/src/lpmd_util.c -@@ -198,8 +198,6 @@ enum system_status { - - static enum system_status sys_stat = SYS_NORMAL; - --static struct timespec tp1, tp2; -- - static int first_run = 1; - - static enum system_status get_sys_stat(void) - -From 1668ed0265ed7cd0e21fe33dd82404b8087bb844 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ali=20Erdin=C3=A7=20K=C3=B6ro=C4=9Flu?= - -Date: Fri, 27 Oct 2023 14:25:05 +0300 -Subject: [PATCH 2/2] Update Makefile - -use conditional variable ---- - tools/Makefile | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tools/Makefile b/tools/Makefile -index 9b5924c..670a74e 100755 ---- a/tools/Makefile -+++ b/tools/Makefile -@@ -2,12 +2,12 @@ CFLAGS_DBUS_GLIB = $(shell pkg-config --cflags --libs dbus-glib-1) - - bindir ?= /usr/bin - --CFLAGS = -g -Wall -Werror -+CFLAGS ?= -g -Wall -Werror - - all: intel_lpmd_control - - intel_lpmd_control: intel_lpmd_control.c -- gcc $< -o $@ $(CFLAGS) $(CFLAGS_DBUS_GLIB) -+ gcc $< -o $@ $(CFLAGS) $(CFLAGS_DBUS_GLIB) $(LDFLAGS) - - clean: - rm -f intel_lpmd_control diff --git a/22.patch b/22.patch new file mode 100644 index 0000000..b38b186 --- /dev/null +++ b/22.patch @@ -0,0 +1,32 @@ +From 3717c7186895951f58b429d67b954e23a1986b05 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ali=20Erdin=C3=A7=20K=C3=B6ro=C4=9Flu?= + +Date: Fri, 9 Feb 2024 17:17:09 +0200 +Subject: [PATCH] Update lpmd_cpu.c + +Werror unused-variable fixes +--- + src/lpmd_cpu.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/lpmd_cpu.c b/src/lpmd_cpu.c +index f4dec42..bddd3a7 100644 +--- a/src/lpmd_cpu.c ++++ b/src/lpmd_cpu.c +@@ -804,7 +804,7 @@ static int detect_lpm_cpus_cmd(char *cmd) + */ + static int is_cpu_atom(int cpu) + { +- unsigned int eax, ebx, ecx, edx, subleaf; ++ unsigned int eax, ebx, ecx, edx; + unsigned int type; + + if (cpu_migrate(cpu) < 0) { +@@ -906,7 +906,6 @@ static int detect_cpu_l3(int cpu) + */ + static int detect_lpm_cpus_l3(void) + { +- char path[MAX_STR_LENGTH]; + int i; + + for (i = 0; i < topo_max_cpus; i++) { diff --git a/intel-lpmd.spec b/intel-lpmd.spec index cc054b4..43265e9 100644 --- a/intel-lpmd.spec +++ b/intel-lpmd.spec @@ -1,7 +1,7 @@ %global daemon_name intel_lpmd Name: intel-lpmd -Version: 0.0.2 +Version: 0.0.3 Release: 1%{?dist} Summary: Intel Low Power Mode Daemon @@ -9,8 +9,8 @@ License: GPL-2.0-or-later URL: https://github.com/intel/intel-lpmd Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz -# https://github.com/intel/intel-lpmd/pull/13 -Patch0: 13.patch +# https://patch-diff.githubusercontent.com/raw/intel/intel-lpmd/pull/22.patch +Patch0: 22.patch ExclusiveArch: x86_64 @@ -74,5 +74,9 @@ install -D -p -m 644 src/%{daemon_name}_dbus_interface.xml %{buildroot}/%{_datad %{_mandir}/man8/%{daemon_name}.8* %changelog +* Mon Feb 26 2024 Kate Hsuan - 0.0.3-1 +- Update to 0.0.3 +- Use cpuid() to detect Lcores + * Fri Feb 2 2024 Kate Hsuan - 0.0.2-1 - Initial upstream release diff --git a/sources b/sources index b1806e2..0c912b5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (intel-lpmd-0.0.2.tar.gz) = f4a1bd58b5d03f5fb95f4bbc89f052a73c06d2ed8947c48b5206ebe39bae82b5fbf88be69ad84f35cb48ef5bad0743a95d07d06bbad0671b882855b310e7f789 +SHA512 (intel-lpmd-0.0.3.tar.gz) = 1de0ec7ef316d3b8052e487578acb2f70f9d65af866a48ff6fff10528882f619b0700fb986f44f8b6504a0f0a17a40a7e963085d85bc4723ef81e93454e65bfa