* [PATCH net] selftests: drv-net: devmem: Skip when hugetlbfs isn't supported
@ 2026-10-21 9:08 Maxime Chevallier
2026-10-21 9:47 ` Björn Töpel
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Maxime Chevallier @ 2026-10-21 9:08 UTC (permalink / raw)
To: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
Simon Horman, Russell King, Shuah Khan, Bobby Eshleman,
Stanislav Fomichev, Breno Leitao
Cc: Maxime Chevallier, thomas.petazzoni, netdev, linux-kernel,
linux-kselftest
The devmem selftest requires accessing /proc/sys/vm/nr_hugepages,
which is only available when hugetlbfs is supported. This isn't the
case on all CPU architectures, for example it isn't supported on ARM
32-bits on cores that don't support LPAE.
On these devices, the devmem kselftest doesn't skip gracefully, it hits
an exception while trying to open the nr_hugepages file :
# Exception| _reserve_hugepages()
# Exception| ~~~~~~~~~~~~~~~~~~^^
# Exception| File "/usr/lib/kselftests/drivers/net/hw/devmem_lib.py", line 36, in _reserve_hugepages
# Exception| with open(NR_HUGEPAGES_FILE, 'r+', encoding='utf-8') as f:
# Exception| ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Exception| FileNotFoundError: [Errno 2] No such file or directory: '/proc/sys/vm/nr_hugepages'
Let's check if the file exists before trying to open it, and return
immediately if we can't.
The _reserve_hugepages() runs as part of the "require_devmem()", that
skips if devmem itself isn't supported. Before the blamed commit, this
check was done prior to accessing nr_hugepages, so the problem wasn't
showing.
This has been found by trying to run the selftest on stmmac, on an
Altera CycloneV SoC (Cortex A9, doesn't support hugepages).
Fixes: 8ac4255c1e0c ("selftests/net: devmem.py: add check_rx_large_niov")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
tools/testing/selftests/drivers/net/hw/devmem_lib.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/drivers/net/hw/devmem_lib.py b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
index 3554954a6691..24637fb180ca 100644
--- a/tools/testing/selftests/drivers/net/hw/devmem_lib.py
+++ b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
@@ -33,6 +33,8 @@ def _restore_nr_hugepages(nr_hugepages):
def _reserve_hugepages(want=64):
"""Raise nr_hugepages to @want and arrange for it to be restored."""
+ if not os.path.exists(NR_HUGEPAGES_FILE):
+ return
with open(NR_HUGEPAGES_FILE, 'r+', encoding='utf-8') as f:
nr_hugepages = int(f.read().strip())
if nr_hugepages >= want:
--
2.56.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net] selftests: drv-net: devmem: Skip when hugetlbfs isn't supported
2026-10-21 9:08 [PATCH net] selftests: drv-net: devmem: Skip when hugetlbfs isn't supported Maxime Chevallier
@ 2026-10-21 9:47 ` Björn Töpel
2026-10-21 14:55 ` Stanislav Fomichev
2026-10-23 17:52 ` Jakub Kicinski
2 siblings, 0 replies; 4+ messages in thread
From: Björn Töpel @ 2026-10-21 9:47 UTC (permalink / raw)
To: Maxime Chevallier, Andrew Lunn, Jakub Kicinski, davem,
Eric Dumazet, Paolo Abeni, Simon Horman, Russell King,
Shuah Khan, Bobby Eshleman, Stanislav Fomichev, Breno Leitao
Cc: Maxime Chevallier, thomas.petazzoni, netdev, linux-kernel,
linux-kselftest
Maxime Chevallier <maxime.chevallier@bootlin.com> writes:
> The devmem selftest requires accessing /proc/sys/vm/nr_hugepages,
> which is only available when hugetlbfs is supported. This isn't the
> case on all CPU architectures, for example it isn't supported on ARM
> 32-bits on cores that don't support LPAE.
>
> On these devices, the devmem kselftest doesn't skip gracefully, it hits
> an exception while trying to open the nr_hugepages file :
>
> # Exception| _reserve_hugepages()
> # Exception| ~~~~~~~~~~~~~~~~~~^^
> # Exception| File "/usr/lib/kselftests/drivers/net/hw/devmem_lib.py", line 36, in _reserve_hugepages
> # Exception| with open(NR_HUGEPAGES_FILE, 'r+', encoding='utf-8') as f:
> # Exception| ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> # Exception| FileNotFoundError: [Errno 2] No such file or directory: '/proc/sys/vm/nr_hugepages'
>
> Let's check if the file exists before trying to open it, and return
> immediately if we can't.
>
> The _reserve_hugepages() runs as part of the "require_devmem()", that
> skips if devmem itself isn't supported. Before the blamed commit, this
> check was done prior to accessing nr_hugepages, so the problem wasn't
> showing.
>
> This has been found by trying to run the selftest on stmmac, on an
> Altera CycloneV SoC (Cortex A9, doesn't support hugepages).
>
> Fixes: 8ac4255c1e0c ("selftests/net: devmem.py: add check_rx_large_niov")
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
> tools/testing/selftests/drivers/net/hw/devmem_lib.py | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/drivers/net/hw/devmem_lib.py b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
> index 3554954a6691..24637fb180ca 100644
> --- a/tools/testing/selftests/drivers/net/hw/devmem_lib.py
> +++ b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
> @@ -33,6 +33,8 @@ def _restore_nr_hugepages(nr_hugepages):
>
> def _reserve_hugepages(want=64):
> """Raise nr_hugepages to @want and arrange for it to be restored."""
> + if not os.path.exists(NR_HUGEPAGES_FILE):
> + return
Maybe raise a KsftSkipEx() would be more robust? No biggie...
Reviewed-by: Björn Töpel <bjorn@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net] selftests: drv-net: devmem: Skip when hugetlbfs isn't supported
2026-10-21 9:08 [PATCH net] selftests: drv-net: devmem: Skip when hugetlbfs isn't supported Maxime Chevallier
2026-10-21 9:47 ` Björn Töpel
@ 2026-10-21 14:55 ` Stanislav Fomichev
2026-10-23 17:52 ` Jakub Kicinski
2 siblings, 0 replies; 4+ messages in thread
From: Stanislav Fomichev @ 2026-10-21 14:55 UTC (permalink / raw)
To: Maxime Chevallier
Cc: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
Simon Horman, Russell King, Shuah Khan, Bobby Eshleman,
Stanislav Fomichev, Breno Leitao, thomas.petazzoni, netdev,
linux-kernel, linux-kselftest
On 10/21, Maxime Chevallier wrote:
> The devmem selftest requires accessing /proc/sys/vm/nr_hugepages,
> which is only available when hugetlbfs is supported. This isn't the
> case on all CPU architectures, for example it isn't supported on ARM
> 32-bits on cores that don't support LPAE.
>
> On these devices, the devmem kselftest doesn't skip gracefully, it hits
> an exception while trying to open the nr_hugepages file :
>
> # Exception| _reserve_hugepages()
> # Exception| ~~~~~~~~~~~~~~~~~~^^
> # Exception| File "/usr/lib/kselftests/drivers/net/hw/devmem_lib.py", line 36, in _reserve_hugepages
> # Exception| with open(NR_HUGEPAGES_FILE, 'r+', encoding='utf-8') as f:
> # Exception| ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> # Exception| FileNotFoundError: [Errno 2] No such file or directory: '/proc/sys/vm/nr_hugepages'
>
> Let's check if the file exists before trying to open it, and return
> immediately if we can't.
>
> The _reserve_hugepages() runs as part of the "require_devmem()", that
> skips if devmem itself isn't supported. Before the blamed commit, this
> check was done prior to accessing nr_hugepages, so the problem wasn't
> showing.
>
> This has been found by trying to run the selftest on stmmac, on an
> Altera CycloneV SoC (Cortex A9, doesn't support hugepages).
>
> Fixes: 8ac4255c1e0c ("selftests/net: devmem.py: add check_rx_large_niov")
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net] selftests: drv-net: devmem: Skip when hugetlbfs isn't supported
2026-10-21 9:08 [PATCH net] selftests: drv-net: devmem: Skip when hugetlbfs isn't supported Maxime Chevallier
2026-10-21 9:47 ` Björn Töpel
2026-10-21 14:55 ` Stanislav Fomichev
@ 2026-10-23 17:52 ` Jakub Kicinski
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-10-23 17:52 UTC (permalink / raw)
To: Maxime Chevallier
Cc: Andrew Lunn, davem, Eric Dumazet, Paolo Abeni, Simon Horman,
Russell King, Shuah Khan, Bobby Eshleman, Stanislav Fomichev,
Breno Leitao, thomas.petazzoni, netdev, linux-kernel,
linux-kselftest
On Wed, 21 Oct 2026 11:08:51 +0200 Maxime Chevallier wrote:
> The devmem selftest requires accessing /proc/sys/vm/nr_hugepages,
> which is only available when hugetlbfs is supported. This isn't the
> case on all CPU architectures, for example it isn't supported on ARM
> 32-bits on cores that don't support LPAE.
>
> On these devices, the devmem kselftest doesn't skip gracefully
We don't require graceful skipping. If anything IMO hiding the stack
traces isn't great.
If the check is extraneous and makes us fail some tests which don't
actually require huge pages please make that clear in the commit
message. Otherwise the net benefit of the changes is unclear.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-23 17:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 9:08 [PATCH net] selftests: drv-net: devmem: Skip when hugetlbfs isn't supported Maxime Chevallier
2026-10-21 9:47 ` Björn Töpel
2026-10-21 14:55 ` Stanislav Fomichev
2026-10-23 17:52 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®