Skip to content

uncore: Allow to configure uncore ELC control - #796

Open
spandruvada wants to merge 1 commit into
redhat-performance:masterfrom
spandruvada:uncore-elc
Open

spandruvada wants to merge 1 commit into
redhat-performance:masterfrom
spandruvada:uncore-elc

Conversation

@spandruvada

Copy link
Copy Markdown

The Efficiency Latency Control (ELC) feature improves performance per watt. With this feature hardware power management algorithms optimize trade-off between latency and power consumption.

Add additional configuration for uncore plugin to include attributes to configure ELC.

Refer to Intel White Paper
Link:

Linux kernel documentation:
https://docs.kernel.org/admin-guide/pm/intel_uncore_frequency_scaling.html

Example configuration:

[uncore_all]
type=uncore
elc_floor_freq_khz=2400000
elc_high_threshold_enable=1
elc_high_threshold_percent=95
elc_low_threshold_percent=10

@spandruvada

Copy link
Copy Markdown
Author

As per comments in #731
updated pull request.
Thanks @jmencak and @yarda for the code suggestions.

@jmencak

jmencak commented Aug 13, 2025

Copy link
Copy Markdown
Contributor

Thank you @spandruvada for addressing the issues in #731, I guess we can close it now.

@yarda , do we want to include this in the next FDP? Thanks.

@jmencak

jmencak commented Aug 13, 2025

Copy link
Copy Markdown
Contributor

LGTM

Comment thread tuned/plugins/plugin_uncore.py Outdated
@yarda

yarda commented Aug 17, 2025

Copy link
Copy Markdown
Contributor

The CentOS 7 CI failure is unrelated.

The Efficiency Latency Control (ELC) feature improves performance per
watt. With this feature hardware power management algorithms optimize
trade-off between latency and power consumption.

Add additional configuration for uncore plugin to include attributes
to configure ELC.

Refer to Intel White Paper
Link:

Linux kernel documentation:
https://docs.kernel.org/admin-guide/pm/intel_uncore_frequency_scaling.html

Example configuration:

[uncore_all]
type=uncore
elc_floor_freq_khz=2400000
elc_high_threshold_enable=1
elc_high_threshold_percent=95
elc_low_threshold_percent=10
@spandruvada

Copy link
Copy Markdown
Author

Fixed the issue pointed by @yarda . Thanks for review.

@yarda

yarda commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

/packit build

@yarda

yarda commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for configuring ELC floor frequency.
    • Added options for ELC high- and low-threshold percentages.
    • Added the ability to enable or disable the ELC high-threshold state.
    • Added support for reading and applying these ELC settings through device commands.
  • Documentation

    • Added documentation describing the new ELC configuration options.

Walkthrough

The uncore plugin now documents ELC controls, collects their sysfs values, registers configuration options, and provides handlers for reading and setting floor frequency, threshold percentages, and high-threshold enable state.

Changes

Uncore ELC controls

Layer / File(s) Summary
ELC values and configuration
tuned/plugins/plugin_uncore.py
The plugin documents four ELC options, collects their sysfs values, registers configuration options, and updates frequency and percentage tuple validation.
ELC floor frequency handlers
tuned/plugins/plugin_uncore.py
The plugin adds getter and setter handlers for ELC floor frequency with validation, simulation handling, sysfs error handling, and logging.
ELC threshold handlers
tuned/plugins/plugin_uncore.py
The plugin adds getter and setter handlers for high and low threshold percentages and high-threshold enable state. The handlers validate values and handle simulation, sysfs errors, and logging.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: configurable uncore ELC control.
Description check ✅ Passed The description explains the ELC configuration changes and provides a relevant example and documentation link.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tuned/plugins/plugin_uncore.py`:
- Around line 102-112: Update _get_all so missing ELC sysfs files do not cause
the entire frequency-value read to return None. Keep max_freq_khz and
min_freq_khz retrieval and validation independent, and obtain
elc_floor_freq_khz, elc_high_threshold_enable, elc_high_threshold_percent, and
elc_low_threshold_percent through optional ELC-specific getters or a separate
helper that tolerates unavailable files.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e82f4e71-151d-4d9a-9791-9bb10ef7b130

📥 Commits

Reviewing files that changed from the base of the PR and between c07833b and a4f0364.

📒 Files selected for processing (1)
  • tuned/plugins/plugin_uncore.py

Comment on lines +102 to +112
elc_floor_freq_khz = self._get(device, "elc_floor_freq_khz")
elc_high_threshold_enable = self._get(device, "elc_high_threshold_enable")
elc_high_threshold_percent = self._get(device, "elc_high_threshold_percent")
elc_low_threshold_percent = self._get(device, "elc_low_threshold_percent")

except (OSError, IOError):
log.error("fail to read uncore frequency values")
return None
return (initial_max_freq_khz, initial_min_freq_khz, max_freq_khz, min_freq_khz)
return (initial_max_freq_khz, initial_min_freq_khz, max_freq_khz, min_freq_khz,
elc_floor_freq_khz, elc_high_threshold_enable, elc_high_threshold_percent,
elc_low_threshold_percent)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve existing frequency controls when ELC files are absent.

Lines 102-105 make _get_all require all ELC sysfs files. If a system supports max_freq_khz and min_freq_khz but does not expose ELC, _get_all returns None. _validate_khz_value then rejects existing max/min configuration before it writes either file.

Treat unavailable ELC values as optional, or read ELC values only from ELC handlers.

Proposed direction
-			elc_floor_freq_khz = self._get(device, "elc_floor_freq_khz")
-			elc_high_threshold_enable = self._get(device, "elc_high_threshold_enable")
-			elc_high_threshold_percent = self._get(device, "elc_high_threshold_percent")
-			elc_low_threshold_percent = self._get(device, "elc_low_threshold_percent")
+			# Keep `_get_all` limited to values required by max/min validation.

Move ELC reads into their respective getters or a separate optional ELC-value helper.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tuned/plugins/plugin_uncore.py` around lines 102 - 112, Update _get_all so
missing ELC sysfs files do not cause the entire frequency-value read to return
None. Keep max_freq_khz and min_freq_khz retrieval and validation independent,
and obtain elc_floor_freq_khz, elc_high_threshold_enable,
elc_high_threshold_percent, and elc_low_threshold_percent through optional
ELC-specific getters or a separate helper that tolerates unavailable files.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this can happen that the basic uncore knobs exist but the ELC ones don't, @spandruvada can you please address it? Otherwise LGTM.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants