CVS commit: src/sys/dev/sbus

2017-12-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Dec  8 07:47:00 UTC 2017

Modified Files:
src/sys/dev/sbus: dbri.c dbrivar.h

Log Message:
fix audiomp bugs:
- switch from tsleep/wakeup to condvar
- fix locking in a bunch of places.  there were several locking
  against myself issues.

also:
- don't let dbri_process_interrupt_buffer() loop more than once
  over the array of intrs.

this fixes hangs when using audio on ss20 in -current, but does
not make audio work.  it eventually times out with eg:

dbri0: switching to control mode timed out (0 f6)

and may leave a sample in the audio buffer repeating.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/sbus/dbri.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/sbus/dbrivar.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/dev/sbus/dbri.c
diff -u src/sys/dev/sbus/dbri.c:1.35 src/sys/dev/sbus/dbri.c:1.36
--- src/sys/dev/sbus/dbri.c:1.35	Sat Oct 19 21:00:32 2013
+++ src/sys/dev/sbus/dbri.c	Fri Dec  8 07:47:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbri.c,v 1.35 2013/10/19 21:00:32 mrg Exp $	*/
+/*	$NetBSD: dbri.c,v 1.36 2017/12/08 07:47:00 mrg Exp $	*/
 
 /*
  * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de)
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.35 2013/10/19 21:00:32 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.36 2017/12/08 07:47:00 mrg Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -367,6 +367,10 @@ dbri_attach_sbus(device_t parent, device
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
 
+#ifndef DBRI_SPIN
+	cv_init(>sc_cv, "dbricv");
+#endif
+
 	bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_SCHED, dbri_intr,
 	sc);
 
@@ -444,8 +448,11 @@ dbri_config_interrupts(device_t dev)
 {
 	struct dbri_softc *sc = device_private(dev);
 
-	if (sc->sc_init_done != 0)
+	mutex_spin_enter(>sc_intr_lock);
+	if (sc->sc_init_done != 0) {
+		mutex_spin_exit(>sc_intr_lock);
 		return 0;
+	}
 
 	sc->sc_init_done = 1;
 
@@ -453,14 +460,19 @@ dbri_config_interrupts(device_t dev)
 	if (mmcodec_init(sc) == -1) {
 		printf("%s: no codec detected, aborting\n",
 		device_xname(dev));
+		mutex_spin_exit(>sc_intr_lock);
 		return 0;
 	}
+	mutex_spin_exit(>sc_intr_lock);
 
 	/* Attach ourselves to the high level audio interface */
 	audio_attach_mi(_hw_if, sc, sc->sc_dev);
 
 	/* power down until open() */
+	mutex_spin_enter(>sc_intr_lock);
 	dbri_set_power(sc, 0);
+	mutex_spin_exit(>sc_intr_lock);
+
 	return 0;
 }
 
@@ -532,6 +544,8 @@ dbri_init(struct dbri_softc *sc)
 	bus_addr_t dmaaddr;
 	int n;
 
+	KASSERT(mutex_owned(sc->sc_intr_lock));
+
 	dbri_reset(sc);
 
 	cmd = dbri_command_lock(sc);
@@ -562,6 +576,7 @@ dbri_init(struct dbri_softc *sc)
 	*(cmd++) = dmaaddr;
 
 	dbri_command_send(sc, cmd);
+
 	return (0);
 }
 
@@ -603,7 +618,7 @@ dbri_command_send(struct dbri_softc *sc,
 	bus_space_tag_t iot = sc->sc_iot;
 	int maxloops = 100;
 
-	mutex_spin_enter(>sc_intr_lock);
+	KASSERT(mutex_owned(sc->sc_intr_lock));
 
 	sc->sc_locked--;
 
@@ -641,8 +656,6 @@ dbri_command_send(struct dbri_softc *sc,
 		}
 	}
 
-	mutex_spin_exit(>sc_intr_lock);
-
 	return;
 }
 
@@ -650,6 +663,9 @@ static void
 dbri_process_interrupt_buffer(struct dbri_softc *sc)
 {
 	int32_t i;
+	int orig_irqp = sc->sc_irqp;
+
+	KASSERT(mutex_owned(sc->sc_intr_lock));
 
 	while ((i = sc->sc_dma->intr[sc->sc_irqp]) != 0) {
 		sc->sc_dma->intr[sc->sc_irqp] = 0;
@@ -661,6 +677,10 @@ dbri_process_interrupt_buffer(struct dbr
 			sc->sc_irqp++;
 
 		dbri_process_interrupt(sc, i);
+
+		/* don't loop more than once. */
+		if (orig_irqp == sc->sc_irqp)
+			break;
 	}
 
 	return;
@@ -688,6 +708,7 @@ dbri_process_interrupt(struct dbri_softc
 		int td;
 		struct dbri_desc *dd;
 
+		DPRINTF("%s:%d tx complete\n", __func__, channel);
 		td = sc->sc_pipe[channel].desc;
 		dd = >sc_desc[td];
 
@@ -696,7 +717,7 @@ dbri_process_interrupt(struct dbri_softc
 		break;
 	}
 	case DBRI_INTR_FXDT:		/* fixed data change */
-		DPRINTF("dbri_intr: Fixed data change (%d: %x)\n", channel,
+		DPRINTF("%s:%d: Fixed data change: %x\n", __func__, channel,
 		val);
 #if 0
 		printf("reg: %08x\n", sc->sc_mm.status);
@@ -706,8 +727,8 @@ dbri_process_interrupt(struct dbri_softc
 		if (sc->sc_pipe[channel].prec)
 			*(sc->sc_pipe[channel].prec) = val;
 #ifndef DBRI_SPIN
-		DPRINTF("%s: wakeup %p\n", device_xname(sc->sc_dev), sc);
-		wakeup(sc);
+		DPRINTF("%s: cv_broadcast %p\n", device_xname(sc->sc_dev), sc);
+		cv_broadcast(>sc_cv);
 #endif
 		break;
 	case DBRI_INTR_SBRI:
@@ -718,6 +739,7 @@ dbri_process_interrupt(struct dbri_softc
 		int td;
 		struct dbri_desc *dd;
 
+		DPRINTF("dbri_intr: buffer ready (%d)\n", channel);
 		td = sc->sc_pipe[channel].desc;
 		dd = >sc_desc[td];
 
@@ -973,6 +995,8 @@ mmcodec_setcontrol(struct dbri_softc *sc
 	int bail = 0;
 #if DBRI_SPIN
 	int i;

CVS commit: [netbsd-8] src/doc

2017-12-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec  8 06:19:01 UTC 2017

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
 Ticket #422-423, 425, 428-431.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.90 -r1.1.2.91 src/doc/CHANGES-8.0

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.90 src/doc/CHANGES-8.0:1.1.2.91
--- src/doc/CHANGES-8.0:1.1.2.90	Mon Dec  4 19:53:44 2017
+++ src/doc/CHANGES-8.0	Fri Dec  8 06:19:01 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.90 2017/12/04 19:53:44 snj Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.91 2017/12/08 06:19:01 msaitoh Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -8270,3 +8270,48 @@ include/endian.h1.1
 	Add endian.h header.  Simply includes sys/endian.h
 	[maya, ticket #416]
 
+sys/external/bsd/drm2/drm/drm_drv.c		1.20
+
+	drm_stat: Fix device minor calculation to make X work with multiple
+	graphics cards.
+	[jmcneill, ticket #422]
+
+etc/MAKEDEV.tmpl1.188
+
+	Make a few more drm nodes.
+	[jmcneill, ticket #423]
+
+external/historical/nawk/dist/lex.c		1.3
+
+	awk: Fix memory leak (PR#52516 reported by Guy Incognito).
+	[dholland, ticket #425]
+
+external/bsd/nvi/dist/cl/cl_main.c		1.9
+
+	Corrects an issue where vi crashes after a window is resized.
+	[jmcneill, ticket #428]
+
+sys/arch/sparc/include/cpu.h			1.99
+sys/arch/sparc/sparc/cpu.c			1.250
+sys/arch/sparc/sparc/intr.c			1.119
+
+	- Return early in xcall() if the function is sparc_noop() instead of
+	  triggering the IPI and then ignoring responses (or lack thereof).
+	- Write the .tag field last to avoid a race when polling for an
+	  incoming IPI.
+	- Add event counters for IPIs being caught with the mutex not held,
+	  and for messages that are already marked as completed.
+	[macallan, ticket #429]
+
+etc/root/dot.cshrc1.26
+etc/root/dot.profile1.29
+
+	Update example PKG_PATH entry to use the CDN frontend, use uname -p
+	instead of uname -m for processor subdirectory, and derive the OS
+	release from uname -r.
+	[jmcneill, ticket #430]
+
+sys/net/if_pppoe.c1.133
+
+	Remove wrong assertions. From s-yamaguchi@IIJ.
+	[ozaki-r, ticket #431]



CVS commit: [netbsd-8] src/sys/net

2017-12-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec  8 06:12:35 UTC 2017

Modified Files:
src/sys/net [netbsd-8]: if_pppoe.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #431):
sys/net/if_pppoe.c: revision 1.133
Remove wrong assertions
rw_lock_held() returns true when any context holds the lock. However, in
if_pppoe.c, the function was used wrongly as it returns true only if the lock is
held in the same context.
>From s-yamaguchi@IIJ


To generate a diff of this commit:
cvs rdiff -u -r1.125.6.2 -r1.125.6.3 src/sys/net/if_pppoe.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/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.125.6.2 src/sys/net/if_pppoe.c:1.125.6.3
--- src/sys/net/if_pppoe.c:1.125.6.2	Thu Nov  2 20:28:24 2017
+++ src/sys/net/if_pppoe.c	Fri Dec  8 06:12:35 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.125.6.2 2017/11/02 20:28:24 snj Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.125.6.3 2017/12/08 06:12:35 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.125.6.2 2017/11/02 20:28:24 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.125.6.3 2017/12/08 06:12:35 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -135,9 +135,7 @@ struct pppoetag {
 
 #define PPPOE_LOCK(_sc, _op)	rw_enter(&(_sc)->sc_lock, (_op))
 #define PPPOE_UNLOCK(_sc)	rw_exit(&(_sc)->sc_lock)
-#define PPPOE_LOCKED(_sc)	rw_lock_held(&(_sc)->sc_lock)
 #define PPPOE_WLOCKED(_sc)	rw_write_held(&(_sc)->sc_lock)
-#define PPPOE_RLOCKED(_sc)	rw_read_held(&(_sc)->sc_lock)
 
 #ifdef PPPOE_MPSAFE
 #define DECLARE_SPLNET_VARIABLE
@@ -1049,8 +1047,6 @@ pppoe_output(struct pppoe_softc *sc, str
 	struct ether_header *eh;
 	uint16_t etype;
 
-	KASSERT(PPPOE_LOCKED(sc));
-
 	if (sc->sc_eth_if == NULL) {
 		m_freem(m);
 		return EIO;
@@ -1253,8 +1249,6 @@ pppoe_send_padi(struct pppoe_softc *sc)
 	int len, l1 = 0, l2 = 0; /* XXX: gcc */
 	uint8_t *p;
 
-	KASSERT(PPPOE_LOCKED(sc));
-
 	if (sc->sc_state >PPPOE_STATE_PADI_SENT)
 		panic("pppoe_send_padi in state %d", sc->sc_state);
 
@@ -1529,8 +1523,6 @@ pppoe_send_padr(struct pppoe_softc *sc)
 	uint8_t *p;
 	size_t len, l1 = 0; /* XXX: gcc */
 
-	KASSERT(PPPOE_LOCKED(sc));
-
 	if (sc->sc_state != PPPOE_STATE_PADR_SENT)
 		return EIO;
 
@@ -1624,8 +1616,6 @@ pppoe_send_pado(struct pppoe_softc *sc)
 	uint8_t *p;
 	size_t len;
 
-	KASSERT(PPPOE_LOCKED(sc)); /* required by pppoe_output(). */
-
 	if (sc->sc_state != PPPOE_STATE_PADO_SENT)
 		return EIO;
 
@@ -1699,8 +1689,6 @@ pppoe_tls(struct sppp *sp)
 	struct pppoe_softc *sc = (void *)sp;
 	int wtime;
 
-	KASSERT(!PPPOE_LOCKED(sc));
-
 	PPPOE_LOCK(sc, RW_READER);
 
 	if (sc->sc_state != PPPOE_STATE_INITIAL) {
@@ -1730,8 +1718,6 @@ pppoe_tlf(struct sppp *sp)
 {
 	struct pppoe_softc *sc = (void *)sp;
 
-	KASSERT(!PPPOE_LOCKED(sc));
-
 	PPPOE_LOCK(sc, RW_WRITER);
 
 	if (sc->sc_state < PPPOE_STATE_SESSION) {



CVS commit: [netbsd-8] src/etc/root

2017-12-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec  8 06:10:46 UTC 2017

Modified Files:
src/etc/root [netbsd-8]: dot.cshrc dot.profile

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #430):
etc/root/dot.cshrc: revision 1.26
etc/root/dot.profile: revision 1.29
Update example PKG_PATH entry to use the CDN frontend, use uname -p instead
of uname -m for processor subdirectory, and derive the OS release from
uname -r.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.8.1 src/etc/root/dot.cshrc
cvs rdiff -u -r1.28 -r1.28.8.1 src/etc/root/dot.profile

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

Modified files:

Index: src/etc/root/dot.cshrc
diff -u src/etc/root/dot.cshrc:1.25 src/etc/root/dot.cshrc:1.25.8.1
--- src/etc/root/dot.cshrc:1.25	Sun Nov 30 23:43:30 2014
+++ src/etc/root/dot.cshrc	Fri Dec  8 06:10:46 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: dot.cshrc,v 1.25 2014/11/30 23:43:30 riz Exp $
+#	$NetBSD: dot.cshrc,v 1.25.8.1 2017/12/08 06:10:46 msaitoh Exp $
 
 alias	h	history
 alias	j	jobs -l
@@ -22,8 +22,7 @@ setenv BLOCKSIZE 1k
 
 # Uncomment the following line(s) to install binary packages
 # from ftp.NetBSD.org via pkg_add.  (See also pkg_install.conf)
-#setenv PKG_PATH "ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/`uname -m`/7.0/All"
-#setenv PKG_PATH "${PKG_PATH};ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/`uname -m`/6.0/All"
+#setenv PKG_PATH "http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/`uname -p`/`uname -r|cut -f '1 2' -d.|cut -f 1 -d_`/All"
 
 set history=1000
 set path=(/sbin /usr/sbin /bin /usr/bin /usr/pkg/sbin /usr/pkg/bin /usr/X11R7/bin /usr/X11R6/bin /usr/local/sbin /usr/local/bin)

Index: src/etc/root/dot.profile
diff -u src/etc/root/dot.profile:1.28 src/etc/root/dot.profile:1.28.8.1
--- src/etc/root/dot.profile:1.28	Tue Mar  8 09:51:15 2016
+++ src/etc/root/dot.profile	Fri Dec  8 06:10:46 2017
@@ -1,12 +1,11 @@
-#	$NetBSD: dot.profile,v 1.28 2016/03/08 09:51:15 mlelstv Exp $
+#	$NetBSD: dot.profile,v 1.28.8.1 2017/12/08 06:10:46 msaitoh Exp $
 
 export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin
 export PATH=${PATH}:/usr/X11R7/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin
 
 # Uncomment the following line(s) to install binary packages
-# from ftp.NetBSD.org via pkg_add.  (See also pkg_install.conf)
-#export PKG_PATH=ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/7.0/All
-#export PKG_PATH="${PKG_PATH};ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/6.0/All"
+# from cdn.NetBSD.org via pkg_add.  (See also pkg_install.conf)
+#export PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f '1 2' -d.|cut -f 1 -d_)/All"
 
 export BLOCKSIZE=1k
 



CVS commit: [netbsd-8] src/sys/arch/sparc

2017-12-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec  8 06:05:15 UTC 2017

Modified Files:
src/sys/arch/sparc/include [netbsd-8]: cpu.h
src/sys/arch/sparc/sparc [netbsd-8]: cpu.c intr.c

Log Message:
Pull up following revision(s) (requested by macallan in ticket #429):
sys/arch/sparc/sparc/cpu.c: revision 1.250
sys/arch/sparc/include/cpu.h: revision 1.99
sys/arch/sparc/sparc/intr.c: revision 1.119
- return early in xcall() if the function is sparc_noop() instead of triggering
  the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
  IPI
- add event counters for IPIs being caught with the mutex not held, and for
  messages that are already marked as completed
With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.
Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.97.8.1 src/sys/arch/sparc/include/cpu.h
cvs rdiff -u -r1.249 -r1.249.6.1 src/sys/arch/sparc/sparc/cpu.c
cvs rdiff -u -r1.118 -r1.118.22.1 src/sys/arch/sparc/sparc/intr.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/arch/sparc/include/cpu.h
diff -u src/sys/arch/sparc/include/cpu.h:1.97 src/sys/arch/sparc/include/cpu.h:1.97.8.1
--- src/sys/arch/sparc/include/cpu.h:1.97	Sat Dec 10 10:41:07 2016
+++ src/sys/arch/sparc/include/cpu.h	Fri Dec  8 06:05:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.97 2016/12/10 10:41:07 mrg Exp $ */
+/*	$NetBSD: cpu.h,v 1.97.8.1 2017/12/08 06:05:15 msaitoh Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -164,7 +164,7 @@ struct cpu_info {
 	 * the pending register to avoid a hardware bug.
 	 */
 #define raise_ipi(cpi,lvl)	do {			\
-	int x;		\
+	volatile int x;		\
 	(cpi)->intreg_4m->pi_set = PINTR_SINTRLEV(lvl);	\
 	x = (cpi)->intreg_4m->pi_pend; __USE(x);	\
 } while (0)
@@ -333,6 +333,8 @@ struct cpu_info {
 	struct evcnt ci_savefpstate_null;
 	struct evcnt ci_xpmsg_mutex_fail;
 	struct evcnt ci_xpmsg_mutex_fail_call;
+	struct evcnt ci_xpmsg_mutex_not_held;
+	struct evcnt ci_xpmsg_bogus;
 	struct evcnt ci_intrcnt[16];
 	struct evcnt ci_sintrcnt[16];
 };

Index: src/sys/arch/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.249 src/sys/arch/sparc/sparc/cpu.c:1.249.6.1
--- src/sys/arch/sparc/sparc/cpu.c:1.249	Wed Jan 18 21:33:25 2017
+++ src/sys/arch/sparc/sparc/cpu.c	Fri Dec  8 06:05:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.249 2017/01/18 21:33:25 macallan Exp $ */
+/*	$NetBSD: cpu.c,v 1.249.6.1 2017/12/08 06:05:15 msaitoh Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.249 2017/01/18 21:33:25 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.249.6.1 2017/12/08 06:05:15 msaitoh Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -183,7 +183,7 @@ int go_smp_cpus = 0;	/* non-primary CPUs
  * This must be locked around all message transactions to ensure only
  * one CPU is generating them.
  */
-static kmutex_t xpmsg_mutex;
+kmutex_t xpmsg_mutex;
 
 #endif /* MULTIPROCESSOR */
 
@@ -367,6 +367,10 @@ cpu_init_evcnt(struct cpu_info *cpi)
 			 NULL, cpu_name(cpi), "IPI mutex_trylock fail");
 	evcnt_attach_dynamic(>ci_xpmsg_mutex_fail_call, EVCNT_TYPE_MISC,
 			 NULL, cpu_name(cpi), "IPI mutex_trylock fail/call");
+	evcnt_attach_dynamic(>ci_xpmsg_mutex_not_held, EVCNT_TYPE_MISC,
+			 NULL, cpu_name(cpi), "IPI with mutex not held");
+	evcnt_attach_dynamic(>ci_xpmsg_bogus, EVCNT_TYPE_MISC,
+			 NULL, cpu_name(cpi), "bogus IPI");
 
 	/*
 	 * These are the per-cpu per-IPL hard & soft interrupt counters.
@@ -653,6 +657,8 @@ xcall(xcall_func_t func, xcall_trap_t tr
 	char *bufp = errbuf;
 	size_t bufsz = sizeof errbuf, wrsz;
 
+	if (is_noop) return;
+
 	mybit = (1 << cpuinfo.ci_cpuid);
 	callself = func && (cpuset & mybit) != 0;
 	cpuset &= ~mybit;
@@ -714,7 +720,10 @@ xcall(xcall_func_t func, xcall_trap_t tr
 		if ((cpuset & (1 << n)) == 0)
 			continue;
 
-		cpi->msg.tag = XPMSG_FUNC;
+		/*
+		 * Write msg.tag last - if another CPU is polling above it may
+		 * end up seeing an incomplete message. Not likely but still.
+		 */ 
 		cpi->msg.complete = 0;
 		p = >msg.u.xpmsg_func;
 		p->func = func;
@@ -722,6 +731,9 @@ xcall(xcall_func_t func, xcall_trap_t tr
 		p->arg0 = arg0;
 		p->arg1 = arg1;
 		p->arg2 = arg2;
+		__insn_barrier();
+		cpi->msg.tag = XPMSG_FUNC;
+		__insn_barrier();
 		/* Fast cross calls use interrupt level 14 */
 		raise_ipi(cpi,13+fasttrap);/*xcall_cookie->pil*/
 	}
@@ -737,7 +749,7 @@ xcall(xcall_func_t func, xcall_trap_t tr
 	 * have completed (bailing 

CVS commit: [netbsd-8] src/external/bsd/nvi/dist/cl

2017-12-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec  8 06:02:11 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl [netbsd-8]: cl_main.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #428):
external/bsd/nvi/dist/cl/cl_main.c: revision 1.9
When testing to see if a signal handler was previously installed in
h_winch, test sa_handler against all SIG_* actions defined in sys/signal.h
instead of just 0. Corrects an issue where vi crashes after a window is
resized.


To generate a diff of this commit:
cvs rdiff -u -r1.5.8.1 -r1.5.8.2 src/external/bsd/nvi/dist/cl/cl_main.c

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

Modified files:

Index: src/external/bsd/nvi/dist/cl/cl_main.c
diff -u src/external/bsd/nvi/dist/cl/cl_main.c:1.5.8.1 src/external/bsd/nvi/dist/cl/cl_main.c:1.5.8.2
--- src/external/bsd/nvi/dist/cl/cl_main.c:1.5.8.1	Sat Sep 23 17:04:40 2017
+++ src/external/bsd/nvi/dist/cl/cl_main.c	Fri Dec  8 06:02:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_main.c,v 1.5.8.1 2017/09/23 17:04:40 snj Exp $ */
+/*	$NetBSD: cl_main.c,v 1.5.8.2 2017/12/08 06:02:11 msaitoh Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_main.c,v 10.54 2001/07/29 19:07:27 skimo Exp  (Berkeley) Date: 2001/07/29 19:07:27 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_main.c,v 1.5.8.1 2017/09/23 17:04:40 snj Exp $");
+__RCSID("$NetBSD: cl_main.c,v 1.5.8.2 2017/12/08 06:02:11 msaitoh Exp $");
 #endif
 
 #include 
@@ -313,8 +313,12 @@ h_winch(int signo)
 	F_SET(clp, CL_SIGWINCH);
 
 	/* If there was a previous handler, call that. */
-	if (clp->oact[INDX_WINCH].sa_handler)
+	if (clp->oact[INDX_WINCH].sa_handler != SIG_DFL &&
+	clp->oact[INDX_WINCH].sa_handler != SIG_IGN &&
+	clp->oact[INDX_WINCH].sa_handler != SIG_ERR &&
+	clp->oact[INDX_WINCH].sa_handler != SIG_HOLD) {
 		clp->oact[INDX_WINCH].sa_handler(signo);
+	}
 }
 #undef	GLOBAL_CLP
 



CVS commit: [netbsd-8] src/external/historical/nawk/dist

2017-12-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec  8 05:56:05 UTC 2017

Modified Files:
src/external/historical/nawk/dist [netbsd-8]: lex.c

Log Message:
Pull up following revision(s) (requested by dholland in ticket #425):
external/historical/nawk/dist/lex.c: revision 1.3
PR/52516: Guy Incognito: Fix memory leak; setsymtab already calls tostring()
for the buffer, don't do it twice.
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.38.1 src/external/historical/nawk/dist/lex.c

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

Modified files:

Index: src/external/historical/nawk/dist/lex.c
diff -u src/external/historical/nawk/dist/lex.c:1.2 src/external/historical/nawk/dist/lex.c:1.2.38.1
--- src/external/historical/nawk/dist/lex.c:1.2	Thu Aug 26 14:55:19 2010
+++ src/external/historical/nawk/dist/lex.c	Fri Dec  8 05:56:04 2017
@@ -201,7 +201,7 @@ int yylex(void)
 		if (isalpha(c) || c == '_')
 			return word(buf);
 		if (isdigit(c)) {
-			yylval.cp = setsymtab(buf, tostring(buf), atof(buf), CON|NUM, symtab);
+			yylval.cp = setsymtab(buf, buf, atof(buf), CON|NUM, symtab);
 			/* should this also have STR set? */
 			RET(NUMBER);
 		}



CVS commit: [netbsd-8] src/etc

2017-12-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec  8 05:48:21 UTC 2017

Modified Files:
src/etc [netbsd-8]: MAKEDEV.tmpl

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #423):
etc/MAKEDEV.tmpl: revision 1.188
make a few more drm nodes


To generate a diff of this commit:
cvs rdiff -u -r1.183.6.1 -r1.183.6.2 src/etc/MAKEDEV.tmpl

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

Modified files:

Index: src/etc/MAKEDEV.tmpl
diff -u src/etc/MAKEDEV.tmpl:1.183.6.1 src/etc/MAKEDEV.tmpl:1.183.6.2
--- src/etc/MAKEDEV.tmpl:1.183.6.1	Thu Aug 31 11:27:50 2017
+++ src/etc/MAKEDEV.tmpl	Fri Dec  8 05:48:21 2017
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: MAKEDEV.tmpl,v 1.183.6.1 2017/08/31 11:27:50 martin Exp $
+#	$NetBSD: MAKEDEV.tmpl,v 1.183.6.2 2017/12/08 05:48:21 msaitoh Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -839,7 +839,7 @@ all)
 	makedev drvctl
 	makedev video
 	makedev dtv
-	makedev drm0
+	makedev drm0 drm1 drm2 drm3
 	makedev altmem
 	makedev zfs
 	makedev lua



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/drm

2017-12-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec  8 05:43:51 UTC 2017

Modified Files:
src/sys/external/bsd/drm2/drm [netbsd-8]: drm_drv.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #422):
sys/external/bsd/drm2/drm/drm_drv.c: revision 1.20
drm_stat: fix device minor calculation, ok riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.17.10.1 src/sys/external/bsd/drm2/drm/drm_drv.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_drv.c
diff -u src/sys/external/bsd/drm2/drm/drm_drv.c:1.17 src/sys/external/bsd/drm2/drm/drm_drv.c:1.17.10.1
--- src/sys/external/bsd/drm2/drm/drm_drv.c:1.17	Mon Nov  9 22:04:53 2015
+++ src/sys/external/bsd/drm2/drm/drm_drv.c	Fri Dec  8 05:43:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_drv.c,v 1.17 2015/11/09 22:04:53 jmcneill Exp $	*/
+/*	$NetBSD: drm_drv.c,v 1.17.10.1 2017/12/08 05:43:51 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.17 2015/11/09 22:04:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.17.10.1 2017/12/08 05:43:51 msaitoh Exp $");
 
 #include 
 #include 
@@ -581,7 +581,7 @@ drm_stat(struct file *fp, struct stat *s
 	struct drm_file *const file = fp->f_data;
 	struct drm_minor *const dminor = file->minor;
 	const dev_t devno = makedev(cdevsw_lookup_major(_cdevsw),
-	64*dminor->index + dminor->type);
+	64*dminor->type + dminor->index);
 
 	(void)memset(st, 0, sizeof(*st));
 



CVS commit: src/sys

2017-12-07 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec  8 05:22:23 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c
src/sys/net: if.c if.h

Log Message:
Revert "Make if_timer MP-safe if IFEF_MPSAFE"

Because it has decreased the performance of wm. And also I found that
wm_watchdog doesn't work well with if_watchdog framework at all. Sharing one
counter (if_timer) with multiple instances (hardware multi-queues) can't detect
a single (or some) stall of them because other instances reset the counter even
if the stalled one want the watchdog to fire.

Interfaces without IFEF_MPSAFE works safely with the original if_watchdog thanks
to KENREL_LOCK. OTOH, interfaces with IFEF_MPSAFE shouldn't use if_watchdog and
should implement their own watchdog timer that works with multiple instances.


To generate a diff of this commit:
cvs rdiff -u -r1.548 -r1.549 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.410 -r1.411 src/sys/net/if.c
cvs rdiff -u -r1.250 -r1.251 src/sys/net/if.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/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.548 src/sys/dev/pci/if_wm.c:1.549
--- src/sys/dev/pci/if_wm.c:1.548	Thu Dec  7 00:38:38 2017
+++ src/sys/dev/pci/if_wm.c	Fri Dec  8 05:22:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.548 2017/12/07 00:38:38 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.549 2017/12/08 05:22:23 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.548 2017/12/07 00:38:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.549 2017/12/08 05:22:23 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -5937,7 +5937,7 @@ wm_stop_locked(struct ifnet *ifp, int di
 
 	/* Mark the interface as down and cancel the watchdog timer. */
 	ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
-	if_watchdog_stop(ifp);
+	ifp->if_timer = 0;
 
 	if (disable) {
 		for (i = 0; i < sc->sc_nqueues; i++) {
@@ -7373,7 +7373,7 @@ wm_send_common_locked(struct ifnet *ifp,
 
 	if (txq->txq_free != ofree) {
 		/* Set a watchdog timer in case the chip flakes out. */
-		if_watchdog_reset(ifp, 5);
+		ifp->if_timer = 5;
 	}
 }
 
@@ -7945,7 +7945,7 @@ wm_nq_send_common_locked(struct ifnet *i
 
 	if (sent) {
 		/* Set a watchdog timer in case the chip flakes out. */
-		if_watchdog_reset(ifp, 5);
+		ifp->if_timer = 5;
 	}
 }
 
@@ -8082,7 +8082,7 @@ wm_txeof(struct wm_softc *sc, struct wm_
 	 * timer.
 	 */
 	if (txq->txq_sfree == WM_TXQUEUELEN(txq))
-		if_watchdog_stop(ifp);
+		ifp->if_timer = 0;
 
 	return processed;
 }

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.410 src/sys/net/if.c:1.411
--- src/sys/net/if.c:1.410	Fri Dec  8 04:03:51 2017
+++ src/sys/net/if.c	Fri Dec  8 05:22:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.410 2017/12/08 04:03:51 ozaki-r Exp $	*/
+/*	$NetBSD: if.c,v 1.411 2017/12/08 05:22:23 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.410 2017/12/08 04:03:51 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.411 2017/12/08 05:22:23 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -771,11 +771,9 @@ if_register(ifnet_t *ifp)
 	rt_ifannouncemsg(ifp, IFAN_ARRIVAL);
 
 	if (ifp->if_slowtimo != NULL) {
-		int flags = ISSET(ifp->if_extflags, IFEF_MPSAFE) ?
-		CALLOUT_MPSAFE : 0;
 		ifp->if_slowtimo_ch =
 		kmem_zalloc(sizeof(*ifp->if_slowtimo_ch), KM_SLEEP);
-		callout_init(ifp->if_slowtimo_ch, flags);
+		callout_init(ifp->if_slowtimo_ch, 0);
 		callout_setfunc(ifp->if_slowtimo_ch, if_slowtimo, ifp);
 		if_slowtimo(ifp);
 	}
@@ -2539,18 +2537,6 @@ if_up_locked(struct ifnet *ifp)
 }
 
 /*
- * XXX reusing (ifp)->if_snd->ifq_lock rather than having another spin mutex
- * for each ifnet.  It doesn't matter because:
- * - if IFEF_MPSAFE is enabled, if_snd isn't used and lock contention on
- *   ifq_lock don't happen
- * - if IFEF_MPSAFE is disabled, there is no lock contention on ifq_lock
- *   because if_snd and if_watchdog_reset is used with KERNEL_LOCK on packet
- *   transmissions and if_slowtimo is also called with KERNEL_LOCK
- */
-#define IF_WATCHDOG_LOCK(ifp)	mutex_enter((ifp)->if_snd.ifq_lock)
-#define IF_WATCHDOG_UNLOCK(ifp)	mutex_exit((ifp)->if_snd.ifq_lock)
-
-/*
  * Handle interface slowtimo timer routine.  Called
  * from softclock, we decrement timer (if set) and
  * call the appropriate interface routine on expiration.
@@ -2561,40 +2547,21 @@ if_slowtimo(void *arg)
 	void (*slowtimo)(struct ifnet *);
 	struct ifnet *ifp = arg;
 	int s;
-	bool fire;
 
 	slowtimo = ifp->if_slowtimo;
 	if (__predict_false(slowtimo == NULL))
 		return;
 
 	s = splnet();
-	IF_WATCHDOG_LOCK(ifp);
-	fire = (ifp->if_timer != 0 && --ifp->if_timer == 0);
-	IF_WATCHDOG_UNLOCK(ifp);
-	if (fire)
+	if 

CVS commit: src/distrib/sets/lists/debug

2017-12-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec  8 04:37:15 UTC 2017

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
 Add missing h_segv.debug.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/distrib/sets/lists/debug/mi

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.229 src/distrib/sets/lists/debug/mi:1.230
--- src/distrib/sets/lists/debug/mi:1.229	Sun Nov 19 21:05:26 2017
+++ src/distrib/sets/lists/debug/mi	Fri Dec  8 04:37:15 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.229 2017/11/19 21:05:26 martin Exp $
+# $NetBSD: mi,v 1.230 2017/12/08 04:37:15 msaitoh Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -1694,6 +1694,7 @@
 ./usr/libdata/debug/usr/tests/kernel/arch/i386/t_ptrace_waitpid.debug	tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/h_ps_strings1.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/h_ps_strings2.debug		tests-kernel-tests	debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/kernel/h_segv.debug			tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/kqueue/read/t_fifo.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/kqueue/read/t_file.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/kqueue/read/t_file2.debug		tests-kernel-tests	debug,atf,compattestfile



CVS commit: src/sys/net

2017-12-07 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec  8 04:03:51 UTC 2017

Modified Files:
src/sys/net: if.c if.h if_bridge.c if_vlan.c

Log Message:
Fix build of kernels without ether

By throwing out if_enable_vlan_mtu and if_disable_vlan_mtu that
created a unnecessary dependency from if.c to if_ethersubr.c.

PR kern/52790


To generate a diff of this commit:
cvs rdiff -u -r1.409 -r1.410 src/sys/net/if.c
cvs rdiff -u -r1.249 -r1.250 src/sys/net/if.h
cvs rdiff -u -r1.143 -r1.144 src/sys/net/if_bridge.c
cvs rdiff -u -r1.117 -r1.118 src/sys/net/if_vlan.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/net/if.c
diff -u src/sys/net/if.c:1.409 src/sys/net/if.c:1.410
--- src/sys/net/if.c:1.409	Thu Dec  7 10:05:42 2017
+++ src/sys/net/if.c	Fri Dec  8 04:03:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.409 2017/12/07 10:05:42 ozaki-r Exp $	*/
+/*	$NetBSD: if.c,v 1.410 2017/12/08 04:03:51 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.409 2017/12/07 10:05:42 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.410 2017/12/08 04:03:51 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3614,30 +3614,6 @@ if_mcast_op(ifnet_t *ifp, const unsigned
 	return rc;
 }
 
-int
-if_enable_vlan_mtu(struct ifnet *ifp)
-{
-	int error;
-
-	mutex_enter(ifp->if_ioctl_lock);
-	error= ether_enable_vlan_mtu(ifp);
-	mutex_exit(ifp->if_ioctl_lock);
-
-	return error;
-}
-
-int
-if_disable_vlan_mtu(struct ifnet *ifp)
-{
-	int error;
-
-	mutex_enter(ifp->if_ioctl_lock);
-	error= ether_disable_vlan_mtu(ifp);
-	mutex_exit(ifp->if_ioctl_lock);
-
-	return error;
-}
-
 static void
 sysctl_sndq_setup(struct sysctllog **clog, const char *ifname,
 struct ifaltq *ifq)

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.249 src/sys/net/if.h:1.250
--- src/sys/net/if.h:1.249	Wed Dec  6 09:03:12 2017
+++ src/sys/net/if.h	Fri Dec  8 04:03:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.249 2017/12/06 09:03:12 ozaki-r Exp $	*/
+/*	$NetBSD: if.h,v 1.250 2017/12/08 04:03:51 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -1022,8 +1022,6 @@ int	if_do_dad(struct ifnet *);
 int	if_mcast_op(ifnet_t *, const unsigned long, const struct sockaddr *);
 int	if_flags_set(struct ifnet *, const short);
 int	if_clone_list(int, char *, int *);
-int	if_enable_vlan_mtu(struct ifnet *);
-int	if_disable_vlan_mtu(struct ifnet *);
 
 struct	ifnet *ifunit(const char *);
 struct	ifnet *if_get(const char *, struct psref *);

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.143 src/sys/net/if_bridge.c:1.144
--- src/sys/net/if_bridge.c:1.143	Wed Dec  6 07:40:16 2017
+++ src/sys/net/if_bridge.c	Fri Dec  8 04:03:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.143 2017/12/06 07:40:16 ozaki-r Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.144 2017/12/08 04:03:51 ozaki-r Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.143 2017/12/06 07:40:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.144 2017/12/08 04:03:51 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -772,7 +772,9 @@ bridge_ioctl_add(struct bridge_softc *sc
 		}
 		/* FALLTHROUGH */
 	case IFT_L2TP:
-		error = if_enable_vlan_mtu(ifs);
+		mutex_enter(ifs->if_ioctl_lock);
+		error = ether_enable_vlan_mtu(ifs);
+		mutex_exit(ifs->if_ioctl_lock);
 		if (error > 0)
 			goto out;
 		/*
@@ -854,7 +856,9 @@ bridge_ioctl_del(struct bridge_softc *sc
 		 * Don't call it with holding a spin lock.
 		 */
 		(void) ifpromisc(ifs, 0);
-		(void) if_disable_vlan_mtu(ifs);
+		mutex_enter(ifs->if_ioctl_lock);
+		(void) ether_disable_vlan_mtu(ifs);
+		mutex_exit(ifs->if_ioctl_lock);
 		break;
 	default:
 #ifdef DIAGNOSTIC

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.117 src/sys/net/if_vlan.c:1.118
--- src/sys/net/if_vlan.c:1.117	Wed Dec  6 08:12:54 2017
+++ src/sys/net/if_vlan.c	Fri Dec  8 04:03:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.117 2017/12/06 08:12:54 ozaki-r Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.118 2017/12/08 04:03:51 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.117 2017/12/06 08:12:54 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.118 2017/12/08 04:03:51 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -463,7 +463,9 @@ vlan_config(struct ifvlan *ifv, struct i
 		nmib->ifvm_mintu = ETHERMIN;
 
 		if (ec->ec_nvlans++ == 0) {
-			error = if_enable_vlan_mtu(p);
+			mutex_enter(p->if_ioctl_lock);
+			error = ether_enable_vlan_mtu(p);
+			mutex_exit(p->if_ioctl_lock);
 			if (error >= 0) {
 if (error) {
 	ec->ec_nvlans--;
@@ -610,8 

CVS commit: src/usr.bin/make

2017-12-07 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Fri Dec  8 03:36:42 UTC 2017

Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: varcmd.exp varcmd.mk

Log Message:
Ensure VAR+=val on command line is handled correctly

If VAR is not previously set, call Var_Set to deal with
the special case of VAR_CMD.

If VAR is previously set, and ctxt is VAR_CMD we should do the update
even if VAR_FROM_CMD is set.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/usr.bin/make/var.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varcmd.exp \
src/usr.bin/make/unit-tests/varcmd.mk

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

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.216 src/usr.bin/make/var.c:1.217
--- src/usr.bin/make/var.c:1.216	Sat Nov 18 22:34:04 2017
+++ src/usr.bin/make/var.c	Fri Dec  8 03:36:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.216 2017/11/18 22:34:04 sjg Exp $	*/
+/*	$NetBSD: var.c,v 1.217 2017/12/08 03:36:42 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.216 2017/11/18 22:34:04 sjg Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.217 2017/12/08 03:36:42 sjg Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.216 2017/11/18 22:34:04 sjg Exp $");
+__RCSID("$NetBSD: var.c,v 1.217 2017/12/08 03:36:42 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1064,8 +1064,8 @@ Var_Append(const char *name, const char 
 v = VarFind(name, ctxt, (ctxt == VAR_GLOBAL) ? (FIND_CMD|FIND_ENV) : 0);
 
 if (v == NULL) {
-	VarAdd(name, val, ctxt);
-} else if (!(v->flags & VAR_FROM_CMD)) {
+	Var_Set(name, val, ctxt, 0);
+} else if (ctxt == VAR_CMD || !(v->flags & VAR_FROM_CMD)) {
 	Buf_AddByte(>val, ' ');
 	Buf_AddBytes(>val, strlen(val), val);
 

Index: src/usr.bin/make/unit-tests/varcmd.exp
diff -u src/usr.bin/make/unit-tests/varcmd.exp:1.2 src/usr.bin/make/unit-tests/varcmd.exp:1.3
--- src/usr.bin/make/unit-tests/varcmd.exp:1.2	Sat Nov 18 22:34:04 2017
+++ src/usr.bin/make/unit-tests/varcmd.exp	Fri Dec  8 03:36:42 2017
@@ -1,6 +1,7 @@
 default FU=fu FOO=foo VAR=
 two FU=bar FOO=goo VAR=
 immutable FU='bar'
+immutable FOO='goo'
 three FU=bar FOO=goo VAR=
 four FU=bar FOO=goo VAR=Internal
 five FU=bar FOO=goo VAR=Internal
Index: src/usr.bin/make/unit-tests/varcmd.mk
diff -u src/usr.bin/make/unit-tests/varcmd.mk:1.2 src/usr.bin/make/unit-tests/varcmd.mk:1.3
--- src/usr.bin/make/unit-tests/varcmd.mk:1.2	Sat Nov 18 22:34:04 2017
+++ src/usr.bin/make/unit-tests/varcmd.mk	Fri Dec  8 03:36:42 2017
@@ -1,4 +1,4 @@
-# $Id: varcmd.mk,v 1.2 2017/11/18 22:34:04 sjg Exp $
+# $Id: varcmd.mk,v 1.3 2017/12/08 03:36:42 sjg Exp $
 #
 # Test behaviour of recursive make and vars set on command line.
 
@@ -15,7 +15,7 @@ show:
 	@echo "${TAG} FU=${FU} FOO=${FOO} VAR=${VAR}"
 
 one:	show
-	@${.MAKE} -f ${MAKEFILE} FU=bar FOO=goo two
+	@${.MAKE} -f ${MAKEFILE} FU=bar FOO+=goo two
 
 two:	show
 	@${.MAKE} -f ${MAKEFILE} three
@@ -27,10 +27,13 @@ three:	show
 .ifmake two
 # this should not work
 FU+= oops
+FOO+= oops
 _FU:= ${FU}
+_FOO:= ${FOO}
 two: immutable
 immutable:
 	@echo "$@ FU='${_FU}'"
+	@echo "$@ FOO='${_FOO}'"
 .endif
 .ifmake four
 VAR=Internal



CVS commit: src/lib/libpthread

2017-12-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec  8 03:08:19 UTC 2017

Modified Files:
src/lib/libpthread: pthread_cond.c

Log Message:
unconst the timestamp


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/lib/libpthread/pthread_cond.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/libpthread/pthread_cond.c
diff -u src/lib/libpthread/pthread_cond.c:1.64 src/lib/libpthread/pthread_cond.c:1.65
--- src/lib/libpthread/pthread_cond.c:1.64	Sun Jul  3 10:24:58 2016
+++ src/lib/libpthread/pthread_cond.c	Thu Dec  7 22:08:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cond.c,v 1.64 2016/07/03 14:24:58 christos Exp $	*/
+/*	$NetBSD: pthread_cond.c,v 1.65 2017/12/08 03:08:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_cond.c,v 1.64 2016/07/03 14:24:58 christos Exp $");
+__RCSID("$NetBSD: pthread_cond.c,v 1.65 2017/12/08 03:08:19 christos Exp $");
 
 #include 
 #include 
@@ -166,8 +166,9 @@ pthread_cond_timedwait(pthread_cond_t *c
 		self->pt_willpark = 0;
 		self->pt_blocking++;
 		do {
-			retval = _lwp_park(clkid, TIMER_ABSTIME, abstime,
-			self->pt_unpark, __UNVOLATILE(>ptm_waiters),
+			retval = _lwp_park(clkid, TIMER_ABSTIME,
+			__UNCONST(abstime), self->pt_unpark,
+			__UNVOLATILE(>ptm_waiters),
 			__UNVOLATILE(>ptm_waiters));
 			self->pt_unpark = 0;
 		} while (retval == -1 && errno == ESRCH);



CVS commit: src/sys

2017-12-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec  8 01:20:53 UTC 2017

Modified Files:
src/sys/kern: syscalls.c syscalls_autoload.c
src/sys/rump/include/rump: rump_syscalls.h
src/sys/rump/librump/rumpkern: rump_syscalls.c
src/sys/sys: syscall.h syscallargs.h

Log Message:
regen
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.305 -r1.306 src/sys/kern/syscalls.c
cvs rdiff -u -r1.24 -r1.25 src/sys/kern/syscalls_autoload.c
cvs rdiff -u -r1.105 -r1.106 src/sys/rump/include/rump/rump_syscalls.h
cvs rdiff -u -r1.132 -r1.133 src/sys/rump/librump/rumpkern/rump_syscalls.c
cvs rdiff -u -r1.299 -r1.300 src/sys/sys/syscall.h
cvs rdiff -u -r1.283 -r1.284 src/sys/sys/syscallargs.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/kern/syscalls.c
diff -u src/sys/kern/syscalls.c:1.305 src/sys/kern/syscalls.c:1.306
--- src/sys/kern/syscalls.c:1.305	Wed May 10 02:19:47 2017
+++ src/sys/kern/syscalls.c	Thu Dec  7 20:20:52 2017
@@ -1,14 +1,14 @@
-/* $NetBSD: syscalls.c,v 1.305 2017/05/10 06:19:47 riastradh Exp $ */
+/* $NetBSD: syscalls.c,v 1.306 2017/12/08 01:20:52 christos Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.286 2016/11/02 00:11:59 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.287 2017/12/08 01:19:29 christos Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.305 2017/05/10 06:19:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.306 2017/12/08 01:20:52 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_modular.h"

Index: src/sys/kern/syscalls_autoload.c
diff -u src/sys/kern/syscalls_autoload.c:1.24 src/sys/kern/syscalls_autoload.c:1.25
--- src/sys/kern/syscalls_autoload.c:1.24	Wed May 10 02:19:47 2017
+++ src/sys/kern/syscalls_autoload.c	Thu Dec  7 20:20:53 2017
@@ -1,14 +1,14 @@
-/* $NetBSD: syscalls_autoload.c,v 1.24 2017/05/10 06:19:47 riastradh Exp $ */
+/* $NetBSD: syscalls_autoload.c,v 1.25 2017/12/08 01:20:53 christos Exp $ */
 
 /*
  * System call autoload table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.286 2016/11/02 00:11:59 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.287 2017/12/08 01:19:29 christos Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.24 2017/05/10 06:19:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.25 2017/12/08 01:20:53 christos Exp $");
 
 #include 
 static struct sc_autoload netbsd_syscalls_autoload[] = {

Index: src/sys/rump/include/rump/rump_syscalls.h
diff -u src/sys/rump/include/rump/rump_syscalls.h:1.105 src/sys/rump/include/rump/rump_syscalls.h:1.106
--- src/sys/rump/include/rump/rump_syscalls.h:1.105	Wed May 10 02:19:47 2017
+++ src/sys/rump/include/rump/rump_syscalls.h	Thu Dec  7 20:20:53 2017
@@ -1,10 +1,10 @@
-/* $NetBSD: rump_syscalls.h,v 1.105 2017/05/10 06:19:47 riastradh Exp $ */
+/* $NetBSD: rump_syscalls.h,v 1.106 2017/12/08 01:20:53 christos Exp $ */
 
 /*
  * System call protos in rump namespace.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.286 2016/11/02 00:11:59 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.287 2017/12/08 01:19:29 christos Exp
  */
 
 #ifndef _RUMP_RUMP_SYSCALLS_H_

Index: src/sys/rump/librump/rumpkern/rump_syscalls.c
diff -u src/sys/rump/librump/rumpkern/rump_syscalls.c:1.132 src/sys/rump/librump/rumpkern/rump_syscalls.c:1.133
--- src/sys/rump/librump/rumpkern/rump_syscalls.c:1.132	Wed May 10 02:19:47 2017
+++ src/sys/rump/librump/rumpkern/rump_syscalls.c	Thu Dec  7 20:20:53 2017
@@ -1,10 +1,10 @@
-/* $NetBSD: rump_syscalls.c,v 1.132 2017/05/10 06:19:47 riastradh Exp $ */
+/* $NetBSD: rump_syscalls.c,v 1.133 2017/12/08 01:20:53 christos Exp $ */
 
 /*
  * System call vector and marshalling for rump.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.286 2016/11/02 00:11:59 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.287 2017/12/08 01:19:29 christos Exp
  */
 
 #ifdef RUMP_CLIENT
@@ -15,7 +15,7 @@
 
 #ifdef __NetBSD__
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.132 2017/05/10 06:19:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.133 2017/12/08 01:20:53 christos Exp $");
 
 #include 
 #include 

Index: src/sys/sys/syscall.h
diff -u src/sys/sys/syscall.h:1.299 src/sys/sys/syscall.h:1.300
--- src/sys/sys/syscall.h:1.299	Wed May 10 02:19:47 2017
+++ src/sys/sys/syscall.h	Thu Dec  7 20:20:53 2017
@@ -1,10 +1,10 @@
-/* $NetBSD: syscall.h,v 1.299 2017/05/10 06:19:47 riastradh Exp $ */
+/* $NetBSD: syscall.h,v 1.300 2017/12/08 01:20:53 christos Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically 

CVS commit: src

2017-12-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec  8 01:19:30 UTC 2017

Modified Files:
src/distrib/sets/lists/tests: mi
src/include: lwp.h
src/lib/libc/sys: _lwp_park.2
src/sys/kern: subr_time.c sys_lwp.c syscalls.master
src/sys/sys: timevar.h
src/tests/kernel: Makefile
Added Files:
src/tests/kernel: t_timeleft.c

Log Message:
make _lwp_park return the remaining time to sleep in the "ts" argument
if it is a relative timestamp, as discussed in tech-kern.
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.769 -r1.770 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.12 -r1.13 src/include/lwp.h
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/sys/_lwp_park.2
cvs rdiff -u -r1.19 -r1.20 src/sys/kern/subr_time.c
cvs rdiff -u -r1.61 -r1.62 src/sys/kern/sys_lwp.c
cvs rdiff -u -r1.286 -r1.287 src/sys/kern/syscalls.master
cvs rdiff -u -r1.36 -r1.37 src/sys/sys/timevar.h
cvs rdiff -u -r1.48 -r1.49 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/t_timeleft.c

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.769 src/distrib/sets/lists/tests/mi:1.770
--- src/distrib/sets/lists/tests/mi:1.769	Thu Dec  7 14:48:12 2017
+++ src/distrib/sets/lists/tests/mi	Thu Dec  7 20:19:29 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.769 2017/12/07 19:48:12 christos Exp $
+# $NetBSD: mi,v 1.770 2017/12/08 01:19:29 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2179,6 +2179,7 @@
 ./usr/tests/kernel/t_ptrace_waitpid		tests-obsolete		obsolete
 ./usr/tests/kernel/t_pty			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_rnd			tests-kernel-tests	atf,rump
+./usr/tests/kernel/t_timeleft			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_trapsignal			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_sigaction			tests-obsolete		obsolete
 ./usr/tests/kernel/t_subr_prf			tests-kernel-tests	compattestfile,atf

Index: src/include/lwp.h
diff -u src/include/lwp.h:1.12 src/include/lwp.h:1.13
--- src/include/lwp.h:1.12	Fri Jan 31 15:44:17 2014
+++ src/include/lwp.h	Thu Dec  7 20:19:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.12 2014/01/31 20:44:17 christos Exp $	*/
+/*	$NetBSD: lwp.h,v 1.13 2017/12/08 01:19:29 christos Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@ void	_lwp_setprivate(void *);
 int	_lwp_kill(lwpid_t, int);
 int	_lwp_detach(lwpid_t);
 #ifndef __LIBC12_SOURCE__
-int	_lwp_park(clockid_t, int, const struct timespec *, lwpid_t,
+int	_lwp_park(clockid_t, int, struct timespec *, lwpid_t,
 const void *, const void *) __RENAME(___lwp_park60);
 #endif
 int	_lwp_unpark(lwpid_t, const void *);

Index: src/lib/libc/sys/_lwp_park.2
diff -u src/lib/libc/sys/_lwp_park.2:1.9 src/lib/libc/sys/_lwp_park.2:1.10
--- src/lib/libc/sys/_lwp_park.2:1.9	Fri Jan 31 16:11:05 2014
+++ src/lib/libc/sys/_lwp_park.2	Thu Dec  7 20:19:29 2017
@@ -1,6 +1,6 @@
-.\"	$NetBSD: _lwp_park.2,v 1.9 2014/01/31 21:11:05 wiz Exp $
+.\"	$NetBSD: _lwp_park.2,v 1.10 2017/12/08 01:19:29 christos Exp $
 .\"
-.\" Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2003, 2007, 2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 28, 2013
+.Dd December 7, 2017
 .Dt _LWP_PARK 2
 .Os
 .Sh NAME
@@ -38,7 +38,7 @@
 .Sh SYNOPSIS
 .In lwp.h
 .Ft int
-.Fn _lwp_park "clockid_t clock_id" "int flags" "const struct timespec *ts" "lwpid_t unpark" "const void *hint" "const void *unparkhint"
+.Fn _lwp_park "clockid_t clock_id" "int flags" "struct timespec *ts" "lwpid_t unpark" "const void *hint" "const void *unparkhint"
 .Sh DESCRIPTION
 .Fn _lwp_park
 can be used to synchronize access to resources among multiple light-weight
@@ -58,14 +58,13 @@ time can be an relative interval to wait
 .Ar flags
 argument does not contain
 .Dv TIMER_ABSTIME
-or it can be an absolute time compared to
+or it can be an absolute time.
+The
+.Fa clock_id 
+argument contains the clock to be used; it can be:
 .Dv CLOCK_REALTIME
 or
-.Dv CLOCK_MONOTONIC
-depending on the value
-of the
-.Ar clock_id
-argument.
+.Dv CLOCK_MONOTONIC .
 .It
 The LWP receives a directed signal posted using
 .Fn _lwp_kill ,
@@ -82,6 +81,13 @@ or
 .Fn _lwp_unpark_all .
 .El
 .Pp
+If the
+.Fa ts
+argument contains a relative time interval, it will be modified to contain
+the remaining time to sleep when
+.Fn _lwp_park
+returns.
+.Pp
 The preferred method to awaken an LWP sleeping as a result of a call
 to
 .Fn _lwp_park

Index: src/sys/kern/subr_time.c
diff -u src/sys/kern/subr_time.c:1.19 src/sys/kern/subr_time.c:1.20
--- 

CVS commit: src/sys/arch/amd64/amd64

2017-12-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec  7 23:13:17 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: trap.c

Log Message:
Put back the old syscall glue for netbsd32 binaries, and also TRAP_SIGDEBUG
while I am at it.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/amd64/amd64/trap.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/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.106 src/sys/arch/amd64/amd64/trap.c:1.107
--- src/sys/arch/amd64/amd64/trap.c:1.106	Wed Dec  6 22:25:51 2017
+++ src/sys/arch/amd64/amd64/trap.c	Thu Dec  7 18:13:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.106 2017/12/07 03:25:51 riastradh Exp $	*/
+/*	$NetBSD: trap.c,v 1.107 2017/12/07 23:13:17 christos Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.106 2017/12/07 03:25:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.107 2017/12/07 23:13:17 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -86,6 +86,11 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1
 
 #include 
 
+#ifdef COMPAT_NETBSD32
+#include 
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -146,6 +151,10 @@ int	trap_types = __arraycount(trap_type)
 
 #define	IDTVEC(name)	__CONCAT(X, name)
 
+#ifdef TRAP_SIGDEBUG
+static void frame_dump(struct trapframe *, struct pcb *);
+#endif
+
 static void
 onfault_restore(struct trapframe *frame, void *onfault, int error)
 {
@@ -407,11 +416,37 @@ trap(struct trapframe *frame)
 		trap_user_kernelmode(frame, type, l, p);
 		goto we_re_toast;
 
-	case T_PROTFLT|T_USER:
+	case T_PROTFLT|T_USER:		/* protection fault */
+#if defined(COMPAT_NETBSD32) && defined(COMPAT_10)
+	{
+		static const char lcall[7] = { 0x9a, 0, 0, 0, 0, 7, 0 };
+		const size_t sz = sizeof(lcall);
+		char tmp[sz];
+
+		/* Check for the oosyscall lcall instruction. */
+		if (p->p_emul == _netbsd32 &&
+		frame->tf_rip < VM_MAXUSER_ADDRESS32 - sz &&
+		copyin((void *)frame->tf_rip, tmp, sz) == 0 &&
+		memcmp(tmp, lcall, sz) == 0) {
+
+			/* Advance past the lcall. */
+			frame->tf_rip += sz;
+
+			/* Do the syscall. */
+			p->p_md.md_syscall(frame);
+			goto out;
+		}
+	}
+#endif
 	case T_TSSFLT|T_USER:
 	case T_SEGNPFLT|T_USER:
 	case T_STKFLT|T_USER:
 	case T_ALIGNFLT|T_USER:
+#ifdef TRAP_SIGDEBUG
+		printf("pid %d.%d (%s): BUS/SEGV (%#x) at rip %#lx addr %#lx\n",
+		p->p_pid, l->l_lid, p->p_comm, type, frame->tf_rip, rcr2());
+		frame_dump(frame, pcb);
+#endif
 		KSI_INIT_TRAP();
 		ksi.ksi_trap = type & ~T_USER;
 		ksi.ksi_addr = (void *)rcr2();
@@ -439,8 +474,13 @@ trap(struct trapframe *frame)
 		}
 		goto trapsignal;
 
-	case T_PRIVINFLT|T_USER:
-	case T_FPOPFLT|T_USER:
+	case T_PRIVINFLT|T_USER:	/* privileged instruction fault */
+	case T_FPOPFLT|T_USER:		/* coprocessor operand fault */
+#ifdef TRAP_SIGDEBUG
+		printf("pid %d.%d (%s): ILL at rip %#lx addr %#lx\n",
+		p->p_pid, l->l_lid, p->p_comm, frame->tf_rip, rcr2());
+		frame_dump(frame, pcb);
+#endif
 		KSI_INIT_TRAP();
 		ksi.ksi_signo = SIGILL;
 		ksi.ksi_trap = type & ~T_USER;
@@ -681,7 +721,14 @@ faultcommon:
 			break;
 		}
 
-		(*p->p_emul->e_trapsignal)(l, );
+#ifdef TRAP_SIGDEBUG
+		printf("pid %d.%d (%s): signal %d at rip %#lx addr %#lx "
+		"error %d trap %d cr2 %p\n", p->p_pid, l->l_lid, p->p_comm,
+		ksi.ksi_signo, frame->tf_rip, va, error, ksi.ksi_trap,
+		ksi.ksi_addr);
+		frame_dump(frame, pcb);
+#endif
+ 		(*p->p_emul->e_trapsignal)(l, );
 		break;
 	}
 
@@ -707,8 +754,8 @@ faultcommon:
 		}
 		goto we_re_toast;
 
-	case T_BPTFLT|T_USER:
-	case T_TRCTRAP|T_USER:
+	case T_BPTFLT|T_USER:		/* bpt instruction fault */
+	case T_TRCTRAP|T_USER:		/* trace trap */
 		/*
 		 * Don't go single-stepping into a RAS.
 		 */
@@ -756,3 +803,37 @@ startlwp(void *arg)
 	userret(l);
 }
 
+#ifdef TRAP_SIGDEBUG
+void
+frame_dump(struct trapframe *tf, struct pcb *pcb)
+{
+	int i;
+	unsigned long *p;
+
+	printf("trapframe %p\n", tf);
+	printf("rip 0x%016lx  rsp 0x%016lx  rfl 0x%016lx\n",
+	tf->tf_rip, tf->tf_rsp, tf->tf_rflags);
+	printf("rdi 0x%016lx  rsi 0x%016lx  rdx 0x%016lx\n",
+	tf->tf_rdi, tf->tf_rsi, tf->tf_rdx);
+	printf("rcx 0x%016lx  r8  0x%016lx  r9  0x%016lx\n",
+	tf->tf_rcx, tf->tf_r8, tf->tf_r9);
+	printf("r10 0x%016lx  r11 0x%016lx  r12 0x%016lx\n",
+	tf->tf_r10, tf->tf_r11, tf->tf_r12);
+	printf("r13 0x%016lx  r14 0x%016lx  r15 0x%016lx\n",
+	tf->tf_r13, tf->tf_r14, tf->tf_r15);
+	printf("rbp 0x%016lx  rbx 0x%016lx  rax 0x%016lx\n",
+	tf->tf_rbp, tf->tf_rbx, tf->tf_rax);
+	printf("cs 0x%04lx  ds 0x%04lx  es 0x%04lx  "
+	   "fs 0x%04lx  gs 0x%04lx  ss 0x%04lx\n",
+		tf->tf_cs & 0x, tf->tf_ds & 0x, tf->tf_es & 0x,
+		tf->tf_fs & 0x, tf->tf_gs & 0x, tf->tf_ss & 0x);
+	printf("fsbase 0x%016lx 

CVS commit: src/sys/arch/amd64

2017-12-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec  7 23:11:50 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: netbsd32_machdep.c
src/sys/arch/amd64/conf: files.amd64
Added Files:
src/sys/arch/amd64/amd64: compat_13_machdep.c

Log Message:
Save maxv@ some work and put back the compat_13_sigreturn changes that allow
amd64 to run ancient i386 binaries.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.3 src/sys/arch/amd64/amd64/compat_13_machdep.c
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/amd64/conf/files.amd64

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

Modified files:

Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.114 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.115
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.114	Thu Dec  7 11:22:22 2017
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Thu Dec  7 18:11:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.114 2017/12/07 16:22:22 christos Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.115 2017/12/07 23:11:50 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.114 2017/12/07 16:22:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.115 2017/12/07 23:11:50 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1114,3 +1114,67 @@ netbsd32_vm_default_addr(struct proc *p,
 	else
 		return VM_DEFAULT_ADDRESS32_BOTTOMUP(base, sz);
 }
+
+#ifdef COMPAT_13
+int
+compat_13_netbsd32_sigreturn(struct lwp *l, const struct compat_13_netbsd32_sigreturn_args *uap, register_t *retval)
+{
+	/* {
+		syscallarg(struct netbsd32_sigcontext13 *) sigcntxp;
+	} */
+	struct proc *p = l->l_proc;
+	struct netbsd32_sigcontext13 *scp, context;
+	struct trapframe *tf;
+	sigset_t mask;
+	int error;
+
+	/*
+	 * The trampoline code hands us the context.
+	 * It is unsafe to keep track of it ourselves, in the event that a
+	 * program jumps out of a signal handler.
+	 */
+	scp = (struct netbsd32_sigcontext13 *)NETBSD32PTR64(SCARG(uap, sigcntxp));
+	if (copyin((void *)scp, , sizeof(*scp)) != 0)
+		return (EFAULT);
+
+	/* Restore register context. */
+	tf = l->l_md.md_regs;
+
+	/*
+	 * Check for security violations.
+	 */
+	error = check_sigcontext32(l, (const struct netbsd32_sigcontext *));
+	if (error != 0)
+		return error;
+
+	tf->tf_gs = context.sc_gs & 0x;
+	tf->tf_fs = context.sc_fs & 0x;		
+	tf->tf_es = context.sc_es & 0x;
+	tf->tf_ds = context.sc_ds & 0x;
+	tf->tf_rflags = context.sc_eflags;
+	tf->tf_rdi = context.sc_edi;
+	tf->tf_rsi = context.sc_esi;
+	tf->tf_rbp = context.sc_ebp;
+	tf->tf_rbx = context.sc_ebx;
+	tf->tf_rdx = context.sc_edx;
+	tf->tf_rcx = context.sc_ecx;
+	tf->tf_rax = context.sc_eax;
+	tf->tf_rip = context.sc_eip;
+	tf->tf_cs = context.sc_cs & 0x;
+	tf->tf_rsp = context.sc_esp;
+	tf->tf_ss = context.sc_ss & 0x;
+
+	mutex_enter(p->p_lock);
+	/* Restore signal stack. */
+	if (context.sc_onstack & SS_ONSTACK)
+		l->l_sigstk.ss_flags |= SS_ONSTACK;
+	else
+		l->l_sigstk.ss_flags &= ~SS_ONSTACK;
+	/* Restore signal mask. */
+	native_sigset13_to_sigset((sigset13_t *)_mask, );
+	(void) sigprocmask1(l, SIG_SETMASK, , 0);
+	mutex_exit(p->p_lock);
+
+	return (EJUSTRETURN);
+}
+#endif

Index: src/sys/arch/amd64/conf/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.95 src/sys/arch/amd64/conf/files.amd64:1.96
--- src/sys/arch/amd64/conf/files.amd64:1.95	Sat Dec  2 08:03:15 2017
+++ src/sys/arch/amd64/conf/files.amd64	Thu Dec  7 18:11:50 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.95 2017/12/02 13:03:15 maxv Exp $
+#	$NetBSD: files.amd64,v 1.96 2017/12/07 23:11:50 christos Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -136,6 +136,7 @@ attach	fd at fdc
 # Compatibility modules
 #
 # Binary compatibility with previous NetBSD releases (COMPAT_XX)
+file	arch/amd64/amd64/compat_13_machdep.c	compat_13
 file	arch/amd64/amd64/compat_16_machdep.c	compat_16
 
 # NetBSD/i386 32-bit binary compatibility (COMPAT_NETBSD32)

Added files:

Index: src/sys/arch/amd64/amd64/compat_13_machdep.c
diff -u /dev/null src/sys/arch/amd64/amd64/compat_13_machdep.c:1.3
--- /dev/null	Thu Dec  7 18:11:50 2017
+++ src/sys/arch/amd64/amd64/compat_13_machdep.c	Thu Dec  7 18:11:50 2017
@@ -0,0 +1,63 @@
+/*	$NetBSD: compat_13_machdep.c,v 1.3 2017/12/07 23:11:50 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 

CVS commit: src/sys/dev/usb

2017-12-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec  7 22:56:23 UTC 2017

Modified Files:
src/sys/dev/usb: xhci.c

Log Message:
PR/52791: Robert Sprowson: avoid duplicate tests (use accessor variables)


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/usb/xhci.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/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.77 src/sys/dev/usb/xhci.c:1.78
--- src/sys/dev/usb/xhci.c:1.77	Fri Nov 17 03:22:02 2017
+++ src/sys/dev/usb/xhci.c	Thu Dec  7 17:56:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.77 2017/11/17 08:22:02 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.78 2017/12/07 22:56:23 christos Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.77 2017/11/17 08:22:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.78 2017/12/07 22:56:23 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -3154,6 +3154,8 @@ static void
 xhci_setup_tthub(struct usbd_pipe *pipe, uint32_t *cp)
 {
 	struct usbd_device *dev = pipe->up_dev;
+	struct usbd_device *myhub = dev->ud_myhub;
+	struct usbd_port *myhsport = dev->ud_myhsport;
 	usb_device_descriptor_t * const dd = >ud_ddesc;
 	uint32_t speed = dev->ud_speed;
 	uint8_t tthubslot, ttportnum;
@@ -3177,19 +3179,17 @@ xhci_setup_tthub(struct usbd_pipe *pipe,
 	 *   parent hub is not HS hub ||
 	 *   attached to root hub.
 	 */
-	if (dev->ud_myhsport != NULL &&
-	dev->ud_myhub != NULL && dev->ud_myhub->ud_depth != 0 &&
-	(dev->ud_myhub != NULL &&
-	 dev->ud_myhub->ud_speed == USB_SPEED_HIGH) &&
+	if (myhsport && myhub && myhub->ud_depth &&
+	myhub->ud_speed == USB_SPEED_HIGH &&
 	(speed == USB_SPEED_LOW || speed == USB_SPEED_FULL)) {
-		ttportnum = dev->ud_myhsport->up_portno;
-		tthubslot = dev->ud_myhsport->up_parent->ud_addr;
+		ttportnum = myhsport->up_portno;
+		tthubslot = myhsport->up_parent->ud_addr;
 	} else {
 		ttportnum = 0;
 		tthubslot = 0;
 	}
 	DPRINTFN(4, "myhsport %#jx ttportnum=%jd tthubslot=%jd",
-	(uintptr_t)dev->ud_myhsport, ttportnum, tthubslot, 0);
+	(uintptr_t)myhsport, ttportnum, tthubslot, 0);
 
 	/* ishub is valid after reading UDESC_DEVICE */
 	ishub = (dd->bDeviceClass == UDCLASS_HUB);
@@ -3218,13 +3218,9 @@ xhci_setup_tthub(struct usbd_pipe *pipe,
 	 */
 	if (ishub && speed == USB_SPEED_HIGH && IS_TTHUB(dd))
 		usemtt = true;
-	else if (!ishub &&
-	 (speed == USB_SPEED_LOW || speed == USB_SPEED_FULL) &&
-	 dev->ud_myhub != NULL && dev->ud_myhub->ud_depth != 0 &&
-	 (dev->ud_myhub != NULL &&
-	  dev->ud_myhub->ud_speed == USB_SPEED_HIGH) &&
-	 dev->ud_myhsport != NULL &&
-	 IS_TTHUB(>ud_myhsport->up_parent->ud_ddesc))
+	else if (!ishub && (speed == USB_SPEED_LOW || speed == USB_SPEED_FULL) &&
+	 myhub && myhub->ud_depth && myhub->ud_speed == USB_SPEED_HIGH &&
+	 myhsport && IS_TTHUB(>up_parent->ud_ddesc))
 		usemtt = true;
 	else
 		usemtt = false;



CVS commit: src/tests/lib/libc/locale

2017-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 22:23:14 UTC 2017

Modified Files:
src/tests/lib/libc/locale: t_strfmon.c

Log Message:
Update this test to expect the output that is supposed to be produced
by strfmon() rather than the output the old buggy implementation used
to produce.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/locale/t_strfmon.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/lib/libc/locale/t_strfmon.c
diff -u src/tests/lib/libc/locale/t_strfmon.c:1.1 src/tests/lib/libc/locale/t_strfmon.c:1.2
--- src/tests/lib/libc/locale/t_strfmon.c:1.1	Wed Aug 16 13:53:20 2017
+++ src/tests/lib/libc/locale/t_strfmon.c	Thu Dec  7 22:23:14 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_strfmon.c,v 1.1 2017/08/16 13:53:20 joerg Exp $ */
+/* $NetBSD: t_strfmon.c,v 1.2 2017/12/07 22:23:14 kre Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_strfmon.c,v 1.1 2017/08/16 13:53:20 joerg Exp $");
+__RCSID("$NetBSD: t_strfmon.c,v 1.2 2017/12/07 22:23:14 kre Exp $");
 
 #include 
 #include 
@@ -50,9 +50,9 @@ ATF_TC_BODY(strfmon, tc)
 		const char *locale;
 		const char *expected;
 	} tests[] = {
-	{ "C", "[**1234.57] [**1234.57]" },
-	{ "de_DE.UTF-8", "[ **1234,57 €] [ **1.234,57 EUR ]" },
-	{ "en_GB.UTF-8", "[ £**1234.57] [ GBP **1,234.57]" },
+	{ "C", "[ **1234.57] [ **1234.57]" },
+	{ "de_DE.UTF-8", "[ **1234,57 €] [ **1.234,57 EUR]" },
+	{ "en_GB.UTF-8", "[ £**1234.57] [ GBP**1,234.57]" },
 	};
 	locale_t loc;
 	size_t i;



CVS commit: src/lib/libc/stdlib

2017-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 22:19:17 UTC 2017

Modified Files:
src/lib/libc/stdlib: strfmon.3

Log Message:
Fix obvious typo (cut or whatever) - there's only one value that
specifies the number of digits after the decimal point (oh, sorry, the
"radix character") the other specifies the number before...

While here, add a little more info on the effects of using the #n value.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/stdlib/strfmon.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/libc/stdlib/strfmon.3
diff -u src/lib/libc/stdlib/strfmon.3:1.7 src/lib/libc/stdlib/strfmon.3:1.8
--- src/lib/libc/stdlib/strfmon.3:1.7	Wed Aug 16 17:41:36 2017
+++ src/lib/libc/stdlib/strfmon.3	Thu Dec  7 22:19:17 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: strfmon.3,v 1.7 2017/08/16 17:41:36 wiz Exp $
+.\"	$NetBSD: strfmon.3,v 1.8 2017/12/07 22:19:17 kre Exp $
 .\"
 .\" Copyright (c) 2001 Jeroen Ruigrok van der Werven 
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\"
 .\" 	From: FreeBSD: Id: strfmon.3,v 1.7 2003/01/06 06:21:25 tjr Exp
 .\"
-.Dd August 15, 2017
+.Dd December 7, 2017
 .Dt STRFMON 3
 .Os
 .Sh NAME
@@ -102,7 +102,13 @@ By default, there is no minimum width.
 A
 .Sq Cm #
 sign followed by a decimal number specifying the maximum
-expected number of digits after the radix character.
+expected number of digits before the radix character.
+When this option is used, values that do not exceed the
+specified number of digits are formatted so they will be
+correctly aligned with other values printed using the same
+format.
+This includes always leaving space for a possible sign
+indicator, even if none is needed for a particular value.
 .It
 A
 .Sq Cm \&.



CVS commit: src/sys/ufs/ffs

2017-12-07 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Dec  7 21:53:41 UTC 2017

Modified Files:
src/sys/ufs/ffs: ffs_alloc.c

Log Message:
fix the UVM_PAGE_TRKOWN page-locking assertion at the top of ffs_alloc()
to work right for multi-threaded processes.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/ufs/ffs/ffs_alloc.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/ufs/ffs/ffs_alloc.c
diff -u src/sys/ufs/ffs/ffs_alloc.c:1.158 src/sys/ufs/ffs/ffs_alloc.c:1.159
--- src/sys/ufs/ffs/ffs_alloc.c:1.158	Sun Aug 13 21:00:58 2017
+++ src/sys/ufs/ffs/ffs_alloc.c	Thu Dec  7 21:53:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_alloc.c,v 1.158 2017/08/13 21:00:58 mlelstv Exp $	*/
+/*	$NetBSD: ffs_alloc.c,v 1.159 2017/12/07 21:53:41 chs Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.158 2017/08/13 21:00:58 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.159 2017/12/07 21:53:41 chs Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -203,10 +203,12 @@ ffs_alloc(struct inode *ip, daddr_t lbn,
 	 * be locked by the current thread.
 	 */
 
-	if (ITOV(ip)->v_type == VREG &&
-	ffs_lblktosize(fs, (voff_t)lbn) < round_page(ITOV(ip)->v_size)) {
+	struct vnode *vp = ITOV(ip);
+	if (vp->v_type == VREG &&
+	ffs_lblktosize(fs, (voff_t)lbn) < round_page(vp->v_size) &&
+	((vp->v_vflag & VV_MAPPED) != 0 || (size & PAGE_MASK) != 0 ||
+	 ffs_blkoff(fs, size) != 0)) {
 		struct vm_page *pg;
-		struct vnode *vp = ITOV(ip);
 		struct uvm_object *uobj = >v_uobj;
 		voff_t off = trunc_page(ffs_lblktosize(fs, lbn));
 		voff_t endoff = round_page(ffs_lblktosize(fs, lbn) + size);
@@ -214,10 +216,8 @@ ffs_alloc(struct inode *ip, daddr_t lbn,
 		mutex_enter(uobj->vmobjlock);
 		while (off < endoff) {
 			pg = uvm_pagelookup(uobj, off);
-			KASSERT((pg == NULL && (vp->v_vflag & VV_MAPPED) == 0 &&
- (size & PAGE_MASK) == 0 && 
- ffs_blkoff(fs, size) == 0) ||
-(pg != NULL && pg->owner == curproc->p_pid &&
+			KASSERT((pg != NULL && pg->owner_tag != NULL &&
+ pg->owner == curproc->p_pid &&
  pg->lowner == curlwp->l_lid));
 			off += PAGE_SIZE;
 		}



CVS commit: src/sys/kern

2017-12-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec  7 19:49:43 UTC 2017

Modified Files:
src/sys/kern: kern_sig.c

Log Message:
- Reset ignored or masked traps to avoid infinite loops
- If sigpost fails don't add an SDT_PROBE
ok (and author) chuq


To generate a diff of this commit:
cvs rdiff -u -r1.338 -r1.339 src/sys/kern/kern_sig.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_sig.c
diff -u src/sys/kern/kern_sig.c:1.338 src/sys/kern/kern_sig.c:1.339
--- src/sys/kern/kern_sig.c:1.338	Wed Oct 25 04:12:39 2017
+++ src/sys/kern/kern_sig.c	Thu Dec  7 14:49:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.338 2017/10/25 08:12:39 maya Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.339 2017/12/07 19:49:43 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.338 2017/10/25 08:12:39 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.339 2017/12/07 19:49:43 christos Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -903,9 +903,10 @@ trapsignal(struct lwp *l, ksiginfo_t *ks
 	mask = >l_sigmask;
 	ps = p->p_sigacts;
 
-	if ((p->p_slflag & PSL_TRACED) == 0 &&
-	sigismember(>p_sigctx.ps_sigcatch, signo) &&
-	!sigismember(mask, signo)) {
+	const bool traced = (p->p_slflag & PSL_TRACED) != 0;
+	const bool caught = sigismember(>p_sigctx.ps_sigcatch, signo);
+	const bool masked = sigismember(mask, signo);
+	if (!traced && caught && !masked) {
 		mutex_exit(proc_lock);
 		l->l_ru.ru_nsignals++;
 		kpsendsig(l, ksi, mask);
@@ -920,11 +921,28 @@ trapsignal(struct lwp *l, ksiginfo_t *ks
 SIGACTION_PS(ps, signo).sa_handler,
 mask, ksi);
 		}
-	} else {
-		kpsignal2(p, ksi);
-		mutex_exit(p->p_lock);
-		mutex_exit(proc_lock);
+		return;
+	}
+
+	/*
+	 * If the signal is masked or ignored, then unmask it and
+	 * reset it to the default action so that the process or
+	 * its tracer will be notified.
+	 */
+	const bool ignored = SIGACTION_PS(ps, signo).sa_handler == SIG_IGN;
+	if (masked || ignored) {
+		mutex_enter(>sa_mutex);
+		sigdelset(mask, signo);	
+		sigdelset(>p_sigctx.ps_sigcatch, signo);
+		sigdelset(>p_sigctx.ps_sigignore, signo);
+		sigdelset(_PS(ps, signo).sa_mask, signo);
+		SIGACTION_PS(ps, signo).sa_handler = SIG_DFL;
+		mutex_exit(>sa_mutex);
 	}
+
+	kpsignal2(p, ksi);
+	mutex_exit(p->p_lock);
+	mutex_exit(proc_lock);
 }
 
 /*
@@ -1215,7 +1233,6 @@ int
 kpsignal2(struct proc *p, ksiginfo_t *ksi)
 {
 	int prop, signo = ksi->ksi_signo;
-	struct sigacts *sa;
 	struct lwp *l = NULL;
 	ksiginfo_t *kp;
 	lwpid_t lid;
@@ -1275,20 +1292,6 @@ kpsignal2(struct proc *p, ksiginfo_t *ks
 goto out;
 		}
 	} else {
-		/*
-		 * If the signal was the result of a trap and is not being
-		 * caught, then reset it to default action so that the
-		 * process dumps core immediately.
-		 */
-		if (KSI_TRAP_P(ksi)) {
-			sa = p->p_sigacts;
-			mutex_enter(>sa_mutex);
-			if (!sigismember(>p_sigctx.ps_sigcatch, signo)) {
-sigdelset(>p_sigctx.ps_sigignore, signo);
-SIGACTION(p, signo).sa_handler = SIG_DFL;
-			}
-			mutex_exit(>sa_mutex);
-		}
 
 		/*
 		 * If the signal is being ignored, then drop it.  Note: we
@@ -1365,7 +1368,8 @@ kpsignal2(struct proc *p, ksiginfo_t *ks
 			if ((error = sigput(>l_sigpend, p, kp)) != 0)
 goto out;
 			membar_producer();
-			(void)sigpost(l, action, prop, kp->ksi_signo);
+			if (sigpost(l, action, prop, kp->ksi_signo) != 0)
+signo = -1;
 		}
 		goto out;
 	}



CVS commit: src/distrib/sets/lists/tests

2017-12-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec  7 19:48:12 UTC 2017

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
new test for trapsignal


To generate a diff of this commit:
cvs rdiff -u -r1.768 -r1.769 src/distrib/sets/lists/tests/mi

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.768 src/distrib/sets/lists/tests/mi:1.769
--- src/distrib/sets/lists/tests/mi:1.768	Wed Dec  6 08:55:31 2017
+++ src/distrib/sets/lists/tests/mi	Thu Dec  7 14:48:12 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.768 2017/12/06 13:55:31 christos Exp $
+# $NetBSD: mi,v 1.769 2017/12/07 19:48:12 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2120,6 +2120,7 @@
 ./usr/tests/kernel/arch/x86			tests-obsolete		obsolete
 ./usr/tests/kernel/h_ps_strings1		tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/h_ps_strings2		tests-kernel-tests	compattestfile,atf
+./usr/tests/kernel/h_segv			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/kqueue			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/kqueue/Atffile		tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/kqueue/Kyuafile		tests-kernel-tests	compattestfile,atf,kyua
@@ -2178,6 +2179,7 @@
 ./usr/tests/kernel/t_ptrace_waitpid		tests-obsolete		obsolete
 ./usr/tests/kernel/t_pty			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_rnd			tests-kernel-tests	atf,rump
+./usr/tests/kernel/t_trapsignal			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_sigaction			tests-obsolete		obsolete
 ./usr/tests/kernel/t_subr_prf			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_sysctl			tests-kernel-tests	compattestfile,atf



CVS commit: src/tests/kernel

2017-12-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec  7 19:46:40 UTC 2017

Modified Files:
src/tests/kernel: Makefile
Added Files:
src/tests/kernel: h_segv.c t_trapsignal.sh

Log Message:
Add trapsignal tests that make sure that traps don't end up spinning
indefinitely, discussed in tech-kern.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/h_segv.c \
src/tests/kernel/t_trapsignal.sh

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

Modified files:

Index: src/tests/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.47 src/tests/kernel/Makefile:1.48
--- src/tests/kernel/Makefile:1.47	Wed Dec  6 08:54:26 2017
+++ src/tests/kernel/Makefile	Thu Dec  7 14:46:40 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.47 2017/12/06 13:54:26 christos Exp $
+# $NetBSD: Makefile,v 1.48 2017/12/07 19:46:40 christos Exp $
 
 NOMAN=		# defined
 
@@ -19,11 +19,13 @@ TESTS_C+=	t_sysctl
 TESTS_SH=	t_umount
 TESTS_SH+=	t_umountstress
 TESTS_SH+=	t_ps_strings
+TESTS_SH+=	t_trapsignal
 TESTS_SH+=	t_interp
 
 BINDIR=		${TESTSDIR}
 PROGS=		h_ps_strings1
 PROGS+=		h_ps_strings2
+PROGS+=		h_segv
 
 LDADD.t_mqueue+= -lrt
 

Added files:

Index: src/tests/kernel/h_segv.c
diff -u /dev/null src/tests/kernel/h_segv.c:1.1
--- /dev/null	Thu Dec  7 14:46:40 2017
+++ src/tests/kernel/h_segv.c	Thu Dec  7 14:46:40 2017
@@ -0,0 +1,117 @@
+/*	$NetBSD: h_segv.c,v 1.1 2017/12/07 19:46:40 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION 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 
+__RCSID("$NetBSD: h_segv.c,v 1.1 2017/12/07 19:46:40 christos Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// A faulting address
+static int *p = (int *) 0xfefefef0;
+
+static int flags;
+#define F_RECURSE 	1
+#define F_HANDLE	2
+#define F_MASK		4
+
+static struct {
+	const char *n;
+	int v;
+} nv[] = {
+	{ "recurse",	F_RECURSE },
+	{ "handle",	F_HANDLE },
+	{ "mask",	F_MASK },
+};
+
+static void
+foo(int s)
+{
+char buf[64];
+int i = snprintf(buf, sizeof(buf), "got %d\n", s);
+write(2, buf, i);
+	if (flags & F_RECURSE)
+		*p = 0;
+exit(EXIT_SUCCESS);
+}
+
+static __dead void
+usage(void)
+{
+	fprintf(stderr, "Usage: %s recurse|mask|unhandle ...\n", getprogname());
+	exit(EXIT_FAILURE);
+}
+
+int
+main(int argc, char *argv[])
+{
+	if (argc == 1)
+	usage();
+
+	for (int i = 1; i < argc; i++) {
+		size_t j;
+		for (j = 0; j < __arraycount(nv); j++)
+			if (strcmp(nv[j].n, argv[i]) == 0) {
+flags |= nv[j].v;
+break;
+			}
+		if (j == __arraycount(nv))
+			usage();
+	}
+
+	if (flags == 0)
+		usage();
+
+	if (flags & F_HANDLE) {
+		struct sigaction sa;
+
+		sa.sa_flags = SA_RESTART;
+		sa.sa_handler = foo;
+		sigemptyset(_mask);
+		if (sigaction(SIGSEGV, , NULL) == -1)
+			err(EXIT_FAILURE, "sigaction");
+	}
+
+	if (flags & F_MASK) {
+		sigset_t set;
+
+		sigemptyset();
+		sigaddset(, SIGSEGV);
+		if (sigprocmask(SIG_BLOCK, , NULL) == -1)
+			err(EXIT_FAILURE, "sigprocmask");
+	}
+
+*p = 1;
+	return EXIT_SUCCESS;
+}
Index: src/tests/kernel/t_trapsignal.sh
diff -u /dev/null src/tests/kernel/t_trapsignal.sh:1.1
--- /dev/null	Thu Dec  7 14:46:40 2017
+++ src/tests/kernel/t_trapsignal.sh	Thu Dec  7 14:46:40 2017
@@ -0,0 +1,94 @@
+# $NetBSD: t_trapsignal.sh,v 1.1 2017/12/07 19:46:40 christos Exp $
+#
+# Copyright (c) 2017 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is 

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2017-12-07 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Dec  7 19:23:22 UTC 2017

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_accel.c
cg14_render.c

Log Message:
RGB/BGR-flip source images in CG14Comp_Over32*() with non-solid sources
as well. This takes care of most remaining RGB/BGR issues in xrender.
Next step: do more than one pixel at a time in those operations.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.10 -r1.11 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.12 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.13
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.12	Mon Oct 30 22:09:54 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Thu Dec  7 19:23:22 2017
@@ -135,13 +135,13 @@ void CG14Comp_Over8Solid(Cg14Ptr, uint32
 void CG14Comp_Over32Solid(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
int, int);
 void CG14Comp_Over32(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
-   int, int);
+   int, int, int);
 void CG14Comp_Over32Mask(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
-   uint32_t, uint32_t, int, int);
+   uint32_t, uint32_t, int, int, int);
 void CG14Comp_Over32Mask_noalpha(Cg14Ptr, uint32_t, uint32_t, uint32_t,
-		   uint32_t, uint32_t, uint32_t, int, int);
+		   uint32_t, uint32_t, uint32_t, int, int, int);
 void CG14Comp_Over32Mask32_noalpha(Cg14Ptr, uint32_t, uint32_t, uint32_t,
-		   uint32_t, uint32_t, uint32_t, int, int);
+		   uint32_t, uint32_t, uint32_t, int, int, int);
 void CG14Comp_Add8(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
int, int);
 void CG14Comp_Add8_32(Cg14Ptr, uint32_t, uint32_t, uint32_t, uint32_t,
Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.12 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.13
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.12	Mon Oct 30 22:09:54 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Thu Dec  7 19:23:22 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.12 2017/10/30 22:09:54 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.13 2017/12/07 19:23:22 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -888,11 +888,15 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 	Cg14Ptr p = GET_CG14_FROM_SCRN(pScrn);
 	uint32_t dstoff, dstpitch;
 	uint32_t dst, msk, src;
+	int flip = 0;
 
 	ENTER;
 	dstoff = exaGetPixmapOffset(pDst);		
 	dstpitch = exaGetPixmapPitch(pDst);
 
+	flip = (PICT_FORMAT_TYPE(p->srcformat) !=
+		PICT_FORMAT_TYPE(p->dstformat));
+
 	switch (p->op) {
 		case PictOpOver:
 			dst = dstoff + (dstY * dstpitch) + (dstX << 2);
@@ -943,12 +947,12 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 			src, p->srcpitch,
 			msk, p->mskpitch,
 			dst, dstpitch,
-			width, height);
+			width, height, flip);
 		} else {
 			CG14Comp_Over32(p, 
 			src, p->srcpitch,
 			dst, dstpitch,
-			width, height);
+			width, height, flip);
 		}
 		break;
 	case PICT_x8r8g8b8:
@@ -967,7 +971,7 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 			src, p->srcpitch,
 			msk, p->mskpitch,
 			dst, dstpitch,
-			width, height);
+			width, height, flip);
 		} else if ((p->mskformat == PICT_a8r8g8b8) ||
 			   (p->mskformat == PICT_a8b8g8r8)) {
 			msk = p->mskoff + 
@@ -977,7 +981,7 @@ CG14Composite(PixmapPtr pDst, int srcX, 
 			src, p->srcpitch,
 			msk, p->mskpitch,
 			dst, dstpitch,
-			width, height);
+			width, height, flip);
 		} else {
 			xf86Msg(X_ERROR, "no src alpha, mask is %x\n", p->mskformat);
 		}

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.10 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.11
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c:1.10	Mon Oct 30 22:09:54 2017
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_render.c	Thu Dec  7 19:23:22 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_render.c,v 1.10 2017/10/30 22:09:54 macallan Exp $ */
+/* $NetBSD: cg14_render.c,v 1.11 2017/12/07 19:23:22 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -469,7 +469,7 @@ void CG14Comp_Add8_32(Cg14Ptr p,
 void 

CVS commit: src/sys/arch/sparc/dev

2017-12-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec  7 19:15:56 UTC 2017

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add SCATTER/GATHER instructions


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc/dev/sxreg.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/arch/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.14 src/sys/arch/sparc/dev/sxreg.h:1.15
--- src/sys/arch/sparc/dev/sxreg.h:1.14	Mon Oct 30 21:41:39 2017
+++ src/sys/arch/sparc/dev/sxreg.h	Thu Dec  7 19:15:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.14 2017/10/30 21:41:39 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.15 2017/12/07 19:15:56 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -290,4 +290,12 @@
 #define SX_ADDV(sa, sb, d, cnt) (0xa000 | ((cnt) << 24) | SX_ADD_V | \
 		((sa) << 14) | ((d) << 7) | (sb))
 
+/* MISC group */
+#define SX_GTHR		(3 << 21)	/* sa with spacing sb -> d */
+#define SX_SCTR		(2 << 21)	/* sa -> d with spacing sb */
+#define SX_GATHER(sa, sb, d, cnt) (0xe000 | ((cnt << 24) | SX_GTHR | \
+		((sa) << 14) | ((d << 7) | (sb))
+#define SX_SCATTER(sa, sb, d, cnt) (0xe000 | ((cnt << 24) | SX_SCRT | \
+		((sa) << 14) | ((d << 7) | (sb))
+
 #endif /* SXREG_H */



CVS commit: src/etc/root

2017-12-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Dec  7 18:26:51 UTC 2017

Modified Files:
src/etc/root: dot.cshrc dot.profile

Log Message:
Update example PKG_PATH entry to use the CDN frontend, use uname -p instead
of uname -m for processor subdirectory, and derive the OS release from
uname -r.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/etc/root/dot.cshrc
cvs rdiff -u -r1.28 -r1.29 src/etc/root/dot.profile

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

Modified files:

Index: src/etc/root/dot.cshrc
diff -u src/etc/root/dot.cshrc:1.25 src/etc/root/dot.cshrc:1.26
--- src/etc/root/dot.cshrc:1.25	Sun Nov 30 23:43:30 2014
+++ src/etc/root/dot.cshrc	Thu Dec  7 18:26:51 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: dot.cshrc,v 1.25 2014/11/30 23:43:30 riz Exp $
+#	$NetBSD: dot.cshrc,v 1.26 2017/12/07 18:26:51 jmcneill Exp $
 
 alias	h	history
 alias	j	jobs -l
@@ -22,8 +22,7 @@ setenv BLOCKSIZE 1k
 
 # Uncomment the following line(s) to install binary packages
 # from ftp.NetBSD.org via pkg_add.  (See also pkg_install.conf)
-#setenv PKG_PATH "ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/`uname -m`/7.0/All"
-#setenv PKG_PATH "${PKG_PATH};ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/`uname -m`/6.0/All"
+#setenv PKG_PATH "http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/`uname -p`/`uname -r|cut -f '1 2' -d.|cut -f 1 -d_`/All"
 
 set history=1000
 set path=(/sbin /usr/sbin /bin /usr/bin /usr/pkg/sbin /usr/pkg/bin /usr/X11R7/bin /usr/X11R6/bin /usr/local/sbin /usr/local/bin)

Index: src/etc/root/dot.profile
diff -u src/etc/root/dot.profile:1.28 src/etc/root/dot.profile:1.29
--- src/etc/root/dot.profile:1.28	Tue Mar  8 09:51:15 2016
+++ src/etc/root/dot.profile	Thu Dec  7 18:26:51 2017
@@ -1,12 +1,11 @@
-#	$NetBSD: dot.profile,v 1.28 2016/03/08 09:51:15 mlelstv Exp $
+#	$NetBSD: dot.profile,v 1.29 2017/12/07 18:26:51 jmcneill Exp $
 
 export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin
 export PATH=${PATH}:/usr/X11R7/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin
 
 # Uncomment the following line(s) to install binary packages
-# from ftp.NetBSD.org via pkg_add.  (See also pkg_install.conf)
-#export PKG_PATH=ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/7.0/All
-#export PKG_PATH="${PKG_PATH};ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/6.0/All"
+# from cdn.NetBSD.org via pkg_add.  (See also pkg_install.conf)
+#export PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f '1 2' -d.|cut -f 1 -d_)/All"
 
 export BLOCKSIZE=1k
 



CVS commit: src/sys/arch/amd64/amd64

2017-12-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec  7 16:22:22 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: netbsd32_machdep.c

Log Message:
Keep fs/gs the same for the signal context; otherwise calling things
like __lwp_getprivate_fast() from a signal handler (that uses %gs) die.

Merge context building code.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/amd64/amd64/netbsd32_machdep.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/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.113 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.114
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.113	Sat Dec  2 10:36:24 2017
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Thu Dec  7 11:22:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.113 2017/12/02 15:36:24 maxv Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.114 2017/12/07 16:22:22 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.113 2017/12/02 15:36:24 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.114 2017/12/07 16:22:22 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -164,6 +164,43 @@ netbsd32_setregs(struct lwp *l, struct e
 	tf->tf_ss = LSEL(LUDATA32_SEL, SEL_UPL);
 }
 
+static void
+netbsd32_buildcontext(struct lwp *l, struct trapframe *tf, void *fp,
+sig_t catcher, int onstack)
+{
+	/*
+	 * Build context to run handler in.
+	 */
+	tf->tf_ds = GSEL(GUDATA32_SEL, SEL_UPL);
+	tf->tf_es = GSEL(GUDATA32_SEL, SEL_UPL);
+#if 0
+	tf->tf_fs = GSEL(GUDATA32_SEL, SEL_UPL);
+	tf->tf_gs = GSEL(GUDATA32_SEL, SEL_UPL);
+#endif
+
+	/* Ensure FP state is sane. */
+	fpu_save_area_reset(l);
+
+	tf->tf_rip = (uint64_t)catcher;
+	tf->tf_cs = GSEL(GUCODE32_SEL, SEL_UPL);
+	tf->tf_rflags &= ~PSL_CLEARSIG;
+	tf->tf_rsp = (uint64_t)fp;
+	tf->tf_ss = GSEL(GUDATA32_SEL, SEL_UPL);
+
+	/* Remember that we're now on the signal stack. */
+	if (onstack)
+		l->l_sigstk.ss_flags |= SS_ONSTACK;
+	if ((vaddr_t)catcher >= VM_MAXUSER_ADDRESS32) {
+		/*
+		 * process has given an invalid address for the
+		 * handler. Stop it, but do not do it before so
+		 * we can return the right info to userland (or in core dump)
+		 */
+		sigexit(l, SIGILL);
+		/* NOTREACHED */
+	}
+}
+
 #ifdef COMPAT_16
 static void
 netbsd32_sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
@@ -249,35 +286,7 @@ netbsd32_sendsig_sigcontext(const ksigin
 		/* NOTREACHED */
 	}
 
-	/*
-	 * Build context to run handler in.
-	 */
-	tf->tf_ds = GSEL(GUDATA32_SEL, SEL_UPL);
-	tf->tf_es = GSEL(GUDATA32_SEL, SEL_UPL);
-	tf->tf_fs = GSEL(GUDATA32_SEL, SEL_UPL);
-	tf->tf_gs = GSEL(GUDATA32_SEL, SEL_UPL);
-
-	/* Ensure FP state is sane. */
-	fpu_save_area_reset(l);
-
-	tf->tf_rip = (uint64_t)catcher;
-	tf->tf_cs = GSEL(GUCODE32_SEL, SEL_UPL);
-	tf->tf_rflags &= ~PSL_CLEARSIG;
-	tf->tf_rsp = (uint64_t)fp;
-	tf->tf_ss = GSEL(GUDATA32_SEL, SEL_UPL);
-
-	/* Remember that we're now on the signal stack. */
-	if (onstack)
-		l->l_sigstk.ss_flags |= SS_ONSTACK;
-	if ((vaddr_t)catcher >= VM_MAXUSER_ADDRESS32) {
-		/*
-		 * process has given an invalid address for the
-		 * handler. Stop it, but do not do it before so
-		 * we can return the right info to userland (or in core dump)
-		 */
-		sigexit(l, SIGILL);
-		/* NOTREACHED */
-	}
+	netbsd32_buildcontext(l, tf, fp, catcher, onstack);
 }
 #endif
 
@@ -346,35 +355,7 @@ netbsd32_sendsig_siginfo(const ksiginfo_
 		/* NOTREACHED */
 	}
 
-	/*
-	 * Build context to run handler in.
-	 */
-	tf->tf_ds = GSEL(GUDATA32_SEL, SEL_UPL);
-	tf->tf_es = GSEL(GUDATA32_SEL, SEL_UPL);
-	tf->tf_fs = GSEL(GUDATA32_SEL, SEL_UPL);
-	tf->tf_gs = GSEL(GUDATA32_SEL, SEL_UPL);
-
-	tf->tf_rip = (uint64_t)catcher;
-	tf->tf_cs = GSEL(GUCODE32_SEL, SEL_UPL);
-	tf->tf_rflags &= ~PSL_CLEARSIG;
-	tf->tf_rsp = (uint64_t)fp;
-	tf->tf_ss = GSEL(GUDATA32_SEL, SEL_UPL);
-
-	/* Ensure FP state is sane. */
-	fpu_save_area_reset(l);
-
-	/* Remember that we're now on the signal stack. */
-	if (onstack)
-		l->l_sigstk.ss_flags |= SS_ONSTACK;
-	if ((vaddr_t)catcher >= VM_MAXUSER_ADDRESS32) {
-		/*
-		 * process has given an invalid address for the
-		 * handler. Stop it, but do not do it before so
-		 * we can return the right info to userland (or in core dump)
-		 */
-		sigexit(l, SIGILL);
-		/* NOTREACHED */
-	}
+	netbsd32_buildcontext(l, tf, fp, catcher, onstack);
 }
 
 void



CVS commit: src/sys/kern

2017-12-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec  7 15:21:34 UTC 2017

Modified Files:
src/sys/kern: sys_ptrace_common.c

Log Message:
Make {s,g}et{db,fp,}regs work again for PK_32 processes
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/kern/sys_ptrace_common.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/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.23 src/sys/kern/sys_ptrace_common.c:1.24
--- src/sys/kern/sys_ptrace_common.c:1.23	Sun Aug 27 20:46:07 2017
+++ src/sys/kern/sys_ptrace_common.c	Thu Dec  7 10:21:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.23 2017/08/28 00:46:07 kamil Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.24 2017/12/07 15:21:34 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,12 +118,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.23 2017/08/28 00:46:07 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.24 2017/12/07 15:21:34 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
 #include "opt_ktrace.h"
 #include "opt_pax.h"
+#include "opt_compat_netbsd32.h"
 #endif
 
 #include 
@@ -1320,40 +1321,69 @@ do_ptrace(struct ptrace_methods *ptm, st
 	return error;
 }
 
-int
-process_doregs(struct lwp *curl /*tracer*/,
-struct lwp *l /*traced*/,
-struct uio *uio)
+typedef int (*regfunc_t)(struct lwp *, void *);
+
+#if defined(PT_GETDBREGS) || defined(PT_SETDBREGS) || \
+defined(PT_GETFPREGS) || defined(PT_SETFPREGS) || \
+defined(PT_GETREGS) || defined(PT_SETREGS)
+static int
+proc_regio(struct lwp *l, struct uio *uio, size_t kl, regfunc_t r, regfunc_t w)
 {
-#if defined(PT_GETREGS) || defined(PT_SETREGS)
+	char buf[1024];
 	int error;
-	struct reg r;
 	char *kv;
-	int kl;
 
-	if (uio->uio_offset < 0 || uio->uio_offset > (off_t)sizeof(r))
-		return EINVAL;
+	if (kl > sizeof(buf))
+		return E2BIG;
 
-	kl = sizeof(r);
-	kv = (char *)
+	if (uio->uio_offset < 0 || uio->uio_offset > (off_t)kl)
+		return EINVAL;
 
-	kv += uio->uio_offset;
+	kv = buf + uio->uio_offset;
 	kl -= uio->uio_offset;
-	if ((size_t)kl > uio->uio_resid)
+
+	if (kl > uio->uio_resid)
 		kl = uio->uio_resid;
 
-	error = process_read_regs(l, );
+	error = (*r)(l, buf);
 	if (error == 0)
 		error = uiomove(kv, kl, uio);
 	if (error == 0 && uio->uio_rw == UIO_WRITE) {
 		if (l->l_stat != LSSTOP)
 			error = EBUSY;
 		else
-			error = process_write_regs(l, );
+			error = (*w)(l, buf);
 	}
 
 	uio->uio_offset = 0;
 	return error;
+}
+#endif
+
+int
+process_doregs(struct lwp *curl /*tracer*/,
+struct lwp *l /*traced*/,
+struct uio *uio)
+{
+#if defined(PT_GETREGS) || defined(PT_SETREGS)
+	size_t s;
+	regfunc_t r, w;
+
+#ifdef COMPAT_NETBSD32
+	const bool pk32 = (l->l_proc->p_flag & PK_32) != 0;
+
+	if (__predict_false(pk32)) {
+		s = sizeof(struct reg32);
+		r = (regfunc_t)process_read_regs32;
+		w = (regfunc_t)process_write_regs32;
+	} else
+#endif
+	{
+		s = sizeof(struct reg);
+		r = (regfunc_t)process_read_regs;
+		w = (regfunc_t)process_write_regs;
+	}
+	return proc_regio(l, uio, s, r, w);
 #else
 	return EINVAL;
 #endif
@@ -1376,33 +1406,24 @@ process_dofpregs(struct lwp *curl /*trac
 struct uio *uio)
 {
 #if defined(PT_GETFPREGS) || defined(PT_SETFPREGS)
-	int error;
-	struct fpreg r;
-	char *kv;
-	size_t kl;
+	size_t s;
+	regfunc_t r, w;
 
-	if (uio->uio_offset < 0 || uio->uio_offset > (off_t)sizeof(r))
-		return EINVAL;
-
-	kl = sizeof(r);
-	kv = (char *)
+#ifdef COMPAT_NETBSD32
+	const bool pk32 = (l->l_proc->p_flag & PK_32) != 0;
 
-	kv += uio->uio_offset;
-	kl -= uio->uio_offset;
-	if (kl > uio->uio_resid)
-		kl = uio->uio_resid;
-
-	error = process_read_fpregs(l, , );
-	if (error == 0)
-		error = uiomove(kv, kl, uio);
-	if (error == 0 && uio->uio_rw == UIO_WRITE) {
-		if (l->l_stat != LSSTOP)
-			error = EBUSY;
-		else
-			error = process_write_fpregs(l, , kl);
+	if (__predict_false(pk32)) {
+		s = sizeof(struct fpreg32);
+		r = (regfunc_t)process_read_fpregs32;
+		w = (regfunc_t)process_write_fpregs32;
+	} else
+#endif
+	{
+		s = sizeof(struct fpreg);
+		r = (regfunc_t)process_read_fpregs;
+		w = (regfunc_t)process_write_fpregs;
 	}
-	uio->uio_offset = 0;
-	return error;
+	return proc_regio(l, uio, s, r, w);
 #else
 	return EINVAL;
 #endif
@@ -1425,33 +1446,24 @@ process_dodbregs(struct lwp *curl /*trac
 struct uio *uio)
 {
 #if defined(PT_GETDBREGS) || defined(PT_SETDBREGS)
-	int error;
-	struct dbreg r;
-	char *kv;
-	size_t kl;
+	size_t s;
+	regfunc_t r, w;
 
-	if (uio->uio_offset < 0 || uio->uio_offset > (off_t)sizeof(r))
-		return EINVAL;
+#ifdef COMPAT_NETBSD32
+	const bool pk32 = (l->l_proc->p_flag & PK_32) != 0;
 
-	kl = sizeof(r);
-	kv = (char *)
-
-	kv += uio->uio_offset;
-	kl -= uio->uio_offset;
-	if (kl > uio->uio_resid)
-		kl = uio->uio_resid;
-
-	error = process_read_dbregs(l, 

CVS commit: src/sys/net

2017-12-07 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Dec  7 10:22:04 UTC 2017

Modified Files:
src/sys/net: if_pppoe.c

Log Message:
Remove wrong assertions

rw_lock_held() returns true when any context holds the lock. However, in
if_pppoe.c, the function was used wrongly as it returns true only if the lock is
held in the same context.

>From s-yamaguchi@IIJ


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/net/if_pppoe.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/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.132 src/sys/net/if_pppoe.c:1.133
--- src/sys/net/if_pppoe.c:1.132	Fri Nov 17 07:37:12 2017
+++ src/sys/net/if_pppoe.c	Thu Dec  7 10:22:04 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.132 2017/11/17 07:37:12 ozaki-r Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.133 2017/12/07 10:22:04 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.132 2017/11/17 07:37:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.133 2017/12/07 10:22:04 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -135,9 +135,7 @@ struct pppoetag {
 
 #define PPPOE_LOCK(_sc, _op)	rw_enter(&(_sc)->sc_lock, (_op))
 #define PPPOE_UNLOCK(_sc)	rw_exit(&(_sc)->sc_lock)
-#define PPPOE_LOCKED(_sc)	rw_lock_held(&(_sc)->sc_lock)
 #define PPPOE_WLOCKED(_sc)	rw_write_held(&(_sc)->sc_lock)
-#define PPPOE_RLOCKED(_sc)	rw_read_held(&(_sc)->sc_lock)
 
 #ifdef PPPOE_MPSAFE
 #define DECLARE_SPLNET_VARIABLE
@@ -1056,8 +1054,6 @@ pppoe_output(struct pppoe_softc *sc, str
 	struct ether_header *eh;
 	uint16_t etype;
 
-	KASSERT(PPPOE_LOCKED(sc));
-
 	if (sc->sc_eth_if == NULL) {
 		m_freem(m);
 		return EIO;
@@ -1261,8 +1257,6 @@ pppoe_send_padi(struct pppoe_softc *sc)
 	int len, l1 = 0, l2 = 0; /* XXX: gcc */
 	uint8_t *p;
 
-	KASSERT(PPPOE_LOCKED(sc));
-
 	if (sc->sc_state >PPPOE_STATE_PADI_SENT)
 		panic("pppoe_send_padi in state %d", sc->sc_state);
 
@@ -1537,8 +1531,6 @@ pppoe_send_padr(struct pppoe_softc *sc)
 	uint8_t *p;
 	size_t len, l1 = 0; /* XXX: gcc */
 
-	KASSERT(PPPOE_LOCKED(sc));
-
 	if (sc->sc_state != PPPOE_STATE_PADR_SENT)
 		return EIO;
 
@@ -1632,8 +1624,6 @@ pppoe_send_pado(struct pppoe_softc *sc)
 	uint8_t *p;
 	size_t len;
 
-	KASSERT(PPPOE_LOCKED(sc)); /* required by pppoe_output(). */
-
 	if (sc->sc_state != PPPOE_STATE_PADO_SENT)
 		return EIO;
 
@@ -1707,8 +1697,6 @@ pppoe_tls(struct sppp *sp)
 	struct pppoe_softc *sc = (void *)sp;
 	int wtime;
 
-	KASSERT(!PPPOE_LOCKED(sc));
-
 	PPPOE_LOCK(sc, RW_READER);
 
 	if (sc->sc_state != PPPOE_STATE_INITIAL) {
@@ -1738,8 +1726,6 @@ pppoe_tlf(struct sppp *sp)
 {
 	struct pppoe_softc *sc = (void *)sp;
 
-	KASSERT(!PPPOE_LOCKED(sc));
-
 	PPPOE_LOCK(sc, RW_WRITER);
 
 	if (sc->sc_state < PPPOE_STATE_SESSION) {



CVS commit: src/sys/net

2017-12-07 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Dec  7 10:05:42 UTC 2017

Modified Files:
src/sys/net: if.c

Log Message:
Get rid of outdated comments


To generate a diff of this commit:
cvs rdiff -u -r1.408 -r1.409 src/sys/net/if.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/net/if.c
diff -u src/sys/net/if.c:1.408 src/sys/net/if.c:1.409
--- src/sys/net/if.c:1.408	Thu Dec  7 03:16:24 2017
+++ src/sys/net/if.c	Thu Dec  7 10:05:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.408 2017/12/07 03:16:24 ozaki-r Exp $	*/
+/*	$NetBSD: if.c,v 1.409 2017/12/07 10:05:42 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.408 2017/12/07 03:16:24 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.409 2017/12/07 10:05:42 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3521,7 +3521,6 @@ if_addr_init(ifnet_t *ifp, struct ifaddr
 	if (ifp->if_initaddr != NULL)
 		rc = (*ifp->if_initaddr)(ifp, ifa, src);
 	else if (src ||
-		/* FIXME: may not hold if_ioctl_lock */
 	 (rc = (*ifp->if_ioctl)(ifp, SIOCSIFDSTADDR, ifa)) == ENOTTY)
 		rc = (*ifp->if_ioctl)(ifp, SIOCINITIFADDR, ifa);
 
@@ -3590,7 +3589,6 @@ if_flags_set(ifnet_t *ifp, const short f
 		memset(, 0, sizeof(ifr));
 
 		ifr.ifr_flags = flags & ~IFF_CANTCHANGE;
-		/* FIXME: may not hold if_ioctl_lock */
 		rc = (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, );
 
 		if (rc != 0 && cantflags != 0)



CVS commit: src/tests/lib/libc/gen

2017-12-07 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Dec  7 09:37:33 UTC 2017

Modified Files:
src/tests/lib/libc/gen: t_fmtcheck.c

Log Message:
Correct a couple of broken test cases:
"%d"  does not take the same args as "%d %s"
"%%"  does not take the same args as "%llx"
How did these ever survive any kind of even basic sanity check?


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/gen/t_fmtcheck.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/lib/libc/gen/t_fmtcheck.c
diff -u src/tests/lib/libc/gen/t_fmtcheck.c:1.3 src/tests/lib/libc/gen/t_fmtcheck.c:1.4
--- src/tests/lib/libc/gen/t_fmtcheck.c:1.3	Sat Jun 14 08:19:02 2014
+++ src/tests/lib/libc/gen/t_fmtcheck.c	Thu Dec  7 09:37:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fmtcheck.c,v 1.3 2014/06/14 08:19:02 apb Exp $	*/
+/*	$NetBSD: t_fmtcheck.c,v 1.4 2017/12/07 09:37:33 kre Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,13 +65,13 @@ struct test_fmt {
 	{ "%-3", "%d", 2 },
 	{ "%d %s", "%d", 2 },
 	{ "%*.*.*d", "%*.*.*d", 2 },
-	{ "%d", "%d %s", 1 },
+	{ "%d", "%d %s", 2 },
 	{ "%40s", "%20s", 1 },
 	{ "%x %x %x", "%o %u %d", 1 },
 	{ "%o %u %d", "%x %x %X", 1 },
 	{ "%#o %u %#-d", "%x %#x %X", 1 },
 	{ "%qd", "%llx", 1 },
-	{ "%%", "%llx", 1 },
+	{ "%%", "%llx", 2 },
 	{ "%ld %30s %#llx %-10.*e", "This number %lu%% and string %s has %qd numbers and %.*g floats", 1 },
 	{ "%o", "%lx", 2 },
 	{ "%p", "%lu", 2 },