[LTP] high_freq_hwp_cap_cppc.c: new test

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Mon May 4 13:55:49 CEST 2026


Hi Piotr,

On Mon, 4 May 2026 12:17:36 +0200, Piotr Kubaj wrote:
> high_freq_hwp_cap_cppc.c: new test
>
> Verify for all online logical CPUs that their highest performance value are
> the same for HWP Capability MSR 0x771 and CPPC sysfs file.

The body describes what the test does but not why it is needed. Please
add at least one sentence explaining the motivation — e.g. a known
inconsistency, a kernel regression, or a new interface being validated.

[...]

> +		snprintf(path, sizeof(path), "/dev/cpu/%d/msr", i);
> +		int fd = SAFE_OPEN(path, O_RDONLY);
> +
> +		SAFE_PREAD(1, fd, &msr_highest_perf, sizeof(msr_highest_perf), MSR_HWP_CAPABILITIES);
> +		SAFE_CLOSE(fd);

If SAFE_PREAD aborts via tst_brk(), cleanup() is called but fd is never
closed because it is a loop-local variable with no cleanup handler.
Promote fd to a static (initialized to -1) and add a cleanup() that
guards with `if (fd != -1) SAFE_CLOSE(fd);`.

---
Note:

Our agent completed the review of the patch. The full review can be
found at: https://github.com/linux-test-project/ltp-agent/actions/runs/25317225258

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