Skip to content

Commit 498b195

Browse files
authored
Merge pull request #105 from intel/for-pantherlake
For pantherlake
2 parents eb94c25 + 956df74 commit 498b195

File tree

12 files changed

+544
-20
lines changed

12 files changed

+544
-20
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ Run a workload and monitor `lpmd` to ensure it puts the system in the appropriat
9292

9393
## Releases
9494

95+
### Release 0.1.0
96+
- Add support for Panther Lake
97+
9598
### Release 0.0.9
9699

97100
- Fix lpmd from processing HFI/WLT updates when it is not in auto mode.

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
AC_PREREQ(1.0)
22

33
m4_define([lpmd_major_version], [0])
4-
m4_define([lpmd_minor_version], [0.9])
4+
m4_define([lpmd_minor_version], [1.0])
55
m4_define([lpmd_version],
66
[lpmd_major_version.lpmd_minor_version])
77

data/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ lpmd_configdir = $(lpmd_confdir)
3030
lpmd_config_DATA = \
3131
intel_lpmd_config.xml \
3232
intel_lpmd_config_F6_M170.xml \
33-
intel_lpmd_config_F6_M189.xml
33+
intel_lpmd_config_F6_M189.xml \
34+
intel_lpmd_config_F6_M204.xml
3435

3536
EXTRA_DIST = \
3637
intel_lpmd.service.in \

data/intel_lpmd_config_F6_M204.xml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
<?xml version="1.0"?>
2+
3+
<!--
4+
Specifies the configuration data
5+
for Intel Energy Optimizer (LPMD) daemon
6+
-->
7+
8+
<Configuration>
9+
<!--
10+
CPU format example: 1,2,4..6,8-10
11+
-->
12+
<lp_mode_cpus></lp_mode_cpus>
13+
14+
<!--
15+
EPP to use in Low Power Mode
16+
0-255: Valid EPP value to use in Low Power Mode
17+
-1: Don't change EPP in Low Power Mode
18+
-->
19+
<lp_mode_epp></lp_mode_epp>
20+
21+
<!--
22+
Mode values
23+
0: Cgroup v2
24+
1: Cgroup v2 isolate
25+
2: CPU idle injection
26+
<Mode>0</Mode>
27+
-->
28+
29+
<!--
30+
Default behavior when Performance power setting is used
31+
-1: force off. (Never enter Low Power Mode)
32+
1: force on. (Always stay in Low Power Mode)
33+
0: auto. (opportunistic Low Power Mode enter/exit)
34+
-->
35+
<PerformanceDef>-1</PerformanceDef>
36+
37+
<!--
38+
Default behavior when Balanced power setting is used
39+
-1: force off. (Never enter Low Power Mode)
40+
1: force on. (Always stay in Low Power Mode)
41+
0: auto. (opportunistic Low Power Mode enter/exit)
42+
-->
43+
<BalancedDef>-1</BalancedDef>
44+
45+
<!--
46+
Default behavior when Power saver setting is used
47+
-1: force off. (Never enter Low Power Mode)
48+
1: force on. (Always stay in Low Power Mode)
49+
0: auto. (opportunistic Low Power Mode enter/exit)
50+
-->
51+
<PowersaverDef>-1</PowersaverDef>
52+
53+
<!--
54+
Use HFI LPM hints
55+
0 : No
56+
1 : Yes
57+
-->
58+
<HfiLpmEnable>0</HfiLpmEnable>
59+
60+
<!--
61+
Use WLT hints
62+
0 : No
63+
1 : Yes
64+
-->
65+
<WLTHintEnable>1</WLTHintEnable>
66+
67+
<!--
68+
Use WLT hint Poll enable
69+
0 : No
70+
1 : Yes
71+
-->
72+
<WLTHintPollEnable>0</WLTHintPollEnable>
73+
74+
<!--
75+
Use WLT hint Mask
76+
0 : Non
77+
* : Value to AND with with the hardware hint
78+
-->
79+
<WLTHintMask>15</WLTHintMask>
80+
81+
<!--
82+
Use HFI SUV hints
83+
0 : No
84+
1 : Yes
85+
-->
86+
<HfiSuvEnable>0</HfiSuvEnable>
87+
88+
<!--
89+
System utilization threshold to enter LP mode
90+
from 0 - 100
91+
clear both util_entry_threshold and util_exit_threshold to disable util monitor
92+
<util_entry_threshold>0</util_entry_threshold>
93+
-->
94+
95+
<!--
96+
System utilization threshold to exit LP mode
97+
from 0 - 100
98+
clear both util_entry_threshold and util_exit_threshold to disable util monitor
99+
<util_exit_threshold>0</util_exit_threshold>
100+
-->
101+
102+
<!--
103+
Entry delay. Minimum delay in non Low Power mode to
104+
enter LPM mode.
105+
<EntryDelayMS>0</EntryDelayMS>
106+
-->
107+
108+
<!--
109+
Exit delay. Minimum delay in Low Power mode to
110+
exit LPM mode.
111+
<ExitDelayMS>0</ExitDelayMS>
112+
-->
113+
114+
<!--
115+
Lowest hysteresis average in-LP-mode time in msec to enter LP mode
116+
0: to disable hysteresis support
117+
<EntryHystMS>0</EntryHystMS>
118+
-->
119+
120+
<!--
121+
Lowest hysteresis average out-of-LP-mode time in msec to exit LP mode
122+
0: to disable hysteresis support
123+
<ExitHystMS>0</ExitHystMS>
124+
-->
125+
126+
<!--
127+
Ignore ITMT setting during LP-mode enter/exit
128+
0: disable ITMT upon LP-mode enter and re-enable ITMT upon LP-mode exit
129+
1: do not touch ITMT setting during LP-mode enter/exit
130+
-->
131+
<IgnoreITMT>0</IgnoreITMT>
132+
133+
<!--
134+
Slider default configuration for AC and DC
135+
-->
136+
<BalancedSliderAC>1</BalancedSliderAC>
137+
<BalancedSliderDC>3</BalancedSliderDC>
138+
<SliderOffsetAC>0</SliderOffsetAC>
139+
<SliderOffsetDC>3</SliderOffsetDC>
140+
141+
<States>
142+
<CPUFamily> 6 </CPUFamily>
143+
<CPUModel> 204 </CPUModel>
144+
<CPUConfig> 4P8E4L-25W </CPUConfig>
145+
<State>
146+
<ID> 1 </ID>
147+
<Name> UTIL_IDLE </Name>
148+
<WLTType> 1 </WLTType>
149+
<ActiveCPUs>16-19</ActiveCPUs>
150+
</State>
151+
<State>
152+
<ID> 2 </ID>
153+
<Name> UTIL_IDLE_SUSTAIN </Name>
154+
<WLTType> 2 </WLTType>
155+
<ActiveCPUs>0-19</ActiveCPUs>
156+
</State>
157+
<State>
158+
<ID> 3 </ID>
159+
<Name> UTIL_IDLE_BURSTY </Name>
160+
<WLTType> 3 </WLTType>
161+
<ActiveCPUs>0-19</ActiveCPUs>
162+
</State>
163+
</States>
164+
165+
<States>
166+
<CPUFamily> 6 </CPUFamily>
167+
<CPUModel> 204 </CPUModel>
168+
<CPUConfig> 4P4E4L-25W </CPUConfig>
169+
<State>
170+
<ID> 1 </ID>
171+
<Name> UTIL_IDLE </Name>
172+
<WLTType> 1 </WLTType>
173+
<ActiveCPUs>8-11</ActiveCPUs>
174+
</State>
175+
<State>
176+
<ID> 2 </ID>
177+
<Name> UTIL_IDLE_SUSTAIN </Name>
178+
<WLTType> 2 </WLTType>
179+
<ActiveCPUs>0-11</ActiveCPUs>
180+
</State>
181+
<State>
182+
<ID> 3 </ID>
183+
<Name> UTIL_IDLE_BURSTY </Name>
184+
<WLTType> 3 </WLTType>
185+
<ActiveCPUs>0-11</ActiveCPUs>
186+
</State>
187+
</States>
188+
189+
</Configuration>

src/include/lpmd.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ typedef struct {
174174
int itmt_state;
175175
int irq_migrate;
176176

177+
int balance_slider_ac;
178+
int slider_offset_ac;
179+
int balance_slider_dc;
180+
int slider_offset_dc;
181+
177182
// Private state variables, not configurable
178183
int entry_load_sys;
179184
int entry_load_cpu;
@@ -191,6 +196,8 @@ typedef struct {
191196
int wlt_hint_enable;
192197
int wlt_hint_poll_enable;
193198
int wlt_proxy_enable;
199+
int wlt_hint_mask;
200+
194201
union {
195202
struct {
196203
uint32_t util_sys_enable:1;
@@ -214,6 +221,12 @@ typedef struct {
214221
char cpu_config[MAX_CONFIG_LEN];
215222
int config_state_count;
216223
int tdp;
224+
225+
int balance_slider_def_ac;
226+
int slider_offset_def_ac;
227+
int balance_slider_def_dc;
228+
int slider_offset_def_dc;
229+
217230
lpmd_config_state_t config_states[MAX_STATES];
218231
lpmd_data_t data;
219232
} lpmd_config_t;
@@ -328,6 +341,10 @@ int epp_epb_init(void);
328341
int get_epp_epb(int *epp, char *epp_str, int size, int *epb);
329342
int process_epp_epb(lpmd_config_state_t *state);
330343

344+
void process_balance_slider_default_update(lpmd_config_t *config);
345+
void process_slider_offset_default_update(lpmd_config_t *config);
346+
void process_slider(lpmd_config_t *config, lpmd_config_state_t *state);
347+
331348
/* lpmd_irq.c */
332349
int irq_init(void);
333350
int process_irq(lpmd_config_state_t *state);
@@ -384,6 +401,7 @@ int socket_send_cmd(char *name, char *data);
384401

385402
/* helper */
386403
int copy_user_string(char *src, char *dst, int size);
404+
int lpmd_read_str(char *path, char *str, int size);
387405
int lpmd_write_str(const char *name, char *str, int print_level);
388406
int lpmd_write_str_verbose(const char *name, char *str, int print_level);
389407
int lpmd_write_str_append(const char *name, char *str, int print_level);

src/lpmd_config.c

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ static void lpmd_parse_state(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *config
9696
else
9797
copy_user_string(tmp_value, state->active_cpus, sizeof(state->active_cpus));
9898
}
99+
if (!strncmp((const char*)cur_node->name, "BalanceSliderAC", strlen("BalanceSliderAC")))
100+
state->balance_slider_ac = strtol (tmp_value, &pos, 10);
101+
if (!strncmp((const char*)cur_node->name, "SliderOffsetAC", strlen("SliderOffsetAC")))
102+
state->slider_offset_ac = strtol (tmp_value, &pos, 10);
103+
104+
if (!strncmp((const char*)cur_node->name, "BalanceSliderDC", strlen("BalanceSliderDC")))
105+
state->balance_slider_dc = strtol (tmp_value, &pos, 10);
106+
if (!strncmp((const char*)cur_node->name, "SliderOffsetDC", strlen("SliderOffsetDC")))
107+
state->slider_offset_dc = strtol (tmp_value, &pos, 10);
108+
99109
xmlFree(tmp_value);
100110
}
101111
}
@@ -106,9 +116,9 @@ static int is_wildcard(char *str)
106116
{
107117
if (!str)
108118
return 1;
109-
if (strncmp(str, "*", strlen("*")))
119+
if (!strncmp(str, "*", strlen("*")))
110120
return 1;
111-
if (strncmp(str, " * ", strlen(" * ")))
121+
if (!strncmp(str, " * ", strlen(" * ")))
112122
return 1;
113123

114124
return 0;
@@ -191,6 +201,11 @@ static void lpmd_init_config(lpmd_config_t *config)
191201
config->data.util_cpu = -1;
192202
config->data.util_gfx = -1;
193203
config->data.wlt_hint = -1;
204+
config->balance_slider_def_ac = -1;
205+
config->balance_slider_def_dc = -1;
206+
config->slider_offset_def_ac = -1;
207+
config->slider_offset_def_dc = -1;
208+
config->wlt_hint_mask = -1;
194209
}
195210

196211
static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_config)
@@ -229,6 +244,10 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
229244
|| (lpmd_config->wlt_hint_enable != 1 && lpmd_config->wlt_hint_enable != 0))
230245
goto err;
231246
}
247+
else if (!strncmp((const char*)cur_node->name, "WLTHintMask", strlen("WLTHintMask"))) {
248+
errno = 0;
249+
lpmd_config->wlt_hint_mask = strtol (tmp_value, &pos, 10);
250+
}
232251
else if (!strncmp((const char*)cur_node->name, "WLTHintPollEnable", strlen("WLtHintPollEnable"))) {
233252
errno = 0;
234253
lpmd_config->wlt_hint_poll_enable = strtol (tmp_value, &pos, 10);
@@ -361,6 +380,23 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
361380
errno = 0;
362381
lpmd_parse_states(doc, cur_node->children, lpmd_config);
363382
}
383+
else if (!strncmp((const char*)cur_node->name, "BalancedSliderAC", strlen ("BalancedSliderAC"))) {
384+
errno = 0;
385+
lpmd_config->balance_slider_def_ac = strtol (tmp_value, &pos, 10);
386+
387+
}
388+
else if (!strncmp((const char*)cur_node->name, "BalancedSliderDC", strlen ("BalancedSliderDC"))) {
389+
errno = 0;
390+
lpmd_config->balance_slider_def_dc = strtol (tmp_value, &pos, 10);
391+
}
392+
else if (!strncmp((const char*)cur_node->name, "SliderOffsetAC", strlen ("SliderOffsetAC"))) {
393+
errno = 0;
394+
lpmd_config->slider_offset_def_ac = strtol (tmp_value, &pos, 10);
395+
}
396+
else if (!strncmp((const char*)cur_node->name, "SliderOffsetDC", strlen ("SliderOffsetDC"))) {
397+
errno = 0;
398+
lpmd_config->slider_offset_def_dc = strtol (tmp_value, &pos, 10);
399+
}
364400
else {
365401
if (!strncmp((const char*)cur_node->name, "HfiSuvEnable", strlen("HfiSuvEnable"))) {
366402
lpmd_log_debug("Ignore deprecated HfiSuvEnable setting\n");

src/lpmd_helpers.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,31 @@ int copy_user_string(char *src, char *dst, int size)
4747
return 0;
4848
}
4949

50+
int lpmd_read_str(char *path, char *str, int size)
51+
{
52+
FILE *filep;
53+
int ret;
54+
55+
filep = fopen (path, "r");
56+
if (!filep) {
57+
lpmd_log_error("Cannot open %s\n", path);
58+
return 1;
59+
}
60+
61+
ret = fread (str, 1, size, filep);
62+
fclose (filep);
63+
64+
if (ret <= 0)
65+
return 1;
66+
67+
if (ret >= size)
68+
ret = size - 1;
69+
str[ret - 1] = '\0';
70+
71+
lpmd_log_debug ("Read \"%s\" from %s\n", str, path);
72+
return 0;
73+
}
74+
5075
static int _write_str(const char *name, char *str, int print_level, int log_level, const char *mode)
5176
{
5277
FILE *filep;

0 commit comments

Comments
 (0)