[PW_SID:1161077] [v2] ACPI: RISC-V: CPPC: Implement cpc_read_ffh_fb_ctrs() - #2627
Open
linux-riscv-bot wants to merge 1 commit into
Open
[PW_SID:1161077] [v2] ACPI: RISC-V: CPPC: Implement cpc_read_ffh_fb_ctrs()#2627linux-riscv-bot wants to merge 1 commit into
linux-riscv-bot wants to merge 1 commit into
Conversation
On RISC-V, reading FFH feedback counters on a remote hart through cpc_read_ffh() requires a separate IPI for each register. cppc_get_perf_ctrs() therefore samples the delivered and reference counters in two separate IPIs. Variation in the delay between these reads distorts the delivered/reference ratio and thus the frequency reported by cpufreq. Implement cpc_read_ffh_fb_ctrs() to read both counters back-to-back in a single callback on the target hart. For remote reads, this reduces two IPIs to one and narrows the separation between the counter samples. Support CSR-type, SBI-type and mixed-type pairs. Pairing SBI reads does not reduce the number of SBI calls, but still avoids a separate IPI for each counter. Factor the execution-context handling into cppc_ffh_read_on_cpu(), shared by cpc_read_ffh() and cpc_read_ffh_fb_ctrs(). CPPC frequency invariance (FIE) reads non-PCC counters directly from the scheduler tick, with local interrupts disabled. Unconditionally rejecting such reads prevents the frequency scale from being updated. Following arm64's counters_read_on_cpu(), invoke the callback directly when interrupts are disabled and the target is the current CPU. Reject remote reads in that context. Otherwise, use smp_call_function_single() and propagate its return value before accessing the callback results. Frequency accuracy testing used CSR-type delivered and reference counters, with CPU1 kept busy by: # stress-ng --cpu 1 --taskset 1 On a CPU with cpuinfo_max_freq of 3000000 kHz: Before: Maximum observed cpuinfo_cur_freq: 3201369 kHz Maximum observed deviation: +201369 kHz (+6.71%) After: Maximum observed cpuinfo_cur_freq: 3009646 kHz Maximum observed deviation: +9646 kHz (+0.32%) The maximum observed deviation from cpuinfo_max_freq decreased by 95.2%. Additional testing covered the CPPC FIE tick path and SBI-type FFH register reads. Co-developed-by: Yicong Yang <yang.yicong@picoheart.com> Signed-off-by: Yicong Yang <yang.yicong@picoheart.com> Signed-off-by: Yufan Dou <douyufan@picoheart.com> Reviewed-by: Sunil V L <sunilvl@oss.qualcomm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR for series 1161077 applied to workflow__riscv__fixes
Name: [v2] ACPI: RISC-V: CPPC: Implement cpc_read_ffh_fb_ctrs()
URL: https://patchwork.kernel.org/series/1161077/
Version: 2