Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] Unhandled Python exception in selftests when hugepages are disabled 
or sysctl is read-only.
--

--- Patch [3]: [PATCH net-next v5 3/3] selftests/net: devmem.py: add 
check_rx_large_niov ---
commit c6680f91b9c04fa78f7d8b9d5f92ce1bee9816c1
Author: Bobby Eshleman <[email protected]>

selftests/net: devmem.py: add check_rx_large_niov

This commit adds a new devmem test case for binding a dmabuf with a 16K
rx-buf-size. It also sweeps various RX payload sizes across the niov boundary
to exercise the sub-niov, exact-niov, and multi-niov RX paths.

> diff --git a/tools/testing/selftests/drivers/net/hw/devmem_lib.py 
> b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
> --- a/tools/testing/selftests/drivers/net/hw/devmem_lib.py
> +++ b/tools/testing/selftests/drivers/net/hw/devmem_lib.py

[ ... ]

> +def run_rx_large_niov(cfg):
> +    """Run the devmem RX test with a large niov (rx-buf-size > PAGE_SIZE).
> +
> +    Sweep payload sizes that straddle the niov boundary: below, equal to,
> +    and above rx_buf_size, to exercise sub-niov, exact-niov, and multi-niov
> +    RX paths.
> +    """
> +    hp_file = "/proc/sys/vm/nr_hugepages"
> +    with open(hp_file, 'r+', encoding='utf-8') as f:

[Severity: Medium]
Will this crash with an unhandled exception on systems without hugepages
enabled or when run without write permissions to /proc/sys?

If the system was compiled without CONFIG_HUGETLB_PAGE=y, opening this file
will throw a FileNotFoundError, causing the kselftest framework to report a
test failure rather than gracefully skipping. 

Could this be wrapped in a try/except block to catch these exceptions and
raise KsftSkipEx instead?

> +        nr_hugepages = int(f.read().strip())
> +        if nr_hugepages < 64:
> +            f.seek(0)
> +            f.write("64")
> +            defer(_restore_nr_hugepages, hp_file, nr_hugepages)

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=3

Reply via email to