Skip to content

SoC_Infra: add SoC_Infra_GPU_Clock_Rate_Validation suite - #695

Open
VinodGudla wants to merge 2 commits into
qualcomm-linux:mainfrom
VinodGudla:feature/soc_infra_gpu_clock_rate
Open

VinodGudla wants to merge 2 commits into
qualcomm-linux:mainfrom
VinodGudla:feature/soc_infra_gpu_clock_rate

Conversation

@VinodGudla

Copy link
Copy Markdown

Add the SoC_Infra_GPU_Clock_Rate_Validation suite under Runner/suites/Kernel/Baseport/SoC_Infra_GPU_Clock_Rate_Validation (run.sh, LAVA YAML, README). It checks that every /sys/kernel/debug/clk/gpu*/clk_rate value is an integer. It skips when the device tree has no GPU clock controller and fails when the controller exists but no gpu* clocks are registered.

  • Add two helpers to Runner/utils/functestlib.sh:
    • socinfra_debugfs_root: prints the mounted debugfs root.
    • socinfra_check_clk_rates : validates clk_rate for a clock name prefix.

@VinodGudla VinodGudla changed the title SoC_Infra: add SoC_Infra_GPU_Clock_Rate_Validation suiteFeature/soc infra gpu clock rate SoC_Infra: add SoC_Infra_GPU_Clock_Rate_Validation suite Nov 25, 2026
fi
log_info "GPU clock controller (*-gpucc) in the device tree: $gpucc_in_dt"

if ! debugfs_root=$(socinfra_debugfs_root); then

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.

An enabled GPU controller in DT does not guarantee debugfs support or a mounted/readable clock tree, so this fails healthy images with optional debugfs unavailable. Gate that prerequisite separately and SKIP when unavailable, retaining FAIL for broken clocks on an applicable interface (kernel export gate).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

debugfs and /clk are now gated separately and SKIP when unavailable, whatever the DT says. FAIL is kept for the case where the interface is present but no gpu* clocks are registered. Checked on QCS615-ride: normal run PASS (15 clocks); with debugfs unmounted the test SKIPs. Not tested: a platform without a GPU clock controller (logic unchanged). Fixed in 0693797.

logs-
root@qcs615-ride:/var/qcom-linux-testkit/Runner/suites/Kernel/Baseport/SoC_Infra_GPU_Clock_Rate_Validation# umount /sys/kernel/debug
root@qcs615-ride:/var/qcom-linux-testkit/Runner/suites/Kernel/Baseport/SoC_Infra_GPU_Clock_Rate_Validation# ./run.sh
[INFO] 2026-11-26 07:58:38 - --------------------------------------------------------------------------
[INFO] 2026-11-26 07:58:38 - Starting SoC_Infra_GPU_Clock_Rate_Validation
[SKIP] 2026-11-26 07:58:38 - SoC_Infra_GPU_Clock_Rate_Validation SKIP: debugfs is not mounted or not readable, so the clock tree is unavailable (mount -t debugfs debugfs /sys/kernel/debug, run as root)

Comment thread Runner/utils/functestlib.sh Outdated
for scr_file in "$1/clk/$2"*/clk_rate; do
[ -e "$scr_file" ] || continue
scr_name=$(basename "$(dirname "$scr_file")")
scr_val=$(tr -d '[:space:]' 2>/dev/null <"$scr_file")

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.

Removing all whitespace turns malformed values such as 12 34 into 1234 and PASS, and the read status is discarded. Preserve the single-value format, check the read status, and reuse is_unsigned_number for validation.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed tr -d '[:space:]'. The value is now read with cat and the read status is checked (READ_ERROR on failure). It is then validated with is_unsigned_number exactly as read, so only the trailing newline is dropped and "12 34" is no longer merged into 1234.

Fixed in 02a1ae6.

- REPO_PATH=$PWD
- cd Runner/suites/Kernel/Baseport/SoC_Infra_GPU_Clock_Rate_Validation
- ./run.sh || true
- $REPO_PATH/Runner/utils/send-to-lava.sh SoC_Infra_GPU_Clock_Rate_Validation.res

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.

An early runner exit without a result, such as failure to create gpu_clk_rates.log, is swallowed here and the default publisher exits successfully without reporting this testcase. Use send-to-lava.sh --strict --expected-testcase-id SoC_Infra_GPU_Clock_Rate_Validation and retain its failure status.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The publisher now runs as the last step with --strict --expected-testcase-id SoC_Infra_GPU_Clock_Rate_Validation, with no || true on it, so its failure status is kept. A missing or invalid result file now fails the step instead of publishing nothing.

Fixed in 0693797.

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.

Please fold 02a1ae6 into c227efa and 0693797 into 48b23ac, retaining two signed commits: shared helpers first, then the suite. These follow-ups only correct this PR?s new code, so they can be included in the commits that introduce it.

Signed-off-by: VinodGudla <vinodgudla6@gmail.com>
Signed-off-by: VinodGudla <vinodgudla6@gmail.com>

socinfra_check_clk_rates "$debugfs_root" "$CLK_PREFIX" "$REPORT_FILE"
clk_rc=$?
log_info "Clocks checked: total=$SOCINFRA_CLK_TOTAL invalid=$SOCINFRA_CLK_BAD (details: $REPORT_FILE)"

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.

Job 619157 reports PASS for 18 clocks, but stdout contains none of their names or rates. Replay $REPORT_FILE using the existing log_file_with_label after saving clk_rc, label the values as Hz, and retain the report file.


| Verdict | Condition |
|---|---|
| PASS | At least one `gpu*` clock exists and each `clk_rate` file holds exactly one non-negative integer. A rate of `0` is valid, because a gated clock reports zero. |

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.

The clock core can retain a nonzero cached rate for a gated clock or return zero for an unresolved parent. Please replace the gated-clock explanation with: zero is accepted by this readability/format check, which does not establish the physical frequency or clock enable state.

@smuppand

Copy link
Copy Markdown
Contributor

Source coverage follow-up for 2815e43: I traced the meta-qcom kernel selection through the Kaanapali GPUCC driver and clock-core rate callback.

The callback formats an unsigned integer and normally returns a cached rate. This means:

  • The suite detects unreadable/malformed selected files, or no matching clocks when GPUCC is present and the debugfs clock interface is available.
  • An incorrect but numeric rate, a stuck frequency transition, or some missing clocks can still PASS. Malformed-output fixtures exercise the parser, not those component failures.

Keep this PR's coverage described as registration/readability smoke coverage and address the existing stdout evidence and zero-rate explanation comments.

Suggested separate coverage enhancement: a focused GPU workload/frequency-transition test using supported runtime interfaces. Do not make this smoke test reject every zero rate or introduce board-specific expected frequencies. The functional enhancement is a follow-up, not an additional merge requirement.

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.

2 participants