Article View: linux.kernel.netdev
Article #5943Re: [PATCH net] selftests: drv-net: devmem: Skip when hugetlbfs isn't supported
From: Björn Töpel
Date: Wed, 21 Oct 2026 09:47
Date: Wed, 21 Oct 2026 09:47
53 lines
9952 bytes
9952 bytes
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>
Technical Details
Message-ID:
<87qzhj75cm.fsf@all.your.base.are.belong.to.us>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349926-linux-kernel-netdev=dewy.ruReferences:
<20261021090852.996899-1-maxime.chevallier@bootlin.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349926-linux-kernel-netdev=dewy.ru From: bjorn@kernel.org (Björn Töpel) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] selftests: drv-net: devmem: Skip when hugetlbfs isn't supported Date: Wed, 21 Oct 2026 11:47:21 +0200 Organization: Usenet Network Message-ID: <87qzhj75cm.fsf@all.your.base.are.belong.to.us> References: <20261021090852.996899-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="4096993"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:2pwLz1eaIELhe3Y6nGjoUbx8bQU= sha256:wCiec9x8MNvWklBqZQ0t63IfeOusU7a1Je/vIkA8N2g= sha1:OTxpdCaz5q/i4uW0OfZihapodnM= sha256:vz1iHxHbgjzHdiMcgGCEFO66UpPUgYslsIATtAadS2g= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 392FC110FA2; Wed, 21 Oct 2026 12:47:54 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jMo55Pao3VEB; Wed, 21 Oct 2026 12:47:51 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-349926-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id A1AA6110FA1; Wed, 21 Oct 2026 12:47:42 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 2945E605453; Wed, 21 Oct 2026 09:47:40 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792576057; b=oVl2FQA29wu3IQKiSeR/t/Pvaa7/FmNrCpPRvNldPYhnw7OlvDq+VMBgQzTCDSl+dI63 0qBhxeyKYbAaNU2T9z8rfGS+ezhqs01+/6qHTcNE5P9LKXGUxxBiDCgDewWyunuj/O4dG v65M2g+LWBZFv/AyBDChbvc8vnK2WpnmDptUufZHMlfzUlrD4NDPryb386ntoKD3Abb1W bO267rYTuCWxu5PWsK5DpnXHCFYkw8UWEybW32AaCy0azg2K7swyHkUDQTD4oenAB9d5w FIy+6KwkhRjOE8aeDatoeWItZp73iCVnzjAtKasP+UKCMvNJ+myTZq05JjQhn1xxaqg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792576057; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: In-Reply-To:References:Date:Message-ID:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=6jxbovViT1dwleMaJSyVR1xtPDE5gaIC6VKfIzW7oqs=; b=2Ht9XirnAiWMvC2yKa5PmNnHnAds1dRtNwljLvBTTJrnztw5uQv4T5f9BsetPRNzI7rL cFE/+5/hNyErB9sHngWlZ6oNAyAW3VsrypxqwC/pggbBjeLmEJoYbqRD7HMjXka7jADsx YatIJrU7UaznzEyfV/aY++oyBAFagZ7eAmZf7t2/u1LkWtkZbO9GGlBNgU+nEPP/Gy5Xm JwhxrRcF8UgXS+FWdnPI8Ig9XCam77+AZZW2mzrmCmhhpuocrVAYgSxVtIenErdP3JOtD 1Vz3eyu3YtfVL0Bk6goQCunLZmFQcRIcjpAO4Cs5fTdbc6HPpsW9sjAGyCXFkSlakFA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lWgSk3P2; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0511E606A32D; Wed, 21 Oct 2026 09:47:37 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lWgSk3P2 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792576045; b=vU2R8e6SfnfnS6lTjzL5afHV9tggXOvFCLFGpWFAaQD9qgJYmAWa44kmpPglH4KlfeFQ ZyqxCRa5M/tcQtN9Jbe2aSHB7VajVmmMXlXnM3AIgPxeTmL7XE+hYCj+0WA0lG1VCaVdu /5LPzQfjpRG9EO4SSyyefsOh+HCUv5mZ8GnKWCqnoT0Tx8UKmD55FvSseMXlCz3Ypb1lZ HbveVq28ZfI4zcHFBun8Wg0yfNjbgiiq04UTw/y9Htt60hLPx77gp82wV4i0vO9S2kzVR rQ4PJwrECwz5t18nSzURbmauTLVmgM2Ysz5hQMoYbOkTnJVomWTeJTdn2k1piFbkMHA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792576045; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=6jxbovViT1dwleMaJSyVR1xtPDE5gaIC6VKfIzW7oqs=; b=osurjl69hAu9QsFJmALPrAVQ9JPTk2WA8SkpiAe8+w57sLf+g6T0L1C+X74jz8rf9OOr HUvtzqDEGR+SwGAg73KueJIFJ4IjDMlBOXPWsMlYko85M0TkDIBzyTQwrYSPjdSWzsT2T 3cRRi/CWCNnbyo+bzrwjO/Zql/aM2fNMI9mpXYznSZjYveXFXBEjs+Xc5+NE/+5jDtiSi LLnjJCxtTmEuQZeyfnZRtiJIOZUNuX06tR9vmQDwSAQ0MdYvk6OD2RQO+e/iaKSkB8LnW LnKQaklCaWEIGjrTOOCOEmZa6krmaU7A+Gs9DGjqeVwiALvqKoG9nnbIPjUipz9uqOQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lWgSk3P2; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D655606A319; Wed, 21 Oct 2026 09:47:25 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6497A1F000C9; Wed, 21 Oct 2026 09:47:24 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792576044; bh=6jxbovViT1dwleMaJSyVR1xtPDE5gaIC6VKfIzW7oqs=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=lWgSk3P21BYenopQ2upzfYo3d/TE4oDtM4SR3JFBUhdZMD5viF2Re7D/QpEpSa/Zf 7sP4LYeo+yENInG+nqx12ZhtdozTQ7uVR5+vPueCegxy/4dKbzGtBagLjmXU4m4ejw S6fbTZhBvonPWyvEU+c92IRdzvs/8V71KuIQH+fruYepE4uUuHiEvjXUgxbaLPzgoC RQJcYewDbmMS51g9DMnjQTHLr4pxQibEDPd298cncqLzxtyL/GoSNc9+xc1NfB6pBj YBtO3ds+fKMrJkfQMRLlUHYvmBrPqxjHp/fz+HeDYXMQL5IuYlHcuknSZSsopx2xSp US+0SlOFkY2mg== X-Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>, thomas.petazzoni@bootlin.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org X-In-Reply-To: <20261021090852.996899-1-maxime.chevallier@bootlin.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list