CVS commit: src
Module Name:src Committed By: pooka Date: Wed Jul 3 19:21:12 UTC 2013 Modified Files: src/share/man/man4: virt.4 src/sys/rump/librump/rumpnet: rumpnet.ifspec Log Message: Having a system-supplied function interface to create virt(4) is not fully useful when the system doesn't supply anything to configure the interface with. So remove rump_virtif_create(), that functionality is now taken care of with ifcloner. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/virt.4 cvs rdiff -u -r1.2 -r1.3 src/sys/rump/librump/rumpnet/rumpnet.ifspec Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/virt.4 diff -u src/share/man/man4/virt.4:1.2 src/share/man/man4/virt.4:1.3 --- src/share/man/man4/virt.4:1.2 Wed Nov 17 18:03:49 2010 +++ src/share/man/man4/virt.4 Wed Jul 3 19:21:12 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: virt.4,v 1.2 2010/11/17 18:03:49 wiz Exp $ +.\ $NetBSD: virt.4,v 1.3 2013/07/03 19:21:12 pooka Exp $ .\ .\ Copyright (c) 2010 Antti Kantee .\ All rights reserved. @@ -23,22 +23,16 @@ .\ INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\ -.Dd November 15, 2010 +.Dd July 3, 2013 .Dt VIRT 4 .Os .Sh NAME .Nm virt -.Nd rump virtual network interface -.Sh SYNOPSIS -.In rump/rump.h -.Ft int -.Fo rump_pub_virtif_create -.Fa int num -.Fc +.Nd rump kernel virtual network interface .Sh DESCRIPTION The .Nm -interface acts as a link between a rump virtual kernel and a host +interface acts as a link between a rump kernel and a host .Xr tap 4 interface. Interface number n always corresponds with the host tap interface tapn. @@ -48,28 +42,12 @@ is written into .Pa /dev/tapn and all data read from .Pa /dev/tapn -is passed as Ethernet input to the rump virtual kernel. +is passed as Ethernet input to the rump kernel. .Pp A .Nm -interface can be created in two ways: -.Bl -bullet -.It -Programmatically by calling -.Fn rump_pub_virtif_create . -.It -Dynamically at runtime with -.Xr ifconfig 8 -or equivalent using the -.Em create -command. -.El -.Pp -Destroying a -.Nm -interface is possible only through -.Xr ifconfig 8 -.Em destroy . +interface can be created and destroyed in the normal fashion with +.Xr ifconfig 8 . .Pp The host's .Xr tap 4 Index: src/sys/rump/librump/rumpnet/rumpnet.ifspec diff -u src/sys/rump/librump/rumpnet/rumpnet.ifspec:1.2 src/sys/rump/librump/rumpnet/rumpnet.ifspec:1.3 --- src/sys/rump/librump/rumpnet/rumpnet.ifspec:1.2 Tue Oct 20 23:28:50 2009 +++ src/sys/rump/librump/rumpnet/rumpnet.ifspec Wed Jul 3 19:21:11 2013 @@ -1,4 +1,4 @@ -; $NetBSD: rumpnet.ifspec,v 1.2 2009/10/20 23:28:50 pooka Exp $ +; $NetBSD: rumpnet.ifspec,v 1.3 2013/07/03 19:21:11 pooka Exp $ NAME|net PUBHDR|include/rump/rumpnet_if_pub.h @@ -8,5 +8,4 @@ WRAPPERS|librump/rumpnet/rumpnet_if_wrap ; type | name | args | attrs ; -int |virtif_create |int |WEAK int |shmif_create |const char *, int * |WEAK
CVS commit: src/sys/rump
Module Name:src Committed By: pooka Date: Wed Jul 3 19:22:22 UTC 2013 Modified Files: src/sys/rump/include/rump: rumpnet_if_pub.h src/sys/rump/librump/rumpnet: rumpnet_if_priv.h rumpnet_if_wrappers.c Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/rump/include/rump/rumpnet_if_pub.h cvs rdiff -u -r1.4 -r1.5 src/sys/rump/librump/rumpnet/rumpnet_if_priv.h \ src/sys/rump/librump/rumpnet/rumpnet_if_wrappers.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/include/rump/rumpnet_if_pub.h diff -u src/sys/rump/include/rump/rumpnet_if_pub.h:1.4 src/sys/rump/include/rump/rumpnet_if_pub.h:1.5 --- src/sys/rump/include/rump/rumpnet_if_pub.h:1.4 Tue Oct 20 23:29:39 2009 +++ src/sys/rump/include/rump/rumpnet_if_pub.h Wed Jul 3 19:22:21 2013 @@ -1,10 +1,9 @@ -/* $NetBSD: rumpnet_if_pub.h,v 1.4 2009/10/20 23:29:39 pooka Exp $ */ +/* $NetBSD: rumpnet_if_pub.h,v 1.5 2013/07/03 19:22:21 pooka Exp $ */ /* * Automatically generated. DO NOT EDIT. - * from: NetBSD: rumpnet.ifspec,v 1.2 2009/10/20 23:28:50 pooka Exp - * by: NetBSD: makerumpif.sh,v 1.4 2009/10/15 00:29:19 pooka Exp + * from: NetBSD: rumpnet.ifspec,v 1.3 2013/07/03 19:21:11 pooka Exp + * by: NetBSD: makerumpif.sh,v 1.6 2013/02/14 10:54:54 pooka Exp */ -int rump_pub_virtif_create(int); int rump_pub_shmif_create(const char *, int *); Index: src/sys/rump/librump/rumpnet/rumpnet_if_priv.h diff -u src/sys/rump/librump/rumpnet/rumpnet_if_priv.h:1.4 src/sys/rump/librump/rumpnet/rumpnet_if_priv.h:1.5 --- src/sys/rump/librump/rumpnet/rumpnet_if_priv.h:1.4 Tue Oct 20 23:29:39 2009 +++ src/sys/rump/librump/rumpnet/rumpnet_if_priv.h Wed Jul 3 19:22:21 2013 @@ -1,10 +1,9 @@ -/* $NetBSD: rumpnet_if_priv.h,v 1.4 2009/10/20 23:29:39 pooka Exp $ */ +/* $NetBSD: rumpnet_if_priv.h,v 1.5 2013/07/03 19:22:21 pooka Exp $ */ /* * Automatically generated. DO NOT EDIT. - * from: NetBSD: rumpnet.ifspec,v 1.2 2009/10/20 23:28:50 pooka Exp - * by: NetBSD: makerumpif.sh,v 1.4 2009/10/15 00:29:19 pooka Exp + * from: NetBSD: rumpnet.ifspec,v 1.3 2013/07/03 19:21:11 pooka Exp + * by: NetBSD: makerumpif.sh,v 1.6 2013/02/14 10:54:54 pooka Exp */ -int rump_virtif_create(int); int rump_shmif_create(const char *, int *); Index: src/sys/rump/librump/rumpnet/rumpnet_if_wrappers.c diff -u src/sys/rump/librump/rumpnet/rumpnet_if_wrappers.c:1.4 src/sys/rump/librump/rumpnet/rumpnet_if_wrappers.c:1.5 --- src/sys/rump/librump/rumpnet/rumpnet_if_wrappers.c:1.4 Tue Oct 20 23:29:39 2009 +++ src/sys/rump/librump/rumpnet/rumpnet_if_wrappers.c Wed Jul 3 19:22:21 2013 @@ -1,9 +1,9 @@ -/* $NetBSD: rumpnet_if_wrappers.c,v 1.4 2009/10/20 23:29:39 pooka Exp $ */ +/* $NetBSD: rumpnet_if_wrappers.c,v 1.5 2013/07/03 19:22:21 pooka Exp $ */ /* * Automatically generated. DO NOT EDIT. - * from: NetBSD: rumpnet.ifspec,v 1.2 2009/10/20 23:28:50 pooka Exp - * by: NetBSD: makerumpif.sh,v 1.4 2009/10/15 00:29:19 pooka Exp + * from: NetBSD: rumpnet.ifspec,v 1.3 2013/07/03 19:21:11 pooka Exp + * by: NetBSD: makerumpif.sh,v 1.6 2013/02/14 10:54:54 pooka Exp */ #include sys/cdefs.h @@ -24,19 +24,6 @@ rump_net_unavailable(void) } int -rump_pub_virtif_create(int arg1) -{ - int rv; - - rump_schedule(); - rv = rump_virtif_create(arg1); - rump_unschedule(); - - return rv; -} -__weak_alias(rump_virtif_create,rump_net_unavailable); - -int rump_pub_shmif_create(const char *arg1, int *arg2) { int rv;
CVS commit: src/sys/rump/net/lib/libvirtif
Module Name:src Committed By: pooka Date: Wed Jul 3 19:23:46 UTC 2013 Modified Files: src/sys/rump/net/lib/libvirtif: if_virt.c Log Message: Adjust for rump_virtif_create() removal. Incidentally, this reduces the number of exported symbols by one (which is useful for phase 2). To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/rump/net/lib/libvirtif/if_virt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libvirtif/if_virt.c diff -u src/sys/rump/net/lib/libvirtif/if_virt.c:1.33 src/sys/rump/net/lib/libvirtif/if_virt.c:1.34 --- src/sys/rump/net/lib/libvirtif/if_virt.c:1.33 Wed Jul 3 15:08:01 2013 +++ src/sys/rump/net/lib/libvirtif/if_virt.c Wed Jul 3 19:23:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: if_virt.c,v 1.33 2013/07/03 15:08:01 pooka Exp $ */ +/* $NetBSD: if_virt.c,v 1.34 2013/07/03 19:23:46 pooka Exp $ */ /* * Copyright (c) 2008, 2013 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_virt.c,v 1.33 2013/07/03 15:08:01 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: if_virt.c,v 1.34 2013/07/03 19:23:46 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -87,8 +87,8 @@ static int virtif_unclone(struct ifnet struct if_clone virtif_cloner = IF_CLONE_INITIALIZER(VIRTIF_BASE, virtif_clone, virtif_unclone); -int -rump_virtif_create(int num) +static int +virtif_clone(struct if_clone *ifc, int unit) { struct virtif_sc *sc; struct virtif_user *viu; @@ -148,13 +148,6 @@ rump_virtif_create(int num) } static int -virtif_clone(struct if_clone *ifc, int unit) -{ - - return rump_virtif_create(unit); -} - -static int virtif_unclone(struct ifnet *ifp) { struct virtif_sc *sc = ifp-if_softc;
CVS commit: src/sys/rump/net/lib/libvirtif
Module Name:src Committed By: pooka Date: Wed Jul 3 20:17:07 UTC 2013 Modified Files: src/sys/rump/net/lib/libvirtif: if_virt.c Log Message: fix parameter name To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/rump/net/lib/libvirtif/if_virt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libvirtif/if_virt.c diff -u src/sys/rump/net/lib/libvirtif/if_virt.c:1.34 src/sys/rump/net/lib/libvirtif/if_virt.c:1.35 --- src/sys/rump/net/lib/libvirtif/if_virt.c:1.34 Wed Jul 3 19:23:46 2013 +++ src/sys/rump/net/lib/libvirtif/if_virt.c Wed Jul 3 20:17:07 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: if_virt.c,v 1.34 2013/07/03 19:23:46 pooka Exp $ */ +/* $NetBSD: if_virt.c,v 1.35 2013/07/03 20:17:07 pooka Exp $ */ /* * Copyright (c) 2008, 2013 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_virt.c,v 1.34 2013/07/03 19:23:46 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: if_virt.c,v 1.35 2013/07/03 20:17:07 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -88,7 +88,7 @@ struct if_clone virtif_cloner = IF_CLONE_INITIALIZER(VIRTIF_BASE, virtif_clone, virtif_unclone); static int -virtif_clone(struct if_clone *ifc, int unit) +virtif_clone(struct if_clone *ifc, int num) { struct virtif_sc *sc; struct virtif_user *viu;
CVS commit: src/sys/rump/net/lib/libnetinet
Module Name:src Committed By: pooka Date: Sun Jun 30 16:04:36 UTC 2013 Modified Files: src/sys/rump/net/lib/libnetinet: component.c Log Message: Raise lo0 so that ipv6 config gets done for it. Requested and tested by Justin Cormack. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/rump/net/lib/libnetinet/component.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libnetinet/component.c diff -u src/sys/rump/net/lib/libnetinet/component.c:1.5 src/sys/rump/net/lib/libnetinet/component.c:1.6 --- src/sys/rump/net/lib/libnetinet/component.c:1.5 Tue Jan 11 09:24:06 2011 +++ src/sys/rump/net/lib/libnetinet/component.c Sun Jun 30 16:04:36 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: component.c,v 1.5 2011/01/11 09:24:06 pooka Exp $ */ +/* $NetBSD: component.c,v 1.6 2013/06/30 16:04:36 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: component.c,v 1.5 2011/01/11 09:24:06 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: component.c,v 1.6 2013/06/30 16:04:36 pooka Exp $); #include sys/param.h #include sys/domain.h @@ -84,5 +84,6 @@ RUMP_COMPONENT(RUMP_COMPONENT_NET_IFCFG) sin-sin_addr.s_addr = inet_addr(127.255.255.255); in_control(so, SIOCAIFADDR, ia, lo0ifp, curlwp); + if_up(lo0ifp); soclose(so); }
CVS commit: src/sys/rump/librump/rumpnet
Module Name:src Committed By: pooka Date: Wed Jun 26 17:10:23 UTC 2013 Modified Files: src/sys/rump/librump/rumpnet: net_stub.c Log Message: Remove the route_info weak alias. It's unnecessary since 2011 and confused Linux ld.so, thus preventing dlopen() of librumpnet. Reported in private email by Justin Cormack. Also, g/c a few other stubs which are no longer necessary. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/rump/librump/rumpnet/net_stub.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpnet/net_stub.c diff -u src/sys/rump/librump/rumpnet/net_stub.c:1.13 src/sys/rump/librump/rumpnet/net_stub.c:1.14 --- src/sys/rump/librump/rumpnet/net_stub.c:1.13 Sun Aug 5 15:36:19 2012 +++ src/sys/rump/librump/rumpnet/net_stub.c Wed Jun 26 17:10:23 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: net_stub.c,v 1.13 2012/08/05 15:36:19 pooka Exp $ */ +/* $NetBSD: net_stub.c,v 1.14 2013/06/26 17:10:23 pooka Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: net_stub.c,v 1.13 2012/08/05 15:36:19 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: net_stub.c,v 1.14 2013/06/26 17:10:23 pooka Exp $); #include sys/param.h #include sys/protosw.h @@ -46,14 +46,10 @@ __rumpnet_stub(void) panic(component not available); } __weak_alias(rtioctl,__rumpnet_stub); -__weak_alias(rt_walktree,__rumpnet_stub); __weak_alias(rtrequest,__rumpnet_stub); __weak_alias(ifioctl,__rumpnet_stub); __weak_alias(ifunit,__rumpnet_stub); __weak_alias(ifreq_setaddr,__rumpnet_stub); -__weak_alias(rt_msg1,__rumpnet_stub); -__weak_alias(route_enqueue,__rumpnet_stub); -__weak_alias(route_info,__rumpnet_stub); /* * Weak symbols so that we can optionally leave components out.
CVS commit: src/sys/rump/net/lib/libshmif
Module Name:src Committed By: pooka Date: Fri Jun 14 05:59:51 UTC 2013 Modified Files: src/sys/rump/net/lib/libshmif: if_shmem.c Log Message: sauce previous with a comment To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/rump/net/lib/libshmif/if_shmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libshmif/if_shmem.c diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.55 src/sys/rump/net/lib/libshmif/if_shmem.c:1.56 --- src/sys/rump/net/lib/libshmif/if_shmem.c:1.55 Fri Jun 14 05:56:29 2013 +++ src/sys/rump/net/lib/libshmif/if_shmem.c Fri Jun 14 05:59:50 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: if_shmem.c,v 1.55 2013/06/14 05:56:29 pooka Exp $ */ +/* $NetBSD: if_shmem.c,v 1.56 2013/06/14 05:59:50 pooka Exp $ */ /* * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_shmem.c,v 1.55 2013/06/14 05:56:29 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: if_shmem.c,v 1.56 2013/06/14 05:59:50 pooka Exp $); #include sys/param.h #include sys/atomic.h @@ -724,6 +724,10 @@ shmif_rcv(void *arg) sc, sc-sc_devgen)); } + /* + * Ignore packets too short to possibly be valid. + * This is hit at least for the first frame on a new bus. + */ if (__predict_false(sp.sp_len ETHER_HDR_LEN)) { DPRINTF((shmif read packet len %d ETHER_HDR_LEN\n, sp.sp_len));
CVS commit: src/sys/rump/librump/rumpvfs
Module Name:src Committed By: pooka Date: Fri Jun 14 05:54:04 UTC 2013 Modified Files: src/sys/rump/librump/rumpvfs: rumpfs.c Log Message: Allocate large struct from heap instead of stack for the benefit of low-stack environments in which this code can run. To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/sys/rump/librump/rumpvfs/rumpfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpvfs/rumpfs.c diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.116 src/sys/rump/librump/rumpvfs/rumpfs.c:1.117 --- src/sys/rump/librump/rumpvfs/rumpfs.c:1.116 Wed Jun 12 12:14:35 2013 +++ src/sys/rump/librump/rumpvfs/rumpfs.c Fri Jun 14 05:54:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpfs.c,v 1.116 2013/06/12 12:14:35 pooka Exp $ */ +/* $NetBSD: rumpfs.c,v 1.117 2013/06/14 05:54:04 pooka Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: rumpfs.c,v 1.116 2013/06/12 12:14:35 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: rumpfs.c,v 1.117 2013/06/14 05:54:04 pooka Exp $); #include sys/param.h #include sys/atomic.h @@ -1274,7 +1274,7 @@ rump_vop_open(void *v) return error; } -/* simple readdir. event omits dotstuff and periods */ +/* simple readdir. even omits dotstuff and periods */ static int rump_vop_readdir(void *v) { @@ -1290,6 +1290,7 @@ rump_vop_readdir(void *v) struct uio *uio = ap-a_uio; struct rumpfs_node *rnd = vp-v_data; struct rumpfs_dent *rdent; + struct dirent *dentp = NULL; unsigned i; int rv = 0; @@ -1302,35 +1303,37 @@ rump_vop_readdir(void *v) goto out; /* copy entries */ + dentp = kmem_alloc(sizeof(*dentp), KM_SLEEP); for (; rdent uio-uio_resid 0; rdent = LIST_NEXT(rdent, rd_entries), i++) { - struct dirent dent; - - strlcpy(dent.d_name, rdent-rd_name, sizeof(dent.d_name)); - dent.d_namlen = strlen(dent.d_name); - dent.d_reclen = _DIRENT_RECLEN(dent, dent.d_namlen); + strlcpy(dentp-d_name, rdent-rd_name, sizeof(dentp-d_name)); + dentp-d_namlen = strlen(dentp-d_name); + dentp-d_reclen = _DIRENT_RECLEN(dentp, dentp-d_namlen); if (__predict_false(RDENT_ISWHITEOUT(rdent))) { - dent.d_fileno = INO_WHITEOUT; - dent.d_type = DT_WHT; + dentp-d_fileno = INO_WHITEOUT; + dentp-d_type = DT_WHT; } else { - dent.d_fileno = rdent-rd_node-rn_va.va_fileid; - dent.d_type = vtype2dt(rdent-rd_node-rn_va.va_type); + dentp-d_fileno = rdent-rd_node-rn_va.va_fileid; + dentp-d_type = vtype2dt(rdent-rd_node-rn_va.va_type); } - if (uio-uio_resid dent.d_reclen) { + if (uio-uio_resid dentp-d_reclen) { i--; break; } - rv = uiomove(dent, dent.d_reclen, uio); + rv = uiomove(dentp, dentp-d_reclen, uio); if (rv) { i--; break; } } + kmem_free(dentp, sizeof(*dentp)); + dentp = NULL; out: + KASSERT(dentp == NULL); if (ap-a_cookies) { *ap-a_ncookies = 0; *ap-a_cookies = NULL;
CVS commit: src/sys/rump/net/lib/libshmif
Module Name:src Committed By: pooka Date: Fri Jun 14 05:56:29 UTC 2013 Modified Files: src/sys/rump/net/lib/libshmif: if_shmem.c Log Message: Ignore too short packets. This condition is true especially for the first packet on a new bus (len == 0). Everything else in the stack besides bpf seemed to be able to deal with one, though. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/rump/net/lib/libshmif/if_shmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libshmif/if_shmem.c diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.54 src/sys/rump/net/lib/libshmif/if_shmem.c:1.55 --- src/sys/rump/net/lib/libshmif/if_shmem.c:1.54 Wed May 1 06:58:36 2013 +++ src/sys/rump/net/lib/libshmif/if_shmem.c Fri Jun 14 05:56:29 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: if_shmem.c,v 1.54 2013/05/01 06:58:36 pooka Exp $ */ +/* $NetBSD: if_shmem.c,v 1.55 2013/06/14 05:56:29 pooka Exp $ */ /* * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_shmem.c,v 1.54 2013/05/01 06:58:36 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: if_shmem.c,v 1.55 2013/06/14 05:56:29 pooka Exp $); #include sys/param.h #include sys/atomic.h @@ -724,6 +724,12 @@ shmif_rcv(void *arg) sc, sc-sc_devgen)); } + if (__predict_false(sp.sp_len ETHER_HDR_LEN)) { + DPRINTF((shmif read packet len %d ETHER_HDR_LEN\n, + sp.sp_len)); + continue; + } + m-m_len = m-m_pkthdr.len = sp.sp_len; m-m_pkthdr.rcvif = ifp;
CVS commit: src/tests/fs/vfs
Module Name:src Committed By: pooka Date: Wed Jun 12 12:08:08 UTC 2013 Modified Files: src/tests/fs/vfs: t_io.c Log Message: Fix the test for rumpfs on amd64 by adding a creation mode to open(). thanks to gson for the prod. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/fs/vfs/t_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/vfs/t_io.c diff -u src/tests/fs/vfs/t_io.c:1.10 src/tests/fs/vfs/t_io.c:1.11 --- src/tests/fs/vfs/t_io.c:1.10 Tue Mar 20 18:20:49 2012 +++ src/tests/fs/vfs/t_io.c Wed Jun 12 12:08:08 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: t_io.c,v 1.10 2012/03/20 18:20:49 njoly Exp $ */ +/* $NetBSD: t_io.c,v 1.11 2013/06/12 12:08:08 pooka Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -122,11 +122,11 @@ overwritebody(const atf_tc_t *tc, off_t REQUIRE_LIBC(buf = malloc(count), NULL); FSTEST_ENTER(); - RL(fd = rump_sys_open(testi, O_CREAT | O_RDWR)); + RL(fd = rump_sys_open(testi, O_CREAT | O_RDWR, 0666)); ATF_REQUIRE_EQ(rump_sys_write(fd, buf, count), count); RL(rump_sys_close(fd)); - RL(fd = rump_sys_open(testi, O_CREAT | O_RDWR)); + RL(fd = rump_sys_open(testi, O_RDWR)); if (dotrunc) RL(rump_sys_ftruncate(fd, 0)); ATF_REQUIRE_EQ(rump_sys_write(fd, buf, count), count);
CVS commit: src/sys/rump/librump/rumpvfs
Module Name:src Committed By: pooka Date: Wed Jun 12 12:14:35 UTC 2013 Modified Files: src/sys/rump/librump/rumpvfs: rumpfs.c Log Message: Make sure root creds override fs mode (at least in a root cred secmodel). The correct way is of course for the access method to perform this: return kauth_authorize_vnode(cred, KAUTH_ACCESS_ACTION(mode, vp-v_type, attr-va_mode), vp, NULL, genfs_can_access(vp-v_type, attr-va_mode, attr-va_uid, attr-va_gid, mode, cred)); To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 src/sys/rump/librump/rumpvfs/rumpfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpvfs/rumpfs.c diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.115 src/sys/rump/librump/rumpvfs/rumpfs.c:1.116 --- src/sys/rump/librump/rumpvfs/rumpfs.c:1.115 Mon Jun 10 14:15:03 2013 +++ src/sys/rump/librump/rumpvfs/rumpfs.c Wed Jun 12 12:14:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpfs.c,v 1.115 2013/06/10 14:15:03 pooka Exp $ */ +/* $NetBSD: rumpfs.c,v 1.116 2013/06/12 12:14:35 pooka Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: rumpfs.c,v 1.115 2013/06/10 14:15:03 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: rumpfs.c,v 1.116 2013/06/12 12:14:35 pooka Exp $); #include sys/param.h #include sys/atomic.h @@ -846,8 +846,9 @@ rump_check_permitted(struct vnode *vp, s { struct vattr *attr = rnode-rn_va; - return genfs_can_access(vp-v_type, attr-va_mode, attr-va_uid, - attr-va_gid, mode, cred); + return kauth_authorize_vnode(cred, KAUTH_ACCESS_ACTION(mode, + vp-v_type, attr-va_mode), vp, NULL, genfs_can_access(vp-v_type, + attr-va_mode, attr-va_uid, attr-va_gid, mode, cred)); } int
CVS commit: src/sys/rump/librump/rumpvfs
Module Name:src Committed By: pooka Date: Mon Jun 10 14:15:03 UTC 2013 Modified Files: src/sys/rump/librump/rumpvfs: rumpfs.c Log Message: Create inodes with the specified mode instead of hardcoding to 0755. To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/sys/rump/librump/rumpvfs/rumpfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpvfs/rumpfs.c diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.114 src/sys/rump/librump/rumpvfs/rumpfs.c:1.115 --- src/sys/rump/librump/rumpvfs/rumpfs.c:1.114 Tue Apr 30 00:03:54 2013 +++ src/sys/rump/librump/rumpvfs/rumpfs.c Mon Jun 10 14:15:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpfs.c,v 1.114 2013/04/30 00:03:54 pooka Exp $ */ +/* $NetBSD: rumpfs.c,v 1.115 2013/06/10 14:15:03 pooka Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: rumpfs.c,v 1.114 2013/04/30 00:03:54 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: rumpfs.c,v 1.115 2013/06/10 14:15:03 pooka Exp $); #include sys/param.h #include sys/atomic.h @@ -218,8 +218,9 @@ struct rumpfs_mount { static int lastino = 2; static kmutex_t reclock; +#define RUMPFS_DEFAULTMODE 0755 static void freedir(struct rumpfs_node *, struct componentname *); -static struct rumpfs_node *makeprivate(enum vtype, dev_t, off_t, bool); +static struct rumpfs_node *makeprivate(enum vtype, mode_t, dev_t, off_t, bool); /* * Extra Terrestrial stuff. We map a given key (pathname) to a file on @@ -373,7 +374,8 @@ doregister(const char *key, const char * et = kmem_alloc(sizeof(*et), KM_SLEEP); strcpy(et-et_key, key); et-et_keylen = strlen(et-et_key); - et-et_rn = rn = makeprivate(ettype_to_vtype(ftype), rdev, size, true); + et-et_rn = rn = makeprivate(ettype_to_vtype(ftype), RUMPFS_DEFAULTMODE, + rdev, size, true); et-et_removing = false; et-et_blkmin = dmin; @@ -510,12 +512,13 @@ rump_etfs_remove(const char *key) */ static struct rumpfs_node * -makeprivate(enum vtype vt, dev_t rdev, off_t size, bool et) +makeprivate(enum vtype vt, mode_t mode, dev_t rdev, off_t size, bool et) { struct rumpfs_node *rn; struct vattr *va; struct timespec ts; + KASSERT((mode ~ALLPERMS) == 0); rn = kmem_zalloc(sizeof(*rn), KM_SLEEP); switch (vt) { @@ -536,7 +539,7 @@ makeprivate(enum vtype vt, dev_t rdev, o va = rn-rn_va; va-va_type = vt; - va-va_mode = 0755; + va-va_mode = mode; if (vt == VDIR) va-va_nlink = 2; else @@ -742,7 +745,8 @@ rump_vop_lookup(void *v) return ENOENT; } - rn = makeprivate(hft_to_vtype(hft), NODEV, fsize, true); + rn = makeprivate(hft_to_vtype(hft), RUMPFS_DEFAULTMODE, + NODEV, fsize, true); rn-rn_flags |= RUMPNODE_CANRECLAIM; if (rnd-rn_flags RUMPNODE_DIR_ETSUBS) { rn-rn_flags |= RUMPNODE_DIR_ET | RUMPNODE_DIR_ETSUBS; @@ -997,10 +1001,11 @@ rump_vop_mkdir(void *v) struct vnode *dvp = ap-a_dvp; struct vnode **vpp = ap-a_vpp; struct componentname *cnp = ap-a_cnp; + struct vattr *va = ap-a_vap; struct rumpfs_node *rnd = dvp-v_data, *rn; int rv = 0; - rn = makeprivate(VDIR, NODEV, DEV_BSIZE, false); + rn = makeprivate(VDIR, va-va_mode ALLPERMS, NODEV, DEV_BSIZE, false); if ((cnp-cn_flags ISWHITEOUT) != 0) rn-rn_va.va_flags |= UF_OPAQUE; rn-rn_parent = rnd; @@ -1102,7 +1107,8 @@ rump_vop_mknod(void *v) struct rumpfs_node *rnd = dvp-v_data, *rn; int rv; - rn = makeprivate(va-va_type, va-va_rdev, DEV_BSIZE, false); + rn = makeprivate(va-va_type, va-va_mode ALLPERMS, va-va_rdev, + DEV_BSIZE, false); if ((cnp-cn_flags ISWHITEOUT) != 0) rn-rn_va.va_flags |= UF_OPAQUE; rv = makevnode(dvp-v_mount, rn, vpp); @@ -1134,7 +1140,8 @@ rump_vop_create(void *v) int rv; newsize = va-va_type == VSOCK ? DEV_BSIZE : 0; - rn = makeprivate(va-va_type, NODEV, newsize, false); + rn = makeprivate(va-va_type, va-va_mode ALLPERMS, NODEV, + newsize, false); if ((cnp-cn_flags ISWHITEOUT) != 0) rn-rn_va.va_flags |= UF_OPAQUE; rv = makevnode(dvp-v_mount, rn, vpp); @@ -1161,6 +1168,7 @@ rump_vop_symlink(void *v) struct vnode *dvp = ap-a_dvp; struct vnode **vpp = ap-a_vpp; struct componentname *cnp = ap-a_cnp; + struct vattr *va = ap-a_vap; struct rumpfs_node *rnd = dvp-v_data, *rn; const char *target = ap-a_target; size_t linklen; @@ -1168,7 +1176,7 @@ rump_vop_symlink(void *v) linklen = strlen(target); KASSERT(linklen MAXPATHLEN); - rn = makeprivate(VLNK, NODEV, linklen, false); + rn = makeprivate(VLNK, va-va_mode ALLPERMS, NODEV, linklen, false); if ((cnp-cn_flags ISWHITEOUT) != 0) rn-rn_va.va_flags |= UF_OPAQUE; rv = makevnode(dvp-v_mount, rn, vpp); @@ -1748,7 +1756,7 @@ rumpfs_mountfs(struct mount *mp) rfsmp = kmem_alloc(sizeof(*rfsmp), KM_SLEEP); - rn = makeprivate(VDIR, NODEV, DEV_BSIZE, false); + rn = makeprivate(VDIR
CVS commit: src/sys/kern
Module Name:src Committed By: pooka Date: Mon Jun 10 14:53:52 UTC 2013 Modified Files: src/sys/kern: kern_proc.c Log Message: g/c unused static variable To generate a diff of this commit: cvs rdiff -u -r1.186 -r1.187 src/sys/kern/kern_proc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_proc.c diff -u src/sys/kern/kern_proc.c:1.186 src/sys/kern/kern_proc.c:1.187 --- src/sys/kern/kern_proc.c:1.186 Sat Jun 9 02:31:14 2012 +++ src/sys/kern/kern_proc.c Mon Jun 10 14:53:52 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_proc.c,v 1.186 2012/06/09 02:31:14 christos Exp $ */ +/* $NetBSD: kern_proc.c,v 1.187 2013/06/10 14:53:52 pooka Exp $ */ /*- * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: kern_proc.c,v 1.186 2012/06/09 02:31:14 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: kern_proc.c,v 1.187 2013/06/10 14:53:52 pooka Exp $); #ifdef _KERNEL_OPT #include opt_kstack.h @@ -172,7 +172,7 @@ struct pgrp pgrp0 = { }; filedesc_t filedesc0; struct cwdinfo cwdi0 = { - .cwdi_cmask = CMASK, /* see cmask below */ + .cwdi_cmask = CMASK, .cwdi_refcnt = 1, }; struct plimit limit0; @@ -206,7 +206,6 @@ kauth_cred_t cred0; static const int nofile = NOFILE; static const int maxuprc = MAXUPRC; -static const int cmask = CMASK; static int sysctl_doeproc(SYSCTLFN_PROTO); static int sysctl_kern_proc_args(SYSCTLFN_PROTO);
CVS commit: src/sys/rump/librump/rumpvfs
Module Name:src Committed By: pooka Date: Mon Jun 10 19:48:22 UTC 2013 Modified Files: src/sys/rump/librump/rumpvfs: rump_vfs.c Log Message: create /dev with 0755 instead of 0777 (though it's now effectively the same due to cmask) To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/rump/librump/rumpvfs/rump_vfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpvfs/rump_vfs.c diff -u src/sys/rump/librump/rumpvfs/rump_vfs.c:1.76 src/sys/rump/librump/rumpvfs/rump_vfs.c:1.77 --- src/sys/rump/librump/rumpvfs/rump_vfs.c:1.76 Mon Apr 29 19:31:46 2013 +++ src/sys/rump/librump/rumpvfs/rump_vfs.c Mon Jun 10 19:48:22 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rump_vfs.c,v 1.76 2013/04/29 19:31:46 pooka Exp $ */ +/* $NetBSD: rump_vfs.c,v 1.77 2013/06/10 19:48:22 pooka Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: rump_vfs.c,v 1.76 2013/04/29 19:31:46 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: rump_vfs.c,v 1.77 2013/06/10 19:48:22 pooka Exp $); #include sys/param.h #include sys/buf.h @@ -135,7 +135,7 @@ RUMP_COMPONENT(RUMP__FACTION_VFS) vfs_mountroot(); /* mtree: create /dev */ - do_sys_mkdir(/dev, 0777, UIO_SYSSPACE); + do_sys_mkdir(/dev, 0755, UIO_SYSSPACE); rump_proc_vfs_init = pvfs_init; rump_proc_vfs_release = pvfs_rele;
CVS commit: src/sys/rump/net/lib/libshmif
Module Name:src Committed By: pooka Date: Tue Jun 4 14:54:34 UTC 2013 Modified Files: src/sys/rump/net/lib/libshmif: rumpcomp_user.c Log Message: On Linux, pass the inotify descriptor up so that we can correctly read it in the wait() routine. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/rump/net/lib/libshmif/rumpcomp_user.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libshmif/rumpcomp_user.c diff -u src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.11 src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.12 --- src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.11 Tue May 7 16:18:48 2013 +++ src/sys/rump/net/lib/libshmif/rumpcomp_user.c Tue Jun 4 14:54:34 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcomp_user.c,v 1.11 2013/05/07 16:18:48 pooka Exp $ */ +/* $NetBSD: rumpcomp_user.c,v 1.12 2013/06/04 14:54:34 pooka Exp $ */ /*- * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -137,6 +137,7 @@ rumpcomp_shmif_watchsetup(int *inotifyp, goto out; } rv = 0; + *inotifyp = inotify; out: return rumpuser_component_errtrans(rv);
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Tue Jun 4 15:17:28 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_dl.c Log Message: FreeBSD does the Solaris-like map-l_addr boogie. from Ben Gras To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/lib/librumpuser/rumpuser_dl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_dl.c diff -u src/lib/librumpuser/rumpuser_dl.c:1.18 src/lib/librumpuser/rumpuser_dl.c:1.19 --- src/lib/librumpuser/rumpuser_dl.c:1.18 Mon Apr 29 18:00:20 2013 +++ src/lib/librumpuser/rumpuser_dl.c Tue Jun 4 15:17:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_dl.c,v 1.18 2013/04/29 18:00:20 pooka Exp $ */ +/* $NetBSD: rumpuser_dl.c,v 1.19 2013/06/04 15:17:28 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -40,7 +40,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_dl.c,v 1.18 2013/04/29 18:00:20 pooka Exp $); +__RCSID($NetBSD: rumpuser_dl.c,v 1.19 2013/06/04 15:17:28 pooka Exp $); #endif /* !lint */ #include sys/types.h @@ -151,7 +151,7 @@ do { \ */ #if defined(__linux__) #define adjptr(_map_, _ptr_) ((void *)(_ptr_)) -#elif defined(__sun__) || defined(__DragonFly__) +#elif defined(__sun__) || defined(__DragonFly__) || defined(__FreeBSD__) #define adjptr(_map_, _ptr_) \ (ismainobj ? (void *)(_ptr_) : (void *)(_map_-l_addr + (_ptr_))) #else
CVS commit: src/sys/rump/net/lib
Module Name:src Committed By: pooka Date: Sat Jun 1 10:54:24 UTC 2013 Modified Files: src/sys/rump/net/lib/libnet: Makefile src/sys/rump/net/lib/libnetinet: Makefile.inc Log Message: cosmetic: put portalgo.c in the conceptually right place To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/rump/net/lib/libnet/Makefile cvs rdiff -u -r1.8 -r1.9 src/sys/rump/net/lib/libnetinet/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libnet/Makefile diff -u src/sys/rump/net/lib/libnet/Makefile:1.16 src/sys/rump/net/lib/libnet/Makefile:1.17 --- src/sys/rump/net/lib/libnet/Makefile:1.16 Fri Aug 3 14:27:02 2012 +++ src/sys/rump/net/lib/libnet/Makefile Sat Jun 1 10:54:24 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.16 2012/08/03 14:27:02 pooka Exp $ +# $NetBSD: Makefile,v 1.17 2013/06/01 10:54:24 pooka Exp $ # .PATH: ${.CURDIR}/../../../../net ${.CURDIR}/../../../../compat/common @@ -7,7 +7,7 @@ LIB= rumpnet_net # iffy stuff SRCS= if.c if_loop.c route.c rtsock.c rtsock_50.c raw_usrreq.c \ - raw_cb.c if_media.c link_proto.c net_stats.c if_ethersubr.c portalgo.c + raw_cb.c if_media.c link_proto.c net_stats.c if_ethersubr.c SRCS+= if_43.c pfil.c uipc_syscalls_50.c SRCS+= component.c Index: src/sys/rump/net/lib/libnetinet/Makefile.inc diff -u src/sys/rump/net/lib/libnetinet/Makefile.inc:1.8 src/sys/rump/net/lib/libnetinet/Makefile.inc:1.9 --- src/sys/rump/net/lib/libnetinet/Makefile.inc:1.8 Tue May 3 18:28:45 2011 +++ src/sys/rump/net/lib/libnetinet/Makefile.inc Sat Jun 1 10:54:24 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.8 2011/05/03 18:28:45 dyoung Exp $ +# $NetBSD: Makefile.inc,v 1.9 2013/06/01 10:54:24 pooka Exp $ # .PATH: ${.CURDIR}/../../../../netinet ${.CURDIR}/../../../../netinet6 @@ -6,7 +6,7 @@ # INET SRCS+= in_proto.c igmp.c in.c in_offload.c in_pcb.c ip_carp.c ip_icmp.c\ ip_flow.c ip_id.c ip_input.c ip_reass.c ip_output.c raw_ip.c \ - in_cksum.c cpu_in_cksum.c in4_cksum.c ip_encap.c + in_cksum.c cpu_in_cksum.c in4_cksum.c ip_encap.c portalgo.c # INET6 SRCS+= dest6.c frag6.c icmp6.c in6.c in6_cksum.c in6_ifattach.c \
CVS commit: src/sys/netinet
Module Name:src Committed By: pooka Date: Sat Jun 1 11:01:48 UTC 2013 Modified Files: src/sys/netinet: portalgo.c Log Message: Give portalgo a compile-time override; for cases where the default default doesn't make enough sense to even consider it (a lot of outgoing connections from rump kernels with local port 65535). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/netinet/portalgo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/portalgo.c diff -u src/sys/netinet/portalgo.c:1.4 src/sys/netinet/portalgo.c:1.5 --- src/sys/netinet/portalgo.c:1.4 Fri Dec 7 02:27:41 2012 +++ src/sys/netinet/portalgo.c Sat Jun 1 11:01:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: portalgo.c,v 1.4 2012/12/07 02:27:41 christos Exp $ */ +/* $NetBSD: portalgo.c,v 1.5 2013/06/01 11:01:48 pooka Exp $ */ /* * Copyright 2011 Vlad Balan @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: portalgo.c,v 1.4 2012/12/07 02:27:41 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: portalgo.c,v 1.5 2013/06/01 11:01:48 pooka Exp $); #include opt_inet.h @@ -86,13 +86,20 @@ static bool portalgo_debug = true; #define DPRINTF while (/*CONSTCOND*/0) printf #endif +#ifndef PORTALGO_INET4_DEFAULT +#define PORTALGO_INET4_DEFAULT PORTALGO_BSD +#endif +#ifndef PORTALGO_INET6_DEFAULT +#define PORTALGO_INET6_DEFAULT PORTALGO_BSD +#endif + typedef __BITMAP_TYPE(, uint32_t, 0x1) bitmap; #ifdef INET -static int inet4_portalgo = PORTALGO_BSD; +static int inet4_portalgo = PORTALGO_INET4_DEFAULT; static bitmap inet4_reserve; #endif #ifdef INET6 -static int inet6_portalgo = PORTALGO_BSD; +static int inet6_portalgo = PORTALGO_INET6_DEFAULT; static bitmap inet6_reserve; #endif
CVS commit: src/sys/rump/net/lib/libnetinet
Module Name:src Committed By: pooka Date: Sat Jun 1 11:02:42 UTC 2013 Modified Files: src/sys/rump/net/lib/libnetinet: Makefile.inc Log Message: default portalgo to random_start, for less connections from port 65535 To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/rump/net/lib/libnetinet/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libnetinet/Makefile.inc diff -u src/sys/rump/net/lib/libnetinet/Makefile.inc:1.9 src/sys/rump/net/lib/libnetinet/Makefile.inc:1.10 --- src/sys/rump/net/lib/libnetinet/Makefile.inc:1.9 Sat Jun 1 10:54:24 2013 +++ src/sys/rump/net/lib/libnetinet/Makefile.inc Sat Jun 1 11:02:42 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.9 2013/06/01 10:54:24 pooka Exp $ +# $NetBSD: Makefile.inc,v 1.10 2013/06/01 11:02:42 pooka Exp $ # .PATH: ${.CURDIR}/../../../../netinet ${.CURDIR}/../../../../netinet6 @@ -27,6 +27,9 @@ SRCS+= udp_usrreq.c CPPFLAGS+= -I${.CURDIR}/opt -I${.CURDIR}/../libnet/opt +CPPFLAGS+= -DPORTALGO_INET4_DEFAULT=PORTALGO_RANDOM_START +CPPFLAGS+= -DPORTALGO_INET6_DEFAULT=PORTALGO_RANDOM_START + # TCP debugging #SRCS+= tcp_debug.c #CPPFLAGS+= -DTCP_DEBUG
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Sat Jun 1 11:44:37 UTC 2013 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: Assert that we get PRU_ATTACH requests only for the families we have registered. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.31 src/sys/rump/net/lib/libsockin/sockin.c:1.32 --- src/sys/rump/net/lib/libsockin/sockin.c:1.31 Sat Jun 1 10:10:57 2013 +++ src/sys/rump/net/lib/libsockin/sockin.c Sat Jun 1 11:44:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.31 2013/06/01 10:10:57 stacktic Exp $ */ +/* $NetBSD: sockin.c,v 1.32 2013/06/01 11:44:37 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.31 2013/06/01 10:10:57 stacktic Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.32 2013/06/01 11:44:37 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -400,6 +400,7 @@ sockin_usrreq(struct socket *so, int req { int news; int sbsize; + int family; sosetlock(so); if (so-so_snd.sb_hiwat == 0 || so-so_rcv.sb_hiwat == 0) { @@ -408,8 +409,9 @@ sockin_usrreq(struct socket *so, int req break; } - error = rumpcomp_sockin_socket( - so-so_proto-pr_domain-dom_family, + family = so-so_proto-pr_domain-dom_family; + KASSERT(family == PF_INET || family == PF_INET6); + error = rumpcomp_sockin_socket(family, so-so_proto-pr_type, 0, news); if (error) break;
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Sat Jun 1 11:46:14 UTC 2013 Modified Files: src/sys/rump/net/lib/libsockin: rumpcomp_user.c Log Message: Some minor tweaks to make this compile on Solaris. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/rump/net/lib/libsockin/rumpcomp_user.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/rumpcomp_user.c diff -u src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.6 src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.7 --- src/sys/rump/net/lib/libsockin/rumpcomp_user.c:1.6 Sat Jun 1 10:09:05 2013 +++ src/sys/rump/net/lib/libsockin/rumpcomp_user.c Sat Jun 1 11:46:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcomp_user.c,v 1.6 2013/06/01 10:09:05 stacktic Exp $ */ +/* $NetBSD: rumpcomp_user.c,v 1.7 2013/06/01 11:46:14 pooka Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -25,13 +25,18 @@ * SUCH DAMAGE. */ +/* for struct msghdr content visibility */ +#define _XOPEN_SOURCE 4 +#define _XOPEN_SOURCE_EXTENDED 1 + #ifndef _KERNEL #include sys/types.h #include sys/socket.h #include errno.h #include poll.h - +#include stdlib.h +#include string.h #include stdint.h #include rump/rumpuser_component.h @@ -53,9 +58,6 @@ #include netinet/tcp.h #include netinet/udp.h -#include stdlib.h -#include string.h - static int translate_so_sockopt(int); static int translate_ip_sockopt(int); @@ -120,16 +122,8 @@ translate_domain(int domain) { switch (domain) { - translate(AF_UNIX); translate(AF_INET); - translate(AF_SNA); - translate(AF_DECnet); - translate(AF_APPLETALK); - translate(AF_IPX); translate(AF_INET6); - translate(AF_ISDN); - translate(AF_BLUETOOTH); - translate(AF_ROUTE); default: return AF_UNSPEC; } } @@ -142,16 +136,8 @@ translate_domain_back(int domain) { switch (domain) { - translate_back(AF_UNIX); translate_back(AF_INET); - translate_back(AF_SNA); - translate_back(AF_DECnet); - translate_back(AF_APPLETALK); - translate_back(AF_IPX); translate_back(AF_INET6); - translate_back(AF_ISDN); - translate_back(AF_BLUETOOTH); - translate_back(AF_ROUTE); default: return RUMP_AF_UNSPEC; } } @@ -215,7 +201,11 @@ static const struct { {RUMP_MSG_CTRUNC, MSG_CTRUNC}, {RUMP_MSG_WAITALL, MSG_WAITALL}, {RUMP_MSG_DONTWAIT, MSG_DONTWAIT}, + + /* might be better to always set NOSIGNAL ... */ +#ifdef MSG_NOSIGNAL {RUMP_MSG_NOSIGNAL, MSG_NOSIGNAL}, +#endif }; static int native_to_bsd_msg_flags(int); @@ -264,8 +254,8 @@ bsd_to_native_msg_flags(int bflag) #endif struct rump_sockaddr { - __uint8_t sa_len; /* total length */ - __uint8_t sa_family; /* address family */ + uint8_t sa_len; /* total length */ + uint8_t sa_family; /* address family */ char sa_data[14]; /* actually longer; address value */ };
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Sat Jun 1 20:22:27 UTC 2013 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: check for EOF from backing sucket To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.32 src/sys/rump/net/lib/libsockin/sockin.c:1.33 --- src/sys/rump/net/lib/libsockin/sockin.c:1.32 Sat Jun 1 11:44:37 2013 +++ src/sys/rump/net/lib/libsockin/sockin.c Sat Jun 1 20:22:27 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.32 2013/06/01 11:44:37 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.33 2013/06/01 20:22:27 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.32 2013/06/01 11:44:37 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.33 2013/06/01 20:22:27 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -236,7 +236,7 @@ sockin_process(struct socket *so) rmsg.msg_namelen = sizeof(from); error = rumpcomp_sockin_recvmsg(SO2S(so), rmsg, 0, n); - if (error) { + if (error || n == 0) { m_freem(m); /* Treat a TCP socket a goner */
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: pooka Date: Fri May 31 16:16:40 UTC 2013 Modified Files: src/sys/rump/librump/rumpkern: rump.c Log Message: run shutdownhooks To generate a diff of this commit: cvs rdiff -u -r1.269 -r1.270 src/sys/rump/librump/rumpkern/rump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/rump.c diff -u src/sys/rump/librump/rumpkern/rump.c:1.269 src/sys/rump/librump/rumpkern/rump.c:1.270 --- src/sys/rump/librump/rumpkern/rump.c:1.269 Wed May 15 14:07:26 2013 +++ src/sys/rump/librump/rumpkern/rump.c Fri May 31 16:16:40 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rump.c,v 1.269 2013/05/15 14:07:26 pooka Exp $ */ +/* $NetBSD: rump.c,v 1.270 2013/05/31 16:16:40 pooka Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.269 2013/05/15 14:07:26 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.270 2013/05/31 16:16:40 pooka Exp $); #include sys/systm.h #define ELFSIZE ARCH_ELFSIZE @@ -568,6 +568,8 @@ cpu_reboot(int howto, char *bootstr) rump_vfs_fini(); } + doshutdownhooks(); + /* your wish is my command */ if (howto RB_HALT) { printf(rump kernel halted\n);
CVS commit: src/lib/librump
Module Name:src Committed By: pooka Date: Fri May 31 16:25:24 UTC 2013 Modified Files: src/lib/librump: rump_lwproc.3 Log Message: minor terminology and generality fixes no functional change To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/librump/rump_lwproc.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librump/rump_lwproc.3 diff -u src/lib/librump/rump_lwproc.3:1.4 src/lib/librump/rump_lwproc.3:1.5 --- src/lib/librump/rump_lwproc.3:1.4 Sun Jan 2 13:03:29 2011 +++ src/lib/librump/rump_lwproc.3 Fri May 31 16:25:24 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: rump_lwproc.3,v 1.4 2011/01/02 13:03:29 pooka Exp $ +.\ $NetBSD: rump_lwproc.3,v 1.5 2013/05/31 16:25:24 pooka Exp $ .\ .\ Copyright (c) 2010 Antti Kantee. All rights reserved. .\ @@ -28,7 +28,7 @@ .Os .Sh NAME .Nm rump_lwproc -.Nd rump process/lwp management +.Nd rump kernel process/lwp management .Sh LIBRARY rump kernel (librump, \-lrump) .Sh SYNOPSIS @@ -52,10 +52,11 @@ The current lwp (curlwp) indicates the c which resources, such as UID/GID, current working directory, and file descriptor table, are currently used. These basic principles apply to rump kernels as well, but since -rump uses the host's thread and process context directly, the rules +a rump kernel uses the host's thread and process context directly, the rules for how thread context is determined are different. .Pp -In the rump model, each host thread (pthread) is either bound to +In the rump kernel model, each host thread (implemented for example +with pthreads) is either bound to a rump kernel lwp or accesses the rump kernel with an implicit thread context associated with pid 1. An implicit thread context is created every time the rump kernel @@ -69,7 +70,7 @@ The association between host threads and left to the caller. It is possible to create a dedicated host thread for every rump kernel lwp or multiplex them on top of a single host thread. -After rump lwps have been created, switching curlwp is very cheap +After rump kernel lwps have been created, switching curlwp is very cheap -- faster than a thread context switch on the host. In case multiple lwps/processes are created, it is the caller's responsibility to keep track of them and release them when they
CVS commit: src/sys/rump/net/lib/libvirtif
Module Name:src Committed By: pooka Date: Mon May 20 10:24:26 UTC 2013 Modified Files: src/sys/rump/net/lib/libvirtif: rumpcomp_user.c Log Message: Return 0 for success instead of returning an uninitialized automatic variable. from Gal Sagie, PR 47837 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/rump/net/lib/libvirtif/rumpcomp_user.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libvirtif/rumpcomp_user.c diff -u src/sys/rump/net/lib/libvirtif/rumpcomp_user.c:1.5 src/sys/rump/net/lib/libvirtif/rumpcomp_user.c:1.6 --- src/sys/rump/net/lib/libvirtif/rumpcomp_user.c:1.5 Tue Apr 30 12:39:21 2013 +++ src/sys/rump/net/lib/libvirtif/rumpcomp_user.c Mon May 20 10:24:26 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcomp_user.c,v 1.5 2013/04/30 12:39:21 pooka Exp $ */ +/* $NetBSD: rumpcomp_user.c,v 1.6 2013/05/20 10:24:26 pooka Exp $ */ /* * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -114,6 +114,7 @@ rumpcomp_virtif_create(int devnum, struc goto out; } viu-viu_dying = 0; + rv = 0; out: rumpuser_component_schedule(cookie);
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: pooka Date: Wed May 15 12:49:33 UTC 2013 Modified Files: src/sys/rump/librump/rumpkern: ltsleep.c Log Message: qlock can now be a regular kernel spin mutex instead of a rumpuser mutex. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/rump/librump/rumpkern/ltsleep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/ltsleep.c diff -u src/sys/rump/librump/rumpkern/ltsleep.c:1.31 src/sys/rump/librump/rumpkern/ltsleep.c:1.32 --- src/sys/rump/librump/rumpkern/ltsleep.c:1.31 Sun Apr 28 13:37:52 2013 +++ src/sys/rump/librump/rumpkern/ltsleep.c Wed May 15 12:49:33 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ltsleep.c,v 1.31 2013/04/28 13:37:52 pooka Exp $ */ +/* $NetBSD: ltsleep.c,v 1.32 2013/05/15 12:49:33 pooka Exp $ */ /* * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ltsleep.c,v 1.31 2013/04/28 13:37:52 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: ltsleep.c,v 1.32 2013/05/15 12:49:33 pooka Exp $); #include sys/param.h #include sys/kernel.h @@ -58,7 +58,7 @@ struct ltsleeper { #define kcv u.kern static LIST_HEAD(, ltsleeper) sleepers = LIST_HEAD_INITIALIZER(sleepers); -static struct rumpuser_mtx *qlock; +static kmutex_t *qlock; static int sleeper(wchan_t ident, int timo, kmutex_t *kinterlock) @@ -76,9 +76,9 @@ sleeper(wchan_t ident, int timo, kmutex_ rumpuser_cv_init(lts.ucv); } - rumpuser_mutex_enter_nowrap(qlock); + mutex_spin_enter(qlock); LIST_INSERT_HEAD(sleepers, lts, entries); - rumpuser_mutex_exit(qlock); + mutex_exit(qlock); if (timo) { if (kinterlock) { @@ -104,9 +104,9 @@ sleeper(wchan_t ident, int timo, kmutex_ rv = 0; } - rumpuser_mutex_enter_nowrap(qlock); + mutex_spin_enter(qlock); LIST_REMOVE(lts, entries); - rumpuser_mutex_exit(qlock); + mutex_exit(qlock); if (kinterlock) cv_destroy(lts.kcv); @@ -152,7 +152,7 @@ wakeup(wchan_t ident) { struct ltsleeper *ltsp; - rumpuser_mutex_enter_nowrap(qlock); + mutex_spin_enter(qlock); LIST_FOREACH(ltsp, sleepers, entries) { if (ltsp-id == ident) { if (ltsp-iskwait) { @@ -162,12 +162,12 @@ wakeup(wchan_t ident) } } } - rumpuser_mutex_exit(qlock); + mutex_exit(qlock); } void rump_tsleep_init() { - rumpuser_mutex_init(qlock, RUMPUSER_MTX_SPIN); + mutex_init(qlock, MUTEX_SPIN, IPL_NONE); }
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: pooka Date: Wed May 15 13:58:14 UTC 2013 Modified Files: src/sys/rump/librump/rumpkern: ltsleep.c Log Message: how did that extra asterisk get there? To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/rump/librump/rumpkern/ltsleep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/ltsleep.c diff -u src/sys/rump/librump/rumpkern/ltsleep.c:1.32 src/sys/rump/librump/rumpkern/ltsleep.c:1.33 --- src/sys/rump/librump/rumpkern/ltsleep.c:1.32 Wed May 15 12:49:33 2013 +++ src/sys/rump/librump/rumpkern/ltsleep.c Wed May 15 13:58:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ltsleep.c,v 1.32 2013/05/15 12:49:33 pooka Exp $ */ +/* $NetBSD: ltsleep.c,v 1.33 2013/05/15 13:58:14 pooka Exp $ */ /* * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ltsleep.c,v 1.32 2013/05/15 12:49:33 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: ltsleep.c,v 1.33 2013/05/15 13:58:14 pooka Exp $); #include sys/param.h #include sys/kernel.h @@ -58,7 +58,7 @@ struct ltsleeper { #define kcv u.kern static LIST_HEAD(, ltsleeper) sleepers = LIST_HEAD_INITIALIZER(sleepers); -static kmutex_t *qlock; +static kmutex_t qlock; static int sleeper(wchan_t ident, int timo, kmutex_t *kinterlock)
CVS commit: src
Module Name:src Committed By: pooka Date: Wed May 15 14:07:26 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.3 rumpuser_pth.c src/sys/rump/include/rump: rumpuser.h src/sys/rump/librump/rumpkern: lwproc.c rump.c scheduler.c Log Message: Add RUMPUSER_LWP_CLEAR instead of overloading RUMPUSER_LWP_SET. This simplifies some alternative hypervisor implementations. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/lib/librumpuser/rumpuser.3 cvs rdiff -u -r1.28 -r1.29 src/lib/librumpuser/rumpuser_pth.c cvs rdiff -u -r1.103 -r1.104 src/sys/rump/include/rump/rumpuser.h cvs rdiff -u -r1.22 -r1.23 src/sys/rump/librump/rumpkern/lwproc.c cvs rdiff -u -r1.268 -r1.269 src/sys/rump/librump/rumpkern/rump.c cvs rdiff -u -r1.33 -r1.34 src/sys/rump/librump/rumpkern/scheduler.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.3 diff -u src/lib/librumpuser/rumpuser.3:1.9 src/lib/librumpuser/rumpuser.3:1.10 --- src/lib/librumpuser/rumpuser.3:1.9 Fri May 3 20:27:16 2013 +++ src/lib/librumpuser/rumpuser.3 Wed May 15 14:07:26 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: rumpuser.3,v 1.9 2013/05/03 20:27:16 wiz Exp $ +.\ $NetBSD: rumpuser.3,v 1.10 2013/05/15 14:07:26 pooka Exp $ .\ .\ Copyright (c) 2013 Antti Kantee. All rights reserved. .\ @@ -23,7 +23,7 @@ .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\ SUCH DAMAGE. .\ -.Dd May 2, 2013 +.Dd May 15, 2013 .Dt RUMPUSER 3 .Os .Sh NAME @@ -475,10 +475,14 @@ from the hypervisor. Set .Fa l as the current host thread's rump kernel context. -The value -.Dv NULL -means that an existing rump kernel context (which must exist) -must be cleared. +A previous context must not exist. +.It Dv RUMPUSER_LWP_CLEAR +Clear the context previous set by +.Dv RUMPUSER_LWP_SET . +The value passed in +.Fa l +is the current thread and is never +.Dv NULL. .El .Pp .Ft struct lwp * @@ -641,7 +645,8 @@ Routines which do not return an integer .%A Antti Kantee .%D 2012 .%J Aalto University Doctoral Dissertations -.%T Flexible Operating System Internals: The Design and Implementation of the Anykernel and Rump Kernerls +.%T Flexible Operating System Internals: The Design and Implementation of the Anykernel and Rump Kernels +.%O Section 2.3.2: The Hypercall Interface .Re .Sh HISTORY The rump kernel hypercall API was first introduced in Index: src/lib/librumpuser/rumpuser_pth.c diff -u src/lib/librumpuser/rumpuser_pth.c:1.28 src/lib/librumpuser/rumpuser_pth.c:1.29 --- src/lib/librumpuser/rumpuser_pth.c:1.28 Sun May 5 12:27:38 2013 +++ src/lib/librumpuser/rumpuser_pth.c Wed May 15 14:07:26 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth.c,v 1.28 2013/05/05 12:27:38 pooka Exp $ */ +/* $NetBSD: rumpuser_pth.c,v 1.29 2013/05/15 14:07:26 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_pth.c,v 1.28 2013/05/05 12:27:38 pooka Exp $); +__RCSID($NetBSD: rumpuser_pth.c,v 1.29 2013/05/15 14:07:26 pooka Exp $); #endif /* !lint */ #include sys/queue.h @@ -627,26 +627,27 @@ rumpuser_curlwpop(enum rumplwpop op, str free(rl); break; case RUMPUSER_LWP_SET: - assert(pthread_getspecific(curlwpkey) == NULL || l == NULL); + assert(pthread_getspecific(curlwpkey) == NULL l != NULL); - if (l) { - pthread_mutex_lock(lwplock); - LIST_FOREACH(rl, lwps, l_entries) { -if (rl-l == l) - break; - } - if (!rl) { -fprintf(stderr, -LWP_SET: %p does not exist\n, l); -abort(); - } - pthread_mutex_unlock(lwplock); - } else { - rl = NULL; + pthread_mutex_lock(lwplock); + LIST_FOREACH(rl, lwps, l_entries) { + if (rl-l == l) +break; } + if (!rl) { + fprintf(stderr, + LWP_SET: %p does not exist\n, l); + abort(); + } + pthread_mutex_unlock(lwplock); pthread_setspecific(curlwpkey, rl); break; + case RUMPUSER_LWP_CLEAR: + assert(((struct rumpuser_lwp *) + pthread_getspecific(curlwpkey))-l == l); + pthread_setspecific(curlwpkey, NULL); + break; } } @@ -671,9 +672,13 @@ rumpuser_curlwpop(enum rumplwpop op, str case RUMPUSER_LWP_DESTROY: break; case RUMPUSER_LWP_SET: - assert(pthread_getspecific(curlwpkey) == NULL || l == NULL); + assert(pthread_getspecific(curlwpkey) == NULL); pthread_setspecific(curlwpkey, l); break; + case RUMPUSER_LWP_CLEAR: + assert(pthread_getspecific(curlwpkey) == l); + pthread_setspecific(curlwpkey, NULL); + break; } } Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.103 src/sys/rump/include/rump/rumpuser.h:1.104 --- src/sys/rump/include/rump/rumpuser.h:1.103 Thu May 2 21:45:28 2013 +++ src/sys/rump/include/rump/rumpuser.h Wed May 15 14:07:26 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.103 2013/05/02 21:45:28 pooka
CVS commit: src
Module Name:src Committed By: pooka Date: Wed May 15 14:52:49 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.3 rumpuser.c rumpuser_pth.c rumpuser_pth_dummy.c src/sys/rump/include/rump: rumpuser.h src/sys/rump/librump/rumpkern: locks.c Log Message: Pass enums over the hypercall interface as ints to avoid some pathological scenarios from arising in setups where enums might be of a different size in the rump kernel and hypervisor. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/librumpuser/rumpuser.3 cvs rdiff -u -r1.50 -r1.51 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.29 -r1.30 src/lib/librumpuser/rumpuser_pth.c cvs rdiff -u -r1.15 -r1.16 src/lib/librumpuser/rumpuser_pth_dummy.c cvs rdiff -u -r1.104 -r1.105 src/sys/rump/include/rump/rumpuser.h cvs rdiff -u -r1.63 -r1.64 src/sys/rump/librump/rumpkern/locks.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.3 diff -u src/lib/librumpuser/rumpuser.3:1.10 src/lib/librumpuser/rumpuser.3:1.11 --- src/lib/librumpuser/rumpuser.3:1.10 Wed May 15 14:07:26 2013 +++ src/lib/librumpuser/rumpuser.3 Wed May 15 14:52:49 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: rumpuser.3,v 1.10 2013/05/15 14:07:26 pooka Exp $ +.\ $NetBSD: rumpuser.3,v 1.11 2013/05/15 14:52:49 pooka Exp $ .\ .\ Copyright (c) 2013 Antti Kantee. All rights reserved. .\ @@ -44,6 +44,18 @@ The implementation included in is for POSIX hosts. This document is divided into sections based on the functionality group of each hypercall. +.Pp +Since the hypercall interface is a C function interface, both the +rump kernel and the hypervisor must conform to the same ABI. +The interface itself attempts to assume as little as possible from +the type systems, and for example +.Vt off_t +is passed as +.Vt int64_t +and enums are passed as ints. +It is recommended that the hypervisor converts these to the native +types before starting to process the hypercall, for example by +assigning the ints back to enums. .Sh UPCALLS AND RUMP KERNEL CONTEXT A hypercall is always entered with the calling thread scheduled in the rump kernel. @@ -73,7 +85,7 @@ by calling .Fn rumpuser_init int version struct rump_hyperup *hyp .Pp Initialize the hypervisor. -.Bl -tag -width xalignmentx +.Bl -tag -width xenum_rumpclock .It Fa version hypercall interface version number that the kernel expects to be used. In case the hypervisor cannot provide an exact match, this routine must @@ -84,7 +96,7 @@ pointer to a set of upcalls the hypervis .Ss Memory allocation .Ft int .Fn rumpuser_malloc size_t len int alignment void **memp -.Bl -tag -width xalignmentx +.Bl -tag -width xenum_rumpclock .It Fa len amount of memory to allocate .It Fa alignment @@ -97,7 +109,7 @@ return pointer for allocated memory .Pp .Ft void .Fn rumpuser_free void *mem size_t len -.Bl -tag -width xalignmentx +.Bl -tag -width xenum_rumpclock .It Fa mem memory to free .It Fa len @@ -120,7 +132,7 @@ and the host's file system namespace. For example, it is possible to associate the file descriptor with device I/O registers for special values of .Fa name . -.Bl -tag -width xalignmentx +.Bl -tag -width xenum_rumpclock .It Fa name the identifier of the file to open for I/O .It Fa mode @@ -163,7 +175,7 @@ Close a previously opened file descripto .Pp .Ft int .Fn rumpuser_getfileinfo const char *name uint64_t *size int *type -.Bl -tag -width xalignmentx +.Bl -tag -width xenum_rumpclock .It Fa name file for which information is returned. The namespace is equal to that of @@ -190,7 +202,7 @@ respectively. .Fc .Pp Initiate block I/O and return immediately. -.Bl -tag -width xalignmentx +.Bl -tag -width xenum_rumpclock .It Fa fd perform I/O on this file descriptor. The file descriptor must have been opened with @@ -239,7 +251,7 @@ These routines perform scatter-gather I/ block I/O by nature and therefore cannot be handled by .Fn rumpuser_bio . .Pp -.Bl -tag -width xalignmentx +.Bl -tag -width xenum_rumpclock .It Fa fd file descriptor to perform I/O on .It Fa ruiov @@ -276,10 +288,10 @@ If this is not possible, the hypervisor retain semantics. .Pp .Ft int -.Fn rumpuser_clock_gettime enum rumpclock clk int64_t *sec long *nsec +.Fn rumpuser_clock_gettime int enum_rumpclock int64_t *sec long *nsec .Pp -.Bl -tag -width xalignmentx -.It Fa clk +.Bl -tag -width xenum_rumpclock +.It Fa enum_rumpclock specifies the clock type. In case of .Dv RUMPUSER_CLOCK_RELWALL @@ -294,9 +306,9 @@ return value for nanoseconds .El .Pp .Ft int -.Fn rumpuser_clock_sleep enum rumpclock clk int64_t sec long nsec -.Bl -tag -width xalignmentx -.It Fa clk +.Fn rumpuser_clock_sleep int enum_rumpclock int64_t sec long nsec +.Bl -tag -width xenum_rumpclock +.It Fa enum_rumpclock In case of .Dv RUMPUSER_CLOCK_RELWALL , the sleep should last at least as long
CVS commit: src
Module Name:src Committed By: pooka Date: Wed May 15 14:58:24 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.3 rumpuser.c rumpuser_bio.c src/sys/rump/include/rump: rumpuser.h Log Message: Pass off_t over the hypercall interface as int64_t to avoid potential problems in setups where off_t doesn't want to be 64bit. I'm already excitedly waiting for 128bit off_t and _LARGE_LARGE_FILES To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/lib/librumpuser/rumpuser.3 cvs rdiff -u -r1.51 -r1.52 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.6 -r1.7 src/lib/librumpuser/rumpuser_bio.c cvs rdiff -u -r1.105 -r1.106 src/sys/rump/include/rump/rumpuser.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.3 diff -u src/lib/librumpuser/rumpuser.3:1.11 src/lib/librumpuser/rumpuser.3:1.12 --- src/lib/librumpuser/rumpuser.3:1.11 Wed May 15 14:52:49 2013 +++ src/lib/librumpuser/rumpuser.3 Wed May 15 14:58:24 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: rumpuser.3,v 1.11 2013/05/15 14:52:49 pooka Exp $ +.\ $NetBSD: rumpuser.3,v 1.12 2013/05/15 14:58:24 pooka Exp $ .\ .\ Copyright (c) 2013 Antti Kantee. All rights reserved. .\ @@ -197,7 +197,7 @@ respectively. .Pp .Ft void .Fo rumpuser_bio -.Fa int fd int op void *data size_t dlen off_t off +.Fa int fd int op void *data size_t dlen int64_t off .Fa rump_biodone_fn biodone void *donearg .Fc .Pp @@ -238,13 +238,13 @@ opaque arg that must be passed to .Ft int .Fo rumpuser_iovread .Fa int fd struct rumpuser_iovec *ruiov size_t iovlen -.Fa off_t off size_t *retv +.Fa int64_t off size_t *retv .Fc .Pp .Ft int .Fo rumpuser_iovwrite .Fa int fd struct rumpuser_iovec *ruiov size_t iovlen -.Fa off_t off size_t *retv +.Fa int64_t off size_t *retv .Fc .Pp These routines perform scatter-gather I/O which is not Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.51 src/lib/librumpuser/rumpuser.c:1.52 --- src/lib/librumpuser/rumpuser.c:1.51 Wed May 15 14:52:49 2013 +++ src/lib/librumpuser/rumpuser.c Wed May 15 14:58:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.51 2013/05/15 14:52:49 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.52 2013/05/15 14:58:24 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.51 2013/05/15 14:52:49 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.52 2013/05/15 14:58:24 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -332,9 +332,10 @@ rumpuser_close(int fd) */ int rumpuser_iovread(int fd, struct rumpuser_iovec *ruiov, size_t iovlen, - off_t off, size_t *retp) + int64_t roff, size_t *retp) { struct iovec *iov = (struct iovec *)ruiov; + off_t off = (off_t)roff; ssize_t nn; int rv; @@ -364,9 +365,10 @@ rumpuser_iovread(int fd, struct rumpuser int rumpuser_iovwrite(int fd, const struct rumpuser_iovec *ruiov, size_t iovlen, - off_t off, size_t *retp) + int64_t roff, size_t *retp) { const struct iovec *iov = (const struct iovec *)ruiov; + off_t off = (off_t)roff; ssize_t nn; int rv; Index: src/lib/librumpuser/rumpuser_bio.c diff -u src/lib/librumpuser/rumpuser_bio.c:1.6 src/lib/librumpuser/rumpuser_bio.c:1.7 --- src/lib/librumpuser/rumpuser_bio.c:1.6 Tue May 7 15:18:35 2013 +++ src/lib/librumpuser/rumpuser_bio.c Wed May 15 14:58:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_bio.c,v 1.6 2013/05/07 15:18:35 pooka Exp $ */ +/* $NetBSD: rumpuser_bio.c,v 1.7 2013/05/15 14:58:24 pooka Exp $ */ /*- * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -127,7 +127,7 @@ biothread(void *arg) } void -rumpuser_bio(int fd, int op, void *data, size_t dlen, off_t doff, +rumpuser_bio(int fd, int op, void *data, size_t dlen, int64_t doff, rump_biodone_fn biodone, void *bioarg) { struct rumpuser_bio bio; @@ -163,7 +163,7 @@ rumpuser_bio(int fd, int op, void *data, bio.bio_op = op; bio.bio_data = data; bio.bio_dlen = dlen; - bio.bio_off = doff; + bio.bio_off = (off_t)doff; bio.bio_done = biodone; bio.bio_donearg = bioarg; Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.105 src/sys/rump/include/rump/rumpuser.h:1.106 --- src/sys/rump/include/rump/rumpuser.h:1.105 Wed May 15 14:52:49 2013 +++ src/sys/rump/include/rump/rumpuser.h Wed May 15 14:58:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.105 2013/05/15 14:52:49 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.106 2013/05/15 14:58:24 pooka Exp $ */ /* * Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved. @@ -97,7 +97,7 @@ int rumpuser_getfileinfo(const char *, u #define RUMPUSER_BIO_WRITE 0x02 #define RUMPUSER_BIO_SYNC 0x04 typedef void (*rump_biodone_fn)(void *, size_t, int); -void rumpuser_bio(int, int, void *, size_t, off_t, rump_biodone_fn, void *); +void
CVS commit: src
Module Name:src Committed By: pooka Date: Wed May 15 15:57:01 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.3 rumpuser.c src/sys/rump/include/rump: rumpuser.h Log Message: Add a generalized rumpuser_syncfd() call which allows the caller to request a sync or a barrier for fd. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/lib/librumpuser/rumpuser.3 cvs rdiff -u -r1.52 -r1.53 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.106 -r1.107 src/sys/rump/include/rump/rumpuser.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.3 diff -u src/lib/librumpuser/rumpuser.3:1.12 src/lib/librumpuser/rumpuser.3:1.13 --- src/lib/librumpuser/rumpuser.3:1.12 Wed May 15 14:58:24 2013 +++ src/lib/librumpuser/rumpuser.3 Wed May 15 15:57:01 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: rumpuser.3,v 1.12 2013/05/15 14:58:24 pooka Exp $ +.\ $NetBSD: rumpuser.3,v 1.13 2013/05/15 15:57:01 pooka Exp $ .\ .\ Copyright (c) 2013 Antti Kantee. All rights reserved. .\ @@ -280,6 +280,51 @@ results in undefined behavior. .It Fa retv number of bytes successfully transferred is returned here .El +.Pp +.Ft int +.Fo rumpuser_syncfd +.Fa int fd int flags uint64_t start uint64_t len +.Fc +.Pp +Synchronizes +.Fa fd +with respect to backing storage. +The other arguments are: +.Pp +.Bl -tag -width xenum_rumpclock +.It Fa flags +controls how syncronization happens. +It must contain one of the following: +.Bl -tag -width XRUMPUSER_SYNCFD_BARRIER +.It Dv RUMPUSER_SYNCFD_READ +Make sure that the next read sees writes from all other parties. +This is useful for example in the case that +.Fa fd +represents memory to write a DMA read is being performed. +.It Dv RUMPUSER_SYNCFD_WRITE +Flush cached writes. +.El +.Pp +The following additional parameters may be passed in +.Fa flags : +.Pp +.Bl -tag -width XRUMPUSER_SYNCFD_BARRIER +.It Dv RUMPUSER_SYNCFD_BARRIER +Issue a barrier. +Outstanding I/O operations which were started before the barrier +complete before any operations after the barrier are performed. +.It Dv RUMPUSER_SYNCFD_SYNC +Wait for the synchronization operation to fully complete before +returning. +For example, this could mean that the data to be written to a disk +has hit either the disk or non-volatile memory. +.El +.It Fa start +offset into the object. +.It Fa len +the number of bytes to synchronize. +The value 0 denotes until the end of the object. +.El .Ss Clocks The hypervisor should support two clocks, one for wall time and one for monotonically increasing time, the latter of which may be based Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.52 src/lib/librumpuser/rumpuser.c:1.53 --- src/lib/librumpuser/rumpuser.c:1.52 Wed May 15 14:58:24 2013 +++ src/lib/librumpuser/rumpuser.c Wed May 15 15:57:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.52 2013/05/15 14:58:24 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.53 2013/05/15 15:57:01 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.52 2013/05/15 14:58:24 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.53 2013/05/15 15:57:01 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -397,6 +397,43 @@ rumpuser_iovwrite(int fd, const struct r } int +rumpuser_syncfd(int fd, int flags, uint64_t start, uint64_t len) +{ + int rv = 0; + + /* + * For now, assume fd is regular file and does not care + * about read syncing + */ + if ((flags RUMPUSER_SYNCFD_BOTH) == 0) { + rv = EINVAL; + goto out; + } + if ((flags RUMPUSER_SYNCFD_WRITE) == 0) { + rv = 0; + goto out; + } + +#ifdef __NetBSD__ + { + int fsflags = FDATASYNC; + + if (fsflags RUMPUSER_SYNCFD_SYNC) + fsflags |= FDISKSYNC; + if (fsync_range(fd, fsflags, start, len) == -1) + rv = errno; + } +#else + /* el-simplo */ + if (fsync(fd) == -1) + rv = errno; +#endif + + out: + ET(rv); +} + +int rumpuser_clock_gettime(int enum_rumpclock, int64_t *sec, long *nsec) { enum rumpclock rclk = enum_rumpclock; Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.106 src/sys/rump/include/rump/rumpuser.h:1.107 --- src/sys/rump/include/rump/rumpuser.h:1.106 Wed May 15 14:58:24 2013 +++ src/sys/rump/include/rump/rumpuser.h Wed May 15 15:57:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.106 2013/05/15 14:58:24 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.107 2013/05/15 15:57:01 pooka Exp $ */ /* * Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved. @@ -109,6 +109,13 @@ int rumpuser_iovread(int, struct rumpuse int rumpuser_iovwrite(int, const struct rumpuser_iovec *, size_t, int64_t, size_t *); +#define RUMPUSER_SYNCFD_READ 0x01 +#define RUMPUSER_SYNCFD_WRITE 0x02 +#define RUMPUSER_SYNCFD_BOTH (RUMPUSER_SYNCFD_READ
CVS commit: src/sys/rump/include/rump
Module Name:src Committed By: pooka Date: Wed May 15 16:00:04 UTC 2013 Modified Files: src/sys/rump/include/rump: rumpuser.h Log Message: Looks like I'm done revamping, so bump interface version to 17, where it will hopefully stay for all eternity (unless some snafus are discovered before NetBSD 7). To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/sys/rump/include/rump/rumpuser.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.107 src/sys/rump/include/rump/rumpuser.h:1.108 --- src/sys/rump/include/rump/rumpuser.h:1.107 Wed May 15 15:57:01 2013 +++ src/sys/rump/include/rump/rumpuser.h Wed May 15 16:00:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.107 2013/05/15 15:57:01 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.108 2013/05/15 16:00:04 pooka Exp $ */ /* * Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved. @@ -42,7 +42,11 @@ struct lwp; * init */ -#define RUMPUSER_VERSION 16 +/* + * Bumping this causes all kinds of havoc for implementations + * outside of the NetBSD tree, so try to avoid it. + */ +#define RUMPUSER_VERSION 17 /* hypervisor upcall routines */ struct rumpuser_hyperup {
CVS commit: src/sys/fs/sysvbfs
Module Name:src Committed By: pooka Date: Wed May 15 16:44:03 UTC 2013 Modified Files: src/sys/fs/sysvbfs: sysvbfs_vnops.c Log Message: Don't change a read-only file system. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/fs/sysvbfs/sysvbfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/sysvbfs/sysvbfs_vnops.c diff -u src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.47 src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.48 --- src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.47 Mon Mar 18 19:35:40 2013 +++ src/sys/fs/sysvbfs/sysvbfs_vnops.c Wed May 15 16:44:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: sysvbfs_vnops.c,v 1.47 2013/03/18 19:35:40 plunky Exp $ */ +/* $NetBSD: sysvbfs_vnops.c,v 1.48 2013/05/15 16:44:03 pooka Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sysvbfs_vnops.c,v 1.47 2013/03/18 19:35:40 plunky Exp $); +__KERNEL_RCSID(0, $NetBSD: sysvbfs_vnops.c,v 1.48 2013/05/15 16:44:03 pooka Exp $); #include sys/param.h #include sys/kernel.h @@ -218,6 +218,10 @@ sysvbfs_close(void *arg) struct bfs_fileattr attr; DPRINTF(%s:\n, __func__); + + if (v-v_mount-mnt_flag MNT_RDONLY) + goto out; + uvm_vnp_setsize(v, bnode-size); memset(attr, 0xff, sizeof attr); /* Set VNOVAL all */ @@ -231,6 +235,7 @@ sysvbfs_close(void *arg) VOP_FSYNC(a-a_vp, a-a_cred, FSYNC_WAIT, 0, 0); + out: return 0; } @@ -877,6 +882,9 @@ sysvbfs_update(struct vnode *vp, const s struct sysvbfs_node *bnode = vp-v_data; struct bfs_fileattr attr; + if (vp-v_mount-mnt_flag MNT_RDONLY) + return 0; + DPRINTF(%s:\n, __func__); memset(attr, 0xff, sizeof attr); /* Set VNOVAL all */ if (bnode-update_atime) {
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Wed May 15 17:53:09 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.3 Log Message: Improve documentation on the locking order of cv_wait mtx/cpu. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/lib/librumpuser/rumpuser.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.3 diff -u src/lib/librumpuser/rumpuser.3:1.13 src/lib/librumpuser/rumpuser.3:1.14 --- src/lib/librumpuser/rumpuser.3:1.13 Wed May 15 15:57:01 2013 +++ src/lib/librumpuser/rumpuser.3 Wed May 15 17:53:09 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: rumpuser.3,v 1.13 2013/05/15 15:57:01 pooka Exp $ +.\ $NetBSD: rumpuser.3,v 1.14 2013/05/15 17:53:09 pooka Exp $ .\ .\ Copyright (c) 2013 Antti Kantee. All rights reserved. .\ @@ -600,7 +600,7 @@ may not relinquish rump kernel context. .Fn rumpuser_mutex_owner struct rumpuser_mtx *mtx struct lwp **lp .Pp Mutexes provide mutually exclusive locking. -The flags for initialization are as follows: +The flags, of which at least one must be given, are as follows: .Bl -tag -width XRUMPUSER_MTX_KMUTEX .It Dv RUMPUSER_MTX_SPIN Create a spin mutex. @@ -691,6 +691,19 @@ sleep duration after which the routine w .Er ETIMEDOUT . If a timedwait is signalled before the timeout expires, the routine will return 0. +.Pp +The order in which the hypervisor +reacquires the rump kernel context and interlock mutex before +returning into the rump kernel is as follows. +In case the interlock mutex was initialized with both +.Dv RUMPUSER_MTX_SPIN +and +.Dv RUMPUSER_MTX_KMUTEX , +the rump kernel context is scheduled before the mutex is reacquired. +In case of a purely +.Dv RUMPUSER_MTX_SPIN +mutex, the mutex is acquired first. +In the final case the order is implementation-defined. .Sh RETURN VALUES All routines which return an integer return an errno value. The hypervisor must translate the value to the the native errno
CVS commit: src/sys/rump
Module Name:src Committed By: pooka Date: Wed May 15 19:30:46 UTC 2013 Modified Files: src/sys/rump: VERSION Log Message: bump version for rumpuser changes To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/rump/VERSION Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/VERSION diff -u src/sys/rump/VERSION:1.7 src/sys/rump/VERSION:1.8 --- src/sys/rump/VERSION:1.7 Mon Mar 18 15:55:43 2013 +++ src/sys/rump/VERSION Wed May 15 19:30:46 2013 @@ -1,4 +1,4 @@ -# $NetBSD: VERSION,v 1.7 2013/03/18 15:55:43 pooka Exp $ +# $NetBSD: VERSION,v 1.8 2013/05/15 19:30:46 pooka Exp $ # # Since cvs does not provide a version number for the entire tree, provide # identifiers which can be used by external parties to check if the NetBSD @@ -9,4 +9,4 @@ # when date is bumped. # -BUILDRUMP=20130318:0 +BUILDRUMP=20130515:0
CVS commit: src/lib
Module Name:src Committed By: pooka Date: Wed May 15 20:27:00 UTC 2013 Modified Files: src/lib/librumpclient: Makefile src/lib/librumpuser: Makefile Log Message: Make it possible for external parties to specify additional dplibs. This is useful for example on platforms which require -ldl. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/librumpclient/Makefile cvs rdiff -u -r1.12 -r1.13 src/lib/librumpuser/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpclient/Makefile diff -u src/lib/librumpclient/Makefile:1.7 src/lib/librumpclient/Makefile:1.8 --- src/lib/librumpclient/Makefile:1.7 Tue Mar 8 19:11:27 2011 +++ src/lib/librumpclient/Makefile Wed May 15 20:27:00 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.7 2011/03/08 19:11:27 pooka Exp $ +# $NetBSD: Makefile,v 1.8 2013/05/15 20:27:00 pooka Exp $ # .PATH: ${.CURDIR}/../../sys/rump/librump/rumpkern @@ -12,6 +12,11 @@ MAN= rumpclient.3 INCS= rumpclient.h INCSDIR= /usr/include/rump +.for lib in ${RUMPCLIENT_EXTERNAL_DPLIBS} +LIBDO.${lib}= _external +LIBDPLIBS+= ${lib} lib +.endfor + CPPFLAGS+= -DRUMP_CLIENT CPPFLAGS+= -I${.OBJDIR} -I${.CURDIR} -I${.CURDIR}/../librumpuser SRCS= rumpclient.c Index: src/lib/librumpuser/Makefile diff -u src/lib/librumpuser/Makefile:1.12 src/lib/librumpuser/Makefile:1.13 --- src/lib/librumpuser/Makefile:1.12 Tue Apr 30 15:48:29 2013 +++ src/lib/librumpuser/Makefile Wed May 15 20:27:00 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.12 2013/04/30 15:48:29 pooka Exp $ +# $NetBSD: Makefile,v 1.13 2013/05/15 20:27:00 pooka Exp $ # WARNS?= 5 @@ -8,6 +8,10 @@ WARNS?= 5 LIB= rumpuser LIBDPLIBS+= pthread ${.CURDIR}/../libpthread +.for lib in ${RUMPUSER_EXTERNAL_DPLIBS} +LIBDO.${lib}= _external +LIBDPLIBS+= ${lib} lib +.endfor CPPFLAGS+= -DLIBRUMPUSER #CPPFLAGS+= -D_DIAGNOSTIC
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Wed May 15 20:47:20 UTC 2013 Modified Files: src/lib/librumpuser: Makefile Log Message: also, bsd.own.mk to pick up mk.conf To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/lib/librumpuser/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/Makefile diff -u src/lib/librumpuser/Makefile:1.13 src/lib/librumpuser/Makefile:1.14 --- src/lib/librumpuser/Makefile:1.13 Wed May 15 20:27:00 2013 +++ src/lib/librumpuser/Makefile Wed May 15 20:47:20 2013 @@ -1,6 +1,8 @@ -# $NetBSD: Makefile,v 1.13 2013/05/15 20:27:00 pooka Exp $ +# $NetBSD: Makefile,v 1.14 2013/05/15 20:47:20 pooka Exp $ # +.include bsd.own.mk + WARNS?= 5 # rumpuser.h is in sys/rump for inclusion by kernel components
CVS commit: src/sys/rump/kern/lib
Module Name:src Committed By: pooka Date: Wed May 15 21:39:30 UTC 2013 Modified Files: src/sys/rump/kern/lib/libsys_cygwin: syscalls.master src/sys/rump/kern/lib/libsys_sunos: syscalls.master Log Message: Support utimes/futimes. Makes at least fsu_touch work on these platforms. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/rump/kern/lib/libsys_cygwin/syscalls.master cvs rdiff -u -r1.1 -r1.2 src/sys/rump/kern/lib/libsys_sunos/syscalls.master Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/kern/lib/libsys_cygwin/syscalls.master diff -u src/sys/rump/kern/lib/libsys_cygwin/syscalls.master:1.1 src/sys/rump/kern/lib/libsys_cygwin/syscalls.master:1.2 --- src/sys/rump/kern/lib/libsys_cygwin/syscalls.master:1.1 Wed Apr 10 16:44:54 2013 +++ src/sys/rump/kern/lib/libsys_cygwin/syscalls.master Wed May 15 21:39:30 2013 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.1 2013/04/10 16:44:54 pooka Exp $ + $NetBSD: syscalls.master,v 1.2 2013/05/15 21:39:30 pooka Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -508,10 +508,12 @@ 417 UNIMPL select 418 UNIMPL gettimeofday 419 UNIMPL settimeofday -420 UNIMPL utimes +420 NOARGS { int|compat_50_sys||utimes(char *path, \ + struct timeval50 *tptr); } 421 UNIMPL adjtime 422 UNIMPL lfs_segwait -423 UNIMPL futimes +423 NOARGS { int|compat_50_sys||futimes(int fd, \ + struct timeval50 *tptr); } 424 UNIMPL lutimes 425 UNIMPL setitimer 426 UNIMPL getitimer Index: src/sys/rump/kern/lib/libsys_sunos/syscalls.master diff -u src/sys/rump/kern/lib/libsys_sunos/syscalls.master:1.1 src/sys/rump/kern/lib/libsys_sunos/syscalls.master:1.2 --- src/sys/rump/kern/lib/libsys_sunos/syscalls.master:1.1 Tue Apr 9 13:08:33 2013 +++ src/sys/rump/kern/lib/libsys_sunos/syscalls.master Wed May 15 21:39:30 2013 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.1 2013/04/09 13:08:33 pooka Exp $ + $NetBSD: syscalls.master,v 1.2 2013/05/15 21:39:30 pooka Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -511,10 +511,12 @@ 417 UNIMPL select 418 UNIMPL gettimeofday 419 UNIMPL settimeofday -420 UNIMPL utimes +420 NOARGS { int|compat_50_sys||utimes(char *path, \ + struct timeval50 *tptr); } 421 UNIMPL adjtime 422 UNIMPL lfs_segwait -423 UNIMPL futimes +423 NOARGS { int|compat_50_sys||futimes(int fd, \ + struct timeval50 *tptr); } 424 UNIMPL lutimes 425 UNIMPL setitimer 426 UNIMPL getitimer
CVS commit: src/sys/rump/kern/lib
Module Name:src Committed By: pooka Date: Wed May 15 21:41:25 UTC 2013 Modified Files: src/sys/rump/kern/lib/libsys_cygwin: rump_cygwin_syscall.h rump_cygwin_syscallargs.h rump_cygwin_syscalls.c rump_cygwin_sysent.c src/sys/rump/kern/lib/libsys_sunos: rump_sunos_syscall.h rump_sunos_syscallargs.h rump_sunos_syscalls.c rump_sunos_sysent.c Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscall.h \ src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscallargs.h \ src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscalls.c \ src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_sysent.c cvs rdiff -u -r1.1 -r1.2 \ src/sys/rump/kern/lib/libsys_sunos/rump_sunos_syscall.h \ src/sys/rump/kern/lib/libsys_sunos/rump_sunos_syscallargs.h \ src/sys/rump/kern/lib/libsys_sunos/rump_sunos_syscalls.c \ src/sys/rump/kern/lib/libsys_sunos/rump_sunos_sysent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscall.h diff -u src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscall.h:1.1 src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscall.h:1.2 --- src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscall.h:1.1 Wed Apr 10 16:45:45 2013 +++ src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscall.h Wed May 15 21:41:25 2013 @@ -1,10 +1,10 @@ -/* $NetBSD: rump_cygwin_syscall.h,v 1.1 2013/04/10 16:45:45 pooka Exp $ */ +/* $NetBSD: rump_cygwin_syscall.h,v 1.2 2013/05/15 21:41:25 pooka Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.1 2013/04/10 16:44:54 pooka Exp + * created from NetBSD: syscalls.master,v 1.2 2013/05/15 21:39:30 pooka Exp */ #ifndef _RUMP_CYGWIN_SYS_SYSCALL_H_ @@ -171,6 +171,12 @@ /* syscall: fchroot ret: int args: int */ #define RUMP_CYGWIN_SYS_fchroot 297 +/* syscall: utimes ret: int args: char * struct timeval50 * */ +#define RUMP_CYGWIN_SYS_utimes 420 + +/* syscall: futimes ret: int args: int struct timeval50 * */ +#define RUMP_CYGWIN_SYS_futimes 423 + /* syscall: __mknod50 ret: int args: const char * mode_t int */ #define RUMP_CYGWIN_SYS___mknod50 450 Index: src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscallargs.h diff -u src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscallargs.h:1.1 src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscallargs.h:1.2 --- src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscallargs.h:1.1 Wed Apr 10 16:45:45 2013 +++ src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscallargs.h Wed May 15 21:41:25 2013 @@ -1,10 +1,10 @@ -/* $NetBSD: rump_cygwin_syscallargs.h,v 1.1 2013/04/10 16:45:45 pooka Exp $ */ +/* $NetBSD: rump_cygwin_syscallargs.h,v 1.2 2013/05/15 21:41:25 pooka Exp $ */ /* * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.1 2013/04/10 16:44:54 pooka Exp + * created from NetBSD: syscalls.master,v 1.2 2013/05/15 21:39:30 pooka Exp */ #ifndef _RUMP_CYGWIN_SYS_SYSCALLARGS_H_ @@ -133,6 +133,10 @@ struct rump_cygwin_sys_getdents_args { }; check_syscall_args(rump_cygwin_sys_getdents) +struct compat_50_sys_utimes_args; + +struct compat_50_sys_futimes_args; + struct rump_cygwin_sys_stat_args { syscallarg(const char *) path; syscallarg(struct cygwin_stat *) sp; @@ -267,6 +271,10 @@ int sys_fchroot(struct lwp *, const stru int rump_cygwin_sys_getdents(struct lwp *, const struct rump_cygwin_sys_getdents_args *, register_t *); +int compat_50_sys_utimes(struct lwp *, const struct compat_50_sys_utimes_args *, register_t *); + +int compat_50_sys_futimes(struct lwp *, const struct compat_50_sys_futimes_args *, register_t *); + int rump_cygwin_sys_stat(struct lwp *, const struct rump_cygwin_sys_stat_args *, register_t *); int rump_cygwin_sys_fstat(struct lwp *, const struct rump_cygwin_sys_fstat_args *, register_t *); Index: src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscalls.c diff -u src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscalls.c:1.1 src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscalls.c:1.2 --- src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscalls.c:1.1 Wed Apr 10 16:45:45 2013 +++ src/sys/rump/kern/lib/libsys_cygwin/rump_cygwin_syscalls.c Wed May 15 21:41:25 2013 @@ -1,14 +1,14 @@ -/* $NetBSD: rump_cygwin_syscalls.c,v 1.1 2013/04/10 16:45:45 pooka Exp $ */ +/* $NetBSD: rump_cygwin_syscalls.c,v 1.2 2013/05/15 21:41:25 pooka Exp $ */ /* * System call names. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.1 2013/04/10 16:44:54 pooka Exp + * created from NetBSD: syscalls.master,v 1.2 2013/05/15 21:39:30 pooka Exp */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD:
CVS commit: src/sys/rump
Module Name:src Committed By: pooka Date: Wed May 15 21:53:27 UTC 2013 Modified Files: src/sys/rump: VERSION Log Message: one more bump for the recent changes To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/rump/VERSION Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/VERSION diff -u src/sys/rump/VERSION:1.8 src/sys/rump/VERSION:1.9 --- src/sys/rump/VERSION:1.8 Wed May 15 19:30:46 2013 +++ src/sys/rump/VERSION Wed May 15 21:53:27 2013 @@ -1,4 +1,4 @@ -# $NetBSD: VERSION,v 1.8 2013/05/15 19:30:46 pooka Exp $ +# $NetBSD: VERSION,v 1.9 2013/05/15 21:53:27 pooka Exp $ # # Since cvs does not provide a version number for the entire tree, provide # identifiers which can be used by external parties to check if the NetBSD @@ -9,4 +9,4 @@ # when date is bumped. # -BUILDRUMP=20130515:0 +BUILDRUMP=20130515:1
CVS commit: src/sys/kern
Module Name:src Committed By: pooka Date: Wed May 8 11:08:46 UTC 2013 Modified Files: src/sys/kern: uipc_mbuf.c Log Message: print more diagnostic info in panic message To generate a diff of this commit: cvs rdiff -u -r1.148 -r1.149 src/sys/kern/uipc_mbuf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/uipc_mbuf.c diff -u src/sys/kern/uipc_mbuf.c:1.148 src/sys/kern/uipc_mbuf.c:1.149 --- src/sys/kern/uipc_mbuf.c:1.148 Sat Jan 19 00:51:52 2013 +++ src/sys/kern/uipc_mbuf.c Wed May 8 11:08:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_mbuf.c,v 1.148 2013/01/19 00:51:52 rmind Exp $ */ +/* $NetBSD: uipc_mbuf.c,v 1.149 2013/05/08 11:08:45 pooka Exp $ */ /*- * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uipc_mbuf.c,v 1.148 2013/01/19 00:51:52 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: uipc_mbuf.c,v 1.149 2013/05/08 11:08:45 pooka Exp $); #include opt_mbuftrace.h #include opt_nmbclusters.h @@ -706,7 +706,7 @@ m_copym0(struct mbuf *m, int off0, int l off += n-m_len; #ifdef DIAGNOSTIC if (off m-m_len) - panic(m_copym0 overrun); + panic(m_copym0 overrun %d %d, off, m-m_len); #endif if (off == m-m_len) { m = m-m_next;
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Tue May 7 15:18:35 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_bio.c rumpuser_component.c rumpuser_daemonize.c Log Message: include stdint.h before rumpuser.h (on some platforms it doesn't get there automagically) To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/librumpuser/rumpuser_bio.c \ src/lib/librumpuser/rumpuser_component.c \ src/lib/librumpuser/rumpuser_daemonize.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_bio.c diff -u src/lib/librumpuser/rumpuser_bio.c:1.5 src/lib/librumpuser/rumpuser_bio.c:1.6 --- src/lib/librumpuser/rumpuser_bio.c:1.5 Mon Apr 29 14:54:03 2013 +++ src/lib/librumpuser/rumpuser_bio.c Tue May 7 15:18:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_bio.c,v 1.5 2013/04/29 14:54:03 pooka Exp $ */ +/* $NetBSD: rumpuser_bio.c,v 1.6 2013/05/07 15:18:35 pooka Exp $ */ /*- * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -32,6 +32,7 @@ #include assert.h #include errno.h #include pthread.h +#include stdint.h #include stdio.h #include string.h #include unistd.h Index: src/lib/librumpuser/rumpuser_component.c diff -u src/lib/librumpuser/rumpuser_component.c:1.5 src/lib/librumpuser/rumpuser_component.c:1.6 --- src/lib/librumpuser/rumpuser_component.c:1.5 Tue Apr 30 12:39:20 2013 +++ src/lib/librumpuser/rumpuser_component.c Tue May 7 15:18:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_component.c,v 1.5 2013/04/30 12:39:20 pooka Exp $ */ +/* $NetBSD: rumpuser_component.c,v 1.6 2013/05/07 15:18:35 pooka Exp $ */ /* * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -28,9 +28,11 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_component.c,v 1.5 2013/04/30 12:39:20 pooka Exp $); +__RCSID($NetBSD: rumpuser_component.c,v 1.6 2013/05/07 15:18:35 pooka Exp $); #endif /* !lint */ +#include stdint.h + /* * These interfaces affect the shlib major/minor; they can be called from * any program when applicable. The rest of the interfaces provided Index: src/lib/librumpuser/rumpuser_daemonize.c diff -u src/lib/librumpuser/rumpuser_daemonize.c:1.5 src/lib/librumpuser/rumpuser_daemonize.c:1.6 --- src/lib/librumpuser/rumpuser_daemonize.c:1.5 Tue Apr 30 12:39:20 2013 +++ src/lib/librumpuser/rumpuser_daemonize.c Tue May 7 15:18:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_daemonize.c,v 1.5 2013/04/30 12:39:20 pooka Exp $ */ +/* $NetBSD: rumpuser_daemonize.c,v 1.6 2013/05/07 15:18:35 pooka Exp $ */ /* * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_daemonize.c,v 1.5 2013/04/30 12:39:20 pooka Exp $); +__RCSID($NetBSD: rumpuser_daemonize.c,v 1.6 2013/05/07 15:18:35 pooka Exp $); #endif /* !lint */ #include sys/types.h @@ -36,6 +36,7 @@ __RCSID($NetBSD: rumpuser_daemonize.c,v #include errno.h #include fcntl.h +#include stdint.h #include stdio.h #include unistd.h
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Tue May 7 15:37:05 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_pth_dummy.c Log Message: update to recent interface changes To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/lib/librumpuser/rumpuser_pth_dummy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_pth_dummy.c diff -u src/lib/librumpuser/rumpuser_pth_dummy.c:1.13 src/lib/librumpuser/rumpuser_pth_dummy.c:1.14 --- src/lib/librumpuser/rumpuser_pth_dummy.c:1.13 Thu May 2 19:14:59 2013 +++ src/lib/librumpuser/rumpuser_pth_dummy.c Tue May 7 15:37:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth_dummy.c,v 1.13 2013/05/02 19:14:59 pooka Exp $ */ +/* $NetBSD: rumpuser_pth_dummy.c,v 1.14 2013/05/07 15:37:05 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -29,7 +29,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_pth_dummy.c,v 1.13 2013/05/02 19:14:59 pooka Exp $); +__RCSID($NetBSD: rumpuser_pth_dummy.c,v 1.14 2013/05/07 15:37:05 pooka Exp $); #endif /* !lint */ #include sys/time.h @@ -40,6 +40,7 @@ __RCSID($NetBSD: rumpuser_pth_dummy.c,v #include stdio.h #include string.h #include stdint.h +#include time.h #include rump/rumpuser.h @@ -152,23 +153,26 @@ rumpuser_rw_init(struct rumpuser_rw **rw } void -rumpuser_rw_enter(struct rumpuser_rw *rw, int write) +rumpuser_rw_enter(struct rumpuser_rw *rw, enum rumprwlock lk) { - if (write) { + switch (lk) { + case RUMPUSER_RW_WRITER: rw-v++; assert(rw-v == 1); - } else { + break; + case RUMPUSER_RW_READER: assert(rw-v = 0); rw-v--; + break; } } int -rumpuser_rw_tryenter(struct rumpuser_rw *rw, int write) +rumpuser_rw_tryenter(struct rumpuser_rw *rw, enum rumprwlock lk) { - rumpuser_rw_enter(rw, write); + rumpuser_rw_enter(rw, lk); return 0; } @@ -192,24 +196,17 @@ rumpuser_rw_destroy(struct rumpuser_rw * } void -rumpuser_rw_held(struct rumpuser_rw *rw, int *rvp) -{ - - *rvp = rw-v != 0; -} - -void -rumpuser_rw_rdheld(struct rumpuser_rw *rw, int *rvp) +rumpuser_rw_held(struct rumpuser_rw *rw, enum rumprwlock lk, int *rvp) { - *rvp = rw-v 0; -} - -void -rumpuser_rw_wrheld(struct rumpuser_rw *rw, int *rvp) -{ - - *rvp = rw-v 0; + switch (lk) { + case RUMPUSER_RW_WRITER: + *rvp = rw-v 0; + break; + case RUMPUSER_RW_READER: + *rvp = rw-v 0; + break; + } } /*ARGSUSED*/
CVS commit: src/sys/rump/net/lib/libshmif
Module Name:src Committed By: pooka Date: Tue May 7 16:18:49 UTC 2013 Modified Files: src/sys/rump/net/lib/libshmif: rumpcomp_user.c Log Message: Include necessary headers on Linux To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/rump/net/lib/libshmif/rumpcomp_user.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libshmif/rumpcomp_user.c diff -u src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.10 src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.11 --- src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.10 Tue Apr 30 12:39:21 2013 +++ src/sys/rump/net/lib/libshmif/rumpcomp_user.c Tue May 7 16:18:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcomp_user.c,v 1.10 2013/04/30 12:39:21 pooka Exp $ */ +/* $NetBSD: rumpcomp_user.c,v 1.11 2013/05/07 16:18:48 pooka Exp $ */ /*- * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -97,6 +97,10 @@ rumpcomp_shmif_watchwait(int kq) #elif defined(__linux__) #include sys/inotify.h +#include limits.h +#include stdio.h +#include unistd.h + int rumpcomp_shmif_watchsetup(int *inotifyp, int fd) {
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Tue May 7 16:40:31 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_pth_dummy.c Log Message: need the rw_downgrade/tryupgrade methods too To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/lib/librumpuser/rumpuser_pth_dummy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_pth_dummy.c diff -u src/lib/librumpuser/rumpuser_pth_dummy.c:1.14 src/lib/librumpuser/rumpuser_pth_dummy.c:1.15 --- src/lib/librumpuser/rumpuser_pth_dummy.c:1.14 Tue May 7 15:37:05 2013 +++ src/lib/librumpuser/rumpuser_pth_dummy.c Tue May 7 16:40:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth_dummy.c,v 1.14 2013/05/07 15:37:05 pooka Exp $ */ +/* $NetBSD: rumpuser_pth_dummy.c,v 1.15 2013/05/07 16:40:31 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -29,7 +29,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_pth_dummy.c,v 1.14 2013/05/07 15:37:05 pooka Exp $); +__RCSID($NetBSD: rumpuser_pth_dummy.c,v 1.15 2013/05/07 16:40:31 pooka Exp $); #endif /* !lint */ #include sys/time.h @@ -209,6 +209,26 @@ rumpuser_rw_held(struct rumpuser_rw *rw, } } +void +rumpuser_rw_downgrade(struct rumpuser_rw *rw) +{ + + assert(rw-v == 1); + rw-v = -1; +} + +int +rumpuser_rw_tryupgrade(struct rumpuser_rw *rw) +{ + + if (rw-v == -1) { + rw-v = 1; + return 0; + } + + return EBUSY; +} + /*ARGSUSED*/ void rumpuser_cv_init(struct rumpuser_cv **cv)
CVS commit: src/sys/rump/include/rump
Module Name:src Committed By: pooka Date: Wed May 8 00:25:31 UTC 2013 Modified Files: src/sys/rump/include/rump: makerumpdefs.sh Log Message: Grab the sysvbfs args structure too, since the fs is useful for simple testing. Incidentally, the structure is exactly the same as for UFS... To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/rump/include/rump/makerumpdefs.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/include/rump/makerumpdefs.sh diff -u src/sys/rump/include/rump/makerumpdefs.sh:1.14 src/sys/rump/include/rump/makerumpdefs.sh:1.15 --- src/sys/rump/include/rump/makerumpdefs.sh:1.14 Tue Apr 30 11:29:12 2013 +++ src/sys/rump/include/rump/makerumpdefs.sh Wed May 8 00:25:31 2013 @@ -8,7 +8,7 @@ echo Generating rumpdefs.h rm -f rumpdefs.h exec rumpdefs.h -printf '/* $NetBSD: makerumpdefs.sh,v 1.14 2013/04/30 11:29:12 pooka Exp $ */\n\n' +printf '/* $NetBSD: makerumpdefs.sh,v 1.15 2013/05/08 00:25:31 pooka Exp $ */\n\n' printf '/*\n *\tAUTOMATICALLY GENERATED. DO NOT EDIT.\n */\n\n' printf '#ifndef _RUMP_RUMPDEFS_H_\n' printf '#define _RUMP_RUMPDEFS_H_\n\n' @@ -67,4 +67,7 @@ getstruct ../../../sys/module.h modctl_l fromvers ../../../ufs/ufs/ufsmount.h getstruct ../../../ufs/ufs/ufsmount.h ufs_args +fromvers ../../../fs/sysvbfs/sysvbfs_args.h +getstruct ../../../fs/sysvbfs/sysvbfs_args.h sysvbfs_args + printf '\n#endif /* _RUMP_RUMPDEFS_H_ */\n'
CVS commit: src/sys/rump/include/rump
Module Name:src Committed By: pooka Date: Wed May 8 00:25:55 UTC 2013 Modified Files: src/sys/rump/include/rump: rumpdefs.h Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/rump/include/rump/rumpdefs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/include/rump/rumpdefs.h diff -u src/sys/rump/include/rump/rumpdefs.h:1.18 src/sys/rump/include/rump/rumpdefs.h:1.19 --- src/sys/rump/include/rump/rumpdefs.h:1.18 Tue Apr 30 12:39:21 2013 +++ src/sys/rump/include/rump/rumpdefs.h Wed May 8 00:25:55 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpdefs.h,v 1.18 2013/04/30 12:39:21 pooka Exp $ */ +/* $NetBSD: rumpdefs.h,v 1.19 2013/05/08 00:25:55 pooka Exp $ */ /* * AUTOMATICALLY GENERATED. DO NOT EDIT. @@ -291,4 +291,9 @@ struct rump_ufs_args { char *fspec; /* block special device to mount */ }; +/* NetBSD: sysvbfs_args.h,v 1.1 2008/09/04 12:07:30 pooka Exp */ +struct rump_sysvbfs_args { + char *fspec; /* blocks special holding the fs to mount */ +}; + #endif /* _RUMP_RUMPDEFS_H_ */
CVS commit: src/sys/rump/include/rump
Module Name:src Committed By: pooka Date: Wed May 8 00:57:06 UTC 2013 Modified Files: src/sys/rump/include/rump: makerumpdefs.sh Log Message: grab mount-related macros too To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/rump/include/rump/makerumpdefs.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/include/rump/makerumpdefs.sh diff -u src/sys/rump/include/rump/makerumpdefs.sh:1.15 src/sys/rump/include/rump/makerumpdefs.sh:1.16 --- src/sys/rump/include/rump/makerumpdefs.sh:1.15 Wed May 8 00:25:31 2013 +++ src/sys/rump/include/rump/makerumpdefs.sh Wed May 8 00:57:06 2013 @@ -8,7 +8,7 @@ echo Generating rumpdefs.h rm -f rumpdefs.h exec rumpdefs.h -printf '/* $NetBSD: makerumpdefs.sh,v 1.15 2013/05/08 00:25:31 pooka Exp $ */\n\n' +printf '/* $NetBSD: makerumpdefs.sh,v 1.16 2013/05/08 00:57:06 pooka Exp $ */\n\n' printf '/*\n *\tAUTOMATICALLY GENERATED. DO NOT EDIT.\n */\n\n' printf '#ifndef _RUMP_RUMPDEFS_H_\n' printf '#define _RUMP_RUMPDEFS_H_\n\n' @@ -61,6 +61,12 @@ sed -n '/#define[ ]*SO_[A-Z]/s/SO_/RUMP sed -n '/#define[ ]*SOL_[A-Z]/s/SOL_/RUMP_/gp' ../../../sys/socket.h \ | sed 's,/\*.*$,,' +fromvers ../../../sys/mount.h +sed -n '/#define[ ]*MOUNT_[A-Z]/s/MOUNT_/RUMP_MOUNT_/gp' ../../../sys/mount.h | sed 's,/\*.*$,,' + +fromvers ../../../sys/fstypes.h +sed -n '/#define[ ]*MNT_[A-Z].*[^\]$/s/MNT_/RUMP_MNT_/gp' ../../../sys/fstypes.h | sed 's,/\*.*$,,' + fromvers ../../../sys/module.h getstruct ../../../sys/module.h modctl_load
CVS commit: src/sys/rump/include/rump
Module Name:src Committed By: pooka Date: Wed May 8 00:57:25 UTC 2013 Modified Files: src/sys/rump/include/rump: rumpdefs.h Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/rump/include/rump/rumpdefs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/include/rump/rumpdefs.h diff -u src/sys/rump/include/rump/rumpdefs.h:1.19 src/sys/rump/include/rump/rumpdefs.h:1.20 --- src/sys/rump/include/rump/rumpdefs.h:1.19 Wed May 8 00:25:55 2013 +++ src/sys/rump/include/rump/rumpdefs.h Wed May 8 00:57:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpdefs.h,v 1.19 2013/05/08 00:25:55 pooka Exp $ */ +/* $NetBSD: rumpdefs.h,v 1.20 2013/05/08 00:57:24 pooka Exp $ */ /* * AUTOMATICALLY GENERATED. DO NOT EDIT. @@ -276,6 +276,78 @@ enum rump_vtype { RUMP_VNON, RUMP_VREG, #define RUMP_SO_RCVTIMEO 0x100c #define RUMP_SOL_SOCKET 0x +/* NetBSD: mount.h,v 1.209 2013/04/26 22:27:16 mlelstv Exp */ +#define RUMP_MOUNT_FFS ffs +#define RUMP_MOUNT_UFS RUMP_MOUNT_FFS +#define RUMP_MOUNT_NFS nfs +#define RUMP_MOUNT_MFS mfs +#define RUMP_MOUNT_MSDOS msdos +#define RUMP_MOUNT_LFS lfs +#define RUMP_MOUNT_FDESC fdesc +#define RUMP_MOUNT_NULL null +#define RUMP_MOUNT_OVERLAY overlay +#define RUMP_MOUNT_UMAP umap +#define RUMP_MOUNT_KERNFS kernfs +#define RUMP_MOUNT_PROCFS procfs +#define RUMP_MOUNT_AFS afs +#define RUMP_MOUNT_CD9660 cd9660 +#define RUMP_MOUNT_UNION union +#define RUMP_MOUNT_ADOSFS adosfs +#define RUMP_MOUNT_EXT2FS ext2fs +#define RUMP_MOUNT_CFS coda +#define RUMP_MOUNT_CODA RUMP_MOUNT_CFS +#define RUMP_MOUNT_FILECORE filecore +#define RUMP_MOUNT_NTFS ntfs +#define RUMP_MOUNT_SMBFS smbfs +#define RUMP_MOUNT_PTYFS ptyfs +#define RUMP_MOUNT_TMPFS tmpfs +#define RUMP_MOUNT_UDF udf +#define RUMP_MOUNT_SYSVBFS sysvbfs +#define RUMP_MOUNT_PUFFS puffs +#define RUMP_MOUNT_HFS hfs +#define RUMP_MOUNT_EFS efs +#define RUMP_MOUNT_ZFS zfs +#define RUMP_MOUNT_NILFS nilfs +#define RUMP_MOUNT_RUMPFS rumpfs +#define RUMP_MOUNT_V7FS v7fs + +/* NetBSD: fstypes.h,v 1.32 2012/11/26 16:22:21 drochner Exp */ +#define RUMP_MNT_RDONLY 0x0001 +#define RUMP_MNT_SYNCHRONOUS 0x0002 +#define RUMP_MNT_NOEXEC 0x0004 +#define RUMP_MNT_NOSUID 0x0008 +#define RUMP_MNT_NODEV 0x0010 +#define RUMP_MNT_UNION 0x0020 +#define RUMP_MNT_ASYNC 0x0040 +#define RUMP_MNT_NOCOREDUMP 0x8000 +#define RUMP_MNT_RELATIME 0x0002 +#define RUMP_MNT_IGNORE 0x0010 +#define RUMP_MNT_DISCARD 0x0080 +#define RUMP_MNT_EXTATTR 0x0100 +#define RUMP_MNT_LOG 0x0200 +#define RUMP_MNT_NOATIME 0x0400 +#define RUMP_MNT_SYMPERM 0x2000 +#define RUMP_MNT_NODEVMTIME 0x4000 +#define RUMP_MNT_SOFTDEP 0x8000 +#define RUMP_MNT_EXRDONLY 0x0080 +#define RUMP_MNT_EXPORTED 0x0100 +#define RUMP_MNT_DEFEXPORTED 0x0200 +#define RUMP_MNT_EXPORTANON 0x0400 +#define RUMP_MNT_EXKERB 0x0800 +#define RUMP_MNT_EXNORESPORT 0x0800 +#define RUMP_MNT_EXPUBLIC 0x1000 +#define RUMP_MNT_LOCAL 0x1000 +#define RUMP_MNT_QUOTA 0x2000 +#define RUMP_MNT_ROOTFS 0x4000 +#define RUMP_MNT_UPDATE 0x0001 +#define RUMP_MNT_RELOAD 0x0004 +#define RUMP_MNT_FORCE 0x0008 +#define RUMP_MNT_GETARGS 0x0040 +#define RUMP_MNT_OP_FLAGS (RUMP_MNT_UPDATE|RUMP_MNT_RELOAD|RUMP_MNT_FORCE|RUMP_MNT_GETARGS) +#define RUMP_MNT_WAIT 1 +#define RUMP_MNT_NOWAIT 2 +#define RUMP_MNT_LAZY 3 + /* NetBSD: module.h,v 1.32 2012/10/17 17:48:48 dyoung Exp */ struct rump_modctl_load { const char *ml_filename;
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: pooka Date: Mon May 6 16:28:17 UTC 2013 Modified Files: src/sys/rump/librump/rumpkern: locks_up.c Log Message: update for new hypercalls To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/rump/librump/rumpkern/locks_up.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/locks_up.c diff -u src/sys/rump/librump/rumpkern/locks_up.c:1.8 src/sys/rump/librump/rumpkern/locks_up.c:1.9 --- src/sys/rump/librump/rumpkern/locks_up.c:1.8 Sun Apr 28 13:37:52 2013 +++ src/sys/rump/librump/rumpkern/locks_up.c Mon May 6 16:28:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: locks_up.c,v 1.8 2013/04/28 13:37:52 pooka Exp $ */ +/* $NetBSD: locks_up.c,v 1.9 2013/05/06 16:28:17 pooka Exp $ */ /* * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: locks_up.c,v 1.8 2013/04/28 13:37:52 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: locks_up.c,v 1.9 2013/05/06 16:28:17 pooka Exp $); #include sys/param.h #include sys/kernel.h @@ -426,8 +426,11 @@ cv_broadcast(kcondvar_t *cv) bool cv_has_waiters(kcondvar_t *cv) { + int n; - return rumpuser_cv_has_waiters(RUMPCV(cv)); + rumpuser_cv_has_waiters(RUMPCV(cv), n); + + return n 0; } /* this is not much of an attempt, but ... */
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Sun May 5 12:27:38 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_pth.c Log Message: Initialize rw-downgrade when allocating a rwlock. should/might/etc fix recent test hangs reported by martin pgoyette To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/lib/librumpuser/rumpuser_pth.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_pth.c diff -u src/lib/librumpuser/rumpuser_pth.c:1.27 src/lib/librumpuser/rumpuser_pth.c:1.28 --- src/lib/librumpuser/rumpuser_pth.c:1.27 Fri May 3 00:23:49 2013 +++ src/lib/librumpuser/rumpuser_pth.c Sun May 5 12:27:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth.c,v 1.27 2013/05/03 00:23:49 pooka Exp $ */ +/* $NetBSD: rumpuser_pth.c,v 1.28 2013/05/05 12:27:38 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_pth.c,v 1.27 2013/05/03 00:23:49 pooka Exp $); +__RCSID($NetBSD: rumpuser_pth.c,v 1.28 2013/05/05 12:27:38 pooka Exp $); #endif /* !lint */ #include sys/queue.h @@ -317,6 +317,7 @@ rumpuser_rw_init(struct rumpuser_rw **rw NOFAIL_ERRNO(pthread_spin_init(((*rw)-spin),PTHREAD_PROCESS_PRIVATE)); (*rw)-readers = 0; (*rw)-writer = NULL; + (*rw)-downgrade = 0; } void
CVS commit: src/lib/librump
Module Name:src Committed By: pooka Date: Thu May 2 11:32:44 UTC 2013 Modified Files: src/lib/librump: rump.3 Log Message: update and bump date To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/lib/librump/rump.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librump/rump.3 diff -u src/lib/librump/rump.3:1.11 src/lib/librump/rump.3:1.12 --- src/lib/librump/rump.3:1.11 Tue Apr 30 21:21:24 2013 +++ src/lib/librump/rump.3 Thu May 2 11:32:44 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: rump.3,v 1.11 2013/04/30 21:21:24 pooka Exp $ +.\ $NetBSD: rump.3,v 1.12 2013/05/02 11:32:44 pooka Exp $ .\ .\ Copyright (c) 2008-2011 Antti Kantee. All rights reserved. .\ @@ -23,65 +23,58 @@ .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\ SUCH DAMAGE. .\ -.Dd March 25, 2011 +.Dd May 2, 2013 .Dt RUMP 3 .Os .Sh NAME .Nm rump -.Nd The Rump Anykernel +.Nd Rump Kernel .Sh LIBRARY rump Library (librump, \-lrump) .Sh SYNOPSIS .In rump/rump.h -.In rump/rump_syscalls.h .Sh DESCRIPTION -.Nm -is part of the realization of a flexible anykernel architecture for -.Nx . -An anykernel architecture enables using kernel code in a number of -different kernel models. -These models include, but are not limited to, the original monolithic -kernel, a microkernel server, or an exokernel style application -library. -.Nm -itself makes it possible to run unmodified kernel components in a regular -userspace process. -Most of the time unmodified means unmodified source code, but some -architectures can also execute unmodified kernel module binaries -in userspace. -Examples of different use models are running file system drivers -as userspace servers (see -.Xr p2k 3 ) -and being able to write standalone applications which understand -file system images. -.Pp -Regardless of the kernel model used, a rump kernel is a fullfledged -kernel with its own virtual namespaces, -including a file system hierarchy, CPUs, TCP/UDP -ports, device driver attachments and file descriptors. -This means that any modification to the system state on the host -running the rump kernel will not show up in the rump kernel and -vice versa. -A rump kernel may also be significantly more lightweight than the -host, and might not include for example file system support -at all. -.Pp -Clients using services provided by rump kernels can exist either -in the same process as the rump kernel or in other processes. -Local clients access the rump kernel through direct function calls. -They also naturally have access to the kernel memory space. -This document is geared towards local clients. -For more information on remote clients, -see -.Xr rump_sp 7 . -It is also possible to use unmodified application binaries as -remote clients with +A rump kernel is a virtualized kernel instance which retains only part +of the NetBSD kernel. +Rump kernels are aimed at virtualizing kernel drivers and do not support +for example creating processes, managing virtual memory address spaces +or scheduling threads. +These features are unnecessary overhead when virtualizing drivers. +Rump kernels are created by linking a desired set of components together. +On NetBSD, these components are available as userspace libraries with +the prefix +.Pa librump . +The high-level +.Xr rumpuser 3 +hypercall interface is used by a rump kernel to request resources and +services from the host it runs on. +Like any virtualized kernel, a rump kernel also provides its own set +of namespaces, such as a file system hierarchy and TCP ports, +that are independent of the ones on the host and of any other rump +kernel instances. +It should be noted that the presence of the provided namespaces +depends on the components that the rump kernel was constructed with. +.Pp +Since a rump kernel does not provide support for applications processes, +existing entities are used as rump kernel clients. +The relationship between the client and the rump kernel defines the +execution model of the rump kernel. +A local client will reside in the same address space and manipulate the +rump kernel with function calls and direct memory references. +Remote and microkernel clients are disjoint from the rump kernel +and make requests though various protocols, see for example +.Xr p2k 3 , +.Xr rump_sp 7 +and .Xr rumphijack 3 . +Remote clients will also work over a TCP/IP network, or other similar +communication medium. .Pp A rump kernel is bootstrapped by calling .Fn rump_init . -Before bootstrapping the kernel, it is possible to control its -functionality by setting various environment variables: +A number of environment variables set before a rump kernel is bootstrapped +will affect how it works. +Some examples includes: .Bl -tag -width RUMP_MEMLIMITXX .It Dv RUMP_NCPU If set, indicates the number of virtual CPUs configured into a @@ -96,8 +89,11 @@ If set to 0, prevents
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Thu May 2 12:27:08 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.3 Log Message: expand the intended usage of rumpuser_open() To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/librumpuser/rumpuser.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.3 diff -u src/lib/librumpuser/rumpuser.3:1.3 src/lib/librumpuser/rumpuser.3:1.4 --- src/lib/librumpuser/rumpuser.3:1.3 Tue Apr 30 21:18:40 2013 +++ src/lib/librumpuser/rumpuser.3 Thu May 2 12:27:08 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: rumpuser.3,v 1.3 2013/04/30 21:18:40 pooka Exp $ +.\ $NetBSD: rumpuser.3,v 1.4 2013/05/02 12:27:08 pooka Exp $ .\ .\ Copyright (c) 2013 Antti Kantee. All rights reserved. .\ @@ -111,13 +111,15 @@ which returned .Ft int .Fn rumpuser_open const char *name int mode int *fdp .Pp -Open a file for I/O. -Notably, there needs to be no mapping between +Open .Fa name -and the host, but for example on a POSIX system it may be convenient -to let +for I/O and associate a file descriptor with it. +Notably, there needs to be no mapping between .Fa name -denote the host file system namespace. +and the host's file system namespace. +For example, it is possible to associate the file descriptor with +device I/O registers for special values of +.Fa name . .Bl -tag -width xalignmentx .It Fa name the identifier of the file to open for I/O
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Thu May 2 15:32:20 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.3 Log Message: add HISTORY To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/librumpuser/rumpuser.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.3 diff -u src/lib/librumpuser/rumpuser.3:1.4 src/lib/librumpuser/rumpuser.3:1.5 --- src/lib/librumpuser/rumpuser.3:1.4 Thu May 2 12:27:08 2013 +++ src/lib/librumpuser/rumpuser.3 Thu May 2 15:32:19 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: rumpuser.3,v 1.4 2013/05/02 12:27:08 pooka Exp $ +.\ $NetBSD: rumpuser.3,v 1.5 2013/05/02 15:32:19 pooka Exp $ .\ .\ Copyright (c) 2013 Antti Kantee. All rights reserved. .\ @@ -609,3 +609,8 @@ Routines which do not return an integer .%J Aalto University Doctoral Dissertations .%T Flexible Operating System Internals: The Design and Implementation of the Anykernel and Rump Kernerls .Re +.Sh HISTORY +The rump kernel hypercall API was first introduced in +.Nx 5 . +The API described above first appeared in +.Nx 7 .
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Thu May 2 16:49:08 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_pth.c Log Message: Clear rwlock's writer field when releasing the lock. Otherwise it might have been possible for readers to reach visibility before writer when another CPU took the lock, thus leading the previous owner to incorrectly think that it still owned the lock in rw_write_held(). Also, remove duplicate clause from assert(). To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/lib/librumpuser/rumpuser_pth.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_pth.c diff -u src/lib/librumpuser/rumpuser_pth.c:1.21 src/lib/librumpuser/rumpuser_pth.c:1.22 --- src/lib/librumpuser/rumpuser_pth.c:1.21 Tue Apr 30 13:29:28 2013 +++ src/lib/librumpuser/rumpuser_pth.c Thu May 2 16:49:08 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth.c,v 1.21 2013/04/30 13:29:28 pooka Exp $ */ +/* $NetBSD: rumpuser_pth.c,v 1.22 2013/05/02 16:49:08 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_pth.c,v 1.21 2013/04/30 13:29:28 pooka Exp $); +__RCSID($NetBSD: rumpuser_pth.c,v 1.22 2013/05/02 16:49:08 pooka Exp $); #endif /* !lint */ #include assert.h @@ -65,8 +65,9 @@ do { \ } while (/*CONSTCOND*/0) #define RURW_CLRWRITE(rw) \ do { \ - assert(rw-readers == -1 RURW_AMWRITER(rw)); \ + assert(RURW_AMWRITER(rw)); \ rw-readers = 0; \ + rw-writer = NULL; \ } while (/*CONSTCOND*/0) #define RURW_INCREAD(rw) \ do { \
CVS commit: src
Module Name:src Committed By: pooka Date: Thu May 2 20:33:54 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_pth.c src/sys/rump/librump/rumpkern: locks.c Log Message: Retry enabling spin mutexes. We should be able to avoid poking the scheduler by just making wakeup from cv_wait() honor the same locking order as when a spin mutex is acquired though mutex_enter(). *fingers crossed* To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/librumpuser/rumpuser_pth.c cvs rdiff -u -r1.60 -r1.61 src/sys/rump/librump/rumpkern/locks.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_pth.c diff -u src/lib/librumpuser/rumpuser_pth.c:1.23 src/lib/librumpuser/rumpuser_pth.c:1.24 --- src/lib/librumpuser/rumpuser_pth.c:1.23 Thu May 2 19:14:59 2013 +++ src/lib/librumpuser/rumpuser_pth.c Thu May 2 20:33:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth.c,v 1.23 2013/05/02 19:14:59 pooka Exp $ */ +/* $NetBSD: rumpuser_pth.c,v 1.24 2013/05/02 20:33:54 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_pth.c,v 1.23 2013/05/02 19:14:59 pooka Exp $); +__RCSID($NetBSD: rumpuser_pth.c,v 1.24 2013/05/02 20:33:54 pooka Exp $); #endif /* !lint */ #include sys/queue.h @@ -378,17 +378,53 @@ rumpuser_cv_destroy(struct rumpuser_cv * free(cv); } +static void +cv_unschedule(struct rumpuser_mtx *mtx, int *nlocks) +{ + + rumpkern_unsched(nlocks, mtx); + mtxexit(mtx); +} + +static void +cv_reschedule(struct rumpuser_mtx *mtx, int nlocks) +{ + + /* + * If the cv interlock is a spin mutex, we must first release + * the mutex that was reacquired by pthread_cond_wait(), + * acquire the CPU context and only then relock the mutex. + * This is to preserve resource allocation order so that + * we don't deadlock. Non-spinning mutexes don't have this + * problem since they don't use a hold-and-wait approach + * to acquiring the mutex wrt the rump kernel CPU context. + * + * The more optimal solution would be to rework rumpkern_sched() + * so that it's possible to tell the scheduler + * if you need to block, drop this lock first, but I'm not + * going poking there without some numbers on how often this + * path is taken for spin mutexes. + */ + if ((mtx-flags (RUMPUSER_MTX_SPIN | RUMPUSER_MTX_KMUTEX)) == + (RUMPUSER_MTX_SPIN | RUMPUSER_MTX_KMUTEX)) { + NOFAIL_ERRNO(pthread_mutex_unlock(mtx-pthmtx)); + rumpkern_sched(nlocks, mtx); + rumpuser_mutex_enter_nowrap(mtx); + } else { + mtxenter(mtx); + rumpkern_sched(nlocks, mtx); + } +} + void rumpuser_cv_wait(struct rumpuser_cv *cv, struct rumpuser_mtx *mtx) { int nlocks; cv-nwaiters++; - rumpkern_unsched(nlocks, mtx); - mtxexit(mtx); + cv_unschedule(mtx, nlocks); NOFAIL_ERRNO(pthread_cond_wait(cv-pthcv, mtx-pthmtx)); - mtxenter(mtx); - rumpkern_sched(nlocks, mtx); + cv_reschedule(mtx, nlocks); cv-nwaiters--; } @@ -420,8 +456,7 @@ rumpuser_cv_timedwait(struct rumpuser_cv clock_gettime(CLOCK_REALTIME, ts); cv-nwaiters++; - rumpkern_unsched(nlocks, mtx); - mtxexit(mtx); + cv_unschedule(mtx, nlocks); ts.tv_sec += sec; ts.tv_nsec += nsec; @@ -430,8 +465,8 @@ rumpuser_cv_timedwait(struct rumpuser_cv ts.tv_nsec -= 1000*1000*1000; } rv = pthread_cond_timedwait(cv-pthcv, mtx-pthmtx, ts); - mtxenter(mtx); - rumpkern_sched(nlocks, mtx); + + cv_reschedule(mtx, nlocks); cv-nwaiters--; ET(rv); Index: src/sys/rump/librump/rumpkern/locks.c diff -u src/sys/rump/librump/rumpkern/locks.c:1.60 src/sys/rump/librump/rumpkern/locks.c:1.61 --- src/sys/rump/librump/rumpkern/locks.c:1.60 Tue Apr 30 00:03:53 2013 +++ src/sys/rump/librump/rumpkern/locks.c Thu May 2 20:33:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: locks.c,v 1.60 2013/04/30 00:03:53 pooka Exp $ */ +/* $NetBSD: locks.c,v 1.61 2013/05/02 20:33:54 pooka Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: locks.c,v 1.60 2013/04/30 00:03:53 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: locks.c,v 1.61 2013/05/02 20:33:54 pooka Exp $); #include sys/param.h #include sys/kmem.h @@ -113,11 +113,9 @@ mutex_init(kmutex_t *mtx, kmutex_type_t isspin = 1; } -#if 0 /* spin mutex support needs some cpu scheduler rework */ if (isspin) ruflags |= RUMPUSER_MTX_SPIN; -#endif rumpuser_mutex_init((struct rumpuser_mtx **)mtx, ruflags); ALLOCK(mtx, mutex_lockops); } @@ -144,7 +142,7 @@ mutex_spin_enter(kmutex_t *mtx) { WANTLOCK(mtx, false, false); - rumpuser_mutex_enter(RUMPMTX(mtx)); + rumpuser_mutex_enter_nowrap(RUMPMTX(mtx)); LOCKED(mtx, false); }
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: pooka Date: Thu May 2 20:37:33 UTC 2013 Modified Files: src/sys/rump/librump/rumpkern: locks.c Log Message: g/c stale comment To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/rump/librump/rumpkern/locks.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/locks.c diff -u src/sys/rump/librump/rumpkern/locks.c:1.61 src/sys/rump/librump/rumpkern/locks.c:1.62 --- src/sys/rump/librump/rumpkern/locks.c:1.61 Thu May 2 20:33:54 2013 +++ src/sys/rump/librump/rumpkern/locks.c Thu May 2 20:37:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: locks.c,v 1.61 2013/05/02 20:33:54 pooka Exp $ */ +/* $NetBSD: locks.c,v 1.62 2013/05/02 20:37:32 pooka Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: locks.c,v 1.61 2013/05/02 20:33:54 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: locks.c,v 1.62 2013/05/02 20:37:32 pooka Exp $); #include sys/param.h #include sys/kmem.h @@ -113,7 +113,6 @@ mutex_init(kmutex_t *mtx, kmutex_type_t isspin = 1; } - /* spin mutex support needs some cpu scheduler rework */ if (isspin) ruflags |= RUMPUSER_MTX_SPIN; rumpuser_mutex_init((struct rumpuser_mtx **)mtx, ruflags);
CVS commit: src
Module Name:src Committed By: pooka Date: Thu May 2 21:35:19 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.3 rumpuser_pth.c src/sys/rump/include/rump: rumpuser.h src/sys/rump/librump/rumpkern: locks.c Log Message: Push rwlock upgrade and downgrade into the hypervisor where there's at least a chance to implement them with minimal fuss. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/librumpuser/rumpuser.3 cvs rdiff -u -r1.24 -r1.25 src/lib/librumpuser/rumpuser_pth.c cvs rdiff -u -r1.101 -r1.102 src/sys/rump/include/rump/rumpuser.h cvs rdiff -u -r1.62 -r1.63 src/sys/rump/librump/rumpkern/locks.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.3 diff -u src/lib/librumpuser/rumpuser.3:1.6 src/lib/librumpuser/rumpuser.3:1.7 --- src/lib/librumpuser/rumpuser.3:1.6 Thu May 2 19:14:59 2013 +++ src/lib/librumpuser/rumpuser.3 Thu May 2 21:35:19 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: rumpuser.3,v 1.6 2013/05/02 19:14:59 pooka Exp $ +.\ $NetBSD: rumpuser.3,v 1.7 2013/05/02 21:35:19 pooka Exp $ .\ .\ Copyright (c) 2013 Antti Kantee. All rights reserved. .\ @@ -561,30 +561,38 @@ will never be called for that particular .Fn rumpuser_rw_init struct rumpuser_rw **rwp .Pp .Ft void -.Fn rumpuser_rw_enter struct rumpuser_rw *rw int writelock +.Fn rumpuser_rw_enter struct rumpuser_rw *rw const enum rumprwlock lk .Pp .Ft int -.Fn rumpuser_rw_tryenter struct rumpuser_rw *rw int writelock +.Fn rumpuser_rw_tryenter struct rumpuser_rw *rw const enum rumprwlock lk .Pp -.Ft void -.Fn rumpuser_rw_exit struct rumpuser_rw *rw +.Ft int +.Fn rumpuser_rw_tryupgrade struct rumpuser_rw *rw .Pp .Ft void -.Fn rumpuser_rw_destroy struct rumpuser_rw *rw +.Fn rumpuser_rw_downgrade struct rumpuser_rw *rw .Pp .Ft void -.Fn rumpuser_rw_held struct rumpuser_rw *rw int *heldp +.Fn rumpuser_rw_exit struct rumpuser_rw *rw .Pp .Ft void -.Fn rumpuser_rw_rdheld struct rumpuser_rw *rw int *heldp +.Fn rumpuser_rw_destroy struct rumpuser_rw *rw .Pp .Ft void -.Fn rumpuser_rw_wrheld struct rumpuser_rw *rw int *heldp -.Pp -Read/write locks acquire an exclusive version of the lock if the -.Fa writelock -parameter is non-zero and a shared lock otherwise. +.Fo rumpuser_rw_held +.Fa struct rumpuser_rw *rw const enum rumprwlock lk int *heldp +.Fc .Pp +Read/write locks provide either shared or exclusive locking. +The possible values for +.Fa lk +are +.Dv RUMPUSER_RW_READER +and +.Dv RUMPUSER_RW_WRITER . +Upgrading means trying to migrate from an already owned shared +lock to an exclusive lock and downgrading means migrating from +an already owned exclusive lock to a shared lock. .Pp .Ft void .Fn rumpuser_cv_init struct rumpuser_cv **cvp Index: src/lib/librumpuser/rumpuser_pth.c diff -u src/lib/librumpuser/rumpuser_pth.c:1.24 src/lib/librumpuser/rumpuser_pth.c:1.25 --- src/lib/librumpuser/rumpuser_pth.c:1.24 Thu May 2 20:33:54 2013 +++ src/lib/librumpuser/rumpuser_pth.c Thu May 2 21:35:19 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth.c,v 1.24 2013/05/02 20:33:54 pooka Exp $ */ +/* $NetBSD: rumpuser_pth.c,v 1.25 2013/05/02 21:35:19 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_pth.c,v 1.24 2013/05/02 20:33:54 pooka Exp $); +__RCSID($NetBSD: rumpuser_pth.c,v 1.25 2013/05/02 21:35:19 pooka Exp $); #endif /* !lint */ #include sys/queue.h @@ -286,40 +286,72 @@ rumpuser_rw_init(struct rumpuser_rw **rw } void -rumpuser_rw_enter(struct rumpuser_rw *rw, int iswrite) +rumpuser_rw_enter(struct rumpuser_rw *rw, const enum rumprwlock lk) { - if (iswrite) { + switch (lk) { + case RUMPUSER_RW_WRITER: if (pthread_rwlock_trywrlock(rw-pthrw) != 0) KLOCK_WRAP(NOFAIL_ERRNO( pthread_rwlock_wrlock(rw-pthrw))); RURW_SETWRITE(rw); - } else { + break; + case RUMPUSER_RW_READER: if (pthread_rwlock_tryrdlock(rw-pthrw) != 0) KLOCK_WRAP(NOFAIL_ERRNO( pthread_rwlock_rdlock(rw-pthrw))); RURW_INCREAD(rw); + break; } } int -rumpuser_rw_tryenter(struct rumpuser_rw *rw, int iswrite) +rumpuser_rw_tryenter(struct rumpuser_rw *rw, const enum rumprwlock lk) { int rv; - if (iswrite) { + switch (lk) { + case RUMPUSER_RW_WRITER: rv = pthread_rwlock_trywrlock(rw-pthrw); if (rv == 0) RURW_SETWRITE(rw); - } else { + break; + case RUMPUSER_RW_READER: rv = pthread_rwlock_tryrdlock(rw-pthrw); if (rv == 0) RURW_INCREAD(rw); + break; + default: + rv = EINVAL; + break; } ET(rv); } +int +rumpuser_rw_tryupgrade(struct rumpuser_rw *rw) +{ + + /* not supported by pthreads */ + ET(EBUSY); +} + +void +rumpuser_rw_downgrade(struct rumpuser_rw *rw) +{ + + /* + * I guess this is not strictly speaking correct, + * but the option is to provide a complete implementation + * of rwlocks
CVS commit: src
Module Name:src Committed By: pooka Date: Thu May 2 21:45:29 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.c src/sys/rump/include/rump: rumpuser.h src/sys/rump/librump/rumpkern: intr.c rump.c Log Message: Ok, maybe using int64 for nanoseconds in the (sec,nsec) tuple was a bit too future-proof. I think long is enough there (let's just hope nobody redefines nano). Also, make seconds signed just in case someone wants their clock to be in 1901. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.102 -r1.103 src/sys/rump/include/rump/rumpuser.h cvs rdiff -u -r1.39 -r1.40 src/sys/rump/librump/rumpkern/intr.c cvs rdiff -u -r1.267 -r1.268 src/sys/rump/librump/rumpkern/rump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.49 src/lib/librumpuser/rumpuser.c:1.50 --- src/lib/librumpuser/rumpuser.c:1.49 Wed May 1 17:17:54 2013 +++ src/lib/librumpuser/rumpuser.c Thu May 2 21:45:29 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.49 2013/05/01 17:17:54 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.50 2013/05/02 21:45:29 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.49 2013/05/01 17:17:54 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.50 2013/05/02 21:45:29 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -395,7 +395,7 @@ rumpuser_iovwrite(int fd, const struct r } int -rumpuser_clock_gettime(enum rumpclock rclk, uint64_t *sec, uint64_t *nsec) +rumpuser_clock_gettime(enum rumpclock rclk, int64_t *sec, long *nsec) { struct timespec ts; clockid_t clk; @@ -428,7 +428,7 @@ rumpuser_clock_gettime(enum rumpclock rc } int -rumpuser_clock_sleep(enum rumpclock clk, uint64_t sec, uint64_t nsec) +rumpuser_clock_sleep(enum rumpclock clk, int64_t sec, long nsec) { struct timespec rqt, rmt; int nlocks; Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.102 src/sys/rump/include/rump/rumpuser.h:1.103 --- src/sys/rump/include/rump/rumpuser.h:1.102 Thu May 2 21:35:19 2013 +++ src/sys/rump/include/rump/rumpuser.h Thu May 2 21:45:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.102 2013/05/02 21:35:19 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.103 2013/05/02 21:45:28 pooka Exp $ */ /* * Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved. @@ -114,8 +114,8 @@ int rumpuser_iovwrite(int, const struct */ enum rumpclock { RUMPUSER_CLOCK_RELWALL, RUMPUSER_CLOCK_ABSMONO }; -int rumpuser_clock_gettime(enum rumpclock, uint64_t *, uint64_t *); -int rumpuser_clock_sleep(enum rumpclock, uint64_t, uint64_t); +int rumpuser_clock_gettime(enum rumpclock, int64_t *, long *); +int rumpuser_clock_sleep(enum rumpclock, int64_t, long); /* * host information retrieval Index: src/sys/rump/librump/rumpkern/intr.c diff -u src/sys/rump/librump/rumpkern/intr.c:1.39 src/sys/rump/librump/rumpkern/intr.c:1.40 --- src/sys/rump/librump/rumpkern/intr.c:1.39 Tue Apr 30 16:03:44 2013 +++ src/sys/rump/librump/rumpkern/intr.c Thu May 2 21:45:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.39 2013/04/30 16:03:44 pooka Exp $ */ +/* $NetBSD: intr.c,v 1.40 2013/05/02 21:45:28 pooka Exp $ */ /* * Copyright (c) 2008-2010 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.39 2013/04/30 16:03:44 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.40 2013/05/02 21:45:28 pooka Exp $); #include sys/param.h #include sys/atomic.h @@ -100,7 +100,8 @@ static void doclock(void *noarg) { struct timespec thetick, curclock; - uint64_t sec, nsec; + int64_t sec; + long nsec; int error; extern int hz; Index: src/sys/rump/librump/rumpkern/rump.c diff -u src/sys/rump/librump/rumpkern/rump.c:1.267 src/sys/rump/librump/rumpkern/rump.c:1.268 --- src/sys/rump/librump/rumpkern/rump.c:1.267 Thu May 2 19:15:01 2013 +++ src/sys/rump/librump/rumpkern/rump.c Thu May 2 21:45:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rump.c,v 1.267 2013/05/02 19:15:01 pooka Exp $ */ +/* $NetBSD: rump.c,v 1.268 2013/05/02 21:45:28 pooka Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.267 2013/05/02 19:15:01 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.268 2013/05/02 21:45:28 pooka Exp $); #include sys/systm.h #define ELFSIZE ARCH_ELFSIZE @@ -235,7 +235,8 @@ rump_init(void) { char buf[256]; struct timespec ts; - uint64_t sec, nsec; + int64_t sec; + long nsec; struct lwp *l; int i, numcpu;
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Thu May 2 21:47:12 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.3 Log Message: update for previous change To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/librumpuser/rumpuser.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.3 diff -u src/lib/librumpuser/rumpuser.3:1.7 src/lib/librumpuser/rumpuser.3:1.8 --- src/lib/librumpuser/rumpuser.3:1.7 Thu May 2 21:35:19 2013 +++ src/lib/librumpuser/rumpuser.3 Thu May 2 21:47:12 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: rumpuser.3,v 1.7 2013/05/02 21:35:19 pooka Exp $ +.\ $NetBSD: rumpuser.3,v 1.8 2013/05/02 21:47:12 pooka Exp $ .\ .\ Copyright (c) 2013 Antti Kantee. All rights reserved. .\ @@ -276,7 +276,7 @@ If this is not possible, the hypervisor retain semantics. .Pp .Ft int -.Fn rumpuser_clock_gettime enum rumpclock clk uint64_t *sec uint64_t *nsec +.Fn rumpuser_clock_gettime enum rumpclock clk int64_t *sec long *nsec .Pp .Bl -tag -width xalignmentx .It Fa clk @@ -294,7 +294,7 @@ return value for nanoseconds .El .Pp .Ft int -.Fn rumpuser_clock_sleep enum rumpclock clk uint64_t sec uint64_t nsec +.Fn rumpuser_clock_sleep enum rumpclock clk int64_t sec long nsec .Bl -tag -width xalignmentx .It Fa clk In case of
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Thu May 2 22:07:58 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_pth.c Log Message: reorder for better locality. no functional change. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/lib/librumpuser/rumpuser_pth.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_pth.c diff -u src/lib/librumpuser/rumpuser_pth.c:1.25 src/lib/librumpuser/rumpuser_pth.c:1.26 --- src/lib/librumpuser/rumpuser_pth.c:1.25 Thu May 2 21:35:19 2013 +++ src/lib/librumpuser/rumpuser_pth.c Thu May 2 22:07:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth.c,v 1.25 2013/05/02 21:35:19 pooka Exp $ */ +/* $NetBSD: rumpuser_pth.c,v 1.26 2013/05/02 22:07:57 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_pth.c,v 1.25 2013/05/02 21:35:19 pooka Exp $); +__RCSID($NetBSD: rumpuser_pth.c,v 1.26 2013/05/02 22:07:57 pooka Exp $); #endif /* !lint */ #include sys/queue.h @@ -47,64 +47,6 @@ __RCSID($NetBSD: rumpuser_pth.c,v 1.25 #include rumpuser_int.h -static pthread_key_t curlwpkey; - -struct rumpuser_mtx { - pthread_mutex_t pthmtx; - struct lwp *owner; - int flags; -}; - -#define RURW_AMWRITER(rw) (rw-writer == rumpuser_curlwp() \ - rw-readers == -1) -#define RURW_HASREAD(rw) (rw-readers 0) - -#define RURW_SETWRITE(rw) \ -do { \ - assert(rw-readers == 0); \ - rw-writer = rumpuser_curlwp(); \ - rw-readers = -1; \ -} while (/*CONSTCOND*/0) -#define RURW_CLRWRITE(rw) \ -do { \ - assert(RURW_AMWRITER(rw)); \ - rw-readers = 0; \ - rw-writer = NULL; \ -} while (/*CONSTCOND*/0) -#define RURW_INCREAD(rw) \ -do { \ - pthread_spin_lock(rw-spin); \ - assert(rw-readers = 0); \ - ++(rw)-readers; \ - pthread_spin_unlock(rw-spin); \ -} while (/*CONSTCOND*/0) -#define RURW_DECREAD(rw) \ -do { \ - pthread_spin_lock(rw-spin); \ - assert(rw-readers 0); \ - --(rw)-readers; \ - pthread_spin_unlock(rw-spin); \ -} while (/*CONSTCOND*/0) - -struct rumpuser_rw { - pthread_rwlock_t pthrw; - pthread_spinlock_t spin; - int readers; - struct lwp *writer; -}; - -struct rumpuser_cv { - pthread_cond_t pthcv; - int nwaiters; -}; - -void -rumpuser__thrinit(void) -{ - - pthread_key_create(curlwpkey, NULL); -} - int rumpuser_thread_create(void *(*f)(void *), void *arg, const char *thrname, int joinable, int priority, int cpuidx, void **ptcookie) @@ -170,6 +112,12 @@ rumpuser_thread_join(void *ptcookie) ET(rv); } +struct rumpuser_mtx { + pthread_mutex_t pthmtx; + struct lwp *owner; + int flags; +}; + void rumpuser_mutex_init(struct rumpuser_mtx **mtx, int flags) { @@ -274,6 +222,48 @@ rumpuser_mutex_owner(struct rumpuser_mtx *lp = mtx-owner; } +/* + * rwlocks + */ + +struct rumpuser_rw { + pthread_rwlock_t pthrw; + pthread_spinlock_t spin; + int readers; + struct lwp *writer; +}; + +#define RURW_AMWRITER(rw) (rw-writer == rumpuser_curlwp() \ + rw-readers == -1) +#define RURW_HASREAD(rw) (rw-readers 0) + +#define RURW_SETWRITE(rw) \ +do { \ + assert(rw-readers == 0); \ + rw-writer = rumpuser_curlwp(); \ + rw-readers = -1; \ +} while (/*CONSTCOND*/0) +#define RURW_CLRWRITE(rw) \ +do { \ + assert(RURW_AMWRITER(rw)); \ + rw-readers = 0; \ + rw-writer = NULL; \ +} while (/*CONSTCOND*/0) +#define RURW_INCREAD(rw) \ +do { \ + pthread_spin_lock(rw-spin); \ + assert(rw-readers = 0); \ + ++(rw)-readers; \ + pthread_spin_unlock(rw-spin); \ +} while (/*CONSTCOND*/0) +#define RURW_DECREAD(rw) \ +do { \ + pthread_spin_lock(rw-spin); \ + assert(rw-readers 0); \ + --(rw)-readers; \ + pthread_spin_unlock(rw-spin); \ +} while (/*CONSTCOND*/0) + void rumpuser_rw_init(struct rumpuser_rw **rw) { @@ -386,6 +376,15 @@ rumpuser_rw_held(struct rumpuser_rw *rw, } } +/* + * condvar + */ + +struct rumpuser_cv { + pthread_cond_t pthcv; + int nwaiters; +}; + void rumpuser_cv_init(struct rumpuser_cv **cv) { @@ -522,6 +521,8 @@ rumpuser_cv_has_waiters(struct rumpuser_ * curlwp */ +static pthread_key_t curlwpkey; + /* * the if0'd curlwp implementation is not used by this hypervisor, * but serves as test code to check that the intended usage works. @@ -625,3 +626,10 @@ rumpuser_curlwp(void) return pthread_getspecific(curlwpkey); } #endif + + +void +rumpuser__thrinit(void) +{ + pthread_key_create(curlwpkey, NULL); +}
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Fri May 3 00:23:49 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_pth.c Log Message: Support proper rw_downgrade() semantics. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/lib/librumpuser/rumpuser_pth.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_pth.c diff -u src/lib/librumpuser/rumpuser_pth.c:1.26 src/lib/librumpuser/rumpuser_pth.c:1.27 --- src/lib/librumpuser/rumpuser_pth.c:1.26 Thu May 2 22:07:57 2013 +++ src/lib/librumpuser/rumpuser_pth.c Fri May 3 00:23:49 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth.c,v 1.26 2013/05/02 22:07:57 pooka Exp $ */ +/* $NetBSD: rumpuser_pth.c,v 1.27 2013/05/03 00:23:49 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_pth.c,v 1.26 2013/05/02 22:07:57 pooka Exp $); +__RCSID($NetBSD: rumpuser_pth.c,v 1.27 2013/05/03 00:23:49 pooka Exp $); #endif /* !lint */ #include sys/queue.h @@ -223,7 +223,12 @@ rumpuser_mutex_owner(struct rumpuser_mtx } /* - * rwlocks + * rwlocks. these are mostly simple, except that NetBSD wants to + * support something called downgrade, which means we need to swap + * our exclusive lock for a shared lock. to accommodate this, + * we need to check *after* acquiring a lock in case someone was + * downgrading it. if so, we couldn't actually have it and maybe + * need to retry later. */ struct rumpuser_rw { @@ -231,38 +236,77 @@ struct rumpuser_rw { pthread_spinlock_t spin; int readers; struct lwp *writer; + int downgrade; /* someone is downgrading (hopefully lock holder ;) */ }; -#define RURW_AMWRITER(rw) (rw-writer == rumpuser_curlwp() \ - rw-readers == -1) -#define RURW_HASREAD(rw) (rw-readers 0) - -#define RURW_SETWRITE(rw) \ -do { \ - assert(rw-readers == 0); \ - rw-writer = rumpuser_curlwp(); \ - rw-readers = -1; \ -} while (/*CONSTCOND*/0) -#define RURW_CLRWRITE(rw) \ -do { \ - assert(RURW_AMWRITER(rw)); \ - rw-readers = 0; \ - rw-writer = NULL; \ -} while (/*CONSTCOND*/0) -#define RURW_INCREAD(rw) \ -do { \ - pthread_spin_lock(rw-spin); \ - assert(rw-readers = 0); \ - ++(rw)-readers; \ - pthread_spin_unlock(rw-spin); \ -} while (/*CONSTCOND*/0) -#define RURW_DECREAD(rw) \ -do { \ - pthread_spin_lock(rw-spin); \ - assert(rw-readers 0); \ - --(rw)-readers; \ - pthread_spin_unlock(rw-spin); \ -} while (/*CONSTCOND*/0) +static int +rw_amwriter(struct rumpuser_rw *rw) +{ + + return rw-writer == rumpuser_curlwp() rw-readers == -1; +} + +static int +rw_nreaders(struct rumpuser_rw *rw) +{ + + return rw-readers 0 ? rw-readers : 0; +} + +static int +rw_setwriter(struct rumpuser_rw *rw, int retry) +{ + + /* + * Don't need the spinlock here, we already have an + * exclusive lock and downgrade is stable until complete. + */ + if (rw-downgrade) { + pthread_rwlock_unlock(rw-pthrw); + if (retry) { + struct timespec ts; + + /* portable yield, essentially */ + ts.tv_sec = 0; + ts.tv_nsec = 1; + KLOCK_WRAP(nanosleep(ts, NULL)); + } + return EBUSY; + } + assert(rw-readers == 0); + rw-writer = rumpuser_curlwp(); + rw-readers = -1; + return 0; +} + +static void +rw_clearwriter(struct rumpuser_rw *rw) +{ + + assert(rw_amwriter(rw)); + rw-readers = 0; + rw-writer = NULL; +} + +static void +rw_readup(struct rumpuser_rw *rw) +{ + + pthread_spin_lock(rw-spin); + assert(rw-readers = 0); + ++rw-readers; + pthread_spin_unlock(rw-spin); +} + +static void +rw_readdown(struct rumpuser_rw *rw) +{ + + pthread_spin_lock(rw-spin); + assert(rw-readers 0); + --rw-readers; + pthread_spin_unlock(rw-spin); +} void rumpuser_rw_init(struct rumpuser_rw **rw) @@ -281,16 +325,17 @@ rumpuser_rw_enter(struct rumpuser_rw *rw switch (lk) { case RUMPUSER_RW_WRITER: - if (pthread_rwlock_trywrlock(rw-pthrw) != 0) - KLOCK_WRAP(NOFAIL_ERRNO( - pthread_rwlock_wrlock(rw-pthrw))); - RURW_SETWRITE(rw); + do { + if (pthread_rwlock_trywrlock(rw-pthrw) != 0) +KLOCK_WRAP(NOFAIL_ERRNO( +pthread_rwlock_wrlock(rw-pthrw))); + } while (rw_setwriter(rw, 1) != 0); break; case RUMPUSER_RW_READER: if (pthread_rwlock_tryrdlock(rw-pthrw) != 0) KLOCK_WRAP(NOFAIL_ERRNO( pthread_rwlock_rdlock(rw-pthrw))); - RURW_INCREAD(rw); + rw_readup(rw); break; } } @@ -304,12 +349,12 @@ rumpuser_rw_tryenter(struct rumpuser_rw case RUMPUSER_RW_WRITER: rv = pthread_rwlock_trywrlock(rw-pthrw); if (rv == 0) - RURW_SETWRITE(rw); + rv = rw_setwriter(rw, 0); break; case RUMPUSER_RW_READER: rv = pthread_rwlock_tryrdlock(rw-pthrw); if (rv == 0) - RURW_INCREAD(rw); + rw_readup(rw); break; default: rv = EINVAL; @@ -323,33 +368,45 @@ int
CVS commit: src/sys/rump/net/lib/libshmif
Module Name:src Committed By: pooka Date: Wed May 1 06:58:37 UTC 2013 Modified Files: src/sys/rump/net/lib/libshmif: if_shmem.c Log Message: Three cheers for the mighty C type system that doesn't recognize the difference between an enum and an integer. Due to wrong parameter order, the lock backoff routine ended up sleeping 1 million seconds instead of 1ms. On the plus side, we got some sort of idea how often the shmif spinlock backoff routine is hit during a standard test run. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/rump/net/lib/libshmif/if_shmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libshmif/if_shmem.c diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.53 src/sys/rump/net/lib/libshmif/if_shmem.c:1.54 --- src/sys/rump/net/lib/libshmif/if_shmem.c:1.53 Tue Apr 30 00:03:54 2013 +++ src/sys/rump/net/lib/libshmif/if_shmem.c Wed May 1 06:58:36 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: if_shmem.c,v 1.53 2013/04/30 00:03:54 pooka Exp $ */ +/* $NetBSD: if_shmem.c,v 1.54 2013/05/01 06:58:36 pooka Exp $ */ /* * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_shmem.c,v 1.53 2013/04/30 00:03:54 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: if_shmem.c,v 1.54 2013/05/01 06:58:36 pooka Exp $); #include sys/param.h #include sys/atomic.h @@ -135,8 +135,8 @@ shmif_lockbus(struct shmif_mem *busmem) LOCK_UNLOCKED, LOCK_LOCKED) == LOCK_LOCKED)) { if (__predict_false(++i LOCK_COOLDOWN)) { /* wait 1ms */ - rumpuser_clock_sleep(0, 1000*1000, - RUMPUSER_CLOCK_RELWALL); + rumpuser_clock_sleep(RUMPUSER_CLOCK_RELWALL, + 0, 1000*1000); i = 0; } continue;
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Wed May 1 17:17:55 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.c Log Message: avoid Wunused on !NetBSD To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/lib/librumpuser/rumpuser.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.48 src/lib/librumpuser/rumpuser.c:1.49 --- src/lib/librumpuser/rumpuser.c:1.48 Tue Apr 30 16:03:44 2013 +++ src/lib/librumpuser/rumpuser.c Wed May 1 17:17:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.48 2013/04/30 16:03:44 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.49 2013/05/01 17:17:54 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.48 2013/04/30 16:03:44 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.49 2013/05/01 17:17:54 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -597,9 +597,11 @@ rumpuser_dprintf(const char *format, ... int rumpuser_kill(int64_t pid, int sig) { - int rv, error; + int rv; #ifdef __NetBSD__ + int error; + if (pid == RUMPUSER_PID_SELF) { error = raise(sig); } else {
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: pooka Date: Wed May 1 17:52:34 UTC 2013 Modified Files: src/sys/rump/librump/rumpkern: Makefile.rumpkern Log Message: Actually, there's no point in unconditionally compiling in weak stubs which will never be used in the NetBSD build. Comment hyperstubs.c out from SRCS, but retain the source module as documentation. To generate a diff of this commit: cvs rdiff -u -r1.126 -r1.127 src/sys/rump/librump/rumpkern/Makefile.rumpkern Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.126 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.127 --- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.126 Tue Apr 30 13:54:53 2013 +++ src/sys/rump/librump/rumpkern/Makefile.rumpkern Wed May 1 17:52:34 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.rumpkern,v 1.126 2013/04/30 13:54:53 pooka Exp $ +# $NetBSD: Makefile.rumpkern,v 1.127 2013/05/01 17:52:34 pooka Exp $ # .include ${RUMPTOP}/Makefile.rump @@ -21,8 +21,10 @@ LIB= rump # SRCS+= rump.c rumpcopy.c emul.c intr.c lwproc.c klock.c \ kobj_rename.c ltsleep.c scheduler.c \ - signals.c sleepq.c threads.c vm.c cprng_stub.c \ - hyperstubs.c + signals.c sleepq.c threads.c vm.c cprng_stub.c + +# optional hypervisor interfaces +#SRCS+= hyperstubs.c # Multiprocessor or uniprocessor locking. TODO: select right # locking at runtime.
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Tue Apr 30 11:26:26 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.c Log Message: Some systems don't provide preadv/pwritev (hi Solaris!), so implement that with lseek + readv/writev instead (and avoid rewinding the pointer with soon-to-be documentation). To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/lib/librumpuser/rumpuser.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.45 src/lib/librumpuser/rumpuser.c:1.46 --- src/lib/librumpuser/rumpuser.c:1.45 Tue Apr 30 00:03:52 2013 +++ src/lib/librumpuser/rumpuser.c Tue Apr 30 11:26:26 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.45 2013/04/30 00:03:52 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.46 2013/04/30 11:26:26 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.45 2013/04/30 00:03:52 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.46 2013/04/30 11:26:26 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -340,10 +340,19 @@ rumpuser_iovread(int fd, struct rumpuser ssize_t nn; int rv; - if (off == RUMPUSER_IOV_NOSEEK) + if (off == RUMPUSER_IOV_NOSEEK) { KLOCK_WRAP(nn = readv(fd, iov, iovlen)); - else - KLOCK_WRAP(nn = preadv(fd, iov, iovlen, off)); + } else { + int nlocks; + + rumpkern_unsched(nlocks, NULL); + if (lseek(fd, off, SEEK_SET) == off) { + nn = readv(fd, iov, iovlen); + } else { + nn = -1; + } + rumpkern_sched(nlocks, NULL); + } if (nn == -1) { rv = errno; @@ -363,10 +372,19 @@ rumpuser_iovwrite(int fd, const struct r ssize_t nn; int rv; - if (off == RUMPUSER_IOV_NOSEEK) + if (off == RUMPUSER_IOV_NOSEEK) { KLOCK_WRAP(nn = writev(fd, iov, iovlen)); - else - KLOCK_WRAP(nn = pwritev(fd, iov, iovlen, off)); + } else { + int nlocks; + + rumpkern_unsched(nlocks, NULL); + if (lseek(fd, off, SEEK_SET) == off) { + nn = writev(fd, iov, iovlen); + } else { + nn = -1; + } + rumpkern_sched(nlocks, NULL); + } if (nn == -1) { rv = errno;
CVS commit: src/sys/rump/include/rump
Module Name:src Committed By: pooka Date: Tue Apr 30 11:29:12 UTC 2013 Modified Files: src/sys/rump/include/rump: makerumpdefs.sh Log Message: fix sed command To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/rump/include/rump/makerumpdefs.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/include/rump/makerumpdefs.sh diff -u src/sys/rump/include/rump/makerumpdefs.sh:1.13 src/sys/rump/include/rump/makerumpdefs.sh:1.14 --- src/sys/rump/include/rump/makerumpdefs.sh:1.13 Thu Dec 13 17:17:00 2012 +++ src/sys/rump/include/rump/makerumpdefs.sh Tue Apr 30 11:29:12 2013 @@ -8,7 +8,7 @@ echo Generating rumpdefs.h rm -f rumpdefs.h exec rumpdefs.h -printf '/* $NetBSD: makerumpdefs.sh,v 1.13 2012/12/13 17:17:00 pooka Exp $ */\n\n' +printf '/* $NetBSD: makerumpdefs.sh,v 1.14 2013/04/30 11:29:12 pooka Exp $ */\n\n' printf '/*\n *\tAUTOMATICALLY GENERATED. DO NOT EDIT.\n */\n\n' printf '#ifndef _RUMP_RUMPDEFS_H_\n' printf '#define _RUMP_RUMPDEFS_H_\n\n' @@ -38,7 +38,7 @@ sed -n '/#define O_[A-Z]* *0x/s/O_/RUMP_ ../../../sys/fcntl.h fromvers ../../../sys/vnode.h -sed -n '/enum vtype.*{/{s/vtype/rump_/;s/ V/ RUMP_V/gp}' ../../../sys/vnode.h +sed -n '/enum vtype.*{/{s/vtype/rump_/;s/ V/ RUMP_V/gp;}' ../../../sys/vnode.h sed -n '/#define.*LK_[A-Z]/s/LK_/RUMP_LK_/gp' ../../../sys/vnode.h \ | sed 's,/\*.*$,,'
CVS commit: src
Module Name:src Committed By: pooka Date: Tue Apr 30 12:39:21 UTC 2013 Modified Files: src/lib/librumpuser: Makefile rumpuser.c rumpuser_component.c rumpuser_component.h rumpuser_daemonize.c rumpuser_int.h rumpuser_pth.c rumpuser_sp.c src/sys/rump/dev/lib/libugenhc: rumpcomp_user.c src/sys/rump/include/rump: rumpdefs.h src/sys/rump/net/lib/libshmif: rumpcomp_user.c src/sys/rump/net/lib/libsockin: rumpcomp_user.c src/sys/rump/net/lib/libvirtif: rumpcomp_user.c Added Files: src/lib/librumpuser: rumpuser_errtrans.c Log Message: Translate error codes between the hypervisor and rump kernel. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/librumpuser/Makefile cvs rdiff -u -r1.46 -r1.47 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.4 -r1.5 src/lib/librumpuser/rumpuser_component.c \ src/lib/librumpuser/rumpuser_daemonize.c cvs rdiff -u -r1.2 -r1.3 src/lib/librumpuser/rumpuser_component.h cvs rdiff -u -r0 -r1.1 src/lib/librumpuser/rumpuser_errtrans.c cvs rdiff -u -r1.7 -r1.8 src/lib/librumpuser/rumpuser_int.h cvs rdiff -u -r1.19 -r1.20 src/lib/librumpuser/rumpuser_pth.c cvs rdiff -u -r1.57 -r1.58 src/lib/librumpuser/rumpuser_sp.c cvs rdiff -u -r1.4 -r1.5 src/sys/rump/dev/lib/libugenhc/rumpcomp_user.c cvs rdiff -u -r1.17 -r1.18 src/sys/rump/include/rump/rumpdefs.h cvs rdiff -u -r1.9 -r1.10 src/sys/rump/net/lib/libshmif/rumpcomp_user.c cvs rdiff -u -r1.4 -r1.5 src/sys/rump/net/lib/libsockin/rumpcomp_user.c cvs rdiff -u -r1.4 -r1.5 src/sys/rump/net/lib/libvirtif/rumpcomp_user.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/Makefile diff -u src/lib/librumpuser/Makefile:1.10 src/lib/librumpuser/Makefile:1.11 --- src/lib/librumpuser/Makefile:1.10 Mon Apr 29 12:56:04 2013 +++ src/lib/librumpuser/Makefile Tue Apr 30 12:39:20 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.10 2013/04/29 12:56:04 pooka Exp $ +# $NetBSD: Makefile,v 1.11 2013/04/30 12:39:20 pooka Exp $ # WARNS?= 5 @@ -14,7 +14,7 @@ CPPFLAGS+= -DLIBRUMPUSER SRCS= rumpuser.c SRCS+= rumpuser_pth.c SRCS+= rumpuser_dl.c rumpuser_sp.c rumpuser_daemonize.c rumpuser_bio.c -SRCS+= rumpuser_component.c +SRCS+= rumpuser_component.c rumpuser_errtrans.c INCSDIR= /usr/include/rump INCS= rumpuser.h rumpuser_component.h Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.46 src/lib/librumpuser/rumpuser.c:1.47 --- src/lib/librumpuser/rumpuser.c:1.46 Tue Apr 30 11:26:26 2013 +++ src/lib/librumpuser/rumpuser.c Tue Apr 30 12:39:20 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.46 2013/04/30 11:26:26 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.47 2013/04/30 12:39:20 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.46 2013/04/30 11:26:26 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.47 2013/04/30 12:39:20 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -206,7 +206,7 @@ rumpuser_getfileinfo(const char *path, u if (fd != -1) close(fd); - return rv; + ET(rv); } int @@ -228,7 +228,7 @@ rumpuser_malloc(size_t howmuch, int alig } *memp = mem; - return rv; + ET(rv); } /*ARGSUSED1*/ @@ -265,16 +265,14 @@ rumpuser_anonmmap(void *prefaddr, size_t rv = 0; } - return rv; + ET(rv); } void rumpuser_unmap(void *addr, size_t len) { - int rv; - rv = munmap(addr, len); - assert(rv == 0); + munmap(addr, len); } int @@ -311,7 +309,7 @@ rumpuser_open(const char *path, int rufl } out: - return rv; + ET(rv); } int @@ -324,7 +322,7 @@ rumpuser_close(int fd) close(fd); rumpkern_sched(nlocks, NULL); - return 0; + ET(0); } /* @@ -361,7 +359,7 @@ rumpuser_iovread(int fd, struct rumpuser rv = 0; } - return rv; + ET(rv); } int @@ -393,7 +391,7 @@ rumpuser_iovwrite(int fd, const struct r rv = 0; } - return rv; + ET(rv); } int @@ -418,8 +416,7 @@ rumpuser_clock_gettime(uint64_t *sec, ui abort(); } - rv = clock_gettime(clk, ts); - if (rv == -1) { + if (clock_gettime(clk, ts) == -1) { rv = errno; } else { *sec = ts.tv_sec; @@ -427,7 +424,7 @@ rumpuser_clock_gettime(uint64_t *sec, ui rv = 0; } - return rv; + ET(rv); } int @@ -486,7 +483,8 @@ rumpuser_clock_sleep(uint64_t sec, uint6 } rumpkern_sched(nlocks, NULL); - return rv; + + ET(rv); } static int @@ -556,7 +554,7 @@ rumpuser_getparam(const char *name, void rv = 0; } - return rv; + ET(rv); } void @@ -616,7 +614,7 @@ rumpuser_kill(int64_t pid, int sig) rv = EOPNOTSUPP; #endif - return rv; + ET(rv); } int @@ -636,5 +634,5 @@ rumpuser_getrandom(void *buf, size_t buf } while (chunk); *retp = origlen; - return 0; + ET(0); } Index: src/lib/librumpuser/rumpuser_component.c diff -u src/lib/librumpuser
CVS commit: src
Module Name:src Committed By: pooka Date: Tue Apr 30 13:29:29 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_pth.c rumpuser_pth_dummy.c src/sys/rump/include/rump: rumpuser.h src/sys/rump/librump/rumpkern: threads.c Log Message: In kthread_create(), pass the priority and cpu index down to the rump kernel hypervisor (though the current implementation doesn't take advantage of them). To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/lib/librumpuser/rumpuser_pth.c cvs rdiff -u -r1.10 -r1.11 src/lib/librumpuser/rumpuser_pth_dummy.c cvs rdiff -u -r1.98 -r1.99 src/sys/rump/include/rump/rumpuser.h cvs rdiff -u -r1.19 -r1.20 src/sys/rump/librump/rumpkern/threads.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_pth.c diff -u src/lib/librumpuser/rumpuser_pth.c:1.20 src/lib/librumpuser/rumpuser_pth.c:1.21 --- src/lib/librumpuser/rumpuser_pth.c:1.20 Tue Apr 30 12:39:20 2013 +++ src/lib/librumpuser/rumpuser_pth.c Tue Apr 30 13:29:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth.c,v 1.20 2013/04/30 12:39:20 pooka Exp $ */ +/* $NetBSD: rumpuser_pth.c,v 1.21 2013/04/30 13:29:28 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_pth.c,v 1.20 2013/04/30 12:39:20 pooka Exp $); +__RCSID($NetBSD: rumpuser_pth.c,v 1.21 2013/04/30 13:29:28 pooka Exp $); #endif /* !lint */ #include assert.h @@ -104,7 +104,7 @@ rumpuser__thrinit(void) int rumpuser_thread_create(void *(*f)(void *), void *arg, const char *thrname, - int joinable, void **ptcookie) + int joinable, int priority, int cpuidx, void **ptcookie) { pthread_t ptid; pthread_t *ptidp; Index: src/lib/librumpuser/rumpuser_pth_dummy.c diff -u src/lib/librumpuser/rumpuser_pth_dummy.c:1.10 src/lib/librumpuser/rumpuser_pth_dummy.c:1.11 --- src/lib/librumpuser/rumpuser_pth_dummy.c:1.10 Sat Apr 27 16:32:58 2013 +++ src/lib/librumpuser/rumpuser_pth_dummy.c Tue Apr 30 13:29:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth_dummy.c,v 1.10 2013/04/27 16:32:58 pooka Exp $ */ +/* $NetBSD: rumpuser_pth_dummy.c,v 1.11 2013/04/30 13:29:28 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -29,7 +29,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_pth_dummy.c,v 1.10 2013/04/27 16:32:58 pooka Exp $); +__RCSID($NetBSD: rumpuser_pth_dummy.c,v 1.11 2013/04/30 13:29:28 pooka Exp $); #endif /* !lint */ #include sys/time.h @@ -82,7 +82,7 @@ rumpuser_biothread(void *arg) /*ARGSUSED*/ int rumpuser_thread_create(void *(*f)(void *), void *arg, const char *thrname, - int joinable, void **tptr) + int joinable, int pri, int cpuidx, void **tptr) { fprintf(stderr, rumpuser: threads not available\n); Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.98 src/sys/rump/include/rump/rumpuser.h:1.99 --- src/sys/rump/include/rump/rumpuser.h:1.98 Tue Apr 30 00:03:53 2013 +++ src/sys/rump/include/rump/rumpuser.h Tue Apr 30 13:29:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.98 2013/04/30 00:03:53 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.99 2013/04/30 13:29:28 pooka Exp $ */ /* * Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved. @@ -160,7 +160,7 @@ int rumpuser_getrandom(void *, size_t, i * threads, scheduling (host) and synchronization */ int rumpuser_thread_create(void *(*f)(void *), void *, const char *, int, - void **); + int, int, void **); void rumpuser_thread_exit(void) __dead; int rumpuser_thread_join(void *); Index: src/sys/rump/librump/rumpkern/threads.c diff -u src/sys/rump/librump/rumpkern/threads.c:1.19 src/sys/rump/librump/rumpkern/threads.c:1.20 --- src/sys/rump/librump/rumpkern/threads.c:1.19 Sat Apr 27 16:32:57 2013 +++ src/sys/rump/librump/rumpkern/threads.c Tue Apr 30 13:29:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: threads.c,v 1.19 2013/04/27 16:32:57 pooka Exp $ */ +/* $NetBSD: threads.c,v 1.20 2013/04/30 13:29:28 pooka Exp $ */ /* * Copyright (c) 2007-2009 Antti Kantee. All Rights Reserved. @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: threads.c,v 1.19 2013/04/27 16:32:57 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: threads.c,v 1.20 2013/04/30 13:29:28 pooka Exp $); #include sys/param.h #include sys/atomic.h @@ -190,7 +190,8 @@ kthread_create(pri_t pri, int flags, str } rv = rumpuser_thread_create(threadbouncer, k, thrname, - (flags KTHREAD_MUSTJOIN) == KTHREAD_MUSTJOIN, l-l_ctxlink); + (flags KTHREAD_MUSTJOIN) == KTHREAD_MUSTJOIN, + pri, ci ? ci-ci_index : -1, l-l_ctxlink); if (rv) return rv;
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Tue Apr 30 13:37:03 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_pth_dummy.c Log Message: make this build/work again To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/lib/librumpuser/rumpuser_pth_dummy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_pth_dummy.c diff -u src/lib/librumpuser/rumpuser_pth_dummy.c:1.11 src/lib/librumpuser/rumpuser_pth_dummy.c:1.12 --- src/lib/librumpuser/rumpuser_pth_dummy.c:1.11 Tue Apr 30 13:29:28 2013 +++ src/lib/librumpuser/rumpuser_pth_dummy.c Tue Apr 30 13:37:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth_dummy.c,v 1.11 2013/04/30 13:29:28 pooka Exp $ */ +/* $NetBSD: rumpuser_pth_dummy.c,v 1.12 2013/04/30 13:37:03 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -29,7 +29,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_pth_dummy.c,v 1.11 2013/04/30 13:29:28 pooka Exp $); +__RCSID($NetBSD: rumpuser_pth_dummy.c,v 1.12 2013/04/30 13:37:03 pooka Exp $); #endif /* !lint */ #include sys/time.h @@ -58,11 +58,6 @@ struct rumpuser_rw { int v; }; -struct rumpuser_mtx rumpuser_aio_mtx; -struct rumpuser_cv rumpuser_aio_cv; -int rumpuser_aio_head, rumpuser_aio_tail; -struct rumpuser_aio rumpuser_aios[N_AIOS]; - void rumpuser__thrinit(void) { @@ -71,15 +66,6 @@ rumpuser__thrinit(void) } /*ARGSUSED*/ -void -rumpuser_biothread(void *arg) -{ - - fprintf(stderr, rumpuser: threads not available\n); - abort(); -} - -/*ARGSUSED*/ int rumpuser_thread_create(void *(*f)(void *), void *arg, const char *thrname, int joinable, int pri, int cpuidx, void **tptr) @@ -98,6 +84,13 @@ rumpuser_thread_exit(void) abort(); } +int +rumpuser_thread_join(void *p) +{ + + return 0; +} + void rumpuser_mutex_init(struct rumpuser_mtx **mtx, int flgas) { @@ -125,7 +118,7 @@ rumpuser_mutex_tryenter(struct rumpuser_ { mtx-v++; - return 1; + return 0; } void @@ -144,11 +137,11 @@ rumpuser_mutex_destroy(struct rumpuser_m free(mtx); } -struct lwp * -rumpuser_mutex_owner(struct rumpuser_mtx *mtx) +void +rumpuser_mutex_owner(struct rumpuser_mtx *mtx, struct lwp **lp) { - return mtx-o; + *lp = mtx-o; } void @@ -176,7 +169,7 @@ rumpuser_rw_tryenter(struct rumpuser_rw { rumpuser_rw_enter(rw, write); - return 1; + return 0; } void @@ -198,25 +191,25 @@ rumpuser_rw_destroy(struct rumpuser_rw * free(rw); } -int -rumpuser_rw_held(struct rumpuser_rw *rw) +void +rumpuser_rw_held(struct rumpuser_rw *rw, int *rvp) { - return rw-v != 0; + *rvp = rw-v != 0; } -int -rumpuser_rw_rdheld(struct rumpuser_rw *rw) +void +rumpuser_rw_rdheld(struct rumpuser_rw *rw, int *rvp) { - return rw-v 0; + *rvp = rw-v 0; } -int -rumpuser_rw_wrheld(struct rumpuser_rw *rw) +void +rumpuser_rw_wrheld(struct rumpuser_rw *rw, int *rvp) { - return rw-v 0; + *rvp = rw-v 0; } /*ARGSUSED*/ @@ -241,6 +234,13 @@ rumpuser_cv_wait(struct rumpuser_cv *cv, } /*ARGSUSED*/ +void +rumpuser_cv_wait_nowrap(struct rumpuser_cv *cv, struct rumpuser_mtx *mtx) +{ + +} + +/*ARGSUSED*/ int rumpuser_cv_timedwait(struct rumpuser_cv *cv, struct rumpuser_mtx *mtx, int64_t sec, int64_t nsec) @@ -271,11 +271,11 @@ rumpuser_cv_broadcast(struct rumpuser_cv } /*ARGSUSED*/ -int -rumpuser_cv_has_waiters(struct rumpuser_cv *cv) +void +rumpuser_cv_has_waiters(struct rumpuser_cv *cv, int *rvp) { - return 0; + *rvp = 0; } /*
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: pooka Date: Tue Apr 30 13:54:54 UTC 2013 Modified Files: src/sys/rump/librump/rumpkern: Makefile.rumpkern Added Files: src/sys/rump/librump/rumpkern: hyperstubs.c Log Message: weak stubs for optional hypercalls To generate a diff of this commit: cvs rdiff -u -r1.125 -r1.126 src/sys/rump/librump/rumpkern/Makefile.rumpkern cvs rdiff -u -r0 -r1.1 src/sys/rump/librump/rumpkern/hyperstubs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.125 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.126 --- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.125 Sat Apr 27 15:34:53 2013 +++ src/sys/rump/librump/rumpkern/Makefile.rumpkern Tue Apr 30 13:54:53 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.rumpkern,v 1.125 2013/04/27 15:34:53 pooka Exp $ +# $NetBSD: Makefile.rumpkern,v 1.126 2013/04/30 13:54:53 pooka Exp $ # .include ${RUMPTOP}/Makefile.rump @@ -21,7 +21,8 @@ LIB= rump # SRCS+= rump.c rumpcopy.c emul.c intr.c lwproc.c klock.c \ kobj_rename.c ltsleep.c scheduler.c \ - signals.c sleepq.c threads.c vm.c cprng_stub.c + signals.c sleepq.c threads.c vm.c cprng_stub.c \ + hyperstubs.c # Multiprocessor or uniprocessor locking. TODO: select right # locking at runtime. Added files: Index: src/sys/rump/librump/rumpkern/hyperstubs.c diff -u /dev/null src/sys/rump/librump/rumpkern/hyperstubs.c:1.1 --- /dev/null Tue Apr 30 13:54:54 2013 +++ src/sys/rump/librump/rumpkern/hyperstubs.c Tue Apr 30 13:54:53 2013 @@ -0,0 +1,61 @@ +/* $NetBSD: hyperstubs.c,v 1.1 2013/04/30 13:54:53 pooka Exp $ */ + +/* + * Copyright (c) 2013 Antti Kantee. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include sys/cdefs.h +__KERNEL_RCSID(0, $NetBSD: hyperstubs.c,v 1.1 2013/04/30 13:54:53 pooka Exp $); + +#include sys/errno.h + +/* provide weak aliases for optional rump kernel hypervisor features */ + +int rump_hypernotsupp(void); +int rump_hypernotsupp(void) { return ENOTSUP; } + +/* dynlinking */ + +__weak_alias(rumpuser_dl_bootstrap,rump_hypernotsupp); +__weak_alias(rumpuser_dl_globalsym,rump_hypernotsupp); + +/* race-free daemon creation */ + +__weak_alias(rumpuser_daemonize_begin,rump_hypernotsupp); +__weak_alias(rumpuser_daemonize_done,rump_hypernotsupp); + +/* process env */ + +__weak_alias(rumpuser_kill,rump_hypernotsupp); + +/* syscall proxy */ + +__weak_alias(rumpuser_sp_init,rump_hypernotsupp); +__weak_alias(rumpuser_sp_copyin,rump_hypernotsupp); +__weak_alias(rumpuser_sp_copyinstr,rump_hypernotsupp); +__weak_alias(rumpuser_sp_copyout,rump_hypernotsupp); +__weak_alias(rumpuser_sp_copyoutstr,rump_hypernotsupp); +__weak_alias(rumpuser_sp_anonmmap,rump_hypernotsupp); +__weak_alias(rumpuser_sp_raise,rump_hypernotsupp); +__weak_alias(rumpuser_sp_fini,rump_hypernotsupp);
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: pooka Date: Tue Apr 30 14:28:52 UTC 2013 Modified Files: src/sys/rump/librump/rumpkern: hyperstubs.c Log Message: Stub out anonmmap too. This is a clever trick to enable me to avoid having to document that interface. I seriously doubt it's relevant beyond a POSIX env where it's required by the proplib client-side implementation which expects it can do munmap() on a return value from a proplib call. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/rump/librump/rumpkern/hyperstubs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/hyperstubs.c diff -u src/sys/rump/librump/rumpkern/hyperstubs.c:1.1 src/sys/rump/librump/rumpkern/hyperstubs.c:1.2 --- src/sys/rump/librump/rumpkern/hyperstubs.c:1.1 Tue Apr 30 13:54:53 2013 +++ src/sys/rump/librump/rumpkern/hyperstubs.c Tue Apr 30 14:28:52 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: hyperstubs.c,v 1.1 2013/04/30 13:54:53 pooka Exp $ */ +/* $NetBSD: hyperstubs.c,v 1.2 2013/04/30 14:28:52 pooka Exp $ */ /* * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hyperstubs.c,v 1.1 2013/04/30 13:54:53 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: hyperstubs.c,v 1.2 2013/04/30 14:28:52 pooka Exp $); #include sys/errno.h @@ -49,6 +49,11 @@ __weak_alias(rumpuser_daemonize_done,rum __weak_alias(rumpuser_kill,rump_hypernotsupp); +/* anonmmap (for proplib and modules) */ + +__weak_alias(rumpuser_anonmmap,rump_hypernotsupp); +__weak_alias(rumpuser_unmap,rump_hypernotsupp); + /* syscall proxy */ __weak_alias(rumpuser_sp_init,rump_hypernotsupp);
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Tue Apr 30 15:48:29 UTC 2013 Modified Files: src/lib/librumpuser: Makefile Log Message: put optional modules on a separate SRCS line To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/lib/librumpuser/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/Makefile diff -u src/lib/librumpuser/Makefile:1.11 src/lib/librumpuser/Makefile:1.12 --- src/lib/librumpuser/Makefile:1.11 Tue Apr 30 12:39:20 2013 +++ src/lib/librumpuser/Makefile Tue Apr 30 15:48:29 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.11 2013/04/30 12:39:20 pooka Exp $ +# $NetBSD: Makefile,v 1.12 2013/04/30 15:48:29 pooka Exp $ # WARNS?= 5 @@ -13,8 +13,10 @@ CPPFLAGS+= -DLIBRUMPUSER SRCS= rumpuser.c SRCS+= rumpuser_pth.c -SRCS+= rumpuser_dl.c rumpuser_sp.c rumpuser_daemonize.c rumpuser_bio.c -SRCS+= rumpuser_component.c rumpuser_errtrans.c +SRCS+= rumpuser_component.c rumpuser_errtrans.c rumpuser_bio.c + +# optional +SRCS+= rumpuser_dl.c rumpuser_sp.c rumpuser_daemonize.c INCSDIR= /usr/include/rump INCS= rumpuser.h rumpuser_component.h
CVS commit: src
Module Name:src Committed By: pooka Date: Tue Apr 30 16:03:44 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.c src/sys/rump/include/rump: rumpuser.h src/sys/rump/librump/rumpkern: emul.c intr.c rump.c vm.c Log Message: Flip parameter order in the clock hypercalls to make them consistent with everything else wrt in/out parameters. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.99 -r1.100 src/sys/rump/include/rump/rumpuser.h cvs rdiff -u -r1.157 -r1.158 src/sys/rump/librump/rumpkern/emul.c cvs rdiff -u -r1.38 -r1.39 src/sys/rump/librump/rumpkern/intr.c cvs rdiff -u -r1.265 -r1.266 src/sys/rump/librump/rumpkern/rump.c cvs rdiff -u -r1.143 -r1.144 src/sys/rump/librump/rumpkern/vm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.47 src/lib/librumpuser/rumpuser.c:1.48 --- src/lib/librumpuser/rumpuser.c:1.47 Tue Apr 30 12:39:20 2013 +++ src/lib/librumpuser/rumpuser.c Tue Apr 30 16:03:44 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.47 2013/04/30 12:39:20 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.48 2013/04/30 16:03:44 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.47 2013/04/30 12:39:20 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.48 2013/04/30 16:03:44 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -395,7 +395,7 @@ rumpuser_iovwrite(int fd, const struct r } int -rumpuser_clock_gettime(uint64_t *sec, uint64_t *nsec, enum rumpclock rclk) +rumpuser_clock_gettime(enum rumpclock rclk, uint64_t *sec, uint64_t *nsec) { struct timespec ts; clockid_t clk; @@ -428,7 +428,7 @@ rumpuser_clock_gettime(uint64_t *sec, ui } int -rumpuser_clock_sleep(uint64_t sec, uint64_t nsec, enum rumpclock clk) +rumpuser_clock_sleep(enum rumpclock clk, uint64_t sec, uint64_t nsec) { struct timespec rqt, rmt; int nlocks; Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.99 src/sys/rump/include/rump/rumpuser.h:1.100 --- src/sys/rump/include/rump/rumpuser.h:1.99 Tue Apr 30 13:29:28 2013 +++ src/sys/rump/include/rump/rumpuser.h Tue Apr 30 16:03:44 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.99 2013/04/30 13:29:28 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.100 2013/04/30 16:03:44 pooka Exp $ */ /* * Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved. @@ -114,8 +114,8 @@ int rumpuser_iovwrite(int, const struct */ enum rumpclock { RUMPUSER_CLOCK_RELWALL, RUMPUSER_CLOCK_ABSMONO }; -int rumpuser_clock_gettime(uint64_t *, uint64_t *, enum rumpclock); -int rumpuser_clock_sleep(uint64_t, uint64_t, enum rumpclock); +int rumpuser_clock_gettime(enum rumpclock, uint64_t *, uint64_t *); +int rumpuser_clock_sleep(enum rumpclock, uint64_t, uint64_t); /* * host information retrieval Index: src/sys/rump/librump/rumpkern/emul.c diff -u src/sys/rump/librump/rumpkern/emul.c:1.157 src/sys/rump/librump/rumpkern/emul.c:1.158 --- src/sys/rump/librump/rumpkern/emul.c:1.157 Tue Apr 30 00:03:53 2013 +++ src/sys/rump/librump/rumpkern/emul.c Tue Apr 30 16:03:44 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: emul.c,v 1.157 2013/04/30 00:03:53 pooka Exp $ */ +/* $NetBSD: emul.c,v 1.158 2013/04/30 16:03:44 pooka Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: emul.c,v 1.157 2013/04/30 00:03:53 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: emul.c,v 1.158 2013/04/30 16:03:44 pooka Exp $); #include sys/param.h #include sys/null.h @@ -152,7 +152,7 @@ kpause(const char *wmesg, bool intr, int sec = timeo / hz; nsec = (timeo % hz) * (10 / hz); - rv = rumpuser_clock_sleep(sec, nsec, RUMPUSER_CLOCK_RELWALL); + rv = rumpuser_clock_sleep(RUMPUSER_CLOCK_RELWALL, sec, nsec); KASSERT(rv == 0); if (mtx) @@ -230,7 +230,7 @@ rump_delay(unsigned int us) if (__predict_false(sec != 0)) printf(WARNING: over 1s delay\n); - rumpuser_clock_sleep(sec, nsec, RUMPUSER_CLOCK_RELWALL); + rumpuser_clock_sleep(RUMPUSER_CLOCK_RELWALL, sec, nsec); } void (*delay_func)(unsigned int) = rump_delay; Index: src/sys/rump/librump/rumpkern/intr.c diff -u src/sys/rump/librump/rumpkern/intr.c:1.38 src/sys/rump/librump/rumpkern/intr.c:1.39 --- src/sys/rump/librump/rumpkern/intr.c:1.38 Sun Apr 28 13:17:24 2013 +++ src/sys/rump/librump/rumpkern/intr.c Tue Apr 30 16:03:44 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.38 2013/04/28 13:17:24 pooka Exp $ */ +/* $NetBSD: intr.c,v 1.39 2013/04/30 16:03:44 pooka Exp $ */ /* * Copyright (c) 2008-2010 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.38 2013/04/28 13
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Tue Apr 30 21:18:40 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.3 Log Message: document the hypercall interface To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/librumpuser/rumpuser.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.3 diff -u src/lib/librumpuser/rumpuser.3:1.2 src/lib/librumpuser/rumpuser.3:1.3 --- src/lib/librumpuser/rumpuser.3:1.2 Mon Mar 1 17:20:44 2010 +++ src/lib/librumpuser/rumpuser.3 Tue Apr 30 21:18:40 2013 @@ -1,6 +1,6 @@ -.\ $NetBSD: rumpuser.3,v 1.2 2010/03/01 17:20:44 pooka Exp $ +.\ $NetBSD: rumpuser.3,v 1.3 2013/04/30 21:18:40 pooka Exp $ .\ -.\ Copyright (c) 2010 Antti Kantee. All rights reserved. +.\ Copyright (c) 2013 Antti Kantee. All rights reserved. .\ .\ Redistribution and use in source and binary forms, with or without .\ modification, are permitted provided that the following conditions @@ -23,42 +23,587 @@ .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\ SUCH DAMAGE. .\ -.Dd March 1, 2010 +.Dd April 30, 2013 .Dt RUMPUSER 3 .Os .Sh NAME .Nm rumpuser -.Nd rump hypervisor interface +.Nd rump kernel hypercall interface .Sh LIBRARY rump User Library (librumpuser, \-lrumpuser) .Sh SYNOPSIS .In rump/rumpuser.h .Sh DESCRIPTION +The .Nm -is the hypervisor interface for -.Xr rump 3 -style kernel virtualization. -A virtual rump kernel can make calls to the host operating system -libraries and kernel (system calls) using -.Nm -interfaces. -Any slow hypervisor calls such as file I/O, sychronization wait, -or sleep will cause rump to unschedule the calling kernel thread -from the virtual CPU and free it for other consumers. -When the hypervisor call returns to the kernel, a new scheduling -operation takes place. -.Pp -For example, rump implements kernel threads directly as hypervisor -calls to host -.Xr pthread 3 . -This avoids the common virtualization drawback of multiple overlapping -and possibly conflicting implementations of same functionality in -the software stack. +hypercall interfaces allow a rump kernel to access host resources. +A hypervisor implementation must implement the routines described in +this document to allow a rump kernel to run on the host. +The implementation included in +.Nx +is for POSIX hosts. +This document is divided into sections based on the functionality +group of each hypercall. +.Sh UPCALLS AND RUMP KERNEL CONTEXT +A hypercall is always entered with the calling thread scheduled in +the rump kernel. +In case the hypercall intends to block while waiting for an event, +the hypervisor must first release the rump kernel scheduling context. +In other words, the rump kernel context is a resource and holding +on to it while waiting for a rump kernel event/resource may lead +to a deadlock. +Even when there is no possibility of deadlock in the strict sense +of the term, holding on to the rump kernel context while performing +a slow hypercall such as reading a device will prevent other threads +(including the clock interrupt) from using that rump kernel context. +.Pp +Releasing the context is done by calling the +.Fn hyp_backend_unschedule +upcall which the hypervisor received from rump kernel as a parameter +for +.Fn rumpuser_init . +Before a hypercall returns back to the rump kernel, the returning thread +must carry a rump kernel context. +In case the hypercall unscheduled itself, it must reschedule itself +by calling +.Fn hyp_backend_schedule . +.Sh HYPERCALL INTERFACES +.Ss Initialization +.Ft int +.Fn rumpuser_init int version struct rump_hyperup *hyp +.Pp +Initialize the hypervisor. +.Bl -tag -width xalignmentx +.It Fa version +hypercall interface version number that the kernel expects to be used. +In case the hypervisor cannot provide an exact match, this routine must +return a non-zero value. +.It Fa hyp +pointer to a set of upcalls the hypervisor can make into the rump kernel +.El +.Ss Memory allocation +.Ft int +.Fn rumpuser_malloc size_t len int alignment void **memp +.Bl -tag -width xalignmentx +.It Fa len +amount of memory to allocate +.It Fa alignment +size the returned memory must be aligned to. +For example, if the value passed is 4096, the returned memory +must be aligned to a 4k boundary. +.It Fa memp +return pointer for allocated memory +.El +.Pp +.Ft void +.Fn rumpuser_free void *mem size_t len +.Bl -tag -width xalignmentx +.It Fa mem +memory to free +.It Fa len +length of allocation. +This is always equal to the amount the caller requested from the +.Fn rumpuser_malloc +which returned +.Fa mem . +.El +.Ss Files and I/O +.Ft int +.Fn rumpuser_open const char *name int mode int *fdp +.Pp +Open a file for I/O. +Notably, there needs to be no mapping between +.Fa name +and the host, but for example on a POSIX system it may be convenient +to let +.Fa name +denote the host
CVS commit: src/lib/librump
Module Name:src Committed By: pooka Date: Tue Apr 30 21:21:24 UTC 2013 Modified Files: src/lib/librump: rump.3 Log Message: +reference XXX: this manpage is hideously out-of-date To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/librump/rump.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librump/rump.3 diff -u src/lib/librump/rump.3:1.10 src/lib/librump/rump.3:1.11 --- src/lib/librump/rump.3:1.10 Fri Apr 15 22:57:05 2011 +++ src/lib/librump/rump.3 Tue Apr 30 21:21:24 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: rump.3,v 1.10 2011/04/15 22:57:05 jym Exp $ +.\ $NetBSD: rump.3,v 1.11 2013/04/30 21:21:24 pooka Exp $ .\ .\ Copyright (c) 2008-2011 Antti Kantee. All rights reserved. .\ @@ -171,6 +171,12 @@ kernel module boundaries. .Xr rump_sp 7 .Rs .%A Antti Kantee +.%D 2012 +.%J Aalto University Doctoral Dissertations +.%T Flexible Operating System Internals: The Design and Implementation of the Anykernel and Rump Kernerls +.Re +.Rs +.%A Antti Kantee .%D March 2009 .%B Proceedings of AsiaBSDCon 2009 .%P pp. 71-80
CVS commit: src
Module Name:src Committed By: pooka Date: Mon Apr 29 12:56:04 UTC 2013 Modified Files: src/lib/librumpuser: Makefile rumpuser.c rumpuser_int.h rumpuser_pth.c src/sys/rump/include/rump: rumpuser.h src/sys/rump/librump/rumpvfs: rump_vfs.c rumpblk.c Added Files: src/lib/librumpuser: rumpuser_bio.c Log Message: Rework how the bio hypercalls work, part 1/n: Reduce the set of hypercalls to one: do block i/o. This not only eliminates a lot of pseudo-duplicate code, it also gives the hypervisor a lot more freedom on how to optimize the i/o. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/lib/librumpuser/Makefile cvs rdiff -u -r1.37 -r1.38 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r0 -r1.1 src/lib/librumpuser/rumpuser_bio.c cvs rdiff -u -r1.5 -r1.6 src/lib/librumpuser/rumpuser_int.h cvs rdiff -u -r1.16 -r1.17 src/lib/librumpuser/rumpuser_pth.c cvs rdiff -u -r1.88 -r1.89 src/sys/rump/include/rump/rumpuser.h cvs rdiff -u -r1.73 -r1.74 src/sys/rump/librump/rumpvfs/rump_vfs.c cvs rdiff -u -r1.48 -r1.49 src/sys/rump/librump/rumpvfs/rumpblk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/Makefile diff -u src/lib/librumpuser/Makefile:1.9 src/lib/librumpuser/Makefile:1.10 --- src/lib/librumpuser/Makefile:1.9 Mon Mar 18 13:14:10 2013 +++ src/lib/librumpuser/Makefile Mon Apr 29 12:56:04 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.9 2013/03/18 13:14:10 pooka Exp $ +# $NetBSD: Makefile,v 1.10 2013/04/29 12:56:04 pooka Exp $ # WARNS?= 5 @@ -13,7 +13,7 @@ CPPFLAGS+= -DLIBRUMPUSER SRCS= rumpuser.c SRCS+= rumpuser_pth.c -SRCS+= rumpuser_dl.c rumpuser_sp.c rumpuser_daemonize.c +SRCS+= rumpuser_dl.c rumpuser_sp.c rumpuser_daemonize.c rumpuser_bio.c SRCS+= rumpuser_component.c INCSDIR= /usr/include/rump Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.37 src/lib/librumpuser/rumpuser.c:1.38 --- src/lib/librumpuser/rumpuser.c:1.37 Sun Apr 28 13:39:13 2013 +++ src/lib/librumpuser/rumpuser.c Mon Apr 29 12:56:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.37 2013/04/28 13:39:13 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.38 2013/04/29 12:56:04 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.37 2013/04/28 13:39:13 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.38 2013/04/29 12:56:04 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -403,22 +403,6 @@ rumpuser_pread(int fd, void *data, size_ return rv; } -void -rumpuser_read_bio(int fd, void *data, size_t size, off_t offset, - rump_biodone_fn biodone, void *biodonecookie) -{ - ssize_t rv; - int error = 0; - - rv = rumpuser_pread(fd, data, size, offset, error); - /* check against 0 instead of ==-1 to get typing below right */ - if (rv 0) - rv = 0; - - /* LINTED: see above */ - biodone(biodonecookie, rv, error); -} - ssize_t rumpuser_write(int fd, const void *data, size_t size, int *error) { @@ -443,22 +427,6 @@ rumpuser_pwrite(int fd, const void *data return rv; } -void -rumpuser_write_bio(int fd, const void *data, size_t size, off_t offset, - rump_biodone_fn biodone, void *biodonecookie) -{ - ssize_t rv; - int error = 0; - - rv = rumpuser_pwrite(fd, data, size, offset, error); - /* check against 0 instead of ==-1 to get typing below right */ - if (rv 0) - rv = 0; - - /* LINTED: see above */ - biodone(biodonecookie, rv, error); -} - ssize_t rumpuser_readv(int fd, const struct rumpuser_iovec *riov, int iovcnt, int *error) Index: src/lib/librumpuser/rumpuser_int.h diff -u src/lib/librumpuser/rumpuser_int.h:1.5 src/lib/librumpuser/rumpuser_int.h:1.6 --- src/lib/librumpuser/rumpuser_int.h:1.5 Sat Apr 27 14:59:08 2013 +++ src/lib/librumpuser/rumpuser_int.h Mon Apr 29 12:56:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_int.h,v 1.5 2013/04/27 14:59:08 pooka Exp $ */ +/* $NetBSD: rumpuser_int.h,v 1.6 2013/04/29 12:56:04 pooka Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -68,3 +68,15 @@ do { \ } void rumpuser__thrinit(void); + +#define NOFAIL(a) do {if (!(a)) abort();} while (/*CONSTCOND*/0) + +#define NOFAIL_ERRNO(a) \ +do { \ + int fail_rv = (a); \ + if (fail_rv) { \ + printf(panic: rumpuser fatal failure %d (%s)\n, \ + fail_rv, strerror(fail_rv)); \ + abort(); \ + }\ +} while (/*CONSTCOND*/0) Index: src/lib/librumpuser/rumpuser_pth.c diff -u src/lib/librumpuser/rumpuser_pth.c:1.16 src/lib/librumpuser/rumpuser_pth.c:1.17 --- src/lib/librumpuser/rumpuser_pth.c:1.16 Sun Apr 28 13:37:51 2013 +++ src/lib/librumpuser/rumpuser_pth.c Mon Apr 29 12:56:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth.c,v 1.16 2013/04/28 13:37:51 pooka Exp $ */ +/* $NetBSD: rumpuser_pth.c,v 1.17 2013/04/29 12:56:04 pooka Exp
CVS commit: src/sys/rump/librump/rumpvfs
Module Name:src Committed By: pooka Date: Mon Apr 29 13:07:37 UTC 2013 Modified Files: src/sys/rump/librump/rumpvfs: rumpblk.c Log Message: rework bio hypercalls, part 2: Nuke all the policy hacks (r/w, mmap, directio) from the paravirtualized block driver and let the hypervisor decide how it wants to optimize the I/O. It can prepare for this based on if a file is opened with the RUMPUSER_OPEN_BIO flag. mmap was not faster than r/w except in a niche case (yes, it made a good measurement), and directio was never on by default since it was tricky at best to decide on the kernel side of things if directio will do the right thing. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/rump/librump/rumpvfs/rumpblk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpvfs/rumpblk.c diff -u src/sys/rump/librump/rumpvfs/rumpblk.c:1.49 src/sys/rump/librump/rumpvfs/rumpblk.c:1.50 --- src/sys/rump/librump/rumpvfs/rumpblk.c:1.49 Mon Apr 29 12:56:03 2013 +++ src/sys/rump/librump/rumpvfs/rumpblk.c Mon Apr 29 13:07:37 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpblk.c,v 1.49 2013/04/29 12:56:03 pooka Exp $ */ +/* $NetBSD: rumpblk.c,v 1.50 2013/04/29 13:07:37 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -34,25 +34,10 @@ * * We provide fault injection. The driver can be made to fail * I/O occasionally. - * - * The driver also provides an optimization for regular files by - * using memory-mapped I/O. This avoids kernel access for every - * I/O operation. It also gives finer-grained control of how to - * flush data. Additionally, in case the rump kernel dumps core, - * we get way less carnage. - * - * However, it is quite costly in writing large amounts of - * file data, since old contents cannot merely be overwritten, but - * must be paged in first before replacing (i.e. r/m/w). Ideally, - * we should use directio. The problem is that directio can fail - * silently causing improper file system semantics (i.e. unflushed - * data). Therefore, default to mmap for now. Even so, directio - * _should_ be safe and can be enabled by compiling this module - * with -DHAS_DIRECTIO. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: rumpblk.c,v 1.49 2013/04/29 12:56:03 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: rumpblk.c,v 1.50 2013/04/29 13:07:37 pooka Exp $); #include sys/param.h #include sys/buf.h @@ -72,68 +57,29 @@ __KERNEL_RCSID(0, $NetBSD: rumpblk.c,v #include rump_private.h #include rump_vfs_private.h -/* - * O_DIRECT is the fastest alternative, but since it falls back to - * non-direct writes silently, I am not sure it will always be 100% safe. - * Use it and play with it, but do that with caution. - */ -#if 0 -#define HAS_ODIRECT -#endif - #if 0 #define DPRINTF(x) printf x #else #define DPRINTF(x) #endif -/* Default: 16 x 1MB windows */ -unsigned memwinsize = (120); -unsigned memwincnt = 16; - -#define STARTWIN(off) ((off) ~((off_t)memwinsize-1)) -#define INWIN(win,off) ((win)-win_off == STARTWIN(off)) -#define WINSIZE(rblk, win) (MIN((rblk-rblk_hostsize-win-win_off), \ - memwinsize)) -#define WINVALID(win) ((win)-win_off != (off_t)-1) -#define WINVALIDATE(win) ((win)-win_off = (off_t)-1) -struct blkwin { - off_t win_off; - void *win_mem; - int win_refcnt; - - TAILQ_ENTRY(blkwin) win_lru; -}; - #define RUMPBLK_SIZE 16 static struct rblkdev { char *rblk_path; int rblk_fd; int rblk_mode; -#ifdef HAS_ODIRECT - int rblk_dfd; -#endif + uint64_t rblk_size; uint64_t rblk_hostoffset; uint64_t rblk_hostsize; int rblk_ftype; - /* for mmap */ - int rblk_mmflags; - kmutex_t rblk_memmtx; - kcondvar_t rblk_memcv; - TAILQ_HEAD(winlru, blkwin) rblk_lruq; - bool rblk_waiting; - struct disklabel rblk_label; } minors[RUMPBLK_SIZE]; static struct evcnt ev_io_total; static struct evcnt ev_io_async; -static struct evcnt ev_memblk_hits; -static struct evcnt ev_memblk_busy; - static struct evcnt ev_bwrite_total; static struct evcnt ev_bwrite_async; static struct evcnt ev_bread_total; @@ -209,105 +155,6 @@ makedefaultlabel(struct disklabel *lp, o lp-d_checksum = 0; /* XXX */ } -static struct blkwin * -getwindow(struct rblkdev *rblk, off_t off, int *wsize, int *error) -{ - struct blkwin *win; - - mutex_enter(rblk-rblk_memmtx); - retry: - /* search for window */ - TAILQ_FOREACH(win, rblk-rblk_lruq, win_lru) { - if (INWIN(win, off) WINVALID(win)) - break; - } - - /* found? return */ - if (win) { - ev_memblk_hits.ev_count++; - TAILQ_REMOVE(rblk-rblk_lruq, win, win_lru); - goto good; - } - - /* - * Else, create new window. If the least recently used is not - * currently in use, reuse that. Otherwise we need to wait. - */ - win = TAILQ_LAST(rblk-rblk_lruq, winlru); - if (win-win_refcnt == 0) { - TAILQ_REMOVE(rblk-rblk_lruq, win, win_lru); - mutex_exit(rblk-rblk_memmtx
CVS commit: src/sys/rump/net/lib/libshmif
Module Name:src Committed By: pooka Date: Mon Apr 29 13:17:33 UTC 2013 Modified Files: src/sys/rump/net/lib/libshmif: if_shmem.c rumpcomp_user.c rumpcomp_user.h Log Message: add a private hypercall to map the bus into memory To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/rump/net/lib/libshmif/if_shmem.c cvs rdiff -u -r1.5 -r1.6 src/sys/rump/net/lib/libshmif/rumpcomp_user.c cvs rdiff -u -r1.2 -r1.3 src/sys/rump/net/lib/libshmif/rumpcomp_user.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libshmif/if_shmem.c diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.50 src/sys/rump/net/lib/libshmif/if_shmem.c:1.51 --- src/sys/rump/net/lib/libshmif/if_shmem.c:1.50 Sun Apr 28 13:17:25 2013 +++ src/sys/rump/net/lib/libshmif/if_shmem.c Mon Apr 29 13:17:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: if_shmem.c,v 1.50 2013/04/28 13:17:25 pooka Exp $ */ +/* $NetBSD: if_shmem.c,v 1.51 2013/04/29 13:17:32 pooka Exp $ */ /* * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_shmem.c,v 1.50 2013/04/28 13:17:25 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: if_shmem.c,v 1.51 2013/04/29 13:17:32 pooka Exp $); #include sys/param.h #include sys/atomic.h @@ -205,9 +205,7 @@ initbackend(struct shmif_sc *sc, int mem volatile uint8_t *p; int error; - sc-sc_busmem = rumpuser_filemmap(memfd, 0, BUSMEM_SIZE, - RUMPUSER_FILEMMAP_TRUNCATE | RUMPUSER_FILEMMAP_SHARED - | RUMPUSER_FILEMMAP_READ | RUMPUSER_FILEMMAP_WRITE, error); + sc-sc_busmem = rumpcomp_shmif_mmap(memfd, BUSMEM_SIZE, error); if (error) return error; Index: src/sys/rump/net/lib/libshmif/rumpcomp_user.c diff -u src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.5 src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.6 --- src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.5 Sun Apr 28 14:11:43 2013 +++ src/sys/rump/net/lib/libshmif/rumpcomp_user.c Mon Apr 29 13:17:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcomp_user.c,v 1.5 2013/04/28 14:11:43 pooka Exp $ */ +/* $NetBSD: rumpcomp_user.c,v 1.6 2013/04/29 13:17:32 pooka Exp $ */ /*- * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -26,6 +26,7 @@ */ #include sys/types.h +#include sys/mman.h #include errno.h @@ -176,3 +177,26 @@ rumpcomp_shmif_watchwait(int kq, int *er return 0; } #endif + +void * +rumpcomp_shmif_mmap(int fd, size_t len, int *error) +{ + void *rv; + + *error = 0; + if (ftruncate(fd, len) == -1) { + *error = errno; + return NULL; + } + +#if defined(__sun__) !defined(MAP_FILE) +#define MAP_FILE 0 +#endif + + rv = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, 0); + if (rv == MAP_FAILED) { + *error = errno; + } + + return rv; +} Index: src/sys/rump/net/lib/libshmif/rumpcomp_user.h diff -u src/sys/rump/net/lib/libshmif/rumpcomp_user.h:1.2 src/sys/rump/net/lib/libshmif/rumpcomp_user.h:1.3 --- src/sys/rump/net/lib/libshmif/rumpcomp_user.h:1.2 Sun Apr 28 10:53:22 2013 +++ src/sys/rump/net/lib/libshmif/rumpcomp_user.h Mon Apr 29 13:17:33 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcomp_user.h,v 1.2 2013/04/28 10:53:22 pooka Exp $ */ +/* $NetBSD: rumpcomp_user.h,v 1.3 2013/04/29 13:17:33 pooka Exp $ */ /* * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -27,3 +27,4 @@ int rumpcomp_shmif_watchsetup(int, int, int *); int rumpcomp_shmif_watchwait(int, int *); +void *rumpcomp_shmif_mmap(int, size_t, int *);
CVS commit: src
Module Name:src Committed By: pooka Date: Mon Apr 29 13:19:12 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.c src/sys/rump/include/rump: rumpuser.h Log Message: changes to bio hypercalls, part 3/n: retire the filemmap/memsync hypercalls, they're no longer used To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.89 -r1.90 src/sys/rump/include/rump/rumpuser.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.38 src/lib/librumpuser/rumpuser.c:1.39 --- src/lib/librumpuser/rumpuser.c:1.38 Mon Apr 29 12:56:04 2013 +++ src/lib/librumpuser/rumpuser.c Mon Apr 29 13:19:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.38 2013/04/29 12:56:04 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.39 2013/04/29 13:19:11 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.38 2013/04/29 12:56:04 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.39 2013/04/29 13:19:11 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -282,53 +282,6 @@ rumpuser_unmap(void *addr, size_t len) assert(rv == 0); } -void * -rumpuser_filemmap(int fd, off_t offset, size_t len, int flags, int *error) -{ - void *rv; - int mmflags, prot; - - if (flags RUMPUSER_FILEMMAP_TRUNCATE) { - if (ftruncate(fd, offset + len) == -1) { - seterror(errno); - return NULL; - } - } - -/* it's implicit */ -#if defined(__sun__) !defined(MAP_FILE) -#define MAP_FILE 0 -#endif - - mmflags = MAP_FILE; - if (flags RUMPUSER_FILEMMAP_SHARED) - mmflags |= MAP_SHARED; - else - mmflags |= MAP_PRIVATE; - - prot = 0; - if (flags RUMPUSER_FILEMMAP_READ) - prot |= PROT_READ; - if (flags RUMPUSER_FILEMMAP_WRITE) - prot |= PROT_WRITE; - - rv = mmap(NULL, len, PROT_READ|PROT_WRITE, mmflags, fd, offset); - if (rv == MAP_FAILED) { - seterror(errno); - return NULL; - } - - seterror(0); - return rv; -} - -int -rumpuser_memsync(void *addr, size_t len, int *error) -{ - - DOCALL_KLOCK(int, (msync(addr, len, MS_SYNC))); -} - int rumpuser_open(const char *path, int ruflags, int *error) { Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.89 src/sys/rump/include/rump/rumpuser.h:1.90 --- src/sys/rump/include/rump/rumpuser.h:1.89 Mon Apr 29 12:56:03 2013 +++ src/sys/rump/include/rump/rumpuser.h Mon Apr 29 13:19:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.89 2013/04/29 12:56:03 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.90 2013/04/29 13:19:11 pooka Exp $ */ /* * Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved. @@ -57,13 +57,7 @@ void *rumpuser_malloc(size_t, int); void rumpuser_free(void *, size_t); void *rumpuser_anonmmap(void *, size_t, int, int, int *); -#define RUMPUSER_FILEMMAP_READ 0x01 -#define RUMPUSER_FILEMMAP_WRITE 0x02 -#define RUMPUSER_FILEMMAP_TRUNCATE 0x04 -#define RUMPUSER_FILEMMAP_SHARED 0x08 -void *rumpuser_filemmap(int fd, off_t, size_t, int, int *); void rumpuser_unmap(void *, size_t); -int rumpuser_memsync(void *, size_t, int *); #define RUMPUSER_OPEN_RDONLY 0x #define RUMPUSER_OPEN_WRONLY 0x0001
CVS commit: src
Module Name:src Committed By: pooka Date: Mon Apr 29 13:21:03 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.c src/sys/rump/include/rump: rumpuser.h Log Message: RUMPUSER_OPEN_DIRECT is no longer necessary To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.90 -r1.91 src/sys/rump/include/rump/rumpuser.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.39 src/lib/librumpuser/rumpuser.c:1.40 --- src/lib/librumpuser/rumpuser.c:1.39 Mon Apr 29 13:19:11 2013 +++ src/lib/librumpuser/rumpuser.c Mon Apr 29 13:21:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.39 2013/04/29 13:19:11 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.40 2013/04/29 13:21:03 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.39 2013/04/29 13:19:11 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.40 2013/04/29 13:21:03 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -305,14 +305,6 @@ rumpuser_open(const char *path, int rufl #define TESTSET(_ru_, _h_) if (ruflags _ru_) flags |= _h_; TESTSET(RUMPUSER_OPEN_CREATE, O_CREAT); TESTSET(RUMPUSER_OPEN_EXCL, O_EXCL); -#ifdef O_DIRECT - TESTSET(RUMPUSER_OPEN_DIRECT, O_DIRECT); -#else - if (ruflags RUMPUSER_OPEN_DIRECT) { - *error = EOPNOTSUPP; - return -1; - } -#endif #undef TESTSET DOCALL_KLOCK(int, (open(path, flags, 0644))); Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.90 src/sys/rump/include/rump/rumpuser.h:1.91 --- src/sys/rump/include/rump/rumpuser.h:1.90 Mon Apr 29 13:19:11 2013 +++ src/sys/rump/include/rump/rumpuser.h Mon Apr 29 13:21:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.90 2013/04/29 13:19:11 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.91 2013/04/29 13:21:03 pooka Exp $ */ /* * Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved. @@ -65,8 +65,7 @@ void rumpuser_unmap(void *, size_t); #define RUMPUSER_OPEN_ACCMODE 0x0003 /* yay */ #define RUMPUSER_OPEN_CREATE 0x0004 /* create file if it doesn't exist */ #define RUMPUSER_OPEN_EXCL 0x0008 /* exclusive open */ -#define RUMPUSER_OPEN_DIRECT 0x0010 /* use direct i/o */ -#define RUMPUSER_OPEN_BIO 0x0020 /* open device for block i/o */ +#define RUMPUSER_OPEN_BIO 0x0010 /* open device for block i/o */ int rumpuser_open(const char *, int, int *); int rumpuser_close(int, int *);
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Mon Apr 29 13:53:47 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_bio.c Log Message: unschedule around blocking i/o To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/librumpuser/rumpuser_bio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_bio.c diff -u src/lib/librumpuser/rumpuser_bio.c:1.1 src/lib/librumpuser/rumpuser_bio.c:1.2 --- src/lib/librumpuser/rumpuser_bio.c:1.1 Mon Apr 29 12:56:04 2013 +++ src/lib/librumpuser/rumpuser_bio.c Mon Apr 29 13:53:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_bio.c,v 1.1 2013/04/29 12:56:04 pooka Exp $ */ +/* $NetBSD: rumpuser_bio.c,v 1.2 2013/04/29 13:53:46 pooka Exp $ */ /*- * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -127,6 +127,9 @@ rumpuser_bio(int fd, int op, void *data, struct rumpuser_bio bio; static int inited = 0; static int usethread = 0; + int nlocks; + + rumpuser__unschedule(0, nlocks, NULL); if (!inited) { pthread_mutex_lock(biomtx); @@ -170,4 +173,6 @@ rumpuser_bio(int fd, int op, void *data, pthread_cond_signal(biocv); pthread_mutex_unlock(biomtx); } + + rumpuser__reschedule(nlocks, NULL); }
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Mon Apr 29 13:57:46 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_bio.c Log Message: set default bio mode to threaded To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/librumpuser/rumpuser_bio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_bio.c diff -u src/lib/librumpuser/rumpuser_bio.c:1.2 src/lib/librumpuser/rumpuser_bio.c:1.3 --- src/lib/librumpuser/rumpuser_bio.c:1.2 Mon Apr 29 13:53:46 2013 +++ src/lib/librumpuser/rumpuser_bio.c Mon Apr 29 13:57:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_bio.c,v 1.2 2013/04/29 13:53:46 pooka Exp $ */ +/* $NetBSD: rumpuser_bio.c,v 1.3 2013/04/29 13:57:46 pooka Exp $ */ /*- * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -126,7 +126,7 @@ rumpuser_bio(int fd, int op, void *data, { struct rumpuser_bio bio; static int inited = 0; - static int usethread = 0; + static int usethread = 1; int nlocks; rumpuser__unschedule(0, nlocks, NULL); @@ -145,7 +145,8 @@ rumpuser_bio(int fd, int op, void *data, if (getenv_r(RUMP_THREADS, buf, sizeof(buf)) == 0) usethread = *buf != '0'; - pthread_create(pt, NULL, biothread, NULL); + if (usethread) +pthread_create(pt, NULL, biothread, NULL); inited = 1; } pthread_mutex_unlock(biomtx);
CVS commit: src/sys/rump/include/rump
Module Name:src Committed By: pooka Date: Mon Apr 29 14:07:02 UTC 2013 Modified Files: src/sys/rump/include/rump: rumpuser.h Log Message: regroup calls a bit and sprinkle comments no functional change for a change To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/sys/rump/include/rump/rumpuser.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.91 src/sys/rump/include/rump/rumpuser.h:1.92 --- src/sys/rump/include/rump/rumpuser.h:1.91 Mon Apr 29 13:21:03 2013 +++ src/sys/rump/include/rump/rumpuser.h Mon Apr 29 14:07:01 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.91 2013/04/29 13:21:03 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.92 2013/04/29 14:07:01 pooka Exp $ */ /* * Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved. @@ -37,28 +37,28 @@ #error The rump/rumpuser.h interface is not for non-kernel consumers #endif -#define RUMPUSER_VERSION 16 - -int rumpuser_daemonize_begin(void); -int rumpuser_daemonize_done(int); +/* + * init + */ +#define RUMPUSER_VERSION 16 typedef void (*rump_reschedulefn)(int, void *); typedef void (*rump_unschedulefn)(int, int *, void *); int rumpuser_init(int, rump_reschedulefn, rump_unschedulefn); -int rumpuser_getfileinfo(const char *, uint64_t *, int *, int *); -#define RUMPUSER_FT_OTHER 0 -#define RUMPUSER_FT_DIR 1 -#define RUMPUSER_FT_REG 2 -#define RUMPUSER_FT_BLK 3 -#define RUMPUSER_FT_CHR 4 +/* + * memory allocation + */ void *rumpuser_malloc(size_t, int); void rumpuser_free(void *, size_t); - void *rumpuser_anonmmap(void *, size_t, int, int, int *); void rumpuser_unmap(void *, size_t); +/* + * files and I/O + */ + #define RUMPUSER_OPEN_RDONLY 0x #define RUMPUSER_OPEN_WRONLY 0x0001 #define RUMPUSER_OPEN_RDWR 0x0002 @@ -68,6 +68,13 @@ void rumpuser_unmap(void *, size_t); #define RUMPUSER_OPEN_BIO 0x0010 /* open device for block i/o */ int rumpuser_open(const char *, int, int *); +#define RUMPUSER_FT_OTHER 0 +#define RUMPUSER_FT_DIR 1 +#define RUMPUSER_FT_REG 2 +#define RUMPUSER_FT_BLK 3 +#define RUMPUSER_FT_CHR 4 +int rumpuser_getfileinfo(const char *, uint64_t *, int *, int *); + int rumpuser_close(int, int *); int rumpuser_fsync(int, int *); @@ -89,32 +96,56 @@ struct rumpuser_iovec { ssize_t rumpuser_readv(int, const struct rumpuser_iovec *, int, int *); ssize_t rumpuser_writev(int, const struct rumpuser_iovec *, int, int *); +/* + * clock and zzz + */ + enum rumpclock { RUMPUSER_CLOCK_RELWALL, RUMPUSER_CLOCK_ABSMONO }; int rumpuser_clock_gettime(uint64_t *, uint64_t *, enum rumpclock); int rumpuser_clock_sleep(uint64_t, uint64_t, enum rumpclock); -int rumpuser_getenv(const char *, char *, size_t, int *); +/* + * host information retrieval + */ +int rumpuser_getenv(const char *, char *, size_t, int *); +int rumpuser_getnhostcpu(void); int rumpuser_gethostname(char *, size_t, int *); -int rumpuser_putchar(int, int *); +/* + * system call emulation, set errno is TLS + */ + +void rumpuser_seterrno(int); + +/* + * termination + */ #define RUMPUSER_PID_SELF ((int64_t)-1) int rumpuser_kill(int64_t, int, int *); - #define RUMPUSER_PANIC (-1) void rumpuser_exit(int) __dead; -void rumpuser_seterrno(int); +/* + * console output + */ + +int rumpuser_putchar(int, int *); int rumpuser_dprintf(const char *, ...) __printflike(1, 2); -int rumpuser_getnhostcpu(void); +/* + * access to host random pool + */ /* always succeeds unless NOWAIT is given */ #define RUMPUSER_RANDOM_HARD 0x01 #define RUMPUSER_RANDOM_NOWAIT 0x02 size_t rumpuser_getrandom(void *, size_t, int); +/* + * threads, scheduling (host) and synchronization + */ int rumpuser_thread_create(void *(*f)(void *), void *, const char *, int, void **); void rumpuser_thread_exit(void) __dead; @@ -156,7 +187,9 @@ void rumpuser_cv_signal(struct rumpuser_ void rumpuser_cv_broadcast(struct rumpuser_cv *); int rumpuser_cv_has_waiters(struct rumpuser_cv *); -/* rumpuser dynloader */ +/* + * dynloader + */ struct modinfo; struct rump_component; @@ -166,7 +199,16 @@ typedef void (*rump_compload_fn)(const s void rumpuser_dl_bootstrap(rump_modinit_fn, rump_symload_fn, rump_compload_fn); void *rumpuser_dl_globalsym(const char *); -/* syscall proxy routines */ +/* + * misc management + */ + +int rumpuser_daemonize_begin(void); +int rumpuser_daemonize_done(int); + +/* + * syscall proxy + */ struct rumpuser_sp_ops { void (*spop_schedule)(void);
CVS commit: src
Module Name:src Committed By: pooka Date: Mon Apr 29 14:51:41 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.c rumpuser_bio.c rumpuser_component.c rumpuser_int.h rumpuser_pth.c rumpuser_sp.c src/sys/rump/include/rump: rumpuser.h src/sys/rump/librump/rumpkern: klock.c rump.c Log Message: Make the rump kernel upcalls which were previous available only to the sysproxy module available for the entire hypervisor. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.3 -r1.4 src/lib/librumpuser/rumpuser_bio.c cvs rdiff -u -r1.2 -r1.3 src/lib/librumpuser/rumpuser_component.c cvs rdiff -u -r1.6 -r1.7 src/lib/librumpuser/rumpuser_int.h cvs rdiff -u -r1.17 -r1.18 src/lib/librumpuser/rumpuser_pth.c cvs rdiff -u -r1.55 -r1.56 src/lib/librumpuser/rumpuser_sp.c cvs rdiff -u -r1.92 -r1.93 src/sys/rump/include/rump/rumpuser.h cvs rdiff -u -r1.5 -r1.6 src/sys/rump/librump/rumpkern/klock.c cvs rdiff -u -r1.262 -r1.263 src/sys/rump/librump/rumpkern/rump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.40 src/lib/librumpuser/rumpuser.c:1.41 --- src/lib/librumpuser/rumpuser.c:1.40 Mon Apr 29 13:21:03 2013 +++ src/lib/librumpuser/rumpuser.c Mon Apr 29 14:51:39 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.40 2013/04/29 13:21:03 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.41 2013/04/29 14:51:39 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.40 2013/04/29 13:21:03 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.41 2013/04/29 14:51:39 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -64,12 +64,10 @@ __RCSID($NetBSD: rumpuser.c,v 1.40 2013 #include rumpuser_int.h -rump_unschedulefn rumpuser__unschedule; -rump_reschedulefn rumpuser__reschedule; +struct rumpuser_hyperup rumpuser__hyp; int -rumpuser_init(int version, - rump_reschedulefn rumpkern_resched, rump_unschedulefn rumpkern_unsched) +rumpuser_init(int version, const struct rumpuser_hyperup *hyp) { if (version != RUMPUSER_VERSION) { @@ -94,9 +92,7 @@ rumpuser_init(int version, #endif rumpuser__thrinit(); - - rumpuser__unschedule = rumpkern_unsched; - rumpuser__reschedule = rumpkern_resched; + rumpuser__hyp = *hyp; return 0; } @@ -465,7 +461,7 @@ rumpuser_clock_sleep(uint64_t sec, uint6 int nlocks; int rv; - rumpuser__unschedule(0, nlocks, NULL); + rumpkern_unsched(nlocks, NULL); /*LINTED*/ rqt.tv_sec = sec; @@ -513,7 +509,7 @@ rumpuser_clock_sleep(uint64_t sec, uint6 abort(); } - rumpuser__reschedule(nlocks, NULL); + rumpkern_sched(nlocks, NULL); return rv; } Index: src/lib/librumpuser/rumpuser_bio.c diff -u src/lib/librumpuser/rumpuser_bio.c:1.3 src/lib/librumpuser/rumpuser_bio.c:1.4 --- src/lib/librumpuser/rumpuser_bio.c:1.3 Mon Apr 29 13:57:46 2013 +++ src/lib/librumpuser/rumpuser_bio.c Mon Apr 29 14:51:39 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_bio.c,v 1.3 2013/04/29 13:57:46 pooka Exp $ */ +/* $NetBSD: rumpuser_bio.c,v 1.4 2013/04/29 14:51:39 pooka Exp $ */ /*- * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -88,9 +88,9 @@ dobio(struct rumpuser_bio *biop) #endif } } - rumpuser__reschedule(0, NULL); + rumpkern_sched(0, NULL); biop-bio_done(biop-bio_donearg, (size_t)rv, error); - rumpuser__unschedule(0, dummy, NULL); + rumpkern_unsched(dummy, NULL); /* paranoia */ biop-bio_donearg = NULL; @@ -129,7 +129,7 @@ rumpuser_bio(int fd, int op, void *data, static int usethread = 1; int nlocks; - rumpuser__unschedule(0, nlocks, NULL); + rumpkern_unsched(nlocks, NULL); if (!inited) { pthread_mutex_lock(biomtx); @@ -175,5 +175,5 @@ rumpuser_bio(int fd, int op, void *data, pthread_mutex_unlock(biomtx); } - rumpuser__reschedule(nlocks, NULL); + rumpkern_sched(nlocks, NULL); } Index: src/lib/librumpuser/rumpuser_component.c diff -u src/lib/librumpuser/rumpuser_component.c:1.2 src/lib/librumpuser/rumpuser_component.c:1.3 --- src/lib/librumpuser/rumpuser_component.c:1.2 Sat Apr 27 14:59:08 2013 +++ src/lib/librumpuser/rumpuser_component.c Mon Apr 29 14:51:39 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_component.c,v 1.2 2013/04/27 14:59:08 pooka Exp $ */ +/* $NetBSD: rumpuser_component.c,v 1.3 2013/04/29 14:51:39 pooka Exp $ */ /* * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_component.c,v 1.2 2013/04/27 14:59:08 pooka Exp $); +__RCSID($NetBSD: rumpuser_component.c,v 1.3 2013/04/29 14:51:39 pooka Exp $); #endif /* !lint */ /* @@ -47,7 +47,7 @@ rumpuser_component_unschedule(void) { int nlocks; - rumpuser__unschedule(0, nlocks, NULL); + rumpkern_unsched
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: pooka Date: Mon Apr 29 14:53:33 UTC 2013 Modified Files: src/sys/rump/librump/rumpkern: klock.c Log Message: remove routine not meant to be committed To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/rump/librump/rumpkern/klock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/klock.c diff -u src/sys/rump/librump/rumpkern/klock.c:1.6 src/sys/rump/librump/rumpkern/klock.c:1.7 --- src/sys/rump/librump/rumpkern/klock.c:1.6 Mon Apr 29 14:51:41 2013 +++ src/sys/rump/librump/rumpkern/klock.c Mon Apr 29 14:53:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: klock.c,v 1.6 2013/04/29 14:51:41 pooka Exp $ */ +/* $NetBSD: klock.c,v 1.7 2013/04/29 14:53:32 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: klock.c,v 1.6 2013/04/29 14:51:41 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: klock.c,v 1.7 2013/04/29 14:53:32 pooka Exp $); #include sys/param.h #include sys/systm.h @@ -166,14 +166,3 @@ rump_user_schedule(int nlocks, void *int if (nlocks) _kernel_lock(nlocks); } - -void -rump_user_kthread(void) -{ - - KASSERT(curlwp == NULL); - rump_schedule(); - if (rump_lwproc_newlwp(0) != 0) - panic(kthread create failed); - rump_unschedule(); -}
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Mon Apr 29 14:54:03 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_bio.c Log Message: Create a kernel thread context for the bio upcalls. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/librumpuser/rumpuser_bio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_bio.c diff -u src/lib/librumpuser/rumpuser_bio.c:1.4 src/lib/librumpuser/rumpuser_bio.c:1.5 --- src/lib/librumpuser/rumpuser_bio.c:1.4 Mon Apr 29 14:51:39 2013 +++ src/lib/librumpuser/rumpuser_bio.c Mon Apr 29 14:54:03 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_bio.c,v 1.4 2013/04/29 14:51:39 pooka Exp $ */ +/* $NetBSD: rumpuser_bio.c,v 1.5 2013/04/29 14:54:03 pooka Exp $ */ /*- * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -100,7 +100,12 @@ static void * biothread(void *arg) { struct rumpuser_bio *biop; + int rv; + rumpuser__hyp.hyp_schedule(); + rv = rumpuser__hyp.hyp_lwproc_newlwp(0); + assert(rv == 0); + rumpuser__hyp.hyp_unschedule(); NOFAIL_ERRNO(pthread_mutex_lock(biomtx)); for (;;) { while (bio_head == bio_tail)
CVS commit: src/lib/librumpuser
Module Name:src Committed By: pooka Date: Mon Apr 29 15:20:05 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_component.c rumpuser_component.h Log Message: Give private hypercalls the ability to meddle with kthread contexts too. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/librumpuser/rumpuser_component.c cvs rdiff -u -r1.1 -r1.2 src/lib/librumpuser/rumpuser_component.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_component.c diff -u src/lib/librumpuser/rumpuser_component.c:1.3 src/lib/librumpuser/rumpuser_component.c:1.4 --- src/lib/librumpuser/rumpuser_component.c:1.3 Mon Apr 29 14:51:39 2013 +++ src/lib/librumpuser/rumpuser_component.c Mon Apr 29 15:20:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_component.c,v 1.3 2013/04/29 14:51:39 pooka Exp $ */ +/* $NetBSD: rumpuser_component.c,v 1.4 2013/04/29 15:20:05 pooka Exp $ */ /* * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_component.c,v 1.3 2013/04/29 14:51:39 pooka Exp $); +__RCSID($NetBSD: rumpuser_component.c,v 1.4 2013/04/29 15:20:05 pooka Exp $); #endif /* !lint */ /* @@ -58,3 +58,42 @@ rumpuser_component_schedule(void *cookie rumpkern_sched(nlocks, NULL); } + +void +rumpuser_component_kthread(void) +{ + + rumpuser__hyp.hyp_schedule(); + rumpuser__hyp.hyp_lwproc_newlwp(0); + rumpuser__hyp.hyp_unschedule(); +} + +struct lwp * +rumpuser_component_curlwp(void) +{ + struct lwp *l; + + rumpuser__hyp.hyp_schedule(); + l = rumpuser__hyp.hyp_lwproc_curlwp(); + rumpuser__hyp.hyp_unschedule(); + + return l; +} + +void +rumpuser_component_switchlwp(struct lwp *l) +{ + + rumpuser__hyp.hyp_schedule(); + rumpuser__hyp.hyp_lwproc_switch(l); + rumpuser__hyp.hyp_unschedule(); +} + +void +rumpuser_component_kthread_release(void) +{ + + rumpuser__hyp.hyp_schedule(); + rumpuser__hyp.hyp_lwproc_release(); + rumpuser__hyp.hyp_unschedule(); +} Index: src/lib/librumpuser/rumpuser_component.h diff -u src/lib/librumpuser/rumpuser_component.h:1.1 src/lib/librumpuser/rumpuser_component.h:1.2 --- src/lib/librumpuser/rumpuser_component.h:1.1 Fri Mar 1 18:15:36 2013 +++ src/lib/librumpuser/rumpuser_component.h Mon Apr 29 15:20:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_component.h,v 1.1 2013/03/01 18:15:36 pooka Exp $ */ +/* $NetBSD: rumpuser_component.h,v 1.2 2013/04/29 15:20:05 pooka Exp $ */ /* * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -31,4 +31,9 @@ void * rumpuser_component_unschedule(void); void rumpuser_component_schedule(void *); +void rumpuser_component_kthread(void); +struct lwp *rumpuser_component_curlwp(void); +void rumpuser_component_switchlwp(struct lwp *); +void rumpuser_component_kthread_release(void); + #endif /* _RUMP_RUMPUSER_COMPONENT_H_ */
CVS commit: src
Module Name:src Committed By: pooka Date: Mon Apr 29 15:40:39 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.c src/sys/rump/include/rump: rumpuser.h src/sys/rump/librump/rumpvfs: rumpblk.c Log Message: The fsync hypercall is now used only with close, so get rid of it. rumpuser_bio() should do the necessary syncing. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.93 -r1.94 src/sys/rump/include/rump/rumpuser.h cvs rdiff -u -r1.50 -r1.51 src/sys/rump/librump/rumpvfs/rumpblk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.41 src/lib/librumpuser/rumpuser.c:1.42 --- src/lib/librumpuser/rumpuser.c:1.41 Mon Apr 29 14:51:39 2013 +++ src/lib/librumpuser/rumpuser.c Mon Apr 29 15:40:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.41 2013/04/29 14:51:39 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.42 2013/04/29 15:40:38 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.41 2013/04/29 14:51:39 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.42 2013/04/29 15:40:38 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -309,15 +309,14 @@ rumpuser_open(const char *path, int rufl int rumpuser_close(int fd, int *error) { + int nlocks; - DOCALL(int, close(fd)); -} - -int -rumpuser_fsync(int fd, int *error) -{ + rumpkern_unsched(nlocks, NULL); + fsync(fd); + close(fd); + rumpkern_sched(nlocks, NULL); - DOCALL_KLOCK(int, fsync(fd)); + return 0; } ssize_t Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.93 src/sys/rump/include/rump/rumpuser.h:1.94 --- src/sys/rump/include/rump/rumpuser.h:1.93 Mon Apr 29 14:51:40 2013 +++ src/sys/rump/include/rump/rumpuser.h Mon Apr 29 15:40:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.93 2013/04/29 14:51:40 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.94 2013/04/29 15:40:38 pooka Exp $ */ /* * Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved. @@ -85,6 +85,7 @@ void rumpuser_unmap(void *, size_t); #define RUMPUSER_OPEN_EXCL 0x0008 /* exclusive open */ #define RUMPUSER_OPEN_BIO 0x0010 /* open device for block i/o */ int rumpuser_open(const char *, int, int *); +int rumpuser_close(int, int *); #define RUMPUSER_FT_OTHER 0 #define RUMPUSER_FT_DIR 1 @@ -93,9 +94,6 @@ int rumpuser_open(const char *, int, int #define RUMPUSER_FT_CHR 4 int rumpuser_getfileinfo(const char *, uint64_t *, int *, int *); -int rumpuser_close(int, int *); -int rumpuser_fsync(int, int *); - #define RUMPUSER_BIO_READ 0x01 #define RUMPUSER_BIO_WRITE 0x02 #define RUMPUSER_BIO_SYNC 0x04 Index: src/sys/rump/librump/rumpvfs/rumpblk.c diff -u src/sys/rump/librump/rumpvfs/rumpblk.c:1.50 src/sys/rump/librump/rumpvfs/rumpblk.c:1.51 --- src/sys/rump/librump/rumpvfs/rumpblk.c:1.50 Mon Apr 29 13:07:37 2013 +++ src/sys/rump/librump/rumpvfs/rumpblk.c Mon Apr 29 15:40:39 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpblk.c,v 1.50 2013/04/29 13:07:37 pooka Exp $ */ +/* $NetBSD: rumpblk.c,v 1.51 2013/04/29 15:40:39 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: rumpblk.c,v 1.50 2013/04/29 13:07:37 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: rumpblk.c,v 1.51 2013/04/29 15:40:39 pooka Exp $); #include sys/param.h #include sys/buf.h @@ -347,7 +347,6 @@ backend_close(struct rblkdev *rblk) { int dummy; - rumpuser_fsync(rblk-rblk_fd, dummy); rumpuser_close(rblk-rblk_fd, dummy); rblk-rblk_fd = -1;
CVS commit: src
Module Name:src Committed By: pooka Date: Mon Apr 29 17:31:05 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.c src/sys/rump/include/rump: rumpuser.h src/sys/rump/librump/rumpkern: rump.c vm.c src/sys/rump/librump/rumpvfs: rump_vfs.c rumpblk.c Log Message: Replace the various get info from hypervisor interfaces with one unified rumpuser_getparam(), and make it return a plist. The contents can come e.g. from the env or a config file. Make identifiers starting with an underscore denote system identifiers which must be implemented by hypervisor. (yea, j/k about the plist bit) To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.94 -r1.95 src/sys/rump/include/rump/rumpuser.h cvs rdiff -u -r1.263 -r1.264 src/sys/rump/librump/rumpkern/rump.c cvs rdiff -u -r1.140 -r1.141 src/sys/rump/librump/rumpkern/vm.c cvs rdiff -u -r1.74 -r1.75 src/sys/rump/librump/rumpvfs/rump_vfs.c cvs rdiff -u -r1.51 -r1.52 src/sys/rump/librump/rumpvfs/rumpblk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.42 src/lib/librumpuser/rumpuser.c:1.43 --- src/lib/librumpuser/rumpuser.c:1.42 Mon Apr 29 15:40:38 2013 +++ src/lib/librumpuser/rumpuser.c Mon Apr 29 17:31:05 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.42 2013/04/29 15:40:38 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.43 2013/04/29 17:31:05 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.42 2013/04/29 15:40:38 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.43 2013/04/29 17:31:05 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -512,27 +512,71 @@ rumpuser_clock_sleep(uint64_t sec, uint6 return rv; } -int -rumpuser_getenv(const char *name, char *buf, size_t blen, int *error) +static int +gethostncpu(void) { + int ncpu = 1; + +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) + size_t sz = sizeof(ncpu); + + sysctlbyname(hw.ncpu, ncpu, sz, NULL, 0); +#elif defined(__linux__) || defined(__CYGWIN__) + FILE *fp; + char *line = NULL; + size_t n = 0; - DOCALL(int, getenv_r(name, buf, blen)); + /* If anyone knows a better way, I'm all ears */ + if ((fp = fopen(/proc/cpuinfo, r)) != NULL) { + ncpu = 0; + while (getline(line, n, fp) != -1) { + if (strncmp(line, + processor, sizeof(processor)-1) == 0) + ncpu++; + } + if (ncpu == 0) + ncpu = 1; + free(line); + fclose(fp); + } +#elif __sun__ + /* XXX: this is just a rough estimate ... */ + ncpu = sysconf(_SC_NPROCESSORS_ONLN); +#endif + + return ncpu; } int -rumpuser_gethostname(char *name, size_t namelen, int *error) +rumpuser_getparam(const char *name, void *buf, size_t blen) { - char tmp[MAXHOSTNAMELEN]; - if (gethostname(tmp, sizeof(tmp)) == -1) { - snprintf(name, namelen, rump-%05d.rumpdomain, (int)getpid()); + if (strcmp(name, RUMPUSER_PARAM_NCPU) == 0) { + int ncpu; + + if (getenv_r(RUMP_NCPU, buf, blen) == -1) { + ncpu = gethostncpu(); + snprintf(buf, blen, %d, ncpu); + } + return 0; + } else if (strcmp(name, RUMPUSER_PARAM_HOSTNAME) == 0) { + char tmp[MAXHOSTNAMELEN]; + + if (gethostname(tmp, sizeof(tmp)) == -1) { + snprintf(buf, blen, rump-%05d, (int)getpid()); + } else { + snprintf(buf, blen, rump-%05d.%s, + (int)getpid(), tmp); + } + return 0; + } else if (*name == '_') { + return EINVAL; } else { - snprintf(name, namelen, rump-%05d.%s.rumpdomain, - (int)getpid(), tmp); + if (getenv_r(name, buf, blen) == -1) + return errno; + else + return 0; } - - *error = 0; - return 0; } int @@ -592,41 +636,6 @@ rumpuser_kill(int64_t pid, int sig, int #endif } -int -rumpuser_getnhostcpu(void) -{ - int ncpu = 1; - -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) - size_t sz = sizeof(ncpu); - - sysctlbyname(hw.ncpu, ncpu, sz, NULL, 0); -#elif defined(__linux__) || defined(__CYGWIN__) - FILE *fp; - char *line = NULL; - size_t n = 0; - - /* If anyone knows a better way, I'm all ears */ - if ((fp = fopen(/proc/cpuinfo, r)) != NULL) { - ncpu = 0; - while (getline(line, n, fp) != -1) { - if (strncmp(line, - processor, sizeof(processor)-1) == 0) - ncpu++; - } - if (ncpu == 0) - ncpu = 1; - free(line); - fclose(fp); - } -#elif __sun__ - /* XXX: this is just a rough estimate ... */ - ncpu = sysconf(_SC_NPROCESSORS_ONLN); -#endif - - return ncpu; -} - size_t rumpuser_getrandom(void *buf, size_t buflen, int flags) { Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.94 src/sys/rump/include/rump/rumpuser.h:1.95 --- src/sys/rump/include/rump/rumpuser.h:1.94 Mon Apr 29 15:40:38 2013 +++ src/sys/rump/include/rump/rumpuser.h Mon Apr 29 17
CVS commit: src/sys/rump/include/rump
Module Name:src Committed By: pooka Date: Mon Apr 29 17:35:04 UTC 2013 Modified Files: src/sys/rump/include/rump: rumpuser.h Log Message: remove accidentally committed bit To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/rump/include/rump/rumpuser.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.95 src/sys/rump/include/rump/rumpuser.h:1.96 --- src/sys/rump/include/rump/rumpuser.h:1.95 Mon Apr 29 17:31:05 2013 +++ src/sys/rump/include/rump/rumpuser.h Mon Apr 29 17:35:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.95 2013/04/29 17:31:05 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.96 2013/04/29 17:35:04 pooka Exp $ */ /* * Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved. @@ -62,7 +62,6 @@ struct rumpuser_hyperup { void *hyp__extra[8]; }; int rumpuser_init(int, const struct rumpuser_hyperup *); -void rumpuser_fini(void); /* * memory allocation
CVS commit: src
Module Name:src Committed By: pooka Date: Mon Apr 29 18:00:20 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser_dl.c src/sys/rump/librump/rumpkern: rump.c Log Message: Make rumpuser_dl_bootstrap() optional for platforms which don't provide dynamic linking. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/lib/librumpuser/rumpuser_dl.c cvs rdiff -u -r1.264 -r1.265 src/sys/rump/librump/rumpkern/rump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser_dl.c diff -u src/lib/librumpuser/rumpuser_dl.c:1.17 src/lib/librumpuser/rumpuser_dl.c:1.18 --- src/lib/librumpuser/rumpuser_dl.c:1.17 Wed Mar 20 12:59:10 2013 +++ src/lib/librumpuser/rumpuser_dl.c Mon Apr 29 18:00:20 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_dl.c,v 1.17 2013/03/20 12:59:10 pooka Exp $ */ +/* $NetBSD: rumpuser_dl.c,v 1.18 2013/04/29 18:00:20 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -40,7 +40,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser_dl.c,v 1.17 2013/03/20 12:59:10 pooka Exp $); +__RCSID($NetBSD: rumpuser_dl.c,v 1.18 2013/04/29 18:00:20 pooka Exp $); #endif /* !lint */ #include sys/types.h @@ -455,22 +455,14 @@ rumpuser_dl_bootstrap(rump_modinit_fn do } #else /* - * default implementation for platforms where we don't support - * dynamic linking. Assumes that all rump kernel components are - * statically linked with the local client. No need to handle modules - * since the module code does that all by itself. + * no dynamic linking supported */ void rumpuser_dl_bootstrap(rump_modinit_fn domodinit, rump_symload_fn symload, rump_compload_fn compload) { - extern void *__start_link_set_rump_components; - extern void *__stop_link_set_rump_components; - void **rc = __start_link_set_rump_components; - void **rc_end = __stop_link_set_rump_components; - for (; rc rc_end; rc++) - compload(*rc); + return; } #endif Index: src/sys/rump/librump/rumpkern/rump.c diff -u src/sys/rump/librump/rumpkern/rump.c:1.264 src/sys/rump/librump/rumpkern/rump.c:1.265 --- src/sys/rump/librump/rumpkern/rump.c:1.264 Mon Apr 29 17:31:05 2013 +++ src/sys/rump/librump/rumpkern/rump.c Mon Apr 29 18:00:19 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rump.c,v 1.264 2013/04/29 17:31:05 pooka Exp $ */ +/* $NetBSD: rump.c,v 1.265 2013/04/29 18:00:19 pooka Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.264 2013/04/29 17:31:05 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.265 2013/04/29 18:00:19 pooka Exp $); #include sys/systm.h #define ELFSIZE ARCH_ELFSIZE @@ -106,6 +106,7 @@ static int rump_hyp_rfork(void *, int, c static void rump_hyp_lwpexit(void); static void rump_hyp_execnotify(const char *); +static void rump_component_addlocal(void); static void rump_component_load(const struct rump_component *); static struct lwp *bootlwp; @@ -219,8 +220,7 @@ rump_daemonize_done(int error) RUMP_COMPONENT(RUMP_COMPONENT_POSTINIT) { - extern void *__start_link_set_rump_components; - extern void *__stop_link_set_rump_components; + __link_set_decl(rump_components, struct rump_component); /* * Trick compiler into generating references so that statically @@ -402,6 +402,7 @@ rump_init(void) rumpuser_dl_bootstrap(add_linkedin_modules, rump_kernelfsym_load, rump_component_load); + rump_component_addlocal(); rump_component_init(RUMP_COMPONENT_KERN); /* initialize factions, if present */ @@ -679,6 +680,20 @@ struct compstore { }; static LIST_HEAD(, compstore) cshead = LIST_HEAD_INITIALIZER(cshead); +/* + * add components which are visible from the current object. + */ +static void +rump_component_addlocal(void) +{ + __link_set_decl(rump_components, struct rump_component); + struct rump_component *const *rc; + + __link_set_foreach(rc, rump_components) { + rump_component_load(*rc); + } +} + static void rump_component_load(const struct rump_component *rc) {
CVS commit: src/sys/rump/librump/rumpvfs
Module Name:src Committed By: pooka Date: Mon Apr 29 19:52:35 UTC 2013 Modified Files: src/sys/rump/librump/rumpvfs: rumpblk.c Log Message: g/c unused To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/rump/librump/rumpvfs/rumpblk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpvfs/rumpblk.c diff -u src/sys/rump/librump/rumpvfs/rumpblk.c:1.52 src/sys/rump/librump/rumpvfs/rumpblk.c:1.53 --- src/sys/rump/librump/rumpvfs/rumpblk.c:1.52 Mon Apr 29 17:31:05 2013 +++ src/sys/rump/librump/rumpvfs/rumpblk.c Mon Apr 29 19:52:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpblk.c,v 1.52 2013/04/29 17:31:05 pooka Exp $ */ +/* $NetBSD: rumpblk.c,v 1.53 2013/04/29 19:52:35 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: rumpblk.c,v 1.52 2013/04/29 17:31:05 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: rumpblk.c,v 1.53 2013/04/29 19:52:35 pooka Exp $); #include sys/param.h #include sys/buf.h @@ -161,7 +161,7 @@ rumpblk_init(void) char buf[64]; devmajor_t rumpblkmaj = RUMPBLK_DEVMAJOR; unsigned tmp; - int error, i; + int i; mutex_init(rumpblk_lock, MUTEX_DEFAULT, IPL_NONE);
CVS commit: src
Module Name:src Committed By: pooka Date: Mon Apr 29 20:08:49 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.c src/sys/rump/dev/lib/libugenhc: ugenhc.c src/sys/rump/fs/lib/libsyspuffs: puffs_rumpglue.c src/sys/rump/include/rump: rumpuser.h src/sys/rump/librump/rumpvfs: rumpfs.c src/sys/rump/net/lib/libshmif: if_shmem.c Log Message: Reduce hypercalls related to reading to essentially an amalgamation of readv and preadv. ditto for writing. Hypercalls are so seldomly used that it doesn't justify 3x the calls for syntactic sugar. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.13 -r1.14 src/sys/rump/dev/lib/libugenhc/ugenhc.c cvs rdiff -u -r1.11 -r1.12 src/sys/rump/fs/lib/libsyspuffs/puffs_rumpglue.c cvs rdiff -u -r1.96 -r1.97 src/sys/rump/include/rump/rumpuser.h cvs rdiff -u -r1.112 -r1.113 src/sys/rump/librump/rumpvfs/rumpfs.c cvs rdiff -u -r1.51 -r1.52 src/sys/rump/net/lib/libshmif/if_shmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.43 src/lib/librumpuser/rumpuser.c:1.44 --- src/lib/librumpuser/rumpuser.c:1.43 Mon Apr 29 17:31:05 2013 +++ src/lib/librumpuser/rumpuser.c Mon Apr 29 20:08:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.43 2013/04/29 17:31:05 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.44 2013/04/29 20:08:48 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.43 2013/04/29 17:31:05 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.44 2013/04/29 20:08:48 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -319,104 +319,43 @@ rumpuser_close(int fd, int *error) return 0; } +/* + * Assume struct rumpuser_iovec and struct iovec are the same. + * If you encounter POSIX platforms where they aren't, add some + * translation for iovlen 1. + */ ssize_t -rumpuser_read(int fd, void *data, size_t size, int *error) -{ - ssize_t rv; - - KLOCK_WRAP(rv = read(fd, data, size)); - if (rv == -1) - seterror(errno); - - return rv; -} - -ssize_t -rumpuser_pread(int fd, void *data, size_t size, off_t offset, int *error) -{ - ssize_t rv; - - KLOCK_WRAP(rv = pread(fd, data, size, offset)); - if (rv == -1) - seterror(errno); - - return rv; -} - -ssize_t -rumpuser_write(int fd, const void *data, size_t size, int *error) -{ - ssize_t rv; - - KLOCK_WRAP(rv = write(fd, data, size)); - if (rv == -1) - seterror(errno); - - return rv; -} - -ssize_t -rumpuser_pwrite(int fd, const void *data, size_t size, off_t offset, int *error) -{ - ssize_t rv; - - KLOCK_WRAP(rv = pwrite(fd, data, size, offset)); - if (rv == -1) - seterror(errno); - - return rv; -} - -ssize_t -rumpuser_readv(int fd, const struct rumpuser_iovec *riov, int iovcnt, - int *error) +rumpuser_iovread(int fd, struct rumpuser_iovec *ruiov, size_t iovlen, + off_t off, int *error) { - struct iovec *iovp; + struct iovec *iov = (struct iovec *)ruiov; ssize_t rv; - int i; - iovp = malloc(iovcnt * sizeof(struct iovec)); - if (iovp == NULL) { - seterror(ENOMEM); - return -1; - } - for (i = 0; i iovcnt; i++) { - iovp[i].iov_base = riov[i].iov_base; - /*LINTED*/ - iovp[i].iov_len = riov[i].iov_len; - } + if (off == RUMPUSER_IOV_NOSEEK) + KLOCK_WRAP(rv = readv(fd, iov, iovlen)); + else + KLOCK_WRAP(rv = preadv(fd, iov, iovlen, off)); - KLOCK_WRAP(rv = readv(fd, iovp, iovcnt)); if (rv == -1) seterror(errno); - free(iovp); return rv; } ssize_t -rumpuser_writev(int fd, const struct rumpuser_iovec *riov, int iovcnt, - int *error) +rumpuser_iovwrite(int fd, const struct rumpuser_iovec *ruiov, size_t iovlen, + off_t off, int *error) { - struct iovec *iovp; + const struct iovec *iov = (const struct iovec *)ruiov; ssize_t rv; - int i; - iovp = malloc(iovcnt * sizeof(struct iovec)); - if (iovp == NULL) { - seterror(ENOMEM); - return -1; - } - for (i = 0; i iovcnt; i++) { - iovp[i].iov_base = riov[i].iov_base; - /*LINTED*/ - iovp[i].iov_len = riov[i].iov_len; - } + if (off == RUMPUSER_IOV_NOSEEK) + KLOCK_WRAP(rv = writev(fd, iov, iovlen)); + else + KLOCK_WRAP(rv = pwritev(fd, iov, iovlen, off)); - KLOCK_WRAP(rv = writev(fd, iovp, iovcnt)); if (rv == -1) seterror(errno); - free(iovp); return rv; } Index: src/sys/rump/dev/lib/libugenhc/ugenhc.c diff -u src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.13 src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.14 --- src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.13 Sun Apr 28 09:58:11 2013 +++ src/sys/rump/dev/lib/libugenhc/ugenhc.c Mon Apr 29 20:08:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ugenhc.c,v 1.13 2013/04/28 09:58:11 pooka Exp $ */ +/* $NetBSD: ugenhc.c,v 1.14 2013/04/29 20:08:48 pooka Exp $ */ /* * Copyright (c) 2009, 2010 Antti Kantee. All Rights
CVS commit: src/sys/rump/net/lib/libsockin
Module Name:src Committed By: pooka Date: Tue Apr 30 00:12:36 UTC 2013 Modified Files: src/sys/rump/net/lib/libsockin: sockin.c Log Message: few more conversions To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/rump/net/lib/libsockin/sockin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.29 src/sys/rump/net/lib/libsockin/sockin.c:1.30 --- src/sys/rump/net/lib/libsockin/sockin.c:1.29 Tue Apr 30 00:03:54 2013 +++ src/sys/rump/net/lib/libsockin/sockin.c Tue Apr 30 00:12:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.29 2013/04/30 00:03:54 pooka Exp $ */ +/* $NetBSD: sockin.c,v 1.30 2013/04/30 00:12:35 pooka Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.29 2013/04/30 00:03:54 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: sockin.c,v 1.30 2013/04/30 00:12:35 pooka Exp $); #include sys/param.h #include sys/condvar.h @@ -173,8 +173,7 @@ sockin_process(struct socket *so) struct iovec io; struct msghdr rmsg; struct mbuf *m; - ssize_t n; - size_t plen; + size_t n, plen; int error; m = m_gethdr(M_WAIT, MT_DATA); @@ -198,8 +197,8 @@ sockin_process(struct socket *so) rmsg.msg_name = (struct sockaddr *)from; rmsg.msg_namelen = sizeof(from); - n = rumpcomp_sockin_recvmsg(SO2S(so), rmsg, 0, error); - if (n = 0) { + error = rumpcomp_sockin_recvmsg(SO2S(so), rmsg, 0, n); + if (error) { m_freem(m); /* Treat a TCP socket a goner */ @@ -371,9 +370,9 @@ sockin_usrreq(struct socket *so, int req break; } - news = rumpcomp_sockin_socket(PF_INET, so-so_proto-pr_type, - 0, error); - if (news == -1) + error = rumpcomp_sockin_socket(PF_INET, so-so_proto-pr_type, + 0, news); + if (error) break; /* for UDP sockets, make sure we can sendrecv max */ @@ -422,7 +421,7 @@ sockin_usrreq(struct socket *so, int req size_t iov_max, i; struct iovec iov_buf[32], *iov; struct mbuf *m2; - size_t tot; + size_t tot, n; int s; bpf_mtap_af(sockin_if, AF_UNSPEC, m); @@ -457,7 +456,7 @@ sockin_usrreq(struct socket *so, int req mhdr.msg_namelen = saddr-sa_len; } - rumpcomp_sockin_sendmsg(s, mhdr, 0, error); + rumpcomp_sockin_sendmsg(s, mhdr, 0, n); if (iov != iov_buf) kmem_free(iov, sizeof(struct iovec) * iov_max);
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: pooka Date: Tue Apr 30 00:29:19 UTC 2013 Modified Files: src/sys/rump/librump/rumpkern: vm.c Log Message: add missing demogorgon To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/sys/rump/librump/rumpkern/vm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/vm.c diff -u src/sys/rump/librump/rumpkern/vm.c:1.142 src/sys/rump/librump/rumpkern/vm.c:1.143 --- src/sys/rump/librump/rumpkern/vm.c:1.142 Tue Apr 30 00:03:53 2013 +++ src/sys/rump/librump/rumpkern/vm.c Tue Apr 30 00:29:19 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vm.c,v 1.142 2013/04/30 00:03:53 pooka Exp $ */ +/* $NetBSD: vm.c,v 1.143 2013/04/30 00:29:19 pooka Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -41,7 +41,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.142 2013/04/30 00:03:53 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.143 2013/04/30 00:29:19 pooka Exp $); #include sys/param.h #include sys/atomic.h @@ -421,7 +421,7 @@ uvm_mmap(struct vm_map *map, vaddr_t *ad panic(uvm_mmap() variant unsupported); if (RUMP_LOCALPROC_P(curproc)) { - error = rumpuser_anonmmap(NULL, size, 0, 0, uaddr); + error = rumpuser_anonmmap(NULL, size, 0, 0, uaddr); } else { error = rumpuser_sp_anonmmap(curproc-p_vmspace-vm_map.pmap, size, uaddr);
CVS commit: src/sys/rump/net/lib/libshmif
Module Name:src Committed By: pooka Date: Tue Apr 30 00:33:16 UTC 2013 Modified Files: src/sys/rump/net/lib/libshmif: rumpcomp_user.c Log Message: fix non-NetBSD implementation To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/rump/net/lib/libshmif/rumpcomp_user.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libshmif/rumpcomp_user.c diff -u src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.8 src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.9 --- src/sys/rump/net/lib/libshmif/rumpcomp_user.c:1.8 Tue Apr 30 00:03:54 2013 +++ src/sys/rump/net/lib/libshmif/rumpcomp_user.c Tue Apr 30 00:33:16 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcomp_user.c,v 1.8 2013/04/30 00:03:54 pooka Exp $ */ +/* $NetBSD: rumpcomp_user.c,v 1.9 2013/04/30 00:33:16 pooka Exp $ */ /*- * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -167,7 +167,7 @@ rumpcomp_shmif_watchwait(int kq) /* a polling default implementation */ int -rumpcomp_shmif_watchsetup(int inotify, int fd) +rumpcomp_shmif_watchsetup(int *nono, int fd) { static int warned = 0;
CVS commit: src
Module Name:src Committed By: pooka Date: Sun Apr 28 09:58:12 UTC 2013 Modified Files: src/lib/librumpuser: rumpuser.c src/sys/rump/dev/lib/libugenhc: Makefile ugenhc.c src/sys/rump/include/rump: rumpuser.h Added Files: src/sys/rump/dev/lib/libugenhc: rumpcomp_user.c rumpcomp_user.h Log Message: The ioctl hypercall is used only by the usb host controller driver, so make it exclusive to that component. I'm happy to see it gone. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.2 -r1.3 src/sys/rump/dev/lib/libugenhc/Makefile cvs rdiff -u -r0 -r1.1 src/sys/rump/dev/lib/libugenhc/rumpcomp_user.c \ src/sys/rump/dev/lib/libugenhc/rumpcomp_user.h cvs rdiff -u -r1.12 -r1.13 src/sys/rump/dev/lib/libugenhc/ugenhc.c cvs rdiff -u -r1.85 -r1.86 src/sys/rump/include/rump/rumpuser.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.33 src/lib/librumpuser/rumpuser.c:1.34 --- src/lib/librumpuser/rumpuser.c:1.33 Sat Apr 27 16:56:29 2013 +++ src/lib/librumpuser/rumpuser.c Sun Apr 28 09:58:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.33 2013/04/27 16:56:29 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.34 2013/04/28 09:58:11 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include rumpuser_port.h #if !defined(lint) -__RCSID($NetBSD: rumpuser.c,v 1.33 2013/04/27 16:56:29 pooka Exp $); +__RCSID($NetBSD: rumpuser.c,v 1.34 2013/04/28 09:58:11 pooka Exp $); #endif /* !lint */ #include sys/ioctl.h @@ -388,13 +388,6 @@ rumpuser_open(const char *path, int rufl } int -rumpuser_ioctl(int fd, u_long cmd, void *data, int *error) -{ - - DOCALL_KLOCK(int, (ioctl(fd, cmd, data))); -} - -int rumpuser_close(int fd, int *error) { Index: src/sys/rump/dev/lib/libugenhc/Makefile diff -u src/sys/rump/dev/lib/libugenhc/Makefile:1.2 src/sys/rump/dev/lib/libugenhc/Makefile:1.3 --- src/sys/rump/dev/lib/libugenhc/Makefile:1.2 Mon Mar 8 10:24:37 2010 +++ src/sys/rump/dev/lib/libugenhc/Makefile Sun Apr 28 09:58:11 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2010/03/08 10:24:37 pooka Exp $ +# $NetBSD: Makefile,v 1.3 2013/04/28 09:58:11 pooka Exp $ # LIB= rumpdev_ugenhc @@ -8,5 +8,7 @@ SRCS= ugenhc.c ugenhc_at_mainbus.c CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern +RUMPUSER_COMP= ioctl + .include bsd.lib.mk .include bsd.klinks.mk Index: src/sys/rump/dev/lib/libugenhc/ugenhc.c diff -u src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.12 src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.13 --- src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.12 Sat Oct 27 17:18:40 2012 +++ src/sys/rump/dev/lib/libugenhc/ugenhc.c Sun Apr 28 09:58:11 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ugenhc.c,v 1.12 2012/10/27 17:18:40 chs Exp $ */ +/* $NetBSD: ugenhc.c,v 1.13 2013/04/28 09:58:11 pooka Exp $ */ /* * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -61,7 +61,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ugenhc.c,v 1.12 2012/10/27 17:18:40 chs Exp $); +__KERNEL_RCSID(0, $NetBSD: ugenhc.c,v 1.13 2013/04/28 09:58:11 pooka Exp $); #include sys/param.h #include sys/bus.h @@ -81,6 +81,8 @@ __KERNEL_RCSID(0, $NetBSD: ugenhc.c,v 1 #include rump/rumpuser.h +#include rumpcomp_user.h + #include rump_private.h #include rump_dev_private.h @@ -387,7 +389,7 @@ rumpusb_device_ctrl_start(usbd_xfer_hand usb_device_descriptor_t uddesc; totlen = min(len, USB_DEVICE_DESCRIPTOR_SIZE); memset(buf, 0, totlen); - if (rumpuser_ioctl(sc-sc_ugenfd[UGEN_EPT_CTRL], + if (rumpcomp_ugenhc_ioctl(sc-sc_ugenfd[UGEN_EPT_CTRL], USB_GET_DEVICE_DESC, uddesc, ru_error) == -1) { err = EIO; goto ret; @@ -403,7 +405,7 @@ rumpusb_device_ctrl_start(usbd_xfer_hand ufdesc.ufd_size = len; ufdesc.ufd_data = buf; memset(buf, 0, len); - if (rumpuser_ioctl(sc-sc_ugenfd[UGEN_EPT_CTRL], + if (rumpcomp_ugenhc_ioctl(sc-sc_ugenfd[UGEN_EPT_CTRL], USB_GET_FULL_DESC, ufdesc, ru_error) == -1) { err = USBD_IOERROR; goto ret; @@ -416,7 +418,7 @@ rumpusb_device_ctrl_start(usbd_xfer_hand { struct usb_device_info udi; - if (rumpuser_ioctl(sc-sc_ugenfd[UGEN_EPT_CTRL], + if (rumpcomp_ugenhc_ioctl(sc-sc_ugenfd[UGEN_EPT_CTRL], USB_GET_DEVICEINFO, udi, ru_error) == -1) { printf(ugenhc: get dev info failed: %d\n, ru_error); @@ -451,7 +453,7 @@ rumpusb_device_ctrl_start(usbd_xfer_hand break; case C(UR_SET_CONFIG, UT_WRITE_DEVICE): - if (rumpuser_ioctl(sc-sc_ugenfd[UGEN_EPT_CTRL], + if (rumpcomp_ugenhc_ioctl(sc-sc_ugenfd[UGEN_EPT_CTRL], USB_SET_CONFIG, value, ru_error) == -1) { printf(ugenhc: set config failed: %d\n, ru_error); @@ -467,7 +469,7 @@ rumpusb_device_ctrl_start(usbd_xfer_hand totlen = 0; uai.uai_interface_index = UGETW
CVS commit: src/sys/rump/dev/lib/libugenhc
Module Name:src Committed By: pooka Date: Sun Apr 28 10:06:16 UTC 2013 Modified Files: src/sys/rump/dev/lib/libugenhc: Makefile Log Message: typo To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/rump/dev/lib/libugenhc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/dev/lib/libugenhc/Makefile diff -u src/sys/rump/dev/lib/libugenhc/Makefile:1.3 src/sys/rump/dev/lib/libugenhc/Makefile:1.4 --- src/sys/rump/dev/lib/libugenhc/Makefile:1.3 Sun Apr 28 09:58:11 2013 +++ src/sys/rump/dev/lib/libugenhc/Makefile Sun Apr 28 10:06:16 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2013/04/28 09:58:11 pooka Exp $ +# $NetBSD: Makefile,v 1.4 2013/04/28 10:06:16 pooka Exp $ # LIB= rumpdev_ugenhc @@ -8,7 +8,7 @@ SRCS= ugenhc.c ugenhc_at_mainbus.c CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern -RUMPUSER_COMP= ioctl +RUMPCOMP_USER= ioctl .include bsd.lib.mk .include bsd.klinks.mk
CVS commit: src/sys/rump/dev/lib/libugenhc
Module Name:src Committed By: pooka Date: Sun Apr 28 10:16:52 UTC 2013 Modified Files: src/sys/rump/dev/lib/libugenhc: Makefile Log Message: duh, the untypoed version doesn't work with bsd.ioconf.mk. comment it out while i figure it out To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/rump/dev/lib/libugenhc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/dev/lib/libugenhc/Makefile diff -u src/sys/rump/dev/lib/libugenhc/Makefile:1.4 src/sys/rump/dev/lib/libugenhc/Makefile:1.5 --- src/sys/rump/dev/lib/libugenhc/Makefile:1.4 Sun Apr 28 10:06:16 2013 +++ src/sys/rump/dev/lib/libugenhc/Makefile Sun Apr 28 10:16:52 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.4 2013/04/28 10:06:16 pooka Exp $ +# $NetBSD: Makefile,v 1.5 2013/04/28 10:16:52 pooka Exp $ # LIB= rumpdev_ugenhc @@ -8,7 +8,7 @@ SRCS= ugenhc.c ugenhc_at_mainbus.c CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern -RUMPCOMP_USER= ioctl +#RUMPCOMP_USER= #ioctl .include bsd.lib.mk .include bsd.klinks.mk