CVS commit: src/tests/bin/expr

2023-05-01 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue May  2 00:11:27 UTC 2023

Modified Files:
src/tests/bin/expr: t_expr.sh

Log Message:
t_expr.sh: fix naming of head() of lang test case


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/bin/expr/t_expr.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/bin/expr/t_expr.sh
diff -u src/tests/bin/expr/t_expr.sh:1.6 src/tests/bin/expr/t_expr.sh:1.7
--- src/tests/bin/expr/t_expr.sh:1.6	Wed Jun 27 17:39:30 2018
+++ src/tests/bin/expr/t_expr.sh	Tue May  2 00:11:27 2023
@@ -1,4 +1,4 @@
-# $NetBSD: t_expr.sh,v 1.6 2018/06/27 17:39:30 kamil Exp $
+# $NetBSD: t_expr.sh,v 1.7 2023/05/02 00:11:27 gutteridge Exp $
 #
 # Copyright (c) 2007 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -37,7 +37,7 @@ test_expr() {
 }
 
 atf_test_case lang
-lang_ops_head() {
+lang_head() {
 	atf_set "descr" "Test that expr(1) works with non-C LANG (PR bin/2486)"
 }
 lang_body() {



CVS commit: src/tests/bin/expr

2023-05-01 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue May  2 00:11:27 UTC 2023

Modified Files:
src/tests/bin/expr: t_expr.sh

Log Message:
t_expr.sh: fix naming of head() of lang test case


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/bin/expr/t_expr.sh

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



CVS commit: src/share/mk

2023-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May  1 20:22:18 UTC 2023

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

Log Message:
Create the INFODIRFILE if it does not exist, so that we can take a lock
on it. Hopefully fixes a race condition where two parallel makes attempt
to create the file at the same time.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/share/mk/bsd.info.mk

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

Modified files:

Index: src/share/mk/bsd.info.mk
diff -u src/share/mk/bsd.info.mk:1.42 src/share/mk/bsd.info.mk:1.43
--- src/share/mk/bsd.info.mk:1.42	Mon Jan 21 16:11:54 2019
+++ src/share/mk/bsd.info.mk	Mon May  1 16:22:18 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.info.mk,v 1.42 2019/01/21 21:11:54 christos Exp $
+#	$NetBSD: bsd.info.mk,v 1.43 2023/05/01 20:22:18 christos Exp $
 
 .include 
 
@@ -42,7 +42,7 @@ __infoinstall: .USE
 	-g ${INFOGRP_${.ALLSRC:T}:U${INFOGRP}} \
 	-m ${INFOMODE_${.ALLSRC:T}:U${INFOMODE}} \
 	${.ALLSRC} ${.TARGET}
-	@[ -f ${INFODIRFILE} ] &&	\
+	@[ -f ${INFODIRFILE} ] || touch ${INFODIRFILE}; 		\
 	while ! ln ${INFODIRFILE} ${INFODIRFILE}.lock 2> /dev/null;	\
 		do sleep 1; done;	\
 	${TOOL_INSTALL_INFO} -d ${INFODIRFILE} -r ${.TARGET} 2> /dev/null; \



CVS commit: src/share/mk

2023-05-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May  1 20:22:18 UTC 2023

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

Log Message:
Create the INFODIRFILE if it does not exist, so that we can take a lock
on it. Hopefully fixes a race condition where two parallel makes attempt
to create the file at the same time.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/share/mk/bsd.info.mk

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



CVS commit: src/sys/dev/pad

2023-05-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon May  1 16:35:47 UTC 2023

Modified Files:
src/sys/dev/pad: pad.c

Log Message:
Don't overflow when scaling 32bit samples.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/pad/pad.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/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.81 src/sys/dev/pad/pad.c:1.82
--- src/sys/dev/pad/pad.c:1.81	Sun Apr 23 08:21:11 2023
+++ src/sys/dev/pad/pad.c	Mon May  1 16:35:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.81 2023/04/23 08:21:11 mlelstv Exp $ */
+/* $NetBSD: pad.c,v 1.82 2023/05/01 16:35:47 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.81 2023/04/23 08:21:11 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.82 2023/05/01 16:35:47 mlelstv Exp $");
 
 #include 
 #include 
@@ -756,7 +756,7 @@ pad_swvol_codec(audio_filter_arg_t *arg)
 	bits = arg->srcfmt->precision;
 
 	for (i = 0; i < sample_count; i++) {
-		int32_t v;
+		int64_t v;
 
 		switch (howmany(bits, NBBY)) {
 		case 2: /* AUDIO_INTERNAL_BITS == 16 */



CVS commit: src/sys/dev/pad

2023-05-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon May  1 16:35:47 UTC 2023

Modified Files:
src/sys/dev/pad: pad.c

Log Message:
Don't overflow when scaling 32bit samples.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/pad/pad.c

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



CVS commit: src/sys/kern

2023-05-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May  1 12:18:08 UTC 2023

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

Log Message:
mutex(9): Write comments in terms of ordering semantics.

Phrasing things in terms of implementation details like `acquiring
and locking cache lines' both suggests a particular cache coherency
protocol, paints an incomplete picture for more involved protocols,
and doesn't really help to prove theorems the way ordering relations
do.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/kern/kern_mutex.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_mutex.c
diff -u src/sys/kern/kern_mutex.c:1.106 src/sys/kern/kern_mutex.c:1.107
--- src/sys/kern/kern_mutex.c:1.106	Mon May  1 12:17:56 2023
+++ src/sys/kern/kern_mutex.c	Mon May  1 12:18:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_mutex.c,v 1.106 2023/05/01 12:17:56 riastradh Exp $	*/
+/*	$NetBSD: kern_mutex.c,v 1.107 2023/05/01 12:18:08 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #define	__MUTEX_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.106 2023/05/01 12:17:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.107 2023/05/01 12:18:08 riastradh Exp $");
 
 #include 
 #include 
@@ -242,6 +242,7 @@ static inline int
 MUTEX_SET_WAITERS(kmutex_t *mtx, uintptr_t owner)
 {
 	int rv;
+
 	rv = MUTEX_CAS(>mtx_owner, owner, owner | MUTEX_BIT_WAITERS);
 	MUTEX_MEMBAR_ENTER();
 	return rv;
@@ -587,15 +588,10 @@ mutex_vector_enter(kmutex_t *mtx)
 		 *
 		 *  CPU 1: MUTEX_SET_WAITERS()  CPU2: mutex_exit()
 		 *  
-		 *		..		acquire cache line
-		 *		..   test for waiters
-		 *	acquire cache line<-  lose cache line
-		 *	 lock cache line	   ..
-		 * verify mutex is held..
-		 *	set waiters  	   ..
-		 *	 unlock cache line		   ..
-		 *	  lose cache line ->acquire cache line
-		 *		..	  clear lock word, waiters
+		 *		..		load mtx->mtx_owner
+		 *		..		see has-waiters bit clear
+		 *	set has-waiters bit  	   ..
+		 *		..		store mtx->mtx_owner := 0
 		 *	  return success
 		 *
 		 * There is another race that can occur: a third CPU could
@@ -612,18 +608,14 @@ mutex_vector_enter(kmutex_t *mtx)
 		 *   be atomic on the local CPU, e.g. in case interrupted
 		 *   or preempted).
 		 *
-		 * o At any given time, MUTEX_SET_WAITERS() can only ever
-		 *   be in progress on one CPU in the system - guaranteed
-		 *   by the turnstile chain lock.
+		 * o At any given time on each mutex, MUTEX_SET_WAITERS()
+		 *   can only ever be in progress on one CPU in the
+		 *   system - guaranteed by the turnstile chain lock.
 		 *
 		 * o No other operations other than MUTEX_SET_WAITERS()
 		 *   and release can modify a mutex with a non-zero
 		 *   owner field.
 		 *
-		 * o The result of a successful MUTEX_SET_WAITERS() call
-		 *   is an unbuffered write that is immediately visible
-		 *   to all other processors in the system.
-		 *
 		 * o If the holding LWP switches away, it posts a store
 		 *   fence before changing curlwp, ensuring that any
 		 *   overwrite of the mutex waiters flag by mutex_exit()
@@ -639,9 +631,12 @@ mutex_vector_enter(kmutex_t *mtx)
 		 *   flag by mutex_exit() completes before the modification
 		 *   of ci_biglock_wanted becomes visible.
 		 *
-		 * We now post a read memory barrier (after setting the
-		 * waiters field) and check the lock holder's status again.
-		 * Some of the possible outcomes (not an exhaustive list):
+		 * After MUTEX_SET_WAITERS() succeeds, simultaneously
+		 * confirming that the same LWP still holds the mutex
+		 * since we took the turnstile lock and notifying it that
+		 * we're waiting, we check the lock holder's status again.
+		 * Some of the possible outcomes (not an exhaustive list;
+		 * XXX this should be made exhaustive):
 		 *
 		 * 1. The on-CPU check returns true: the holding LWP is
 		 *running again.  The lock may be released soon and



CVS commit: src/sys/kern

2023-05-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May  1 12:18:08 UTC 2023

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

Log Message:
mutex(9): Write comments in terms of ordering semantics.

Phrasing things in terms of implementation details like `acquiring
and locking cache lines' both suggests a particular cache coherency
protocol, paints an incomplete picture for more involved protocols,
and doesn't really help to prove theorems the way ordering relations
do.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/kern/kern_mutex.c

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



CVS commit: src/sys/kern

2023-05-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May  1 12:17:56 UTC 2023

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

Log Message:
mutex(9): Omit needless membar_consumer.

In practical terms, this is not necessary because MUTEX_SET_WAITERS
already issues MUTEX_MEMBAR_ENTER, which on all architectures is a
sequential consistency barrier, i.e., read/write-before-read/write,
subsuming membar_consumer.

In theoretical terms, MUTEX_MEMBAR_ENTER might imply only
write-before-read/write, so one might imagine that the
read-before-read ordering of membar_consumer _could_ be necessary.
However, the memory operations that are significant here are:

1. load owner := mtx->mtx_owner
2. store mtx->mtx_owner := owner | MUTEX_BIT_WAITERS
3. load owner->l_cpu->ci_curlwp to test if equal to owner

(1) is program-before (2) and at the same memory location,
mtx->mtx_owner, so (1) happens-before (2).

And (2) is separated in program order by MUTEX_MEMBAR_ENTER from (3),
so (2) happens-before (3).

So even if the membar_consumer were intended to guarantee that (1)
happens-before (3), it's not necessary, because we can already prove
it from MUTEX_MEMBAR_ENTER.

But actually, we don't really need (1) happens-before (3), exactly;
what we really need is (2) happens-before (3), since this is a little
manifestation of Dekker's algorithm between cpu_switchto and
mutex_exit, where each CPU sets one flag and must ensure it is
visible to the other CPUs before testing the other flag -- one flag
here is the MUTEX_BIT_WAITERS bit, and the other `flag' here is the
condition owner->l_cpu->ci_curlwp == owner; the corresponding logic,
in cpu_switchto, is:

1'. store owner->l_cpu->ci_curlwp := owner
2'. load mtx->mtx_owner to test if MUTEX_BIT_WAITERS set


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/kern/kern_mutex.c

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



CVS commit: src/sys/kern

2023-05-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May  1 12:17:56 UTC 2023

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

Log Message:
mutex(9): Omit needless membar_consumer.

In practical terms, this is not necessary because MUTEX_SET_WAITERS
already issues MUTEX_MEMBAR_ENTER, which on all architectures is a
sequential consistency barrier, i.e., read/write-before-read/write,
subsuming membar_consumer.

In theoretical terms, MUTEX_MEMBAR_ENTER might imply only
write-before-read/write, so one might imagine that the
read-before-read ordering of membar_consumer _could_ be necessary.
However, the memory operations that are significant here are:

1. load owner := mtx->mtx_owner
2. store mtx->mtx_owner := owner | MUTEX_BIT_WAITERS
3. load owner->l_cpu->ci_curlwp to test if equal to owner

(1) is program-before (2) and at the same memory location,
mtx->mtx_owner, so (1) happens-before (2).

And (2) is separated in program order by MUTEX_MEMBAR_ENTER from (3),
so (2) happens-before (3).

So even if the membar_consumer were intended to guarantee that (1)
happens-before (3), it's not necessary, because we can already prove
it from MUTEX_MEMBAR_ENTER.

But actually, we don't really need (1) happens-before (3), exactly;
what we really need is (2) happens-before (3), since this is a little
manifestation of Dekker's algorithm between cpu_switchto and
mutex_exit, where each CPU sets one flag and must ensure it is
visible to the other CPUs before testing the other flag -- one flag
here is the MUTEX_BIT_WAITERS bit, and the other `flag' here is the
condition owner->l_cpu->ci_curlwp == owner; the corresponding logic,
in cpu_switchto, is:

1'. store owner->l_cpu->ci_curlwp := owner
2'. load mtx->mtx_owner to test if MUTEX_BIT_WAITERS set


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/kern/kern_mutex.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_mutex.c
diff -u src/sys/kern/kern_mutex.c:1.105 src/sys/kern/kern_mutex.c:1.106
--- src/sys/kern/kern_mutex.c:1.105	Wed Apr 12 06:35:40 2023
+++ src/sys/kern/kern_mutex.c	Mon May  1 12:17:56 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_mutex.c,v 1.105 2023/04/12 06:35:40 riastradh Exp $	*/
+/*	$NetBSD: kern_mutex.c,v 1.106 2023/05/01 12:17:56 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #define	__MUTEX_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.105 2023/04/12 06:35:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.106 2023/05/01 12:17:56 riastradh Exp $");
 
 #include 
 #include 
@@ -673,7 +673,6 @@ mutex_vector_enter(kmutex_t *mtx)
 		 * If the waiters bit is not set it's unsafe to go asleep,
 		 * as we might never be awoken.
 		 */
-		membar_consumer();
 		if (mutex_oncpu(owner)) {
 			turnstile_exit(mtx);
 			owner = mtx->mtx_owner;



CVS commit: src/usr.sbin/syslogd

2023-05-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon May  1 11:57:53 UTC 2023

Modified Files:
src/usr.sbin/syslogd: sign.html

Log Message:
s/betwen/between/ and s/singed/signed/.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/syslogd/sign.html

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

Modified files:

Index: src/usr.sbin/syslogd/sign.html
diff -u src/usr.sbin/syslogd/sign.html:1.1 src/usr.sbin/syslogd/sign.html:1.2
--- src/usr.sbin/syslogd/sign.html:1.1	Fri Oct 31 16:12:19 2008
+++ src/usr.sbin/syslogd/sign.html	Mon May  1 11:57:53 2023
@@ -9,7 +9,7 @@
 http://tools.ietf.org/html/draft-ietf-syslog-sign;>syslog-sign defines digital signatures for logfiles. This provides end-to-end authentication for network transports, enables the detection of lost UDP messages, and also makes it possible to check a log archive for later modifications (assuming the private key was kept safe).
 
 Signature Groups
-A basic concept of syslog-sign is the signature group which describes a set of messages that are grouped and signed together. Their purpose becomes clear with an example: assume you split your messages to two logservers serverA and serverB. Now if all messages were singed as one stream, then a) where do the signatures go to? and b) how could serverA, having only hashes and signatures, decide which message are missing and which are on serverB?
+A basic concept of syslog-sign is the signature group which describes a set of messages that are grouped and signed together. Their purpose becomes clear with an example: assume you split your messages to two logservers serverA and serverB. Now if all messages were signed as one stream, then a) where do the signatures go to? and b) how could serverA, having only hashes and signatures, decide which message are missing and which are on serverB?
 Thus the messages are selected into two signature groups containing all signatures for messages to serverA and serverB respectively. Then every server has its own messages and its own signatures to verify them.
 There are three predefined and one custom signature groups:
 
@@ -22,7 +22,7 @@ Thus the messages are selected into two 
 
 Configuration/Activation
 syslog-sign is enabled with the option "sign_sg" in syslog.conf. The value selects the signature group strategy, so for example the line "sign_sg=0" enables syslog-sign with one signature group.
-The SG="2" strategy is the only one that might require additional configuration. When selected (with "sign_sg=2") the default is to use one signature group per facility (kernel, user, mail, ...). To allow custom configuration there is an additional option "sign_sg2_delim" to specify the numerical SPRI values, i.e. the boundaries betwen the signature groups.
+The SG="2" strategy is the only one that might require additional configuration. When selected (with "sign_sg=2") the default is to use one signature group per facility (kernel, user, mail, ...). To allow custom configuration there is an additional option "sign_sg2_delim" to specify the numerical SPRI values, i.e. the boundaries between the signature groups.
 Example: With "sign_sg2_delim = 15 31" syslogd will set up three signature groups: one for all priorities x  15 (kernel.*,user.*), one for priorities 15  x  31 (mail.*), and one for all priorities x  31.
 
 Key, Signature, and Hash Types
@@ -137,7 +137,7 @@ messages without signature:
 
   
 Martin Schtte i...@mschuette.name  
-$Id: sign.html,v 1.1 2008/10/31 16:12:19 christos Exp $  
+$Id: sign.html,v 1.2 2023/05/01 11:57:53 andvar Exp $  
   
 
 



CVS commit: src/usr.sbin/syslogd

2023-05-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon May  1 11:57:53 UTC 2023

Modified Files:
src/usr.sbin/syslogd: sign.html

Log Message:
s/betwen/between/ and s/singed/signed/.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/syslogd/sign.html

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



CVS commit: src/sys/external/bsd/drm2/include/linux

2023-05-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May  1 09:41:55 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/include/linux: interval_tree.h

Log Message:
drm: KASSERT(A && B) -> KASSERT(A); KASSERT(B)


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/sys/external/bsd/drm2/include/linux/interval_tree.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/external/bsd/drm2/include/linux/interval_tree.h
diff -u src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.13 src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.14
--- src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.13	Sun Feb 27 14:18:25 2022
+++ src/sys/external/bsd/drm2/include/linux/interval_tree.h	Mon May  1 09:41:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: interval_tree.h,v 1.13 2022/02/27 14:18:25 riastradh Exp $	*/
+/*	$NetBSD: interval_tree.h,v 1.14 2023/05/01 09:41:55 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -120,7 +120,8 @@ interval_tree_iter_first(struct rb_root_
 		return NULL;
 	if (last < node->start)
 		return NULL;
-	KASSERT(node->start <= last && node->last >= start);
+	KASSERT(node->start <= last);
+	KASSERT(node->last >= start);
 
 	return node;
 }
@@ -142,7 +143,8 @@ interval_tree_iter_next(struct rb_root_c
 		return NULL;
 	if (last < next->start)
 		return NULL;
-	KASSERT(next->start <= last && next->last >= start);
+	KASSERT(next->start <= last);
+	KASSERT(next->last >= start);
 
 	return next;
 }



CVS commit: src/sys/external/bsd/drm2/include/linux

2023-05-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May  1 09:41:55 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/include/linux: interval_tree.h

Log Message:
drm: KASSERT(A && B) -> KASSERT(A); KASSERT(B)


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/sys/external/bsd/drm2/include/linux/interval_tree.h

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



CVS commit: src/sys/arch/xen/xen

2023-05-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May  1 09:03:19 UTC 2023

Modified Files:
src/sys/arch/xen/xen: xen_clock.c

Log Message:
xen_clock(4): Sprinkle dtrace probes.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/xen/xen/xen_clock.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/xen/xen/xen_clock.c
diff -u src/sys/arch/xen/xen/xen_clock.c:1.8 src/sys/arch/xen/xen/xen_clock.c:1.9
--- src/sys/arch/xen/xen/xen_clock.c:1.8	Mon Nov 30 17:05:02 2020
+++ src/sys/arch/xen/xen/xen_clock.c	Mon May  1 09:03:19 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_clock.c,v 1.8 2020/11/30 17:05:02 bouyer Exp $	*/
+/*	$NetBSD: xen_clock.c,v 1.9 2023/05/01 09:03:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.8 2020/11/30 17:05:02 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.9 2023/05/01 09:03:19 riastradh Exp $");
 
 #include 
 #include 
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: xen_clock.c,
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -76,6 +77,50 @@ static unsigned	xen_get_timecount(struct
 static int	xen_timer_handler(void *, struct clockframe *);
 
 /*
+ * dtrace probes
+ */
+SDT_PROBE_DEFINE7(sdt, xen, clock, tsc__backward,
+"uint64_t"/*raw_systime_ns*/,
+"uint64_t"/*tsc_timestamp*/,
+"uint64_t"/*tsc_to_system_mul*/,
+"int"/*tsc_shift*/,
+"uint64_t"/*delta_ns*/,
+"uint64_t"/*tsc*/,
+"uint64_t"/*systime_ns*/);
+SDT_PROBE_DEFINE7(sdt, xen, clock, tsc__delta__negative,
+"uint64_t"/*raw_systime_ns*/,
+"uint64_t"/*tsc_timestamp*/,
+"uint64_t"/*tsc_to_system_mul*/,
+"int"/*tsc_shift*/,
+"uint64_t"/*delta_ns*/,
+"uint64_t"/*tsc*/,
+"uint64_t"/*systime_ns*/);
+SDT_PROBE_DEFINE7(sdt, xen, clock, systime__wraparound,
+"uint64_t"/*raw_systime_ns*/,
+"uint64_t"/*tsc_timestamp*/,
+"uint64_t"/*tsc_to_system_mul*/,
+"int"/*tsc_shift*/,
+"uint64_t"/*delta_ns*/,
+"uint64_t"/*tsc*/,
+"uint64_t"/*systime_ns*/);
+SDT_PROBE_DEFINE7(sdt, xen, clock, systime__backward,
+"uint64_t"/*raw_systime_ns*/,
+"uint64_t"/*tsc_timestamp*/,
+"uint64_t"/*tsc_to_system_mul*/,
+"int"/*tsc_shift*/,
+"uint64_t"/*delta_ns*/,
+"uint64_t"/*tsc*/,
+"uint64_t"/*systime_ns*/);
+
+SDT_PROBE_DEFINE2(sdt, xen, hardclock, systime__backward,
+"uint64_t"/*last_systime_ns*/,
+"uint64_t"/*this_systime_ns*/);
+SDT_PROBE_DEFINE3(sdt, xen, hardclock, missed,
+"uint64_t"/*last_systime_ns*/,
+"uint64_t"/*this_systime_ns*/,
+"uint64_t"/*remaining_ns*/);
+
+/*
  * xen timecounter:
  *
  *	Xen vCPU system time, plus an adjustment with rdtsc.
@@ -277,7 +322,11 @@ xen_vcputime_systime_ns(void)
 		 * Notify the console that the CPU's tsc appeared to
 		 * run behind Xen's idea of it, and pretend it hadn't.
 		 */
-#if XEN_CLOCK_DEBUG		/* XXX dtrace hook */
+		SDT_PROBE7(sdt, xen, clock, tsc__backward,
+		raw_systime_ns, tsc_timestamp,
+		tsc_to_system_mul, tsc_shift, /*delta_ns*/0, tsc,
+		/*systime_ns*/raw_systime_ns);
+#if XEN_CLOCK_DEBUG
 		device_printf(ci->ci_dev, "xen cpu tsc %"PRIu64
 		" ran backwards from timestamp %"PRIu64
 		" by %"PRIu64"\n",
@@ -301,9 +350,13 @@ xen_vcputime_systime_ns(void)
 	 * This doesn't make sense but I include it out of paranoia.
 	 */
 	if (__predict_false((int64_t)delta_ns < 0)) {
-#if XEN_CLOCK_DEBUG		/* XXX dtrace hook */
-		device_printf(ci->ci_dev, "xen tsc delta in ns went negative: %"PRId64"\n",
-		delta_ns);
+		SDT_PROBE7(sdt, xen, clock, tsc__delta__negative,
+		raw_systime_ns, tsc_timestamp,
+		tsc_to_system_mul, tsc_shift, delta_ns, tsc,
+		/*systime_ns*/raw_systime_ns);
+#if XEN_CLOCK_DEBUG
+		device_printf(ci->ci_dev, "xen tsc delta in ns went negative:"
+		" %"PRId64"\n", delta_ns);
 #endif
 		ci->ci_xen_tsc_delta_negative_evcnt.ev_count++;
 		delta_ns = 0;
@@ -322,7 +375,11 @@ xen_vcputime_systime_ns(void)
 	 * (2^64 ns is approximately half a millennium.)
 	 */
 	if (__predict_false(systime_ns < raw_systime_ns)) {
-#if XEN_CLOCK_DEBUG		/* XXX dtrace hook */
+		SDT_PROBE7(sdt, xen, clock, systime__wraparound,
+		raw_systime_ns, tsc_timestamp,
+		tsc_to_system_mul, tsc_shift, delta_ns, tsc,
+		systime_ns);
+#if XEN_CLOCK_DEBUG
 		printf("xen raw systime + tsc delta wrapped around:"
 		" %"PRIu64" + %"PRIu64" = %"PRIu64"\n",
 		raw_systime_ns, delta_ns, systime_ns);
@@ -336,7 +393,11 @@ xen_vcputime_systime_ns(void)
 	 * forward.  This seems to happen pretty regularly under load.
 	 */
 	if (__predict_false(ci->ci_xen_last_systime_ns > systime_ns)) {
-#if XEN_CLOCK_DEBUG		/* XXX dtrace hook */
+		SDT_PROBE7(sdt, xen, clock, systime__backward,
+		raw_systime_ns, tsc_timestamp,
+		tsc_to_system_mul, tsc_shift, 

CVS commit: src/sys/arch/xen/xen

2023-05-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon May  1 09:03:19 UTC 2023

Modified Files:
src/sys/arch/xen/xen: xen_clock.c

Log Message:
xen_clock(4): Sprinkle dtrace probes.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/xen/xen/xen_clock.c

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