NetBSD Problem Report #58103

From www@netbsd.org  Tue Apr  2 15:24:57 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 586A11A9239
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  2 Apr 2024 15:24:57 +0000 (UTC)
Message-Id: <20240402152455.7C9FB1A923B@mollari.NetBSD.org>
Date: Tue,  2 Apr 2024 15:24:55 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: bpfjit.kmod is not built on aarch64
X-Send-Pr-Version: www-1.0

>Number:         58103
>Category:       port-arm
>Synopsis:       bpfjit.kmod is not built on aarch64
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    riastradh
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 02 15:25:00 +0000 2024
>Closed-Date:    Thu Apr 18 15:30:10 +0000 2024
>Last-Modified:  Thu Apr 18 15:30:10 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10
>Organization:
The NetBPF Foundation
>Environment:
>Description:
In 2019, alnsn wired up sljit.kmod and bpfjit.kmod to the aarch64 build:

commit 1ca74251406d70324ad4ffe60bc292c3ea056eb1
Author: alnsn <alnsn@NetBSD.org>
Date:   Mon Jan 21 00:21:48 2019 +0000

    Build bpfjit and sljit modules on aarch64.

diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 3378ce99ecf4..f896b2e689dc 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.214 2018/12/19 13:57:52 maxv Exp $
+#	$NetBSD: Makefile,v 1.215 2019/01/21 00:21:48 alnsn Exp $

 .include <bsd.own.mk>

@@ -212,10 +212,11 @@ SUBDIR+=	ubsec		# Builds on architectures with PCI bus
 .endif

 .if ${MKSLJIT} != "no"
-# No modules for arm, mips and powerpc yet.
-.if ${MACHINE_ARCH} == "i386" || \
-    ${MACHINE_ARCH} == "x86_64" || \
-    ${MACHINE_ARCH} == "sparc"
+# No modules for 32-bit arm, mips and powerpc yet.
+.if ${MACHINE_ARCH} == "aarch64" || \
+    ${MACHINE_ARCH} == "i386"    || \
+    ${MACHINE_ARCH} == "sparc"   || \
+    ${MACHINE_ARCH} == "x86_64"
 SUBDIR+=	bpfjit
 SUBDIR+=	sljit
 .endif


Unfortunately, this didn't do anything by default, because by default, MKSLJIT=no on aarch64 -- we only set MKSLJIT=yes by default on i386, amd64, and sparc (not even sparc64):

   1343 #
   1344 # MK* options which default to "no".
   1345 # Note that MKZFS has a different default for some platforms, see above.
   1346 # Please keep alphabetically sorted with one entry per line.
   1347 #
   1348 _MKVARS.no= \
...
   1378 	MKSLJIT \
...
   1390 .for var in ${_MKVARS.no}
   1391 ${var}?=	${${var}.${MACHINE_ARCH}:U${${var}.${MACHINE}:Uno}}
   1392 .endfor
   1393 
   1394 .if ${MACHINE_ARCH} == "i386" || \
   1395     ${MACHINE_ARCH} == "x86_64" || \
   1396     ${MACHINE_ARCH} == "sparc"
   1397 MKSLJIT=	yes
   1398 .endif

https://nxr.netbsd.org/xref/src/share/mk/bsd.own.mk?r=1.1364#1343
>How-To-Repeat:
- try using npf on an aarch64 system
- notice that it complains about missing bpfjit
- add bpfjit.kmod to /etc/modules.conf on an aarch64 system
- reboot
- observe that modload failed because bpfjit.kmod doesn't exist
>Fix:
Yes, please!

>Release-Note:

>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58103 CVS commit: src/sys/external/bsd/sljit/dist/sljit_src
Date: Tue, 2 Apr 2024 22:29:58 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Tue Apr  2 22:29:57 UTC 2024

 Modified Files:
 	src/sys/external/bsd/sljit/dist/sljit_src: sljitNativeARM_64.c

 Log Message:
 sljit: Pacify -Wsign-compare.

 If these sizes are negative, we're probably in trouble anyway, so
 assert nonnegative here.

 Needed to resolve PR 58103.


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.5 \
     src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58103 CVS commit: src
Date: Tue, 2 Apr 2024 22:37:34 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Tue Apr  2 22:37:34 UTC 2024

 Modified Files:
 	src/share/mk: bsd.own.mk
 	src/sys/arch/aarch64/include: sljit_machdep.h
 	src/sys/modules: Makefile

 Log Message:
 bsd.own.mk: Enable MKLSJIT on aarch64.

 Make sure there's only one copy of the conditional, in bsd.own.mk;
 just make sys/modules/Makefile conditional on MKSLJIT so we don't
 have to keep these in sync.

 As a workaround for PR 58106, tweak the conditional definition of
 SLJIT_CACHE_FLUSH to use cpu_icache_sync_range only in _HARDKERNEL,
 and use __builtin___clear_cache in userland and in rump kernels.

 PR 58103: bpfjit.kmod is not built on aarch64


 To generate a diff of this commit:
 cvs rdiff -u -r1.1364 -r1.1365 src/share/mk/bsd.own.mk
 cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/sljit_machdep.h
 cvs rdiff -u -r1.284 -r1.285 src/sys/modules/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58103 CVS commit: src/share/mk
Date: Tue, 2 Apr 2024 22:41:48 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Tue Apr  2 22:41:48 UTC 2024

 Modified Files:
 	src/share/mk: bsd.own.mk

 Log Message:
 bsd.own.mk: No need for MKSLJIT to be set differently from others.

 - Use ?=, not =, so mk.conf setting wins.
 - Write out per-architecture tabular settings, not a conditional.
 - Add comments for the architectures that look like they should have
   sljit but don't.  (XXX Missing comments about powerpc and mips --
   not sure why, is this because modules don't yet work on those
   architectures, or what?)

 Tidying for PR 58103: bpfjit.kmod is not built on aarch64.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1365 -r1.1366 src/share/mk/bsd.own.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: port-arm-maintainer->riastradh
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Wed, 03 Apr 2024 03:15:37 +0000
Responsible-Changed-Why:
needs pullup-10, maybe pullup-9


State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Wed, 03 Apr 2024 03:15:37 +0000
State-Changed-Why:
mine


State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Thu, 04 Apr 2024 19:08:48 +0000
State-Changed-Why:
pullup-10 #655
pullup-9 #1827
no aarch64 <9


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58103 CVS commit: [netbsd-10] src
Date: Thu, 18 Apr 2024 15:21:56 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Apr 18 15:21:55 UTC 2024

 Modified Files:
 	src/share/mk [netbsd-10]: bsd.own.mk
 	src/sys/arch/aarch64/include [netbsd-10]: sljit_machdep.h
 	src/sys/external/bsd/sljit/dist/sljit_src [netbsd-10]:
 	    sljitNativeARM_64.c
 	src/sys/modules [netbsd-10]: Makefile

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #655):

 	sys/modules/Makefile: revision 1.285
 	share/mk/bsd.own.mk: revision 1.1365
 	share/mk/bsd.own.mk: revision 1.1366
 	sys/arch/aarch64/include/sljit_machdep.h: revision 1.4
 	sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c: revision 1.5

 sljit: Pacify -Wsign-compare.

 If these sizes are negative, we're probably in trouble anyway, so
 assert nonnegative here.
 Needed to resolve PR 58103.

 bsd.own.mk: Enable MKLSJIT on aarch64.

 Make sure there's only one copy of the conditional, in bsd.own.mk;
 just make sys/modules/Makefile conditional on MKSLJIT so we don't
 have to keep these in sync.

 As a workaround for PR 58106, tweak the conditional definition of
 SLJIT_CACHE_FLUSH to use cpu_icache_sync_range only in _HARDKERNEL,
 and use __builtin___clear_cache in userland and in rump kernels.

 PR 58103: bpfjit.kmod is not built on aarch64
 bsd.own.mk: No need for MKSLJIT to be set differently from others.
 - Use ?=, not =, so mk.conf setting wins.
 - Write out per-architecture tabular settings, not a conditional.
 - Add comments for the architectures that look like they should have
   sljit but don't.  (XXX Missing comments about powerpc and mips --
   not sure why, is this because modules don't yet work on those
   architectures, or what?)

 Tidying for PR 58103: bpfjit.kmod is not built on aarch64.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1289.2.2 -r1.1289.2.3 src/share/mk/bsd.own.mk
 cvs rdiff -u -r1.3 -r1.3.18.1 src/sys/arch/aarch64/include/sljit_machdep.h
 cvs rdiff -u -r1.4 -r1.4.30.1 \
     src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c
 cvs rdiff -u -r1.274.2.2 -r1.274.2.3 src/sys/modules/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58103 CVS commit: [netbsd-9] src
Date: Thu, 18 Apr 2024 15:24:21 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Apr 18 15:24:21 UTC 2024

 Modified Files:
 	src/share/mk [netbsd-9]: bsd.own.mk
 	src/sys/arch/aarch64/include [netbsd-9]: sljit_machdep.h
 	src/sys/external/bsd/sljit/dist/sljit_src [netbsd-9]:
 	    sljitNativeARM_64.c
 	src/sys/modules [netbsd-9]: Makefile

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #655):

 	sys/modules/Makefile: revision 1.285
 	share/mk/bsd.own.mk: revision 1.1365
 	share/mk/bsd.own.mk: revision 1.1366
 	sys/arch/aarch64/include/sljit_machdep.h: revision 1.4
 	sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c: revision 1.5
 	(all via patch)

 sljit: Pacify -Wsign-compare.

 If these sizes are negative, we're probably in trouble anyway, so
 assert nonnegative here.
 Needed to resolve PR 58103.

 bsd.own.mk: Enable MKLSJIT on aarch64.

 Make sure there's only one copy of the conditional, in bsd.own.mk;
 just make sys/modules/Makefile conditional on MKSLJIT so we don't
 have to keep these in sync.

 As a workaround for PR 58106, tweak the conditional definition of
 SLJIT_CACHE_FLUSH to use cpu_icache_sync_range only in _HARDKERNEL,
 and use __builtin___clear_cache in userland and in rump kernels.

 PR 58103: bpfjit.kmod is not built on aarch64
 bsd.own.mk: No need for MKSLJIT to be set differently from others.
 - Use ?=, not =, so mk.conf setting wins.
 - Write out per-architecture tabular settings, not a conditional.
 - Add comments for the architectures that look like they should have
   sljit but don't.  (XXX Missing comments about powerpc and mips --
   not sure why, is this because modules don't yet work on those
   architectures, or what?)

 Tidying for PR 58103: bpfjit.kmod is not built on aarch64.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1149.2.6 -r1.1149.2.7 src/share/mk/bsd.own.mk
 cvs rdiff -u -r1.2 -r1.2.6.1 src/sys/arch/aarch64/include/sljit_machdep.h
 cvs rdiff -u -r1.4 -r1.4.4.1 \
     src/sys/external/bsd/sljit/dist/sljit_src/sljitNativeARM_64.c
 cvs rdiff -u -r1.222.2.1 -r1.222.2.2 src/sys/modules/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Thu, 18 Apr 2024 15:30:10 +0000
State-Changed-Why:
fixed and pulled up to 10
probably not worth it on 9 (but we can reopen if it is)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.