[LTP] high_freq_hwp_cap_cppc.c: new test for testing acpi_cppc/highest_perf

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Wed Jun 10 15:27:36 CEST 2026


Hi Piotr,

On Wed, 10 Jun 2026 13:18:10 +0200, Piotr Kubaj wrote:
> high_freq_hwp_cap_cppc.c: new test for testing acpi_cppc/highest_perf

> +static void run(void)
> +{
> +	bool status = true;
> +	char path[PATH_MAX];
> +
> +	for (int i = 0; i < nproc; i++) {

The static `mismatch` array is zeroed once by SAFE_CALLOC in setup(),
but run() only ever sets elements to 1 and never resets them. When the
test is invoked with `-i N`, stale entries from a previous iteration
survive into the next one.

For example, if CPU 2 mismatches on iteration 1 but matches on
iteration 2, the summary loop still prints "cpu2: MISMATCH" while the
verdict says TPASS. Adding a memset at the top of run() would fix it:

    memset(mismatch, 0, nproc * sizeof(int));

> +		if (msr_highest_perf != sysfs_highest_perf) {
> +			tst_res(TINFO, "cpu%d: sysfs=%llu MSR=%llu",
> +				i, sysfs_highest_perf, msr_highest_perf);
> +			mismatch[i] = 1;
> +			status = false;
> +		}

Per-CPU mismatches are reported with TINFO and the actual TFAIL is
deferred to the end of run() via the `status` flag. LTP convention is
to report results directly where they are determined. Could the
mismatch be reported as TFAIL inline (dropping the `status` flag and
the `mismatch` array), with TPASS emitted at the end only when no
mismatch was found?

Verdict: Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list