Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Missing explicit inclusion of `<unistd.h>` for POSIX libc functions.
--
--- Patch [1]: [PATCH v4] perf tests: mmap-basic: fix user rdpmc detection logic ---
commit 4b703a4e5dfd0ba3b4f770b8ec3924ee647f0a6c
Author: Qiao Zhao <[email protected]>
perf tests: mmap-basic: fix user rdpmc detection logic
This patch introduces a fallback to /proc/sys/kernel/perf_user_access for
RISC-V and Arm to control userspace counter access in the mmap-basic test.
It also updates the test logic to support restoring arbitrary values and
adjusts expectations for Arm platforms.
> diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
> index 5cec7644952c7..4433a5df3d776 100644
> --- a/tools/perf/tests/mmap-basic.c
> +++ b/tools/perf/tests/mmap-basic.c
[ ... ]
> @@ -182,47 +183,77 @@ static int test__basic_mmap(struct test_suite *test __maybe_unused, int subtest
> }
>
> enum user_read_state {
[ ... ]
> +static int set_user_read_fd(int fd, int enabled)
> {
[ ... ]
> + if (enabled == old_user_read)
> + return old_user_read;
> +
> + len = scnprintf(buf, sizeof(buf), "%d\n", enabled);
> + if (lseek(fd, 0, SEEK_SET) < 0) {
[Severity: Low]
Does this code build correctly with musl libc?
This patch introduces lseek() and SEEK_SET in set_user_read_fd(), but there
is no explicit include for <unistd.h>. While it currently compiles under
glibc due to implicit includes, relying on this can cause build failures
under musl libc where headers are strictly separated.
Could <unistd.h> be explicitly included alongside the other headers?
> + pr_debug("%s seek failed\n", __func__);
> + return old_user_read;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.