NetBSD Problem Report #55777
From www@netbsd.org Mon Nov 2 13:24:42 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-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 5F5471A9239
for <gnats-bugs@gnats.NetBSD.org>; Mon, 2 Nov 2020 13:24:42 +0000 (UTC)
Message-Id: <20201102132441.8293C1A9243@mollari.NetBSD.org>
Date: Mon, 2 Nov 2020 13:24:41 +0000 (UTC)
From: nruslan_devel@yahoo.com
Reply-To: nruslan_devel@yahoo.com
To: gnats-bugs@NetBSD.org
Subject: rump fails to compile
X-Send-Pr-Version: www-1.0
>Number: 55777
>Category: kern
>Synopsis: rump fails to compile
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 02 13:25:00 +0000 2020
>Last-Modified: Fri Nov 06 14:55:00 +0000 2020
>Originator: Ruslan Nikolaev
>Release: master
>Organization:
Virginia Tech
>Environment:
>Description:
There are several problems with rump kernels, which were introduced recently. The below bug report is when we are compiling the code using our version of rumprun (SMP): https://github.com/ssrg-vt/rumprun-smp, which is forked from https://github.com/rumpkernel/rumprun
1.
/mnt/testdrive/rumpddom/./rumprun-netddom/rumprun-x86_64/lib/libpthread.a(libpthread.a.o): In function `pthread_getcpuclockid':
/mnt/testdrive/rumpddom/src-netbsd/lib/libpthread/pthread_getcpuclockid.c:49: undefined reference to `clock_getcpuclockid2'
collect2: error: ld returned 1 exit status
To solve it, just define this dummy symbol in RUMP. Note that all system calls files need to be regenerated after this fix! This happens after
the following change:
Author: maya <maya@NetBSD.org>
Date: Tue May 7 18:12:53 2019 +0000
Replace the link command for libpthread.a so that we create a single section
with all the libpthread symbols in it.
This makes -lpthread behave like to -Wl,--whole-archive -lpthread.
This avoids a situation where threaded static binaries use some libc thread
stubs, which are racy.
Fixes PR lib/54001: call_once2_32, call_once2_static test cases failing on
amd64 since gcc7 import.
Suggested by Jonathan Wakely, thanks!
2. no min() definition
3. Multiple definitions of unp_sysctl_create() resulting in linking errors
The patch is attached. I have one more fix for rump, which I will post shortly in a separate bug report.
>How-To-Repeat:
>Fix:
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index f814c189ee67..b3807db4b680 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1011,7 +1011,7 @@
481 STD { int|sys||wait6(idtype_t idtype, id_t id, \
int *status, int options, struct wrusage *wru, \
siginfo_t *info); }
-482 STD { int|sys||clock_getcpuclockid2(idtype_t idtype, \
+482 STD RUMP { int|sys||clock_getcpuclockid2(idtype_t idtype, \
id_t id, clockid_t *clock_id); }
483 STD RUMP { int|sys|90|getvfsstat(struct statvfs *buf, \
size_t bufsize, int flags); }
diff --git a/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c b/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c
index 07c0dc931d1f..0f48606c9751 100644
--- a/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c
+++ b/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c
@@ -84,6 +84,10 @@ __KERNEL_RCSID(0, "$NetBSD: rumpdev_bus_dma.c,v 1.9 2020/09/05 16:30:12 riastrad
#define EIEIO membar_sync()
+#ifndef min
+# define min(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
int _bus_dmamap_load_buffer (bus_dma_tag_t, bus_dmamap_t, void *,
bus_size_t, struct vmspace *, int, paddr_t *, int *, int);
diff --git a/sys/rump/librump/rumpnet/net_stub.c b/sys/rump/librump/rumpnet/net_stub.c
index e43cdec4ab3f..4249be54f158 100644
--- a/sys/rump/librump/rumpnet/net_stub.c
+++ b/sys/rump/librump/rumpnet/net_stub.c
@@ -88,12 +88,6 @@ int ipsec_used;
percpu_t *ipsecstat_percpu;
u_int ipsec_spdgen;
-/* sysctl */
-void
-unp_sysctl_create(struct sysctllog **clog)
-{
-}
-
__weak_alias(ah4_ctlinput,rumpnet_stub);
__weak_alias(ah6_ctlinput,rumpnet_stub);
__weak_alias(esp4_ctlinput,rumpnet_stub);
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/55777 CVS commit: src/sys/kern
Date: Mon, 2 Nov 2020 13:55:12 -0500
Module Name: src
Committed By: christos
Date: Mon Nov 2 18:55:12 UTC 2020
Modified Files:
src/sys/kern: syscalls.master
Log Message:
PR/55777: Ruslan Nikolaev: Make clock_getcpuclockid2 accessible from rump
To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 src/sys/kern/syscalls.master
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/55777 CVS commit: src/sys/rump/dev/lib/libpci
Date: Mon, 2 Nov 2020 13:58:06 -0500
Module Name: src
Committed By: christos
Date: Mon Nov 2 18:58:06 UTC 2020
Modified Files:
src/sys/rump/dev/lib/libpci: rumpdev_bus_dma.c
Log Message:
PR/55777: Ruslan Nikolaev: use MIN() from <sys/param.h> instead of min()
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org,
nruslan_devel@yahoo.com
Subject: Re: kern/55777: more rump fixes
Date: Mon, 2 Nov 2020 17:11:49 -0500
--Apple-Mail=_A9DD7DF3-CAEB-4119-870E-A03A9F067F3F
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
Can't remove unp_syscall_create, where do you see an issue?
christos
[4:42pm] 342#/usr/obj/amd64-x86_64/tools/bin/nbmake-amd64
# link bpf/t_bpf
/usr/obj/amd64-x86_64/tools/bin/x86_64--netbsd-gcc =
--sysroot=3D/usr/obj/amd64-x86_64/release -Wl,--warn-shared-textrel =
-Wl,-z,relro -pie -shared-libgcc -o t_bpf t_bpf.o =
-Wl,-rpath-link,/usr/obj/amd64-x86_64/release/lib -L=3D/lib =
-lrumpnet_shmif -lrumpdev_bpf -lrumpdev -lrumpnet_netinet -lrumpnet_net =
-lrumpnet -lrumpvfs -lrump -lrumpvfs -lrumpvfs_nofifofs -lrumpuser =
-lrump -lpthread -latf-c
=
/net/quasar/obj-5/arch/amd64-x86_64/tools/bin/../lib/gcc/x86_64--netbsd/9.=
3.0/../../../../x86_64--netbsd/bin/ld: =
/usr/obj/amd64-x86_64/release/usr/lib/librumpnet.so: undefined reference =
to `rumpns_unp_sysctl_create'
collect2: error: ld returned 1 exit status
*** Failed target: t_bpf
*** Failed command: /usr/obj/amd64-x86_64/tools/bin/x86_64--netbsd-gcc =
--sysroot=3D/usr/obj/amd64-x86_64/release -Wl,--warn-shared-textrel =
-Wl,-z,relro -pie -shared-libgcc -o t_bpf t_bpf.o =
-Wl,-rpath-link,/usr/obj/amd64-x86_64/release/lib -L=3D/lib =
-lrumpnet_shmif -lrumpdev_bpf -lrumpdev -lrumpnet_netinet -lrumpnet_net =
-lrumpnet -lrumpvfs -lrump -lrumpvfs -lrumpvfs_nofifofs -lrumpuser =
-lrump -lpthread -latf-c
*** Error code 1
--Apple-Mail=_A9DD7DF3-CAEB-4119-870E-A03A9F067F3F
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCX6CEJgAKCRBxESqxbLM7
OsvfAJ9mRGm2zultiOVSr9o6EefGfJ/P5gCfXqgZk4SEd9Z0Z7ncbIO+Tr7dj2Y=
=tM8O
-----END PGP SIGNATURE-----
--Apple-Mail=_A9DD7DF3-CAEB-4119-870E-A03A9F067F3F--
From: Ruslan Nikolaev <nruslan_devel@yahoo.com>
To: Christos Zoulas <christos@zoulas.com>, gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/55777: more rump fixes
Date: Mon, 2 Nov 2020 18:33:30 -0500
Here is what I get:
/usr/bin/ld:
/mnt/testdrive/rumprun-smp/./rumprun/rumprun-x86_64/lib/rumprun-hw/librumpnet_local.a(uipc_usrreq.o):
in function `unp_sysctl_create':
/mnt/testdrive/rumprun-smp/src-netbsd/sys/rump/net/lib/liblocal/../../../../kern/uipc_usrreq.c:1989:
multiple definition of `rumpns_unp_sysctl_create';
/mnt/testdrive/rumprun-smp/./rumprun/rumprun-x86_64/lib/rumprun-hw/librumpnet.a(net_stub.o):/mnt/testdrive/rumprun-smp/src-netbsd/sys/rump/librump/rumpnet/net_stub.c:92:
first defined here
collect2: error: ld returned 1 exit status
On 11/2/20 5:11 PM, Christos Zoulas wrote:
> Can't remove unp_syscall_create, where do you see an issue?
>
> christos
>
> [4:42pm] 342#/usr/obj/amd64-x86_64/tools/bin/nbmake-amd64
> # link bpf/t_bpf
> /usr/obj/amd64-x86_64/tools/bin/x86_64--netbsd-gcc --sysroot=/usr/obj/amd64-x86_64/release -Wl,--warn-shared-textrel -Wl,-z,relro -pie -shared-libgcc -o t_bpf t_bpf.o -Wl,-rpath-link,/usr/obj/amd64-x86_64/release/lib -L=/lib -lrumpnet_shmif -lrumpdev_bpf -lrumpdev -lrumpnet_netinet -lrumpnet_net -lrumpnet -lrumpvfs -lrump -lrumpvfs -lrumpvfs_nofifofs -lrumpuser -lrump -lpthread -latf-c
> /net/quasar/obj-5/arch/amd64-x86_64/tools/bin/../lib/gcc/x86_64--netbsd/9.3.0/../../../../x86_64--netbsd/bin/ld: /usr/obj/amd64-x86_64/release/usr/lib/librumpnet.so: undefined reference to `rumpns_unp_sysctl_create'
> collect2: error: ld returned 1 exit status
>
> *** Failed target: t_bpf
> *** Failed command: /usr/obj/amd64-x86_64/tools/bin/x86_64--netbsd-gcc --sysroot=/usr/obj/amd64-x86_64/release -Wl,--warn-shared-textrel -Wl,-z,relro -pie -shared-libgcc -o t_bpf t_bpf.o -Wl,-rpath-link,/usr/obj/amd64-x86_64/release/lib -L=/lib -lrumpnet_shmif -lrumpdev_bpf -lrumpdev -lrumpnet_netinet -lrumpnet_net -lrumpnet -lrumpvfs -lrump -lrumpvfs -lrumpvfs_nofifofs -lrumpuser -lrump -lpthread -latf-c
> *** Error code 1
>
From: Christos Zoulas <christos@zoulas.com>
To: Ruslan Nikolaev <nruslan_devel@yahoo.com>
Cc: gnats-bugs@netbsd.org,
kern-bug-people@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: kern/55777: more rump fixes
Date: Mon, 2 Nov 2020 20:24:54 -0500
--Apple-Mail=_60326379-27CF-4FBB-8A84-11EE4E84BAEA
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
Looks like you are linking statically. Can you put unp_syscall_create() =
in a separate file? Even better can you comment out the other symbols =
defined in this file and try to find out what symbol makes it come in? =
Then look if that same symbol is in the rest of the libraries. Perhaps =
there is a library ordering problem that can be fixed without code =
changes.
Best,
christos
--Apple-Mail=_60326379-27CF-4FBB-8A84-11EE4E84BAEA
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCX6CxZgAKCRBxESqxbLM7
OnlDAKC9Onq3sdSA43+ymTA+XMzNX1MY5wCgzVbjBhi2nTXCcFujb/tydsqcAlY=
=n4ai
-----END PGP SIGNATURE-----
--Apple-Mail=_60326379-27CF-4FBB-8A84-11EE4E84BAEA--
From: Ruslan Nikolaev <nruslan_devel@yahoo.com>
To: Christos Zoulas <christos@zoulas.com>
Cc: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/55777: more rump fixes
Date: Mon, 2 Nov 2020 23:48:53 -0500
I see, let me try that. But what is the rationale to have it defined in
*both*
librumpnet_local (through uipc_usrreq.c) and librumpnet (through
net_stub.c)?
On 11/2/20 8:24 PM, Christos Zoulas wrote:
> Looks like you are linking statically. Can you put unp_syscall_create() in a separate file? Even better can you comment out the other symbols defined in this file and try to find out what symbol makes it come in? Then look if that same symbol is in the rest of the libraries. Perhaps there is a library ordering problem that can be fixed without code changes.
>
> Best,
>
> christos
>
>
From: Christos Zoulas <christos@zoulas.com>
To: Ruslan Nikolaev <nruslan_devel@yahoo.com>
Cc: gnats-bugs@netbsd.org,
kern-bug-people@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: kern/55777: more rump fixes
Date: Tue, 3 Nov 2020 08:42:21 -0500
--Apple-Mail=_742F619D-B2DB-450C-927E-29588387AD95
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
> On Nov 2, 2020, at 11:48 PM, Ruslan Nikolaev <nruslan_devel@yahoo.com> =
wrote:
>=20
> I see, let me try that. But what is the rationale to have it defined =
in *both*
>=20
> librumpnet_local (through uipc_usrreq.c) and librumpnet (through =
net_stub.c)?
rump tries to split the kernel into components so that programs that =
just need a
particular subsystem from the kernel don't need to link against the =
whole kernel.
Unfortunately the kernel was not designed with such a split in mind, so =
that variables
are shared between components. The hacky way to make this work is to =
define them
in both components. A better way is to put them in a third component and =
have the other
two require it, but that introduces overhead.
christos
--Apple-Mail=_742F619D-B2DB-450C-927E-29588387AD95
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCX6FePQAKCRBxESqxbLM7
OmuXAKDo4W1J2H0ELVTXWVqd3eZuUpHVpQCguj9XlqXzItMWiQLLi+lbKSsuzZQ=
=u1xK
-----END PGP SIGNATURE-----
--Apple-Mail=_742F619D-B2DB-450C-927E-29588387AD95--
From: Jason Thorpe <thorpej@me.com>
To: Christos Zoulas <christos@zoulas.com>
Cc: Ruslan Nikolaev <nruslan_devel@yahoo.com>,
gnats-bugs@netbsd.org,
kern-bug-people@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: kern/55777: more rump fixes
Date: Tue, 3 Nov 2020 08:17:44 -0800
> On Nov 3, 2020, at 5:42 AM, Christos Zoulas <christos@zoulas.com> =
wrote:
>=20
> rump tries to split the kernel into components so that programs that =
just need a
> particular subsystem from the kernel don't need to link against the =
whole kernel.
> Unfortunately the kernel was not designed with such a split in mind, =
so that variables
> are shared between components. The hacky way to make this work is to =
define them
> in both components. A better way is to put them in a third component =
and have the other
> two require it, but that introduces overhead.
Seems like we should just put it all into a single rump library. If =
it's a static link, it'll naturally reduce the code slurped in, and if =
it's a shared library, who cares?
-- thorpej
From: Martin Husemann <martin@duskware.de>
To: Jason Thorpe <thorpej@me.com>
Cc: Christos Zoulas <christos@zoulas.com>,
Ruslan Nikolaev <nruslan_devel@yahoo.com>, gnats-bugs@netbsd.org,
kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: kern/55777: more rump fixes
Date: Tue, 3 Nov 2020 17:27:31 +0100
On Tue, Nov 03, 2020 at 08:17:44AM -0800, Jason Thorpe wrote:
> Seems like we should just put it all into a single rump library. If it's a static link, it'll naturally reduce the code slurped in, and if it's a shared library, who cares?
Or push forward the kernel modulariziation to a similar state.
Martin
From: Christos Zoulas <christos@zoulas.com>
To: Jason Thorpe <thorpej@me.com>
Cc: Ruslan Nikolaev <nruslan_devel@yahoo.com>,
gnats-bugs@netbsd.org,
kern-bug-people@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: kern/55777: more rump fixes
Date: Tue, 3 Nov 2020 12:06:50 -0500
--Apple-Mail=_2D909171-8320-483D-8A86-FEEF516080BC
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
> On Nov 3, 2020, at 11:17 AM, Jason Thorpe <thorpej@me.com> wrote:
>=20
> Seems like we should just put it all into a single rump library. If =
it's a static link, it'll naturally reduce the code slurped in, and if =
it's a shared library, who cares?
Unfortunately in practice it does not reduce the code slurped in because =
of the same variable interdependencies. It is also better to reduce the =
memory size of the image so that the minimum memory requirements to run =
the process are smaller. We have been fixing those duplications as we =
find them, but we have not proactively tried to eliminate them.
christos
--Apple-Mail=_2D909171-8320-483D-8A86-FEEF516080BC
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCX6GOKgAKCRBxESqxbLM7
Oi98AJ40AgzG5C+knutWo4lTLSKDS9gSwACfbNQqMHgdFQvconW2p8T+dehB4G4=
=3iYJ
-----END PGP SIGNATURE-----
--Apple-Mail=_2D909171-8320-483D-8A86-FEEF516080BC--
From: Ruslan Nikolaev <nruslan_devel@yahoo.com>
To: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc:
Subject: Re: kern/55777: more rump fixes
Date: Tue, 3 Nov 2020 20:00:14 -0500
Thanks for the feedback! I'll see if I can fix it. In the meantime, I
also posted one more SMP-related patch: kern/55781
We also have rump (glue) files for new drivers such as ixgbe, nvme, etc
-- we will post them as well.
On 11/3/20 12:10 PM, Christos Zoulas wrote:
> The following reply was made to PR kern/55777; it has been noted by GNATS.
>
> From: Christos Zoulas <christos@zoulas.com>
> To: Jason Thorpe <thorpej@me.com>
> Cc: Ruslan Nikolaev <nruslan_devel@yahoo.com>,
> gnats-bugs@netbsd.org,
> kern-bug-people@netbsd.org,
> gnats-admin@netbsd.org,
> netbsd-bugs@netbsd.org
> Subject: Re: kern/55777: more rump fixes
> Date: Tue, 3 Nov 2020 12:06:50 -0500
>
> --Apple-Mail=_2D909171-8320-483D-8A86-FEEF516080BC
> Content-Transfer-Encoding: quoted-printable
> Content-Type: text/plain;
> charset=us-ascii
>
>
>
> > On Nov 3, 2020, at 11:17 AM, Jason Thorpe <thorpej@me.com> wrote:
> >=20
> > Seems like we should just put it all into a single rump library. If =
> it's a static link, it'll naturally reduce the code slurped in, and if =
> it's a shared library, who cares?
>
> Unfortunately in practice it does not reduce the code slurped in because =
> of the same variable interdependencies. It is also better to reduce the =
> memory size of the image so that the minimum memory requirements to run =
> the process are smaller. We have been fixing those duplications as we =
> find them, but we have not proactively tried to eliminate them.
>
> christos
>
From: Ruslan Nikolaev <nruslan_devel@yahoo.com>
To: Christos Zoulas <christos@zoulas.com>, Jason Thorpe <thorpej@me.com>
Cc: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/55777: more rump fixes
Date: Thu, 5 Nov 2020 19:18:11 -0500
Christos,
Looks like this function (unp_sysctl_create) was added by you some time
ago. I looked at the code and here is what I found:
1. liblocal uses uipc_usrreq.c (no uipc_domain.c)
2. libnet uses uipc_domain.c (no uipc_usrreq.c)
uipc_domain.c calls unp_sysctl_create which is defined uipc_usrreq.c.
For that reason, libnet defines a dummy function in net_stub.c to avoid
this dependency.
However, looking at the code, this function seems to simply call
sysctl_createv. Do we really need it to be connected to uipc_domain.c
anyhow? (I apologize if I miss something, I am not so familiar with that
code.)
Below, I created a patch which separates uipc_usrreq.c from
uipc_domain.c and removes a dummy function from net_stub.c. Is it
acceptable or there some reason to not do it?
The code (at least) compiles without any issue on rumprun.
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c
index edd7d7a28df0..8a6b8bc1cb31 100644
--- a/sys/kern/uipc_domain.c
+++ b/sys/kern/uipc_domain.c
@@ -692,7 +692,6 @@ sysctl_net_setup(void)
���� ��� ������ SYSCTL_DESCR("SOCK_DGRAM protocol control block list"),
���� ��� ������ sysctl_unpcblist, 0, NULL, 0,
���� ��� ������ CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
-��� unp_sysctl_create(&domain_sysctllog);
�}
�void
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 6c1ca5a1cb3d..3d8d4118c12d 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -111,6 +111,7 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.199
2020/08/26 22:54:30 christos E
�#include <sys/socket.h>
�#include <sys/socketvar.h>
�#include <sys/unpcb.h>
+#include <sys/sysctl.h>
�#include <sys/un.h>
�#include <sys/namei.h>
�#include <sys/vnode.h>
@@ -197,6 +198,9 @@ static lwp_t *unp_thread_lwp;
�static SLIST_HEAD(,file) unp_thread_discard;
�static int unp_defer;
+static struct sysctllog *usrreq_sysctllog;
+static void unp_sysctl_create(void);
+
�/* Compat interface */
�struct mbuf * stub_compat_70_unp_addsockcred(lwp_t *, struct mbuf *);
@@ -219,6 +223,8 @@ uipc_init(void)
�{
���� int error;
+��� unp_sysctl_create();
+
���� uipc_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
���� cv_init(&unp_thread_cv, "unpgc");
@@ -1988,40 +1994,42 @@ unp_discard_later(file_t *fp)
���� mutex_exit(&filelist_lock);
�}
-void
-unp_sysctl_create(struct sysctllog **clog)
+static void
+unp_sysctl_create(void)
�{
-��� sysctl_createv(clog, 0, NULL, NULL,
+
+��� KASSERT(usrreq_sysctllog == NULL);
+��� sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
���� ��� ������ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
���� ��� ������ CTLTYPE_LONG, "sendspace",
���� ��� ������ SYSCTL_DESCR("Default stream send space"),
���� ��� ������ NULL, 0, &unpst_sendspace, 0,
���� ��� ������ CTL_NET, PF_LOCAL, SOCK_STREAM, CTL_CREATE, CTL_EOL);
-��� sysctl_createv(clog, 0, NULL, NULL,
+��� sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
���� ��� ������ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
���� ��� ������ CTLTYPE_LONG, "recvspace",
���� ��� ������ SYSCTL_DESCR("Default stream recv space"),
���� ��� ������ NULL, 0, &unpst_recvspace, 0,
���� ��� ������ CTL_NET, PF_LOCAL, SOCK_STREAM, CTL_CREATE, CTL_EOL);
-��� sysctl_createv(clog, 0, NULL, NULL,
+��� sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
���� ��� ������ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
���� ��� ������ CTLTYPE_LONG, "sendspace",
���� ��� ������ SYSCTL_DESCR("Default datagram send space"),
���� ��� ������ NULL, 0, &unpdg_sendspace, 0,
���� ��� ������ CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
-��� sysctl_createv(clog, 0, NULL, NULL,
+��� sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
���� ��� ������ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
���� ��� ������ CTLTYPE_LONG, "recvspace",
���� ��� ������ SYSCTL_DESCR("Default datagram recv space"),
���� ��� ������ NULL, 0, &unpdg_recvspace, 0,
���� ��� ������ CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
-��� sysctl_createv(clog, 0, NULL, NULL,
+��� sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
���� ��� ������ CTLFLAG_PERMANENT|CTLFLAG_READONLY,
���� ��� ������ CTLTYPE_INT, "inflight",
���� ��� ������ SYSCTL_DESCR("File descriptors in flight"),
���� ��� ������ NULL, 0, &unp_rights, 0,
���� ��� ������ CTL_NET, PF_LOCAL, CTL_CREATE, CTL_EOL);
-��� sysctl_createv(clog, 0, NULL, NULL,
+��� sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
���� ��� ������ CTLFLAG_PERMANENT|CTLFLAG_READONLY,
���� ��� ������ CTLTYPE_INT, "deferred",
���� ��� ������ SYSCTL_DESCR("File descriptors deferred for close"),
diff --git a/sys/rump/librump/rumpnet/net_stub.c
b/sys/rump/librump/rumpnet/net_stub.c
index e43cdec4ab3f..9810adf9aa13 100644
--- a/sys/rump/librump/rumpnet/net_stub.c
+++ b/sys/rump/librump/rumpnet/net_stub.c
@@ -34,8 +34,6 @@ __KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.40
2020/09/27 00:34:44 roy Exp $");
�#include <sys/socketvar.h>
�#include <sys/pslist.h>
�#include <sys/psref.h>
-#include <sys/sysctl.h>
-#include <sys/un.h>
�#include <net/if.h>
�#include <net/route.h>
@@ -88,12 +86,6 @@ int ipsec_used;
�percpu_t *ipsecstat_percpu;
�u_int ipsec_spdgen;
-/* sysctl */
-void
-unp_sysctl_create(struct sysctllog **clog)
-{
-}
-
�__weak_alias(ah4_ctlinput,rumpnet_stub);
�__weak_alias(ah6_ctlinput,rumpnet_stub);
�__weak_alias(esp4_ctlinput,rumpnet_stub);
diff --git a/sys/sys/un.h b/sys/sys/un.h
index 2533ac7f2169..b5dde2de339d 100644
--- a/sys/sys/un.h
+++ b/sys/sys/un.h
@@ -90,7 +90,6 @@ int��� unp_connect(struct socket *, struct sockaddr *,
struct lwp *);
�int��� unp_connect2(struct socket *, struct socket *);
�void ��� unp_dispose(struct mbuf *);
�int ��� unp_externalize(struct mbuf *, struct lwp *, int);
-void��� unp_sysctl_create(struct sysctllog **);
�#else /* !_KERNEL */
On 11/3/20 12:06 PM, Christos Zoulas wrote:
>
>> On Nov 3, 2020, at 11:17 AM, Jason Thorpe <thorpej@me.com> wrote:
>>
>> Seems like we should just put it all into a single rump library. If it's a static link, it'll naturally reduce the code slurped in, and if it's a shared library, who cares?
> Unfortunately in practice it does not reduce the code slurped in because of the same variable interdependencies. It is also better to reduce the memory size of the image so that the minimum memory requirements to run the process are smaller. We have been fixing those duplications as we find them, but we have not proactively tried to eliminate them.
>
> christos
From: Ruslan Nikolaev <rnikola@vt.edu>
To: Christos Zoulas <christos@zoulas.com>, gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/55777: more rump fixes
Date: Fri, 6 Nov 2020 08:03:33 -0500
The previous message got garbled, so I am resending it
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c
index edd7d7a28df0..8a6b8bc1cb31 100644
--- a/sys/kern/uipc_domain.c
+++ b/sys/kern/uipc_domain.c
@@ -692,7 +692,6 @@ sysctl_net_setup(void)
SYSCTL_DESCR("SOCK_DGRAM protocol control block list"),
sysctl_unpcblist, 0, NULL, 0,
CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
- unp_sysctl_create(&domain_sysctllog);
}
void
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 6c1ca5a1cb3d..3d8d4118c12d 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -111,6 +111,7 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.199
2020/08/26 22:54:30 christos E
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/unpcb.h>
+#include <sys/sysctl.h>
#include <sys/un.h>
#include <sys/namei.h>
#include <sys/vnode.h>
@@ -197,6 +198,9 @@ static lwp_t *unp_thread_lwp;
static SLIST_HEAD(,file) unp_thread_discard;
static int unp_defer;
+static struct sysctllog *usrreq_sysctllog;
+static void unp_sysctl_create(void);
+
/* Compat interface */
struct mbuf * stub_compat_70_unp_addsockcred(lwp_t *, struct mbuf *);
@@ -219,6 +223,8 @@ uipc_init(void)
{
int error;
+ unp_sysctl_create();
+
uipc_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
cv_init(&unp_thread_cv, "unpgc");
@@ -1988,40 +1994,42 @@ unp_discard_later(file_t *fp)
mutex_exit(&filelist_lock);
}
-void
-unp_sysctl_create(struct sysctllog **clog)
+static void
+unp_sysctl_create(void)
{
- sysctl_createv(clog, 0, NULL, NULL,
+
+ KASSERT(usrreq_sysctllog == NULL);
+ sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_LONG, "sendspace",
SYSCTL_DESCR("Default stream send space"),
NULL, 0, &unpst_sendspace, 0,
CTL_NET, PF_LOCAL, SOCK_STREAM, CTL_CREATE, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
+ sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_LONG, "recvspace",
SYSCTL_DESCR("Default stream recv space"),
NULL, 0, &unpst_recvspace, 0,
CTL_NET, PF_LOCAL, SOCK_STREAM, CTL_CREATE, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
+ sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_LONG, "sendspace",
SYSCTL_DESCR("Default datagram send space"),
NULL, 0, &unpdg_sendspace, 0,
CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
+ sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_LONG, "recvspace",
SYSCTL_DESCR("Default datagram recv space"),
NULL, 0, &unpdg_recvspace, 0,
CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
+ sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READONLY,
CTLTYPE_INT, "inflight",
SYSCTL_DESCR("File descriptors in flight"),
NULL, 0, &unp_rights, 0,
CTL_NET, PF_LOCAL, CTL_CREATE, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
+ sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READONLY,
CTLTYPE_INT, "deferred",
SYSCTL_DESCR("File descriptors deferred for close"),
diff --git a/sys/rump/librump/rumpnet/net_stub.c
b/sys/rump/librump/rumpnet/net_stub.c
index e43cdec4ab3f..9810adf9aa13 100644
--- a/sys/rump/librump/rumpnet/net_stub.c
+++ b/sys/rump/librump/rumpnet/net_stub.c
@@ -34,8 +34,6 @@ __KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.40
2020/09/27 00:34:44 roy Exp $");
#include <sys/socketvar.h>
#include <sys/pslist.h>
#include <sys/psref.h>
-#include <sys/sysctl.h>
-#include <sys/un.h>
#include <net/if.h>
#include <net/route.h>
@@ -88,12 +86,6 @@ int ipsec_used;
percpu_t *ipsecstat_percpu;
u_int ipsec_spdgen;
-/* sysctl */
-void
-unp_sysctl_create(struct sysctllog **clog)
-{
-}
-
__weak_alias(ah4_ctlinput,rumpnet_stub);
__weak_alias(ah6_ctlinput,rumpnet_stub);
__weak_alias(esp4_ctlinput,rumpnet_stub);
diff --git a/sys/sys/un.h b/sys/sys/un.h
index 2533ac7f2169..b5dde2de339d 100644
--- a/sys/sys/un.h
+++ b/sys/sys/un.h
@@ -90,7 +90,6 @@ int unp_connect(struct socket *, struct sockaddr
*, struct lwp *);
int unp_connect2(struct socket *, struct socket *);
void unp_dispose(struct mbuf *);
int unp_externalize(struct mbuf *, struct lwp *, int);
-void unp_sysctl_create(struct sysctllog **);
#else /* !_KERNEL */
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/55777 CVS commit: src/sys
Date: Fri, 6 Nov 2020 09:50:13 -0500
Module Name: src
Committed By: christos
Date: Fri Nov 6 14:50:13 UTC 2020
Modified Files:
src/sys/kern: uipc_domain.c uipc_usrreq.c
src/sys/rump/librump/rumpnet: net_stub.c
src/sys/sys: un.h
Log Message:
PR/55777: Ruslan Nikolaev: Move the unp_sysctl_create to uipc_usrreq.c to
facilitate splitting rump modules and does not require a dummy function.
To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/kern/uipc_domain.c
cvs rdiff -u -r1.199 -r1.200 src/sys/kern/uipc_usrreq.c
cvs rdiff -u -r1.40 -r1.41 src/sys/rump/librump/rumpnet/net_stub.c
cvs rdiff -u -r1.58 -r1.59 src/sys/sys/un.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.