← Back to Pull requests

uncore: Allow to configure uncore ELC control #796

Open
spandruvada opened this pull request with 141 lines diff across 1 files
View on GitHub
spandruvada spandruvada commented on Aug 01, 2025 20:06 UTC
Author

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

Diff: 141 lines (+138 / -3) across 1 files Reviewer: yarda Review duration: 697476m
All Vouch review confidence checks passed
Residual risk 0.07 = Change Risk (0.63) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.63 · 141 lines diff across 1 files
0.63
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.91 · 5 substantive comment(s)
0.91
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
89%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.296
Sensitive Paths sensitive_paths
0.063
Real PR Conversation Timeline
15 items
spandruvada spandruvada commented on Aug 01, 2025 20:08 UTC
Author

As per comments in https://github.com/redhat-performance/tuned/pull/731
updated pull request.
Thanks @jmencak and @yarda for the code suggestions.

jmencak jmencak commented on Aug 13, 2025 10:01 UTC
Contributor

Thank you @spandruvada for addressing the issues in https://github.com/redhat-performance/tuned/pull/731, I guess we can close it now.

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

jmencak jmencak commented on Aug 13, 2025 10:02 UTC
Contributor

LGTM

yarda yarda commented on code on Aug 17, 2025 20:44 UTC
Code Review
tuned/plugins/plugin_uncore.py:1
@@ -157,7 +182,7 @@ def _validate_value(self, device, min_or_max, value):
 			values = self._get_all(device)
 			if values is None:
 				return None
-			(initial_max_freq_khz, initial_min_freq_khz, _, _) = values
+			(initial_max_freq_khz, initial_min_freq_khz, _, _, _) = values

If I am not missing anything, the _get_all() method returns tuple with 8 values, but here you are assigning only five.

yarda yarda requested changes on Aug 17, 2025 20:45 UTC
Changes Requested Reviewer

Requested changes.

yarda yarda commented on Aug 17, 2025 20:45 UTC
Contributor

The CentOS 7 CI failure is unrelated.

spandruvada spandruvada commented on Aug 21, 2025 21:46 UTC
Author

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

yarda yarda commented on Aug 07, 2026 21:41 UTC
Contributor

/packit build

yarda yarda commented on Aug 07, 2026 21:43 UTC
Contributor

@coderabbitai full review

coderabbitai[bot] coderabbitai[bot] commented on Aug 07, 2026 21:43 UTC
Bot

<!-- This is an auto-generated reply by CodeRabbit -->
<!-- CodeRabbit review command invocation: de363d02-354f-4e4b-9952-08aa0817035b -->
<details>
<summary>✅ Action performed</summary>

Full review finished.

</details>

coderabbitai[bot] coderabbitai[bot] commented on Aug 07, 2026 21:43 UTC
Bot

<!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- review_stack_entry_start -->

![Review Change Stack](https://app.coderabbit.ai/change-stack/redhat-performance/tuned/pull/796?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- walkthrough_start -->

<details>
<summary>📝 Walkthrough</summary>

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

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.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

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 <br> 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 <br> 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 <br> 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

</details>

<!-- walkthrough_end -->
<!-- pre_merge_checks_walkthrough_start -->

<details>
<summary>🚥 Pre-merge checks | ✅ 5</summary>

<details>
<summary>✅ Passed checks (5 passed)</summary>

| 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. |

</details>

</details>

<!-- pre_merge_checks_walkthrough_end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches 💡 1</summary>

<!-- finishing_touch_suggestion:fix_ci -->
<details open>
<summary>🛠️ Fix failing CI checks 💡</summary>

  • <!-- {"checkboxId": "6d21cfe8-ec3f-40e2-9222-b8318b64d3b0", "radioGroupId": "fix-ci-output-choice-group-5222292862"} --> Create stacked PR

  • <!-- {"checkboxId": "9f0d24fb-b419-4f01-baf0-8b26b6424f34", "radioGroupId": "fix-ci-output-choice-group-5222292862"} --> Commit on current branch
  • </details>

    </details>

    <!-- finishing_touch_checkbox_end -->
    <!-- tips_start -->

    ---

    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.

    <details>
    <summary>❤️ Share</summary>

  • X

  • Mastodon

  • Reddit

  • LinkedIn
  • </details>

    <sub>Comment @coderabbitai help to get the list of available commands.</sub>

    <!-- tips_end -->

    coderabbitai[bot] coderabbitai[bot] commented on code on Aug 07, 2026 21:44 UTC
    Code Review
    tuned/plugins/plugin_uncore.py:1
    @@ -88,16 +99,27 @@ def _get_all(self, device):
     			initial_min_freq_khz = self._get(device, "initial_min_freq_khz")
     			max_freq_khz = self._get(device, "max_freq_khz")
     			min_freq_khz = self._get(device, "min_freq_khz")
    +			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)

    _🎯 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.

    <details>
    <summary>Proposed direction</summary>

    -			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.
    </details>

    <details>
    <summary>🤖 Prompt for AI Agents</summary>

    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.
    

    </details>

    <!-- fingerprinting:phantom:poseidon:tapir -->

    <!-- cr-indicator-types:potential_issue -->

    <!-- cr-comment:v1:5cb79ad1accae80e8c027be1 -->

    <!-- This is an auto-generated comment by CodeRabbit -->

    coderabbitai[bot] coderabbitai[bot] commented on Aug 07, 2026 21:44 UTC
    Reviewer

    Actionable comments posted: 1

    <details>
    <summary>🤖 Prompt for all review comments with AI agents</summary>

    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.
    

    </details>

    <details>
    <summary>🪄 Autofix</summary>

    Fix all unresolved CodeRabbit comments on this PR:

  • <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended)

  • <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes
  • </details>

    ---

    <details>
    <summary>ℹ️ Review info</summary>

    <details>
    <summary>⚙️ Run configuration</summary>

    Configuration used: Organization UI

    Review profile: CHILL

    Plan: Pro Plus

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

    </details>

    <details>
    <summary>📥 Commits</summary>

    Reviewing files that changed from the base of the PR and between c07833ba62c9d0707fb9d3b60a87719801047be0 and a4f0364f4c09ebb85d60ce56b9c78265ae39b5e1.

    </details>

    <details>
    <summary>📒 Files selected for processing (1)</summary>

  • tuned/plugins/plugin_uncore.py
  • </details>

    </details>

    <!-- This is an auto-generated comment by CodeRabbit for review status -->

    yarda yarda commented on code on Aug 07, 2026 21:57 UTC
    Code Review
    tuned/plugins/plugin_uncore.py:1
    @@ -88,16 +99,27 @@ def _get_all(self, device):
     			initial_min_freq_khz = self._get(device, "initial_min_freq_khz")
     			max_freq_khz = self._get(device, "max_freq_khz")
     			min_freq_khz = self._get(device, "min_freq_khz")
    +			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)

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

    Reviewers
    Assignees
    spandruvada spandruvada
    Labels
    risk: low confidence: 89.3% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 62.8% (MEDIUM) · Higher = larger blast radius
    62.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 89.3% · Lower = rushed or shallow review
    89.3%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 6.7% · Safe to merge
    6.7%