CPPC: Potential performance feedback scaling mismatch with TIME CSR

Open
#436 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Active
Tech stack
c

Research direction

Start by reading commit bc7a78f and tracing how the RPMI CPPC driver emulates REFERENCE_CTR and DELIVERED_CTR, including its source of REFERENCE_PERF. Establish how the timer frequency and platform performance levels should relate, then agree on a representable scaling rule; the issue does not name files or tests, so the intended behavior needs clarification before implementation.

Written by the indexing model from the issue text.

Description

Description

Since commit bc7a78f, the RPMI CPPC driver emulates REFERENCE_CTR and DELIVERED_CTR locally.

The reference counter uses sbi_timer_value(), while the delivered counter accumulates CPU cycles estimated from the current frequency and elapsed timer ticks.

However, REFERENCE_PERF is still provided by the RPMI backend, without an explicit relationship to the timer frequency used by OpenSBI.

Problem

Linux calculates delivered performance as:

delivered_perf = reference_perf *
                 delta_delivered / delta_reference

With the current OpenSBI implementation, this effectively becomes:

delivered_perf = reference_perf *
                 cpu_frequency / timer_frequency

For this result to match the platform's abstract CPPC performance scale, REFERENCE_PERF must be consistent with both the timer frequency and the mapping between CPU frequency and performance levels.

The RPMI backend may not know the timer frequency used by OpenSBI. Furthermore, performance levels are abstract values and are not necessarily equal to frequencies.

This could lead to incorrect performance feedback being reported to the OS.

Questions

  1. Is the RPMI backend expected to account for the OpenSBI timer frequency when providing REFERENCE_PERF?
  2. Should OpenSBI normalize the locally emulated counters using the platform's nominal frequency and performance level?
  3. How should platforms handle cases where the required reference performance value cannot be represented exactly as an integer?
Dominant language
C
Stars
1.6k
Forks
734
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from riscv-software-src/opensbi

All issues in riscv-software-src/opensbi

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.