CVS commit: src/sys/rump/net/lib

2016-04-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Apr 19 05:48:10 UTC 2016

Modified Files:
src/sys/rump/net/lib/libshmif: if_shmem.c
src/sys/rump/net/lib/libvirtif: if_virt.c

Log Message:
Prevent LWP migrations between CPUs during upper layer processing

This is a contract of psref(9) that is used by upper layer componenets,
e.g., bridge(4).


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/rump/net/lib/libshmif/if_shmem.c
cvs rdiff -u -r1.50 -r1.51 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/libshmif/if_shmem.c
diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.65 src/sys/rump/net/lib/libshmif/if_shmem.c:1.66
--- src/sys/rump/net/lib/libshmif/if_shmem.c:1.65	Tue Feb  9 08:32:12 2016
+++ src/sys/rump/net/lib/libshmif/if_shmem.c	Tue Apr 19 05:48:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_shmem.c,v 1.65 2016/02/09 08:32:12 ozaki-r Exp $	*/
+/*	$NetBSD: if_shmem.c,v 1.66 2016/04/19 05:48:10 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.65 2016/02/09 08:32:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.66 2016/04/19 05:48:10 ozaki-r Exp $");
 
 #include 
 #include 
@@ -764,10 +764,14 @@ shmif_rcv(void *arg)
 		}
 
 		if (passup) {
+			int bound = curlwp->l_pflag & LP_BOUND;
 			ifp->if_ipackets++;
 			KERNEL_LOCK(1, NULL);
+			/* Prevent LWP migrations between CPUs for psref(9) */
+			curlwp->l_pflag |= LP_BOUND;
 			bpf_mtap(ifp, m);
 			if_input(ifp, m);
+			curlwp->l_pflag ^= bound ^ LP_BOUND;
 			KERNEL_UNLOCK_ONE(NULL);
 			m = NULL;
 		}

Index: src/sys/rump/net/lib/libvirtif/if_virt.c
diff -u src/sys/rump/net/lib/libvirtif/if_virt.c:1.50 src/sys/rump/net/lib/libvirtif/if_virt.c:1.51
--- src/sys/rump/net/lib/libvirtif/if_virt.c:1.50	Tue Feb  9 08:32:12 2016
+++ src/sys/rump/net/lib/libvirtif/if_virt.c	Tue Apr 19 05:48:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_virt.c,v 1.50 2016/02/09 08:32:12 ozaki-r Exp $	*/
+/*	$NetBSD: if_virt.c,v 1.51 2016/04/19 05:48:10 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2008, 2013 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.50 2016/02/09 08:32:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.51 2016/04/19 05:48:10 ozaki-r Exp $");
 
 #include 
 #include 
@@ -374,11 +374,15 @@ VIF_DELIVERPKT(struct virtif_sc *sc, str
 	}
 
 	if (passup) {
+		int bound = curlwp->l_pflag & LP_BOUND;
 		ifp->if_ipackets++;
 		m->m_pkthdr.rcvif = ifp;
 		KERNEL_LOCK(1, NULL);
+		/* Prevent LWP migrations between CPUs for psref(9) */
+		curlwp->l_pflag |= LP_BOUND;
 		bpf_mtap(ifp, m);
 		if_input(ifp, m);
+		curlwp->l_pflag ^= bound ^ LP_BOUND;
 		KERNEL_UNLOCK_LAST(NULL);
 	} else {
 		m_freem(m);



CVS commit: src/sys/netinet

2016-04-18 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Apr 19 04:13:56 UTC 2016

Modified Files:
src/sys/netinet: if_arp.c if_inarp.h

Log Message:
Constify rtentry of arpresolve

We don't need to (rather shouldn't) modify rtentry in there.


To generate a diff of this commit:
cvs rdiff -u -r1.207 -r1.208 src/sys/netinet/if_arp.c
cvs rdiff -u -r1.48 -r1.49 src/sys/netinet/if_inarp.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/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.207 src/sys/netinet/if_arp.c:1.208
--- src/sys/netinet/if_arp.c:1.207	Mon Apr 18 02:24:42 2016
+++ src/sys/netinet/if_arp.c	Tue Apr 19 04:13:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.207 2016/04/18 02:24:42 ozaki-r Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.208 2016/04/19 04:13:56 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.207 2016/04/18 02:24:42 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.208 2016/04/19 04:13:56 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -685,7 +685,7 @@ arprequest(struct ifnet *ifp,
  * Any other value indicates an error.
  */
 int
-arpresolve(struct ifnet *ifp, struct rtentry *rt, struct mbuf *m,
+arpresolve(struct ifnet *ifp, const struct rtentry *rt, struct mbuf *m,
 const struct sockaddr *dst, void *desten, size_t destlen)
 {
 	struct llentry *la;
@@ -707,18 +707,6 @@ arpresolve(struct ifnet *ifp, struct rte
 		return 0;
 	}
 
-	/*
-	 * Re-send the ARP request when appropriate.
-	 */
-#ifdef	DIAGNOSTIC
-	if (rt->rt_expire == 0) {
-		/* This should never happen. (Should it? -gwr) */
-		printf("%s: unresolved and rt_expire == 0\n", __func__);
-		/* Set expiration time to now (expired). */
-		rt->rt_expire = time_uptime;
-	}
-#endif
-
 notfound:
 #ifdef IFF_STATICARP /* FreeBSD */
 #define _IFF_NOARP (IFF_NOARP | IFF_STATICARP)
@@ -859,17 +847,18 @@ notfound:
 			(dst)->sin_addr, enaddr);
 		} else {
 			struct sockaddr_in sin;
+			struct rtentry *_rt;
 
 			sockaddr_in_init(, >r_l3addr.addr4, 0);
 
 			/* XXX */
-			rt = rtalloc1((struct sockaddr *), 0);
-			if (rt == NULL)
+			_rt = rtalloc1((struct sockaddr *), 0);
+			if (_rt == NULL)
 goto bad;
-			arprequest(ifp, (rt->rt_ifa->ifa_addr)->sin_addr,
+			arprequest(ifp,
+			(_rt->rt_ifa->ifa_addr)->sin_addr,
 			(dst)->sin_addr, enaddr);
-			rtfree(rt);
-			rt = NULL;
+			rtfree(_rt);
 		}
 		return error;
 	}

Index: src/sys/netinet/if_inarp.h
diff -u src/sys/netinet/if_inarp.h:1.48 src/sys/netinet/if_inarp.h:1.49
--- src/sys/netinet/if_inarp.h:1.48	Thu Apr  7 03:22:15 2016
+++ src/sys/netinet/if_inarp.h	Tue Apr 19 04:13:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_inarp.h,v 1.48 2016/04/07 03:22:15 christos Exp $	*/
+/*	$NetBSD: if_inarp.h,v 1.49 2016/04/19 04:13:56 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -75,7 +75,7 @@ MALLOC_DECLARE(M_IPARP);
 extern struct ifqueue arpintrq;
 void arp_ifinit(struct ifnet *, struct ifaddr *);
 void arp_rtrequest(int, struct rtentry *, const struct rt_addrinfo *);
-int arpresolve(struct ifnet *, struct rtentry *, struct mbuf *,
+int arpresolve(struct ifnet *, const struct rtentry *, struct mbuf *,
 const struct sockaddr *, void *, size_t);
 void arpintr(void);
 void arprequest(struct ifnet *, const struct in_addr *, const struct in_addr *,



CVS commit: src/sys/external/bsd/drm2/drm

2016-04-18 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 19 02:52:29 UTC 2016

Modified Files:
src/sys/external/bsd/drm2/drm: drm_vma_manager.c

Log Message:
Make sure rbtrees are empty on desctruction.

If related to PR kern/51076, might help catch the bug a bit earlier.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/drm/drm_vma_manager.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/external/bsd/drm2/drm/drm_vma_manager.c
diff -u src/sys/external/bsd/drm2/drm/drm_vma_manager.c:1.3 src/sys/external/bsd/drm2/drm/drm_vma_manager.c:1.4
--- src/sys/external/bsd/drm2/drm/drm_vma_manager.c:1.3	Fri Jun 19 22:51:57 2015
+++ src/sys/external/bsd/drm2/drm/drm_vma_manager.c	Tue Apr 19 02:52:29 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_vma_manager.c,v 1.3 2015/06/19 22:51:57 chs Exp $	*/
+/*	$NetBSD: drm_vma_manager.c,v 1.4 2016/04/19 02:52:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_vma_manager.c,v 1.3 2015/06/19 22:51:57 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_vma_manager.c,v 1.4 2016/04/19 02:52:29 riastradh Exp $");
 
 #include 
 #include 
@@ -120,6 +120,8 @@ drm_vma_offset_manager_destroy(struct dr
 {
 
 	vmem_destroy(mgr->vom_vmem);
+	KASSERTMSG((RB_TREE_MIN(>vom_nodes) == NULL),
+	"drm vma offset manager %p not empty", mgr);
 #if 0
 	rb_tree_destroy(>vom_nodes);
 #endif
@@ -143,6 +145,8 @@ void
 drm_vma_node_destroy(struct drm_vma_offset_node *node)
 {
 
+	KASSERTMSG((RB_TREE_MIN(>von_files) == NULL),
+	"drm vma node %p not empty", node);
 #if 0
 	rb_tree_destroy(>von_files);
 #endif



CVS commit: src

2016-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 18 19:37:41 UTC 2016

Modified Files:
src: UPDATING

Log Message:
be more specific about what needs to be cleaned for libedit.


To generate a diff of this commit:
cvs rdiff -u -r1.270 -r1.271 src/UPDATING

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

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.270 src/UPDATING:1.271
--- src/UPDATING:1.270	Mon Apr 18 14:58:04 2016
+++ src/UPDATING	Mon Apr 18 15:37:41 2016
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.270 2016/04/18 18:58:04 christos Exp $
+$NetBSD: UPDATING,v 1.271 2016/04/18 19:37:41 christos Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -21,7 +21,8 @@ Recent changes:
 
 20160418:
 	libedit needs manual removal of all autogenerated files since
-	some of them are not autogenerated anymore.
+	some of them are not autogenerated anymore. Remember that there
+	might be two copies of libedit if your platform builds "compat".
 
 20160410:
 	amd64 needs full "make cleandir" or deletion of objdir now that



CVS commit: src

2016-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 18 18:58:04 UTC 2016

Modified Files:
src: UPDATING

Log Message:
mention libedit


To generate a diff of this commit:
cvs rdiff -u -r1.269 -r1.270 src/UPDATING

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

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.269 src/UPDATING:1.270
--- src/UPDATING:1.269	Sat Apr 16 15:47:45 2016
+++ src/UPDATING	Mon Apr 18 14:58:04 2016
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.269 2016/04/16 19:47:45 dholland Exp $
+$NetBSD: UPDATING,v 1.270 2016/04/18 18:58:04 christos Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -19,8 +19,11 @@ See also: BUILDING, build.sh, Makefile.
 Recent changes:
 ^^^
 
-20160410:
+20160418:
+	libedit needs manual removal of all autogenerated files since
+	some of them are not autogenerated anymore.
 
+20160410:
 	amd64 needs full "make cleandir" or deletion of objdir now that
 	PIE has been enabled for amd64.  PIE, or position-independent
 	executables, means all code, including executables and not just



CVS commit: src/lib/libedit

2016-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 18 17:01:19 UTC 2016

Modified Files:
src/lib/libedit: Makefile chared.c common.c el.h emacs.c keymacro.c
makelist map.c map.h read.c readline.c search.c terminal.c tty.c
vi.c
Added Files:
src/lib/libedit: editline.c historyn.c tokenizern.c

Log Message:
>From Ingo Schwarze:
 * Replace fcns.c by a shorter and simpler func.h
   and include it only in the one file needing it, map.c.
 * Combine help.h and help.c into a simplified help.h
   and include it only in the one file needing it, map.c.
 * Check the very simple, static files editline.c, historyn.c, and
   tokenizern.c into CVS rather than needlessly generating them.
 * So we no longer autogenerate any C files.  :-)
 * Shorten and simplify makelist by deleting the options -n, -e, -bc,
   and -m; the latter was unused and useless in the first place.
 * Move the declaration of el_func_t from fcns.h to the header
   actually needing it, map.h.  Since that header is already
   included by el.h for unrelated reasons, that makes el_func_t
   just as globally available as before.
 * No longer include the simplified fcns.h into el.h,
   include it directly into the *.c files needing it.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/lib/libedit/Makefile
cvs rdiff -u -r1.53 -r1.54 src/lib/libedit/chared.c
cvs rdiff -u -r1.44 -r1.45 src/lib/libedit/common.c src/lib/libedit/search.c
cvs rdiff -u -r0 -r1.1 src/lib/libedit/editline.c src/lib/libedit/historyn.c \
src/lib/libedit/tokenizern.c
cvs rdiff -u -r1.36 -r1.37 src/lib/libedit/el.h
cvs rdiff -u -r1.34 -r1.35 src/lib/libedit/emacs.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libedit/keymacro.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libedit/makelist
cvs rdiff -u -r1.49 -r1.50 src/lib/libedit/map.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libedit/map.h
cvs rdiff -u -r1.93 -r1.94 src/lib/libedit/read.c
cvs rdiff -u -r1.127 -r1.128 src/lib/libedit/readline.c
cvs rdiff -u -r1.29 -r1.30 src/lib/libedit/terminal.c
cvs rdiff -u -r1.63 -r1.64 src/lib/libedit/tty.c
cvs rdiff -u -r1.60 -r1.61 src/lib/libedit/vi.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/libedit/Makefile
diff -u src/lib/libedit/Makefile:1.57 src/lib/libedit/Makefile:1.58
--- src/lib/libedit/Makefile:1.57	Wed Mar 23 18:27:48 2016
+++ src/lib/libedit/Makefile	Mon Apr 18 13:01:19 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.57 2016/03/23 22:27:48 christos Exp $
+#	$NetBSD: Makefile,v 1.58 2016/04/18 17:01:19 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 
 USE_SHLIBDIR=	yes
@@ -14,7 +14,7 @@ COPTS+=	-Wunused-parameter
 CWARNFLAGS.gcc+=	-Wconversion
 CWARNFLAGS.clang+=	-Wno-cast-qual
 
-OSRCS=	chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \
+OSRCS=	chared.c common.c el.c eln.c emacs.c filecomplete.c \
 	hist.c keymacro.c map.c chartype.c \
 	parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c
 
@@ -31,22 +31,20 @@ MLINKS=	editline.3 el_init.3 editline.3 
 	editline.3 tok_line.3 editline.3 tok_str.3
 
 # For speed and debugging
-#SRCS=   ${OSRCS} readline.c tokenizer.c history.c
+#SRCS=   ${OSRCS}
 # For protection
-SRCS=	editline.c readline.c tokenizer.c history.c
+SRCS=	editline.c
 
-SRCS += tokenizern.c historyn.c
-CLEANFILES+=tokenizern.c.tmp tokenizern.c historyn.c.tmp historyn.c
+SRCS += history.c historyn.c tokenizer.c tokenizern.c readline.c
 
 LIBEDITDIR?=${.CURDIR}
 
 INCS= histedit.h
 INCSDIR=/usr/include
 
-CLEANFILES+=editline.c
-CLEANFILES+=common.h.tmp editline.c.tmp emacs.h.tmp fcns.c.tmp fcns.h.tmp
-CLEANFILES+=help.c.tmp help.h.tmp vi.h.tmp tc1.o tc1
-CLEANFILES+=tokenizern.c.tmp tokenizern.c tokenizerw.c.tmp tokenizerw.c
+CLEANFILES+=common.h.tmp emacs.h.tmp fcns.h.tmp func.h.tmp
+CLEANFILES+=help.h.tmp vi.h.tmp tc1.o tc1 .depend
+
 CPPFLAGS+=-I. -I${LIBEDITDIR}
 CPPFLAGS+=-I. -I${.CURDIR}
 #CPPFLAGS+=-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
@@ -55,11 +53,13 @@ CPPFLAGS+=-I. -I${.CURDIR}
 AHDR=vi.h emacs.h common.h
 ASRC=${LIBEDITDIR}/vi.c ${LIBEDITDIR}/emacs.c ${LIBEDITDIR}/common.c
 
-DPSRCS+=	${AHDR} fcns.h help.h fcns.c help.c
-CLEANFILES+=	${AHDR} fcns.h help.h fcns.c help.c
+DPSRCS+=	${AHDR} fcns.h func.h help.h
+CLEANFILES+=	${AHDR} fcns.h func.h help.h
 
 SUBDIR=	readline
 
+.depend: ${AHDR} fcns.h func.h help.h
+
 vi.h: vi.c makelist Makefile
 	${_MKTARGET_CREATE}
 	${HOST_SH} ${LIBEDITDIR}/makelist -h ${LIBEDITDIR}/vi.c \
@@ -83,36 +83,16 @@ fcns.h: ${AHDR} makelist Makefile
 	${HOST_SH} ${LIBEDITDIR}/makelist -fh ${AHDR} > ${.TARGET}.tmp && \
 	mv ${.TARGET}.tmp ${.TARGET}
 
-fcns.c: ${AHDR} fcns.h help.h makelist Makefile
+func.h: ${AHDR} makelist Makefile
 	${_MKTARGET_CREATE}
 	${HOST_SH} ${LIBEDITDIR}/makelist -fc ${AHDR} > ${.TARGET}.tmp && \
 	mv ${.TARGET}.tmp ${.TARGET}
 
-help.c: ${ASRC} makelist Makefile
-	${_MKTARGET_CREATE}
-