CVS commit: othersrc/libexec/tnftpd

2023-09-23 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Sun Sep 24 04:54:13 UTC 2023

Modified Files:
othersrc/libexec/tnftpd: configure.ac tnftpd.h

Log Message:
configure: remove obsolete macros

Remove macros marked obsolescent in autoconf 2.69 and
warned as obsolete in autoconf 2.71:
 AC_HEADER_STDC()
 AC_HEADER_TIME()
 AC_TYPE_SIGNAL()


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 othersrc/libexec/tnftpd/configure.ac
cvs rdiff -u -r1.41 -r1.42 othersrc/libexec/tnftpd/tnftpd.h

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



CVS commit: othersrc/libexec/tnftpd

2023-09-23 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Sun Sep 24 04:54:13 UTC 2023

Modified Files:
othersrc/libexec/tnftpd: configure.ac tnftpd.h

Log Message:
configure: remove obsolete macros

Remove macros marked obsolescent in autoconf 2.69 and
warned as obsolete in autoconf 2.71:
 AC_HEADER_STDC()
 AC_HEADER_TIME()
 AC_TYPE_SIGNAL()


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 othersrc/libexec/tnftpd/configure.ac
cvs rdiff -u -r1.41 -r1.42 othersrc/libexec/tnftpd/tnftpd.h

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

Modified files:

Index: othersrc/libexec/tnftpd/configure.ac
diff -u othersrc/libexec/tnftpd/configure.ac:1.53 othersrc/libexec/tnftpd/configure.ac:1.54
--- othersrc/libexec/tnftpd/configure.ac:1.53	Sun Sep 24 02:07:11 2023
+++ othersrc/libexec/tnftpd/configure.ac	Sun Sep 24 04:54:13 2023
@@ -1,4 +1,4 @@
-# $NetBSD: configure.ac,v 1.53 2023/09/24 02:07:11 lukem Exp $
+# $NetBSD: configure.ac,v 1.54 2023/09/24 04:54:13 lukem Exp $
 #
 # Process this file with autoconf to produce a configure script.
 
@@ -206,8 +206,6 @@ AC_CHECK_HEADERS([sys/types.h sys/ioctl.
 AC_HEADER_DIRENT()
 AC_HEADER_RESOLV()
 AC_HEADER_STAT()
-AC_HEADER_STDC()
-AC_HEADER_TIME()
 AC_HEADER_TIOCGWINSZ()
 AC_CHECK_HEADERS([sys/resource.h \
   arpa/inet.h arpa/nameser.h arpa/telnet.h err.h \
@@ -249,7 +247,6 @@ AC_TYPE_LONG_LONG_INT()
 AC_TYPE_UINT32_T()
 AC_TYPE_OFF_T()
 AC_TYPE_PID_T()
-AC_TYPE_SIGNAL()
 AC_TYPE_SIZE_T()
 AC_STRUCT_TM()
 AC_CHECK_MEMBERS([struct sockaddr.sa_len, struct sockaddr_in.sin_len,

Index: othersrc/libexec/tnftpd/tnftpd.h
diff -u othersrc/libexec/tnftpd/tnftpd.h:1.41 othersrc/libexec/tnftpd/tnftpd.h:1.42
--- othersrc/libexec/tnftpd/tnftpd.h:1.41	Sat Sep 23 04:45:03 2023
+++ othersrc/libexec/tnftpd/tnftpd.h	Sun Sep 24 04:54:13 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: tnftpd.h,v 1.41 2023/09/23 04:45:03 lukem Exp $ */
+/* $NetBSD: tnftpd.h,v 1.42 2023/09/24 04:54:13 lukem Exp $ */
 
 #define	FTPD_VERSION	PACKAGE_STRING
 
@@ -11,11 +11,9 @@
 #if defined(HAVE_SYS_TYPES_H)
 # include 
 #endif
-#if defined(STDC_HEADERS)
-# include 
-# include 
-# include 
-#endif
+#include 
+#include 
+#include 
 #if defined(HAVE_UNISTD_H)
 # include 
 #endif
@@ -154,16 +152,10 @@ struct pollfd {
 };
 #endif
 
-#if defined(TIME_WITH_SYS_TIME)
+#if defined(HAVE_SYS_TIME_H)
 # include 
-# include 
-#else
-# if defined(HAVE_SYS_TIME_H)
-#  include 
-# else
-#  include 
-# endif
 #endif
+#include 
 
 #if defined(HAVE_SYS_RESOURCE_H)
 # include 



CVS commit: othersrc/libexec/tnftpd

2023-09-23 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Sun Sep 24 02:07:12 UTC 2023

Modified Files:
othersrc/libexec/tnftpd: configure.ac

Log Message:
configure: improve check for inet_net_pton()

Look for inet_net_pton() in -lresolv (for glibc).
Move library checks after header checks, in case latter are needed for former.
Display vars at end of configure: CC, CFLAGS, CPPFLAGS, LDFLAGS, LIBS


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 othersrc/libexec/tnftpd/configure.ac

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

Modified files:

Index: othersrc/libexec/tnftpd/configure.ac
diff -u othersrc/libexec/tnftpd/configure.ac:1.52 othersrc/libexec/tnftpd/configure.ac:1.53
--- othersrc/libexec/tnftpd/configure.ac:1.52	Sat Sep 23 04:45:03 2023
+++ othersrc/libexec/tnftpd/configure.ac	Sun Sep 24 02:07:11 2023
@@ -1,4 +1,4 @@
-# $NetBSD: configure.ac,v 1.52 2023/09/23 04:45:03 lukem Exp $
+# $NetBSD: configure.ac,v 1.53 2023/09/24 02:07:11 lukem Exp $
 #
 # Process this file with autoconf to produce a configure script.
 
@@ -139,23 +139,6 @@ AS_CASE([$target_os],
 )
 
 #
-# Checks for libraries.
-#
-AC_SEARCH_LIBS([crypt], [crypt])
-AC_SEARCH_LIBS([pidfile], [util])
-AC_SEARCH_LIBS([setproctitle], [util])
-
-AC_SEARCH_LIBS([gethostbyname], [nsl])
-AC_SEARCH_LIBS([socket],
-   [socket],
-   [],
-   [AC_CHECK_LIB([socket],
- [socket],
- [LIBS="-lsocket -lnsl $LIBS"],
- [],
- [-lnsl])])
-
-#
 # Checks for header files.
 #
 accheck_includes='
@@ -236,6 +219,26 @@ AC_CHECK_HEADERS([sys/resource.h \
   [], [], [$accheck_includes])
 
 #
+# Checks for libraries with specific functions.
+#
+AC_SEARCH_LIBS([crypt], [crypt])
+AC_SEARCH_LIBS([pidfile], [util])
+AC_SEARCH_LIBS([setproctitle], [util])
+
+AC_SEARCH_LIBS([gethostbyname], [nsl])
+AC_SEARCH_LIBS([socket],
+   [socket],
+   [],
+   [AC_CHECK_LIB([socket],
+ [socket],
+ [LIBS="-lsocket -lnsl $LIBS"],
+ [],
+ [-lnsl])])
+
+AC_SEARCH_LIBS([inet_net_pton], [resolv], [], [AC_LIBOBJ([inet_net_pton])])
+AC_CHECK_FUNCS([inet_net_pton])
+
+#
 # Checks for typedefs, structures, and compiler characteristics.
 #
 AC_CHECK_DECLS([AI_NUMERICHOST, FNM_CASEFOLD,
@@ -286,7 +289,7 @@ AC_FUNC_FSEEKO()
 AC_FUNC_STRCOLL()
 AC_REPLACE_FUNCS([daemon err explicit_memset fgetln fparseln \
   getaddrinfo getgrouplist getnameinfo getusershell \
-  inet_net_pton inet_ntop inet_pton mkstemp \
+  inet_ntop inet_pton mkstemp \
   setprogname sl_init snprintf strdup strerror strsuftollx \
   strlcat strlcpy strsep usleep])
 AC_CHECK_FUNCS([dirfd getcwd gethostbyaddr gethostbyname gethostbyname2 \
@@ -294,6 +297,7 @@ AC_CHECK_FUNCS([dirfd getcwd gethostbyad
 isascii madvise memmove memset mmap pidfile realpath \
 select setlogin setproctitle setegid seteuid \
 setresgid setresuid strcasecmp strtol strtoul vfork])
+
 AS_IF([test "$ac_cv_func_dirfd" = no],
   [AC_MSG_CHECKING([whether dirfd() is a macro])
AC_EGREP_CPP([have_dirfd_as_macro], [
@@ -530,6 +534,11 @@ AC_OUTPUT()
 AC_MSG_NOTICE([ === Configuration results ===])
 AC_MSG_NOTICE([Package:   $PACKAGE_STRING])
 AC_MSG_NOTICE([Prefix:$prefix])
+AC_MSG_NOTICE([CC $CC])
+AC_MSG_NOTICE([CFLAGS $CFLAGS])
+AC_MSG_NOTICE([CPPFLAGS   $CPPFLAGS])
+AC_MSG_NOTICE([LDFLAGS$LDFLAGS])
+AC_MSG_NOTICE([LIBS   $LIBS])
 AC_MSG_NOTICE([--enable-builtinls $opt_builtinls])
 AC_MSG_NOTICE([--enable-ipv6  $opt_ipv6])
 AC_MSG_NOTICE([--with-blocklist   $with_blocklist])



CVS commit: othersrc/libexec/tnftpd

2023-09-23 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Sun Sep 24 02:07:12 UTC 2023

Modified Files:
othersrc/libexec/tnftpd: configure.ac

Log Message:
configure: improve check for inet_net_pton()

Look for inet_net_pton() in -lresolv (for glibc).
Move library checks after header checks, in case latter are needed for former.
Display vars at end of configure: CC, CFLAGS, CPPFLAGS, LDFLAGS, LIBS


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 othersrc/libexec/tnftpd/configure.ac

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



CVS commit: othersrc/libexec/tnftpd

2023-09-23 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Sun Sep 24 01:23:17 UTC 2023

Modified Files:
othersrc/libexec/tnftpd: ChangeLog NEWS

Log Message:
update ChangeLog for yesterday's improvements


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 othersrc/libexec/tnftpd/ChangeLog
cvs rdiff -u -r1.15 -r1.16 othersrc/libexec/tnftpd/NEWS

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

Modified files:

Index: othersrc/libexec/tnftpd/ChangeLog
diff -u othersrc/libexec/tnftpd/ChangeLog:1.64 othersrc/libexec/tnftpd/ChangeLog:1.65
--- othersrc/libexec/tnftpd/ChangeLog:1.64	Sat Jul  4 06:49:19 2020
+++ othersrc/libexec/tnftpd/ChangeLog	Sun Sep 24 01:23:17 2023
@@ -1,6 +1,40 @@
-$NetBSD: ChangeLog,v 1.64 2020/07/04 06:49:19 lukem Exp $
+$NetBSD: ChangeLog,v 1.65 2023/09/24 01:23:17 lukem Exp $
 
-Sat Jul  4 06:40:38 UTC 2020	lukem
+Sat Sep 23 05:39:49 UTC 2023	lu...@netbsd.org
+
+	* Security fixes:
+		* CVE-2020-7468: Improve error handling when switching UID/GID.
+		* Prevent MLSD and MLST before authentication succeeds.
+
+	* Update to NetBSD-ftpd 20230922:
+		* Treat failed chdir/chroot for guest and chroot accounts as
+		  fatal. Also treat failed set{e,}(u,g}id calls as fatal.
+		  Addresses CVE-2020-7468, via FreeBSD.
+		* Improve seteuid error handling, per suggestion by Simon
+		  Josefsson.
+		* Add missing check_login checks for MLST and MLSD.
+
+	* Sync libnetbsd replacements with NetBSD upstream:
+		* Replace fgetln() with tools/compat implementation that
+		  handles embedded NULs.
+		* Fix inet_net_pton() to avoid integer overflow in bits.
+		* Fix inet_ntop() to set errno when returning NULL.
+		* Fix inet_pton() to improve hex formatting.
+		* Fix sl_add() to not update size unless realloc() succeeds.
+
+	* Improve portability on NetBSD by providing own setprogname()
+	  and getprogname(), instead of defining global __progname. 
+
+	* Update example ftpusers to use example DNS and IP addresses.
+
+	* Build fixes:
+		* Improve configure's display of detected features.
+		* Enable more POSIX extensions.
+		* Only replace glob() if required GLOB_ flags aren't available.
+		* Only replace fts_open() if required FTS_ flags aren't
+		  available.
+
+Sat Jul  4 06:40:38 UTC 2020	lu...@netbsd.org
 
 	* Release as "tnftpd 20200704".
 
@@ -11,11 +45,11 @@ Sat Jul  4 06:40:38 UTC 2020	lukem
 		* Increase some buffer sizes.
 		* Rename blacklist to blocklist.
 
-Sun Jun  2 05:56:12 UTC 2019	lukem
+Sun Jun  2 05:56:12 UTC 2019	lu...@netbsd.org
 
 	* Release as "tnftpd 20190602".
 
-Tue Jan 29 23:12:52 UTC 2019	lukem
+Tue Jan 29 23:12:52 UTC 2019	lu...@netbsd.org
 
 	* Limit fnmatch(), fts(),  strsuftollx() recursion to avoid
 	  DoS attacks. From Maksymilian Arciemowicz.
@@ -56,13 +90,13 @@ Tue Jan 29 23:12:52 UTC 2019	lukem
 
 	* Remove endorsement clause from some of my licenses.
 
-Mon Mar 25 03:51:20 UTC 2013	lukem
+Mon Mar 25 03:51:20 UTC 2013	lu...@netbsd.org
 
 	* Release as "tnftpd 20130325"
 
 	* Fix incorrect use of test(1) in configure.
 
-Fri Mar 22 09:00:00 UTC 2013	lukem
+Fri Mar 22 09:00:00 UTC 2013	lu...@netbsd.org
 
 	* Release as "tnftpd 20130322"
 
@@ -81,7 +115,7 @@ Fri Mar 22 09:00:00 UTC 2013	lukem
 		* Reduce priority of syslog message if getpeername returns
 		  ENOTCONN.  PR/18934 from Greg A Woods.
 
-Wed Mar 24 12:34:09 UTC 2010	lukem
+Wed Mar 24 12:34:09 UTC 2010	lu...@netbsd.org
 
 	* Release as "tnftpd 20100324"
 
@@ -89,7 +123,7 @@ Wed Mar 24 12:34:09 UTC 2010	lukem
 		* Security fix; apply NetBSD popen.c 1.37:
 		  PR/43023: Bruce Cran: FTPD bug remote crash
 
-Mon Jan  4 05:51:15 UTC 2010	lukem
+Mon Jan  4 05:51:15 UTC 2010	lu...@netbsd.org
 
 	* Regenerate .manin manual page sources from upstream sources.
 
@@ -98,12 +132,12 @@ Mon Jan  4 05:51:15 UTC 2010	lukem
 	* Distribute various files not shipped by default automake rules,
 	  to use 'make dist' instead of 'cvs export'.
 
-Wed Dec 30 01:48:57 UTC 2009	lukem
+Wed Dec 30 01:48:57 UTC 2009	lu...@netbsd.org
 
 	* Release as "tnftpd 20091122"
 
-Sat Nov  7 11:13:38 UTC 2009	lukem
-	
+Sat Nov  7 11:13:38 UTC 2009	lu...@netbsd.org
+
 	* Convert to automake & libtool.
 
 	* Rename config.h to tnftpd_config.h.
@@ -121,7 +155,7 @@ Sat Nov  7 11:13:38 UTC 2009	lukem
 		* Log both the hostname and numeric address.
 		* Improve man page mdoc formatting
 
-Sun Mar  1 03:10:40 UTC 2009	lukem
+Sun Mar  1 03:10:40 UTC 2009	lu...@netbsd.org
 
 	* fts_open.c:
 		- Ensure fts_close() doesn't spuriously close fd 0,
@@ -131,22 +165,22 @@ Sun Mar  1 03:10:40 UTC 2009	lukem
 		  damage.
 		   Received from OpenBSD via US-CERT as VU #590371.
 
-Tue Dec 30 22:36:05 UTC 2008	lukem
+Tue Dec 30 22:36:05 UTC 2008	lu...@netbsd.org
 
 	* Fix the SIA implementation, per feedback from Onno van der Linden.
 
-Sat Dec 20 07:41:22 UTC 2008	lukem
+Sat Dec 20 07:41:22 UTC 2008	lu...@netbsd.org
 
 	* Install into ${exec_prefix}/libexec instead of 

CVS commit: othersrc/libexec/tnftpd

2023-09-23 Thread Luke Mewburn
Module Name:othersrc
Committed By:   lukem
Date:   Sun Sep 24 01:23:17 UTC 2023

Modified Files:
othersrc/libexec/tnftpd: ChangeLog NEWS

Log Message:
update ChangeLog for yesterday's improvements


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 othersrc/libexec/tnftpd/ChangeLog
cvs rdiff -u -r1.15 -r1.16 othersrc/libexec/tnftpd/NEWS

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



CVS commit: src/sys/arch/powerpc/oea

2023-09-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 23 21:26:16 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c ofwoea_machdep.c

Log Message:
add ifdef NWSDISPLAY > 0 around rascons_* functions usage,
otherwise implementation is not available, which breaks macppc MAMBO config.

potentially better solution to provide empty implementation, comments welcome.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/oea/ofw_autoconf.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/powerpc/oea/ofwoea_machdep.c

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



CVS commit: src/sys/arch/powerpc/oea

2023-09-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 23 21:26:16 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c ofwoea_machdep.c

Log Message:
add ifdef NWSDISPLAY > 0 around rascons_* functions usage,
otherwise implementation is not available, which breaks macppc MAMBO config.

potentially better solution to provide empty implementation, comments welcome.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/oea/ofw_autoconf.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/powerpc/oea/ofwoea_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/powerpc/oea/ofw_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.25 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.26
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.25	Wed Dec 14 13:19:04 2022
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Sat Sep 23 21:26:16 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.25 2022/12/14 13:19:04 macallan Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.26 2023/09/23 21:26:16 andvar Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.25 2022/12/14 13:19:04 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.26 2023/09/23 21:26:16 andvar Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -82,7 +82,9 @@ static void canonicalize_bootpath(void);
 void
 cpu_configure(void)
 {
+#if NWSDISPLAY > 0
 	rascons_add_rom_font();
+#endif
 	init_interrupt();
 	canonicalize_bootpath();
 

Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.62 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.63
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.62	Sun Dec  5 07:13:48 2021
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Sat Sep 23 21:26:16 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.62 2021/12/05 07:13:48 msaitoh Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.62 2021/12/05 07:13:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $");
 
 #include "ksyms.h"
 #include "wsdisplay.h"
@@ -270,7 +270,9 @@ ofwoea_initppc(u_int startkernel, u_int 
 
 	restore_ofmap();
 
+#if NWSDISPLAY > 0
 	rascons_finalize();
+#endif
 
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 	ksyms_addsyms_elf((int)((uintptr_t)endsym - (uintptr_t)startsym), startsym, endsym);



CVS commit: src/sys

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 20:23:07 UTC 2023

Modified Files:
src/sys/kern: kern_lwp.c kern_sleepq.c kern_synch.c
src/sys/sys: lwp.h

Log Message:
Sigh..  Adjust previous to work as intended.  The boosted LWP priority
didn't persist as far as the run queue because l_syncobj gets reset
earlier than I recalled.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.75 -r1.76 src/sys/kern/kern_sleepq.c
cvs rdiff -u -r1.359 -r1.360 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.221 -r1.222 src/sys/sys/lwp.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/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.256 src/sys/kern/kern_lwp.c:1.257
--- src/sys/kern/kern_lwp.c:1.256	Sat Sep 23 18:48:04 2023
+++ src/sys/kern/kern_lwp.c	Sat Sep 23 20:23:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.256 2023/09/23 18:48:04 ad Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.257 2023/09/23 20:23:07 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019, 2020, 2023
@@ -217,7 +217,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.256 2023/09/23 18:48:04 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.257 2023/09/23 20:23:07 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -851,7 +851,13 @@ lwp_create(lwp_t *l1, proc_t *p2, vaddr_
 		return EAGAIN;
 	}
 
-	l2->l_priority = l1->l_priority;
+	/*
+	 * If vfork(), we want the LWP to run fast and on the same CPU
+	 * as its parent, so that it can reuse the VM context and cache
+	 * footprint on the local CPU.
+	 */
+	l2->l_boostpri = ((flags & LWP_VFORK) ? PRI_KERNEL : PRI_USER);
+ 	l2->l_priority = l1->l_priority;
 	l2->l_inheritedprio = -1;
 	l2->l_protectprio = -1;
 	l2->l_auxprio = -1;
@@ -1666,7 +1672,6 @@ lwp_lendpri(lwp_t *l, pri_t pri)
 pri_t
 lwp_eprio(lwp_t *l)
 {
-	pri_t boostpri = l->l_syncobj->sobj_boostpri;
 	pri_t pri = l->l_priority;
 
 	KASSERT(mutex_owned(l->l_mutex));
@@ -1681,8 +1686,8 @@ lwp_eprio(lwp_t *l)
 	 * boost and could be preempted very quickly by another LWP but that
 	 * won't happen often enough to be a annoyance.
 	 */
-	if (pri <= MAXPRI_USER && boostpri > PRI_USER)
-		pri = (pri >> 1) + boostpri;
+	if (pri <= MAXPRI_USER && l->l_boostpri > MAXPRI_USER)
+		pri = (pri >> 1) + l->l_boostpri;
 
 	return MAX(l->l_auxprio, pri);
 }

Index: src/sys/kern/kern_sleepq.c
diff -u src/sys/kern/kern_sleepq.c:1.75 src/sys/kern/kern_sleepq.c:1.76
--- src/sys/kern/kern_sleepq.c:1.75	Sat Sep 23 18:48:04 2023
+++ src/sys/kern/kern_sleepq.c	Sat Sep 23 20:23:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sleepq.c,v 1.75 2023/09/23 18:48:04 ad Exp $	*/
+/*	$NetBSD: kern_sleepq.c,v 1.76 2023/09/23 20:23:07 ad Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009, 2019, 2020, 2023
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.75 2023/09/23 18:48:04 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.76 2023/09/23 20:23:07 ad Exp $");
 
 #include 
 #include 
@@ -368,6 +368,7 @@ sleepq_block(int timo, bool catch_p, syn
 			l->l_flag &= ~LW_STIMO;
 			callout_schedule(>l_timeout_ch, timo);
 		}
+		l->l_boostpri = l->l_syncobj->sobj_boostpri;
 		spc_lock(l->l_cpu);
 		mi_switch(l);
 

Index: src/sys/kern/kern_synch.c
diff -u src/sys/kern/kern_synch.c:1.359 src/sys/kern/kern_synch.c:1.360
--- src/sys/kern/kern_synch.c:1.359	Sat Sep 23 18:48:04 2023
+++ src/sys/kern/kern_synch.c	Sat Sep 23 20:23:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.359 2023/09/23 18:48:04 ad Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.360 2023/09/23 20:23:07 ad Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009, 2019, 2020, 2023
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.359 2023/09/23 18:48:04 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.360 2023/09/23 20:23:07 ad Exp $");
 
 #include "opt_kstack.h"
 #include "opt_ddb.h"
@@ -561,6 +561,7 @@ nextlwp(struct cpu_info *ci, struct sche
 		KASSERT(newl->l_cpu == ci);
 		newl->l_stat = LSONPROC;
 		newl->l_pflag |= LP_RUNNING;
+		newl->l_boostpri = PRI_NONE;
 		spc->spc_curpriority = lwp_eprio(newl);
 		spc->spc_flags &= ~(SPCF_SWITCHCLEAR | SPCF_IDLE);
 		lwp_setlock(newl, spc->spc_lwplock);

Index: src/sys/sys/lwp.h
diff -u src/sys/sys/lwp.h:1.221 src/sys/sys/lwp.h:1.222
--- src/sys/sys/lwp.h:1.221	Sat Sep 23 18:48:05 2023
+++ src/sys/sys/lwp.h	Sat Sep 23 20:23:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.221 2023/09/23 18:48:05 ad Exp $	*/
+/*	$NetBSD: lwp.h,v 1.222 2023/09/23 20:23:07 ad Exp $	*/
 
 /*
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010, 2019, 2020, 2023
@@ -112,6 +112,7 @@ struct lwp {
 	u_int		l_slpticksum;	/* l: Sum of ticks spent sleeping */
 	int		l_biglocks;	/* l: biglock count before sleep */
 	int		l_class;	/* l: scheduling class */
+	pri_t		l_boostpri;	/* l: 

CVS commit: src/sys

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 20:23:07 UTC 2023

Modified Files:
src/sys/kern: kern_lwp.c kern_sleepq.c kern_synch.c
src/sys/sys: lwp.h

Log Message:
Sigh..  Adjust previous to work as intended.  The boosted LWP priority
didn't persist as far as the run queue because l_syncobj gets reset
earlier than I recalled.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.75 -r1.76 src/sys/kern/kern_sleepq.c
cvs rdiff -u -r1.359 -r1.360 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.221 -r1.222 src/sys/sys/lwp.h

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



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

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 19:17:38 UTC 2023

Modified Files:
src/common/lib/libc/gen: radixtree.c

Log Message:
kmem_free() -> kmem_intr_free().  Spotted by rin@.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/common/lib/libc/gen/radixtree.c

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

Modified files:

Index: src/common/lib/libc/gen/radixtree.c
diff -u src/common/lib/libc/gen/radixtree.c:1.32 src/common/lib/libc/gen/radixtree.c:1.33
--- src/common/lib/libc/gen/radixtree.c:1.32	Sat Sep 23 18:21:11 2023
+++ src/common/lib/libc/gen/radixtree.c	Sat Sep 23 19:17:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: radixtree.c,v 1.32 2023/09/23 18:21:11 ad Exp $	*/
+/*	$NetBSD: radixtree.c,v 1.33 2023/09/23 19:17:38 ad Exp $	*/
 
 /*-
  * Copyright (c)2011,2012,2013 YAMAMOTO Takashi,
@@ -112,7 +112,7 @@
 #include 
 
 #if defined(_KERNEL) || defined(_STANDALONE)
-__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.32 2023/09/23 18:21:11 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.33 2023/09/23 19:17:38 ad Exp $");
 #include 
 #include 
 #include 
@@ -122,7 +122,7 @@ __KERNEL_RCSID(0, "$NetBSD: radixtree.c,
 #include 
 #endif /* defined(_STANDALONE) */
 #else /* defined(_KERNEL) || defined(_STANDALONE) */
-__RCSID("$NetBSD: radixtree.c,v 1.32 2023/09/23 18:21:11 ad Exp $");
+__RCSID("$NetBSD: radixtree.c,v 1.33 2023/09/23 19:17:38 ad Exp $");
 #include 
 #include 
 #include 
@@ -335,7 +335,7 @@ radix_tree_await_memory(void)
 		KM_SLEEP);
 	}
 	while (--i >= 0) {
-		kmem_free(nodes[i], sizeof(struct radix_tree_node));
+		kmem_intr_free(nodes[i], sizeof(struct radix_tree_node));
 	}
 }
 



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

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 19:17:38 UTC 2023

Modified Files:
src/common/lib/libc/gen: radixtree.c

Log Message:
kmem_free() -> kmem_intr_free().  Spotted by rin@.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/common/lib/libc/gen/radixtree.c

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



Re: CVS commit: src

2023-09-23 Thread Andrew Doran
On Sun, Sep 24, 2023 at 03:51:07AM +0900, Rin Okuyama wrote:
> Hi,
> 
> On 2023/09/24 3:21, Andrew Doran wrote:
> > Index: src/common/lib/libc/gen/radixtree.c
> > diff -u src/common/lib/libc/gen/radixtree.c:1.31 
> > src/common/lib/libc/gen/radixtree.c:1.32
> > --- src/common/lib/libc/gen/radixtree.c:1.31Tue Sep 12 16:17:21 2023
> > +++ src/common/lib/libc/gen/radixtree.c Sat Sep 23 18:21:11 2023
> ...
> > @@ -346,10 +331,11 @@ radix_tree_await_memory(void)
> > int i;
> > for (i = 0; i < __arraycount(nodes); i++) {
> > -   nodes[i] = pool_cache_get(radix_tree_node_cache, PR_WAITOK);
> > +   nodes[i] = kmem_intr_alloc(sizeof(struct radix_tree_node),
> > +   KM_SLEEP);
> > }
> > while (--i >= 0) {
> > -   pool_cache_put(radix_tree_node_cache, nodes[i]);
> > +   kmem_free(nodes[i], sizeof(struct radix_tree_node));
> > }
> >   }
> 
> kmem_intr_free() here?

Good catch! Thank you.

Andrew


Re: CVS commit: src

2023-09-23 Thread Rin Okuyama

Hi,

On 2023/09/24 3:21, Andrew Doran wrote:

Index: src/common/lib/libc/gen/radixtree.c
diff -u src/common/lib/libc/gen/radixtree.c:1.31 
src/common/lib/libc/gen/radixtree.c:1.32
--- src/common/lib/libc/gen/radixtree.c:1.31Tue Sep 12 16:17:21 2023
+++ src/common/lib/libc/gen/radixtree.c Sat Sep 23 18:21:11 2023

...

@@ -346,10 +331,11 @@ radix_tree_await_memory(void)
int i;
  
  	for (i = 0; i < __arraycount(nodes); i++) {

-   nodes[i] = pool_cache_get(radix_tree_node_cache, PR_WAITOK);
+   nodes[i] = kmem_intr_alloc(sizeof(struct radix_tree_node),
+   KM_SLEEP);
}
while (--i >= 0) {
-   pool_cache_put(radix_tree_node_cache, nodes[i]);
+   kmem_free(nodes[i], sizeof(struct radix_tree_node));
}
  }
  


kmem_intr_free() here?

Thanks,
rin


CVS commit: src/sys/sys

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 18:49:16 UTC 2023

Modified Files:
src/sys/sys: param.h

Log Message:
NetBSD 10.99.9 - struct lwp changed


To generate a diff of this commit:
cvs rdiff -u -r1.731 -r1.732 src/sys/sys/param.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/sys/param.h
diff -u src/sys/sys/param.h:1.731 src/sys/sys/param.h:1.732
--- src/sys/sys/param.h:1.731	Wed Sep  6 12:31:49 2023
+++ src/sys/sys/param.h	Sat Sep 23 18:49:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.731 2023/09/06 12:31:49 riastradh Exp $	*/
+/*	$NetBSD: param.h,v 1.732 2023/09/23 18:49:16 ad Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	1099000800	/* NetBSD 10.99.8 */
+#define	__NetBSD_Version__	1099000900	/* NetBSD 10.99.9 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/sys

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 18:49:16 UTC 2023

Modified Files:
src/sys/sys: param.h

Log Message:
NetBSD 10.99.9 - struct lwp changed


To generate a diff of this commit:
cvs rdiff -u -r1.731 -r1.732 src/sys/sys/param.h

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



CVS commit: src/sys

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 18:48:05 UTC 2023

Modified Files:
src/sys/kern: kern_condvar.c kern_lwp.c kern_mutex.c kern_rwlock.c
kern_sleepq.c kern_synch.c kern_timeout.c kern_turnstile.c
sys_lwp.c sys_select.c
src/sys/rump/librump/rumpkern: sleepq.c
src/sys/sys: lwp.h sleepq.h syncobj.h userret.h

Log Message:
- Simplify how priority boost for blocking in kernel is handled.  Rather
  than setting it up at each site where we block, make it a property of
  syncobj_t.  Then, do not hang onto the priority boost until userret(),
  drop it as soon as the LWP is out of the run queue and onto a CPU.
  Holding onto it longer is of questionable benefit.

- This allows two members of lwp_t to be deleted, and mi_userret() to be
  simplified a lot (next step: trim it down to a single conditional).

- While here, constify syncobj_t and de-inline a bunch of small functions
  like lwp_lock() which turn out not to be small after all (I don't know
  why, but atomic_*_relaxed() seem to provoke a compiler shitfit above and
  beyond what volatile does).


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/kern/kern_condvar.c
cvs rdiff -u -r1.255 -r1.256 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.109 -r1.110 src/sys/kern/kern_mutex.c
cvs rdiff -u -r1.72 -r1.73 src/sys/kern/kern_rwlock.c
cvs rdiff -u -r1.74 -r1.75 src/sys/kern/kern_sleepq.c
cvs rdiff -u -r1.358 -r1.359 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.76 -r1.77 src/sys/kern/kern_timeout.c
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/kern_turnstile.c
cvs rdiff -u -r1.84 -r1.85 src/sys/kern/sys_lwp.c
cvs rdiff -u -r1.61 -r1.62 src/sys/kern/sys_select.c
cvs rdiff -u -r1.23 -r1.24 src/sys/rump/librump/rumpkern/sleepq.c
cvs rdiff -u -r1.220 -r1.221 src/sys/sys/lwp.h
cvs rdiff -u -r1.36 -r1.37 src/sys/sys/sleepq.h
cvs rdiff -u -r1.15 -r1.16 src/sys/sys/syncobj.h
cvs rdiff -u -r1.33 -r1.34 src/sys/sys/userret.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/kern_condvar.c
diff -u src/sys/kern/kern_condvar.c:1.55 src/sys/kern/kern_condvar.c:1.56
--- src/sys/kern/kern_condvar.c:1.55	Mon Jul 17 12:54:29 2023
+++ src/sys/kern/kern_condvar.c	Sat Sep 23 18:48:04 2023
@@ -1,7 +1,8 @@
-/*	$NetBSD: kern_condvar.c,v 1.55 2023/07/17 12:54:29 riastradh Exp $	*/
+/*	$NetBSD: kern_condvar.c,v 1.56 2023/09/23 18:48:04 ad Exp $	*/
 
 /*-
- * Copyright (c) 2006, 2007, 2008, 2019, 2020 The NetBSD Foundation, Inc.
+ * Copyright (c) 2006, 2007, 2008, 2019, 2020, 2023
+ * The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -34,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.55 2023/07/17 12:54:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.56 2023/09/23 18:48:04 ad Exp $");
 
 #include 
 #include 
@@ -72,6 +73,7 @@ static inline void	cv_wakeup_all(kcondva
 syncobj_t cv_syncobj = {
 	.sobj_name	= "cv",
 	.sobj_flag	= SOBJ_SLEEPQ_SORTED,
+	.sobj_boostpri  = PRI_KERNEL,
 	.sobj_unsleep	= cv_unsleep,
 	.sobj_changepri	= sleepq_changepri,
 	.sobj_lendpri	= sleepq_lendpri,
@@ -127,7 +129,6 @@ cv_enter(kcondvar_t *cv, kmutex_t *mtx, 
 	KASSERT(!cpu_intr_p());
 	KASSERT((l->l_pflag & LP_INTR) == 0 || panicstr != NULL);
 
-	l->l_kpriority = true;
 	mp = sleepq_hashlock(cv);
 	sq = CV_SLEEPQ(cv);
 	sleepq_enter(sq, l, mp);

Index: src/sys/kern/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.255 src/sys/kern/kern_lwp.c:1.256
--- src/sys/kern/kern_lwp.c:1.255	Sat Sep 23 18:21:11 2023
+++ src/sys/kern/kern_lwp.c	Sat Sep 23 18:48:04 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.255 2023/09/23 18:21:11 ad Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.256 2023/09/23 18:48:04 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019, 2020, 2023
@@ -217,7 +217,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.255 2023/09/23 18:21:11 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.256 2023/09/23 18:48:04 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -851,13 +851,6 @@ lwp_create(lwp_t *l1, proc_t *p2, vaddr_
 		return EAGAIN;
 	}
 
-	/*
-	 * If vfork(), we want the LWP to run fast and on the same CPU
-	 * as its parent, so that it can reuse the VM context and cache
-	 * footprint on the local CPU.
-	 */
-	l2->l_kpriority = ((flags & LWP_VFORK) ? true : false);
-	l2->l_kpribase = PRI_KERNEL;
 	l2->l_priority = l1->l_priority;
 	l2->l_inheritedprio = -1;
 	l2->l_protectprio = -1;
@@ -1619,34 +1612,124 @@ lwp_unsleep(lwp_t *l, bool unlock)
 }
 
 /*
+ * Lock an LWP.
+ */
+void
+lwp_lock(lwp_t *l)
+{
+	kmutex_t *old = atomic_load_consume(>l_mutex);
+
+	/*
+	 * Note: mutex_spin_enter() will have posted a read barrier.
+	 * Re-test l->l_mutex.  If it has changed, we need to try again.
+	 */
+	mutex_spin_enter(old);
+	while 

CVS commit: src/sys

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 18:48:05 UTC 2023

Modified Files:
src/sys/kern: kern_condvar.c kern_lwp.c kern_mutex.c kern_rwlock.c
kern_sleepq.c kern_synch.c kern_timeout.c kern_turnstile.c
sys_lwp.c sys_select.c
src/sys/rump/librump/rumpkern: sleepq.c
src/sys/sys: lwp.h sleepq.h syncobj.h userret.h

Log Message:
- Simplify how priority boost for blocking in kernel is handled.  Rather
  than setting it up at each site where we block, make it a property of
  syncobj_t.  Then, do not hang onto the priority boost until userret(),
  drop it as soon as the LWP is out of the run queue and onto a CPU.
  Holding onto it longer is of questionable benefit.

- This allows two members of lwp_t to be deleted, and mi_userret() to be
  simplified a lot (next step: trim it down to a single conditional).

- While here, constify syncobj_t and de-inline a bunch of small functions
  like lwp_lock() which turn out not to be small after all (I don't know
  why, but atomic_*_relaxed() seem to provoke a compiler shitfit above and
  beyond what volatile does).


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/kern/kern_condvar.c
cvs rdiff -u -r1.255 -r1.256 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.109 -r1.110 src/sys/kern/kern_mutex.c
cvs rdiff -u -r1.72 -r1.73 src/sys/kern/kern_rwlock.c
cvs rdiff -u -r1.74 -r1.75 src/sys/kern/kern_sleepq.c
cvs rdiff -u -r1.358 -r1.359 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.76 -r1.77 src/sys/kern/kern_timeout.c
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/kern_turnstile.c
cvs rdiff -u -r1.84 -r1.85 src/sys/kern/sys_lwp.c
cvs rdiff -u -r1.61 -r1.62 src/sys/kern/sys_select.c
cvs rdiff -u -r1.23 -r1.24 src/sys/rump/librump/rumpkern/sleepq.c
cvs rdiff -u -r1.220 -r1.221 src/sys/sys/lwp.h
cvs rdiff -u -r1.36 -r1.37 src/sys/sys/sleepq.h
cvs rdiff -u -r1.15 -r1.16 src/sys/sys/syncobj.h
cvs rdiff -u -r1.33 -r1.34 src/sys/sys/userret.h

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



CVS commit: src/sys

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 18:21:43 UTC 2023

Modified Files:
src/sys/rump/include/rump: rump_namei.h
src/sys/sys: namei.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.118 -r1.119 src/sys/sys/namei.h

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

Modified files:

Index: src/sys/rump/include/rump/rump_namei.h
diff -u src/sys/rump/include/rump/rump_namei.h:1.51 src/sys/rump/include/rump/rump_namei.h:1.52
--- src/sys/rump/include/rump/rump_namei.h:1.51	Tue Sep 12 16:17:22 2023
+++ src/sys/rump/include/rump/rump_namei.h	Sat Sep 23 18:21:43 2023
@@ -1,11 +1,11 @@
-/*	$NetBSD: rump_namei.h,v 1.51 2023/09/12 16:17:22 ad Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.52 2023/09/23 18:21:43 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.61 2023/09/09 18:27:59 ad Exp 
+ *   from: NetBSD: namei.src,v 1.64 2023/09/23 18:21:12 ad Exp 
  */
 
 #ifndef _RUMP_RUMP_NAMEI_H_

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.118 src/sys/sys/namei.h:1.119
--- src/sys/sys/namei.h:1.118	Tue Sep 12 16:17:21 2023
+++ src/sys/sys/namei.h	Sat Sep 23 18:21:43 2023
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.118 2023/09/12 16:17:21 ad Exp $	*/
+/*	$NetBSD: namei.h,v 1.119 2023/09/23 18:21:43 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.61 2023/09/09 18:27:59 ad Exp 
+ *   from: NetBSD: namei.src,v 1.64 2023/09/23 18:21:12 ad Exp 
  */
 
 /*
@@ -252,15 +252,13 @@ struct namecache {
 #endif /* __NAMECACHE_PRIVATE */
 
 #ifdef _KERNEL
-#include 
+#include 
 
 struct mount;
 struct cpu_info;
 
-extern pool_cache_t pnbuf_cache;	/* pathname buffer cache */
-
-#define	PNBUF_GET()	((char *)pool_cache_get(pnbuf_cache, PR_WAITOK))
-#define	PNBUF_PUT(pnb)	pool_cache_put(pnbuf_cache, (void *)(pnb))
+#define	PNBUF_GET()	((char *)kmem_alloc(MAXPATHLEN, KM_SLEEP))
+#define	PNBUF_PUT(pnb)	kmem_free((pnb), MAXPATHLEN)
 
 /*
  * Typesafe flags for namei_simple/nameiat_simple.



CVS commit: src/sys

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 18:21:43 UTC 2023

Modified Files:
src/sys/rump/include/rump: rump_namei.h
src/sys/sys: namei.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.118 -r1.119 src/sys/sys/namei.h

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



CVS commit: src

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 18:21:12 UTC 2023

Modified Files:
src/common/lib/libc/gen: radixtree.c
src/sys/kern: init_main.c kern_descrip.c kern_lwp.c kern_mutex_obj.c
kern_resource.c kern_rwlock_obj.c kern_turnstile.c subr_kcpuset.c
vfs_cwd.c vfs_init.c vfs_lockf.c
src/sys/rump/librump/rumpkern: rump.c
src/sys/rump/librump/rumpvfs: rump_vfs.c
src/sys/sys: namei.src
src/sys/uvm: uvm_init.c uvm_map.c uvm_readahead.c

Log Message:
Repply this change with a couple of bugs fixed:

- Do away with separate pool_cache for some kernel objects that have no special
  requirements and use the general purpose allocator instead. On one of my
  test systems this makes for a small (~1%) but repeatable reduction in system
  time during builds presumably because it decreases the kernel's cache /
  memory bandwidth footprint a little.
- vfs_lockf: cache a pointer to the uidinfo and put mutex in the data segment.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/common/lib/libc/gen/radixtree.c
cvs rdiff -u -r1.545 -r1.546 src/sys/kern/init_main.c
cvs rdiff -u -r1.260 -r1.261 src/sys/kern/kern_descrip.c
cvs rdiff -u -r1.254 -r1.255 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.13 -r1.14 src/sys/kern/kern_mutex_obj.c
cvs rdiff -u -r1.193 -r1.194 src/sys/kern/kern_resource.c
cvs rdiff -u -r1.11 -r1.12 src/sys/kern/kern_rwlock_obj.c
cvs rdiff -u -r1.48 -r1.49 src/sys/kern/kern_turnstile.c
cvs rdiff -u -r1.19 -r1.20 src/sys/kern/subr_kcpuset.c
cvs rdiff -u -r1.10 -r1.11 src/sys/kern/vfs_cwd.c
cvs rdiff -u -r1.63 -r1.64 src/sys/kern/vfs_init.c
cvs rdiff -u -r1.80 -r1.81 src/sys/kern/vfs_lockf.c
cvs rdiff -u -r1.359 -r1.360 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.96 -r1.97 src/sys/rump/librump/rumpvfs/rump_vfs.c
cvs rdiff -u -r1.63 -r1.64 src/sys/sys/namei.src
cvs rdiff -u -r1.58 -r1.59 src/sys/uvm/uvm_init.c
cvs rdiff -u -r1.409 -r1.410 src/sys/uvm/uvm_map.c
cvs rdiff -u -r1.15 -r1.16 src/sys/uvm/uvm_readahead.c

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

Modified files:

Index: src/common/lib/libc/gen/radixtree.c
diff -u src/common/lib/libc/gen/radixtree.c:1.31 src/common/lib/libc/gen/radixtree.c:1.32
--- src/common/lib/libc/gen/radixtree.c:1.31	Tue Sep 12 16:17:21 2023
+++ src/common/lib/libc/gen/radixtree.c	Sat Sep 23 18:21:11 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: radixtree.c,v 1.31 2023/09/12 16:17:21 ad Exp $	*/
+/*	$NetBSD: radixtree.c,v 1.32 2023/09/23 18:21:11 ad Exp $	*/
 
 /*-
  * Copyright (c)2011,2012,2013 YAMAMOTO Takashi,
@@ -43,7 +43,7 @@
  *
  * Intermediate nodes are automatically allocated and freed internally and
  * basically users don't need to care about them.  The allocation is done via
- * pool_cache_get(9) for _KERNEL, malloc(3) for userland, and alloc() for
+ * kmem_zalloc(9) for _KERNEL, malloc(3) for userland, and alloc() for
  * _STANDALONE environment.  Only radix_tree_insert_node function can allocate
  * memory for intermediate nodes and thus can fail for ENOMEM.
  *
@@ -112,17 +112,17 @@
 #include 
 
 #if defined(_KERNEL) || defined(_STANDALONE)
-__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.31 2023/09/12 16:17:21 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.32 2023/09/23 18:21:11 ad Exp $");
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #if defined(_STANDALONE)
 #include 
 #endif /* defined(_STANDALONE) */
 #else /* defined(_KERNEL) || defined(_STANDALONE) */
-__RCSID("$NetBSD: radixtree.c,v 1.31 2023/09/12 16:17:21 ad Exp $");
+__RCSID("$NetBSD: radixtree.c,v 1.32 2023/09/23 18:21:11 ad Exp $");
 #include 
 #include 
 #include 
@@ -303,18 +303,6 @@ radix_tree_node_init(struct radix_tree_n
 }
 
 #if defined(_KERNEL)
-pool_cache_t radix_tree_node_cache __read_mostly;
-
-static int
-radix_tree_node_ctor(void *dummy, void *item, int flags)
-{
-	struct radix_tree_node *n = item;
-
-	KASSERT(dummy == NULL);
-	radix_tree_node_init(n);
-	return 0;
-}
-
 /*
  * radix_tree_init:
  *
@@ -325,10 +313,7 @@ void
 radix_tree_init(void)
 {
 
-	radix_tree_node_cache = pool_cache_init(sizeof(struct radix_tree_node),
-	coherency_unit, 0, PR_LARGECACHE, "radixnode", NULL, IPL_NONE,
-	radix_tree_node_ctor, NULL, NULL);
-	KASSERT(radix_tree_node_cache != NULL);
+	/* nothing right now */
 }
 
 /*
@@ -346,10 +331,11 @@ radix_tree_await_memory(void)
 	int i;
 
 	for (i = 0; i < __arraycount(nodes); i++) {
-		nodes[i] = pool_cache_get(radix_tree_node_cache, PR_WAITOK);
+		nodes[i] = kmem_intr_alloc(sizeof(struct radix_tree_node),
+		KM_SLEEP);
 	}
 	while (--i >= 0) {
-		pool_cache_put(radix_tree_node_cache, nodes[i]);
+		kmem_free(nodes[i], sizeof(struct radix_tree_node));
 	}
 }
 
@@ -424,11 +410,10 @@ radix_tree_alloc_node(void)
 
 #if defined(_KERNEL)
 	/*
-	 * note that pool_cache_get can block.
+	 * note that kmem_alloc can block.
 	 */
-	n = 

CVS commit: src

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 18:21:12 UTC 2023

Modified Files:
src/common/lib/libc/gen: radixtree.c
src/sys/kern: init_main.c kern_descrip.c kern_lwp.c kern_mutex_obj.c
kern_resource.c kern_rwlock_obj.c kern_turnstile.c subr_kcpuset.c
vfs_cwd.c vfs_init.c vfs_lockf.c
src/sys/rump/librump/rumpkern: rump.c
src/sys/rump/librump/rumpvfs: rump_vfs.c
src/sys/sys: namei.src
src/sys/uvm: uvm_init.c uvm_map.c uvm_readahead.c

Log Message:
Repply this change with a couple of bugs fixed:

- Do away with separate pool_cache for some kernel objects that have no special
  requirements and use the general purpose allocator instead. On one of my
  test systems this makes for a small (~1%) but repeatable reduction in system
  time during builds presumably because it decreases the kernel's cache /
  memory bandwidth footprint a little.
- vfs_lockf: cache a pointer to the uidinfo and put mutex in the data segment.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/common/lib/libc/gen/radixtree.c
cvs rdiff -u -r1.545 -r1.546 src/sys/kern/init_main.c
cvs rdiff -u -r1.260 -r1.261 src/sys/kern/kern_descrip.c
cvs rdiff -u -r1.254 -r1.255 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.13 -r1.14 src/sys/kern/kern_mutex_obj.c
cvs rdiff -u -r1.193 -r1.194 src/sys/kern/kern_resource.c
cvs rdiff -u -r1.11 -r1.12 src/sys/kern/kern_rwlock_obj.c
cvs rdiff -u -r1.48 -r1.49 src/sys/kern/kern_turnstile.c
cvs rdiff -u -r1.19 -r1.20 src/sys/kern/subr_kcpuset.c
cvs rdiff -u -r1.10 -r1.11 src/sys/kern/vfs_cwd.c
cvs rdiff -u -r1.63 -r1.64 src/sys/kern/vfs_init.c
cvs rdiff -u -r1.80 -r1.81 src/sys/kern/vfs_lockf.c
cvs rdiff -u -r1.359 -r1.360 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.96 -r1.97 src/sys/rump/librump/rumpvfs/rump_vfs.c
cvs rdiff -u -r1.63 -r1.64 src/sys/sys/namei.src
cvs rdiff -u -r1.58 -r1.59 src/sys/uvm/uvm_init.c
cvs rdiff -u -r1.409 -r1.410 src/sys/uvm/uvm_map.c
cvs rdiff -u -r1.15 -r1.16 src/sys/uvm/uvm_readahead.c

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



CVS commit: src/sys/uvm

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 18:20:20 UTC 2023

Modified Files:
src/sys/uvm: uvm_page.c uvm_physseg.c

Log Message:
uvm_phys_to_vm_page() turns out to be a fairly central routine due to the
way that some of the pmaps work, so try to optimise it a little.


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.18 -r1.19 src/sys/uvm/uvm_physseg.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/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.253 src/sys/uvm/uvm_page.c:1.254
--- src/sys/uvm/uvm_page.c:1.253	Mon Jul 17 12:55:37 2023
+++ src/sys/uvm/uvm_page.c	Sat Sep 23 18:20:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.253 2023/07/17 12:55:37 riastradh Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.254 2023/09/23 18:20:20 ad Exp $	*/
 
 /*-
  * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.253 2023/07/17 12:55:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.254 2023/09/23 18:20:20 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvm.h"
@@ -671,23 +671,6 @@ uvm_page_physget(paddr_t *paddrp)
 }
 #endif /* PMAP_STEAL_MEMORY */
 
-/*
- * PHYS_TO_VM_PAGE: find vm_page for a PA.   used by MI code to get vm_pages
- * back from an I/O mapping (ugh!).   used in some MD code as well.
- */
-struct vm_page *
-uvm_phys_to_vm_page(paddr_t pa)
-{
-	paddr_t pf = atop(pa);
-	paddr_t	off;
-	uvm_physseg_t	upm;
-
-	upm = uvm_physseg_find(pf, );
-	if (upm != UVM_PHYSSEG_TYPE_INVALID)
-		return uvm_physseg_get_pg(upm, off);
-	return(NULL);
-}
-
 paddr_t
 uvm_vm_page_to_phys(const struct vm_page *pg)
 {

Index: src/sys/uvm/uvm_physseg.c
diff -u src/sys/uvm/uvm_physseg.c:1.18 src/sys/uvm/uvm_physseg.c:1.19
--- src/sys/uvm/uvm_physseg.c:1.18	Sun Apr  9 09:00:56 2023
+++ src/sys/uvm/uvm_physseg.c	Sat Sep 23 18:20:20 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_physseg.c,v 1.18 2023/04/09 09:00:56 riastradh Exp $ */
+/* $NetBSD: uvm_physseg.c,v 1.19 2023/09/23 18:20:20 ad Exp $ */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -88,7 +88,9 @@
  */
 struct uvm_physseg {
 	/* used during RB tree lookup for PHYS_TO_VM_PAGE(). */
+#if defined(UVM_HOTPLUG)
 	struct  rb_node rb_node;	/* tree information */
+#endif
 	paddr_t	start;			/* PF# of first page in segment */
 	paddr_t	end;			/* (PF# of last page in segment) + 1 */
 	struct	vm_page *pgs;		/* vm_page structures (from start) */
@@ -561,8 +563,10 @@ uvm_physseg_find(paddr_t pframe, psize_t
 #define		HANDLE_TO_PHYSSEG_NODE(h)	(VM_PHYSMEM_PTR((int)h))
 #define		PHYSSEG_NODE_TO_HANDLE(u)	((int)((vsize_t) (u - vm_physmem) / sizeof(struct uvm_physseg)))
 
-static struct uvm_physseg vm_physmem[VM_PHYSSEG_MAX];	/* XXXCDC: uvm.physmem */
-static int vm_nphysseg = 0;/* XXXCDC: uvm.nphysseg */
+/* XXXCDC: uvm.physmem */
+static struct uvm_physseg vm_physmem[VM_PHYSSEG_MAX] __read_mostly;
+/* XXXCDC: uvm.nphysseg */
+static int vm_nphysseg __read_mostly = 0;
 #define	vm_nphysmem	vm_nphysseg
 
 void
@@ -851,7 +855,7 @@ static inline int vm_physseg_find_linear
 /*
  * vm_physseg_find: find vm_physseg structure that belongs to a PA
  */
-int
+inline int
 uvm_physseg_find(paddr_t pframe, psize_t *offp)
 {
 
@@ -943,6 +947,40 @@ vm_physseg_find_linear(struct uvm_physse
 #endif
 #endif /* UVM_HOTPLUG */
 
+/*
+ * PHYS_TO_VM_PAGE: find vm_page for a PA.  used by MI code to get vm_pages
+ * back from an I/O mapping (ugh!).  used in some MD code as well.  it can
+ * be prominent in flamegraphs, so optimise it and try to make it easy for
+ * the compiler by including next to the inline lookup routines.
+ */
+struct vm_page *
+uvm_phys_to_vm_page(paddr_t pa)
+{
+#if VM_PHYSSEG_STRAT != VM_PSTRAT_BSEARCH
+	/* 'contig' and linear cases */
+	KASSERT(vm_nphysseg > 0);
+	struct uvm_physseg *ps = _physmem[0];
+	struct uvm_physseg *end = _physmem[vm_nphysseg];
+	paddr_t pframe = atop(pa);
+	do {
+		if (pframe >= ps->start && pframe < ps->end) {
+			return >pgs[pframe - ps->start];
+		}
+	} while (VM_PHYSSEG_MAX > 1 && __predict_false(++ps < end));
+	return NULL;
+#else
+	/* binary search for it */
+	paddr_t pf = atop(pa);
+	paddr_t	off;
+	uvm_physseg_t	upm;
+
+	upm = uvm_physseg_find(pf, );
+	if (upm != UVM_PHYSSEG_TYPE_INVALID)
+		return uvm_physseg_get_pg(upm, off);
+	return(NULL);
+#endif
+}
+
 bool
 uvm_physseg_valid_p(uvm_physseg_t upm)
 {
@@ -1047,7 +1085,7 @@ uvm_physseg_get_avail_end(uvm_physseg_t 
 	return HANDLE_TO_PHYSSEG_NODE(upm)->avail_end;
 }
 
-struct vm_page *
+inline struct vm_page *
 uvm_physseg_get_pg(uvm_physseg_t upm, paddr_t idx)
 {
 	KASSERT(uvm_physseg_valid_p(upm));



CVS commit: src/sys/uvm

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 18:20:20 UTC 2023

Modified Files:
src/sys/uvm: uvm_page.c uvm_physseg.c

Log Message:
uvm_phys_to_vm_page() turns out to be a fairly central routine due to the
way that some of the pmaps work, so try to optimise it a little.


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.18 -r1.19 src/sys/uvm/uvm_physseg.c

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



CVS commit: src/sys/arch

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 14:41:16 UTC 2023

Modified Files:
src/sys/arch/amd64/amd64: genassym.cf
src/sys/arch/i386/i386: genassym.cf

Log Message:
Remove unused L_KPRIORITY.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/i386/i386/genassym.cf

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/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.95 src/sys/arch/amd64/amd64/genassym.cf:1.96
--- src/sys/arch/amd64/amd64/genassym.cf:1.95	Fri Mar  3 14:32:48 2023
+++ src/sys/arch/amd64/amd64/genassym.cf	Sat Sep 23 14:41:15 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.95 2023/03/03 14:32:48 riastradh Exp $
+#	$NetBSD: genassym.cf,v 1.96 2023/09/23 14:41:15 ad Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -160,7 +160,6 @@ define	L_PROC			offsetof(struct lwp, l_p
 define	L_NCSW			offsetof(struct lwp, l_ncsw)
 define	L_NOPREEMPT		offsetof(struct lwp, l_nopreempt)
 define	L_DOPREEMPT		offsetof(struct lwp, l_dopreempt)
-define	L_KPRIORITY		offsetof(struct lwp, l_kpriority)
 define	L_MD_REGS		offsetof(struct lwp, l_md.md_regs)
 define	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)
 define	L_MD_ASTPENDING		offsetof(struct lwp, l_md.md_astpending)

Index: src/sys/arch/i386/i386/genassym.cf
diff -u src/sys/arch/i386/i386/genassym.cf:1.133 src/sys/arch/i386/i386/genassym.cf:1.134
--- src/sys/arch/i386/i386/genassym.cf:1.133	Fri Mar  3 14:32:27 2023
+++ src/sys/arch/i386/i386/genassym.cf	Sat Sep 23 14:41:15 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.133 2023/03/03 14:32:27 riastradh Exp $
+#	$NetBSD: genassym.cf,v 1.134 2023/09/23 14:41:15 ad Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -169,7 +169,6 @@ define	L_PROC			offsetof(struct lwp, l_p
 define	L_NCSW			offsetof(struct lwp, l_ncsw)
 define	L_NOPREEMPT		offsetof(struct lwp, l_nopreempt)
 define	L_DOPREEMPT		offsetof(struct lwp, l_dopreempt)
-define	L_KPRIORITY		offsetof(struct lwp, l_kpriority)
 define	L_MD_REGS		offsetof(struct lwp, l_md.md_regs)
 define	L_MD_FLAGS		offsetof(struct lwp, l_md.md_flags)
 define	L_MD_ASTPENDING		offsetof(struct lwp, l_md.md_astpending)



CVS commit: src/sys/arch

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 14:41:16 UTC 2023

Modified Files:
src/sys/arch/amd64/amd64: genassym.cf
src/sys/arch/i386/i386: genassym.cf

Log Message:
Remove unused L_KPRIORITY.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/i386/i386/genassym.cf

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-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 14:40:42 UTC 2023

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

Log Message:
kernel_lock isn't needed to synchronise kthread_exit() and kthread_join().


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/kern/kern_kthread.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_kthread.c
diff -u src/sys/kern/kern_kthread.c:1.48 src/sys/kern/kern_kthread.c:1.49
--- src/sys/kern/kern_kthread.c:1.48	Mon Jul 17 10:55:27 2023
+++ src/sys/kern/kern_kthread.c	Sat Sep 23 14:40:42 2023
@@ -1,7 +1,8 @@
-/*	$NetBSD: kern_kthread.c,v 1.48 2023/07/17 10:55:27 riastradh Exp $	*/
+/*	$NetBSD: kern_kthread.c,v 1.49 2023/09/23 14:40:42 ad Exp $	*/
 
 /*-
- * Copyright (c) 1998, 1999, 2007, 2009, 2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 1999, 2007, 2009, 2019, 2023
+ * The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -31,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.48 2023/07/17 10:55:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_kthread.c,v 1.49 2023/09/23 14:40:42 ad Exp $");
 
 #include 
 #include 
@@ -114,9 +115,9 @@ kthread_create(pri_t pri, int flag, stru
 		if (ci != l->l_cpu) {
 			lwp_unlock_to(l, ci->ci_schedstate.spc_lwplock);
 			lwp_lock(l);
+			l->l_cpu = ci;
 		}
 		l->l_pflag |= LP_BOUND;
-		l->l_cpu = ci;
 	}
 
 	if ((flag & KTHREAD_MUSTJOIN) != 0) {
@@ -160,6 +161,11 @@ kthread_exit(int ecode)
 	const char *name;
 	lwp_t *l = curlwp;
 
+	/* If the kernel lock is held, we need to drop it now. */
+	if ((l->l_pflag & LP_MPSAFE) == 0) {
+		KERNEL_UNLOCK_LAST(l);
+	}
+
 	/* We can't do much with the exit code, so just report it. */
 	if (ecode != 0) {
 		if ((name = l->l_name) == NULL)
@@ -182,11 +188,6 @@ kthread_exit(int ecode)
 		mutex_exit(_lock);
 	}
 
-	/* If the kernel lock is held, we need to drop it now. */
-	if ((l->l_pflag & LP_MPSAFE) == 0) {
-		KERNEL_UNLOCK_LAST(l);
-	}
-
 	/* And exit.. */
 	lwp_exit(l);
 	panic("kthread_exit");



CVS commit: src/sys/kern

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 14:40:42 UTC 2023

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

Log Message:
kernel_lock isn't needed to synchronise kthread_exit() and kthread_join().


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/kern/kern_kthread.c

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



CVS commit: src/sys/sys

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 14:19:12 UTC 2023

Modified Files:
src/sys/sys: vmmeter.h

Log Message:
Remove last remnant of the long-dead PGINPROF option.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/sys/vmmeter.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/sys/vmmeter.h
diff -u src/sys/sys/vmmeter.h:1.19 src/sys/sys/vmmeter.h:1.20
--- src/sys/sys/vmmeter.h:1.19	Wed Oct 21 21:12:07 2009
+++ src/sys/sys/vmmeter.h	Sat Sep 23 14:19:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmmeter.h,v 1.19 2009/10/21 21:12:07 rmind Exp $	*/
+/*	$NetBSD: vmmeter.h,v 1.20 2023/09/23 14:19:12 ad Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -53,42 +53,4 @@ struct vmtotal
 	int32_t	t_free;		/* free memory pages */
 };
 
-/*
- * Optional instrumentation.
- */
-#ifdef PGINPROF
-
-#define	NDMON	128
-#define	NSMON	128
-
-#define	DRES	20
-#define	SRES	5
-
-#define	PMONMIN	20
-#define	PRES	50
-#define	NPMON	64
-
-#define	RMONMIN	130
-#define	RRES	5
-#define	NRMON	64
-
-/* data and stack size distribution counters */
-u_int	dmon[NDMON+1];
-u_int	smon[NSMON+1];
-
-/* page in time distribution counters */
-u_int	pmon[NPMON+2];
-
-/* reclaim time distribution counters */
-u_int	rmon[NRMON+2];
-
-int	pmonmin;
-int	pres;
-int	rmonmin;
-int	rres;
-
-u_int rectime;		/* accumulator for reclaim times */
-u_int pgintime;		/* accumulator for page in times */
-#endif /* PGINPROF */
-
 #endif /* !_SYS_VMMETER_H_ */



CVS commit: src/sys/sys

2023-09-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Sep 23 14:19:12 UTC 2023

Modified Files:
src/sys/sys: vmmeter.h

Log Message:
Remove last remnant of the long-dead PGINPROF option.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/sys/vmmeter.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/mac68k/mac68k

2023-09-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 23 13:45:50 UTC 2023

Modified Files:
src/sys/arch/mac68k/mac68k: machdep.c

Log Message:
pass just l param to exec_aout_prep_oldzmagic instead of l->l_proc.

In a huge "merge ktrace-lwp." commit struct proc was changed by struct lwp.
seemingly all 68k ports just replaced p with l, however mac68k changed to
refer to l->l_proc. I assume it was accidental leftover during refactoring.

fixes COMPAT_NOMID enabled build for mac68k.


To generate a diff of this commit:
cvs rdiff -u -r1.364 -r1.365 src/sys/arch/mac68k/mac68k/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/mac68k/mac68k/machdep.c
diff -u src/sys/arch/mac68k/mac68k/machdep.c:1.364 src/sys/arch/mac68k/mac68k/machdep.c:1.365
--- src/sys/arch/mac68k/mac68k/machdep.c:1.364	Mon Dec 26 01:05:35 2022
+++ src/sys/arch/mac68k/mac68k/machdep.c	Sat Sep 23 13:45:50 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.364 2022/12/26 01:05:35 nat Exp $	*/
+/*	$NetBSD: machdep.c,v 1.365 2023/09/23 13:45:50 andvar Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.364 2022/12/26 01:05:35 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.365 2023/09/23 13:45:50 andvar Exp $");
 
 #include "opt_adb.h"
 #include "opt_compat_netbsd.h"
@@ -846,7 +846,7 @@ cpu_exec_aout_makecmds(struct lwp *l, st
 #ifdef COMPAT_NOMID
 	/* Check to see if MID == 0. */
 	if (((struct exec *)epp->ep_hdr)->a_midmag == ZMAGIC)
-		return exec_aout_prep_oldzmagic(l->l_proc, epp);
+		return exec_aout_prep_oldzmagic(l, epp);
 #endif
 
 	return error;



CVS commit: src/sys/arch/mac68k/mac68k

2023-09-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 23 13:45:50 UTC 2023

Modified Files:
src/sys/arch/mac68k/mac68k: machdep.c

Log Message:
pass just l param to exec_aout_prep_oldzmagic instead of l->l_proc.

In a huge "merge ktrace-lwp." commit struct proc was changed by struct lwp.
seemingly all 68k ports just replaced p with l, however mac68k changed to
refer to l->l_proc. I assume it was accidental leftover during refactoring.

fixes COMPAT_NOMID enabled build for mac68k.


To generate a diff of this commit:
cvs rdiff -u -r1.364 -r1.365 src/sys/arch/mac68k/mac68k/machdep.c

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



CVS commit: src/sys/dev/pci

2023-09-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 23 13:01:16 UTC 2023

Modified Files:
src/sys/dev/pci: mfii.c

Log Message:
When attaching and detaching disks, use the proper index, skipping the
first 4, which are used for the controller itself (Edgar Fuss)


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pci/mfii.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/pci/mfii.c
diff -u src/sys/dev/pci/mfii.c:1.29 src/sys/dev/pci/mfii.c:1.30
--- src/sys/dev/pci/mfii.c:1.29	Fri Sep 22 10:14:00 2023
+++ src/sys/dev/pci/mfii.c	Sat Sep 23 09:01:16 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.29 2023/09/22 14:14:00 christos Exp $ */
+/* $NetBSD: mfii.c,v 1.30 2023/09/23 13:01:16 christos Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.29 2023/09/22 14:14:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.30 2023/09/23 13:01:16 christos Exp $");
 
 #include "bio.h"
 
@@ -529,6 +529,8 @@ static const char *mfi_bbu_indicators[] 
 };
 #endif
 
+#define MFI_BBU_SENSORS 4
+
 static void	mfii_init_ld_sensor(struct mfii_softc *, envsys_data_t *, int);
 static void	mfii_refresh_ld_sensor(struct mfii_softc *, envsys_data_t *);
 static void	mfii_attach_sensor(struct mfii_softc *, envsys_data_t *);
@@ -1427,7 +1429,7 @@ static void
 mfii_aen_ld_update(struct mfii_softc *sc)
 {
 	union mfi_mbox mbox;
-	int i, target, old, nld;
+	int i, j, target, old, nld;
 	int newlds[MFII_MAX_LD_EXT];
 
 	memset(, 0, sizeof(mbox));
@@ -1464,8 +1466,9 @@ mfii_aen_ld_update(struct mfii_softc *sc
 
 			// XXX scsi_probe_target(sc->sc_scsibus, i);
 
-			mfii_init_ld_sensor(sc, >sc_sensors[i], i);
-			mfii_attach_sensor(sc, >sc_sensors[i]);
+			j = i + MFI_BBU_SENSORS;
+			mfii_init_ld_sensor(sc, >sc_sensors[j], i);
+			mfii_attach_sensor(sc, >sc_sensors[j]);
 		} else if (nld == -1 && old != -1) {
 			printf("%s: logical drive %d removed (target %d)\n",
 			DEVNAME(sc), i, old);
@@ -1473,7 +1476,7 @@ mfii_aen_ld_update(struct mfii_softc *sc
 
 			scsipi_target_detach(>sc_chan, i, 0, DETACH_FORCE);
 			sysmon_envsys_sensor_detach(sc->sc_sme,
-			>sc_sensors[i]);
+			>sc_sensors[i + MFI_BBU_SENSORS]);
 		}
 	}
 
@@ -3834,8 +3837,6 @@ freeme:
 
 #endif /* NBIO > 0 */
 
-#define MFI_BBU_SENSORS 4
-
 static void
 mfii_bbu(struct mfii_softc *sc, envsys_data_t *edata)
 {
@@ -3935,7 +3936,7 @@ mfii_attach_sensor(struct mfii_softc *sc
 static int
 mfii_create_sensors(struct mfii_softc *sc)
 {
-	int i, rv;
+	int i, j, rv;
 	const int nsensors = MFI_BBU_SENSORS + MFII_MAX_LD_EXT;
 
 	sc->sc_sme = sysmon_envsys_create();
@@ -3973,8 +3974,9 @@ mfii_create_sensors(struct mfii_softc *s
 	}
 
 	for (i = 0; i < sc->sc_ld_list.mll_no_ld; i++) {
-		mfii_init_ld_sensor(sc, >sc_sensors[i + MFI_BBU_SENSORS], i);
-		mfii_attach_sensor(sc, >sc_sensors[i + MFI_BBU_SENSORS]);
+		j = i + MFI_BBU_SENSORS;
+		mfii_init_ld_sensor(sc, >sc_sensors[j], i);
+		mfii_attach_sensor(sc, >sc_sensors[j]);
 	}
 
 	sc->sc_sme->sme_name = DEVNAME(sc);



CVS commit: src/sys/dev/pci

2023-09-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 23 13:01:16 UTC 2023

Modified Files:
src/sys/dev/pci: mfii.c

Log Message:
When attaching and detaching disks, use the proper index, skipping the
first 4, which are used for the controller itself (Edgar Fuss)


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pci/mfii.c

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



CVS commit: src/sys/arch

2023-09-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 23 12:48:23 UTC 2023

Modified Files:
src/sys/arch/mac68k/dev: zs.c
src/sys/arch/macppc/dev: zs.c

Log Message:
some whitespace cleanup for debug printf calls.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/mac68k/dev/zs.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/macppc/dev/zs.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/mac68k/dev/zs.c
diff -u src/sys/arch/mac68k/dev/zs.c:1.62 src/sys/arch/mac68k/dev/zs.c:1.63
--- src/sys/arch/mac68k/dev/zs.c:1.62	Sat Sep 23 12:29:25 2023
+++ src/sys/arch/mac68k/dev/zs.c	Sat Sep 23 12:48:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.62 2023/09/23 12:29:25 andvar Exp $	*/
+/*	$NetBSD: zs.c,v 1.63 2023/09/23 12:48:23 andvar Exp $	*/
 
 /*
  * Copyright (c) 1996-1998 Bill Studenmund
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.62 2023/09/23 12:29:25 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.63 2023/09/23 12:48:23 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mac68k.h"
@@ -575,7 +575,7 @@ zs_set_speed(struct zs_chanstate *cs, in
 		}
 	}
 #ifdef ZSMACDEBUG
-	printf("Checking for rate %d. Found source #%d.\n",bps, src);
+	printf("Checking for rate %d. Found source #%d.\n", bps, src);
 #endif
 	if (src == -1)
 		return (EINVAL); /* no can do */
@@ -624,10 +624,10 @@ zs_set_speed(struct zs_chanstate *cs, in
 	splx(s);
 	
 #ifdef ZSMACDEBUG
-	printf("Rate is %7d, tc is %7d, source no. %2d, flags %4x\n", \
+	printf("Rate is %7d, tc is %7d, source no. %2d, flags %4x\n",
 	bps, tc, src, sf);
 	printf("Registers are: 4 %x, 11 %x, 14 %x\n\n",
-		cs->cs_preg[4], cs->cs_preg[11], cs->cs_preg[14]);
+	cs->cs_preg[4], cs->cs_preg[11], cs->cs_preg[14]);
 #endif
 
 	cs->cs_preg[5] |= ZSWR5_RTS;	/* Make sure the drivers are on! */

Index: src/sys/arch/macppc/dev/zs.c
diff -u src/sys/arch/macppc/dev/zs.c:1.57 src/sys/arch/macppc/dev/zs.c:1.58
--- src/sys/arch/macppc/dev/zs.c:1.57	Sat Sep 23 12:29:24 2023
+++ src/sys/arch/macppc/dev/zs.c	Sat Sep 23 12:48:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.57 2023/09/23 12:29:24 andvar Exp $	*/
+/*	$NetBSD: zs.c,v 1.58 2023/09/23 12:48:23 andvar Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998 Bill Studenmund
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.57 2023/09/23 12:29:24 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.58 2023/09/23 12:48:23 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -639,7 +639,7 @@ zs_set_speed(struct zs_chanstate *cs, in
 		}
 	}
 #ifdef ZSMACDEBUG
-	printf("Checking for rate %d. Found source #%d.\n",bps, src);
+	printf("Checking for rate %d. Found source #%d.\n", bps, src);
 #endif
 	if (src == -1)
 		return (EINVAL); /* no can do */
@@ -688,10 +688,10 @@ zs_set_speed(struct zs_chanstate *cs, in
 	splx(s);
 	
 #ifdef ZSMACDEBUG
-	printf("Rate is %7d, tc is %7d, source no. %2d, flags %4x\n", \
+	printf("Rate is %7d, tc is %7d, source no. %2d, flags %4x\n",
 	bps, tc, src, sf);
 	printf("Registers are: 4 %x, 11 %x, 14 %x\n\n",
-		cs->cs_preg[4], cs->cs_preg[11], cs->cs_preg[14]);
+	cs->cs_preg[4], cs->cs_preg[11], cs->cs_preg[14]);
 #endif
 
 	cs->cs_preg[5] |= ZSWR5_RTS;	/* Make sure the drivers are on! */



CVS commit: src/sys/arch

2023-09-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 23 12:48:23 UTC 2023

Modified Files:
src/sys/arch/mac68k/dev: zs.c
src/sys/arch/macppc/dev: zs.c

Log Message:
some whitespace cleanup for debug printf calls.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/mac68k/dev/zs.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/macppc/dev/zs.c

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



CVS commit: src/sys/arch

2023-09-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 23 12:29:25 UTC 2023

Modified Files:
src/sys/arch/mac68k/dev: zs.c
src/sys/arch/macppc/dev: zs.c

Log Message:
change zsprintf to printf. It was defined as printf in include/z8530var.h
up to rev 1.4, then removed with conversion to MI 8530 SCC driver back in 1997.

Fixes build with ZSMACDEBUG option enabled for mac68k and macppc.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/mac68k/dev/zs.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/macppc/dev/zs.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/mac68k/dev/zs.c
diff -u src/sys/arch/mac68k/dev/zs.c:1.61 src/sys/arch/mac68k/dev/zs.c:1.62
--- src/sys/arch/mac68k/dev/zs.c:1.61	Sat Sep 11 20:28:04 2021
+++ src/sys/arch/mac68k/dev/zs.c	Sat Sep 23 12:29:25 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.61 2021/09/11 20:28:04 andvar Exp $	*/
+/*	$NetBSD: zs.c,v 1.62 2023/09/23 12:29:25 andvar Exp $	*/
 
 /*
  * Copyright (c) 1996-1998 Bill Studenmund
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.61 2021/09/11 20:28:04 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.62 2023/09/23 12:29:25 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mac68k.h"
@@ -575,7 +575,7 @@ zs_set_speed(struct zs_chanstate *cs, in
 		}
 	}
 #ifdef ZSMACDEBUG
-	zsprintf("Checking for rate %d. Found source #%d.\n",bps, src);
+	printf("Checking for rate %d. Found source #%d.\n",bps, src);
 #endif
 	if (src == -1)
 		return (EINVAL); /* no can do */
@@ -624,9 +624,9 @@ zs_set_speed(struct zs_chanstate *cs, in
 	splx(s);
 	
 #ifdef ZSMACDEBUG
-	zsprintf("Rate is %7d, tc is %7d, source no. %2d, flags %4x\n", \
+	printf("Rate is %7d, tc is %7d, source no. %2d, flags %4x\n", \
 	bps, tc, src, sf);
-	zsprintf("Registers are: 4 %x, 11 %x, 14 %x\n\n",
+	printf("Registers are: 4 %x, 11 %x, 14 %x\n\n",
 		cs->cs_preg[4], cs->cs_preg[11], cs->cs_preg[14]);
 #endif
 

Index: src/sys/arch/macppc/dev/zs.c
diff -u src/sys/arch/macppc/dev/zs.c:1.56 src/sys/arch/macppc/dev/zs.c:1.57
--- src/sys/arch/macppc/dev/zs.c:1.56	Wed Feb 16 23:49:26 2022
+++ src/sys/arch/macppc/dev/zs.c	Sat Sep 23 12:29:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.56 2022/02/16 23:49:26 riastradh Exp $	*/
+/*	$NetBSD: zs.c,v 1.57 2023/09/23 12:29:24 andvar Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998 Bill Studenmund
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.56 2022/02/16 23:49:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.57 2023/09/23 12:29:24 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -639,7 +639,7 @@ zs_set_speed(struct zs_chanstate *cs, in
 		}
 	}
 #ifdef ZSMACDEBUG
-	zsprintf("Checking for rate %d. Found source #%d.\n",bps, src);
+	printf("Checking for rate %d. Found source #%d.\n",bps, src);
 #endif
 	if (src == -1)
 		return (EINVAL); /* no can do */
@@ -688,9 +688,9 @@ zs_set_speed(struct zs_chanstate *cs, in
 	splx(s);
 	
 #ifdef ZSMACDEBUG
-	zsprintf("Rate is %7d, tc is %7d, source no. %2d, flags %4x\n", \
+	printf("Rate is %7d, tc is %7d, source no. %2d, flags %4x\n", \
 	bps, tc, src, sf);
-	zsprintf("Registers are: 4 %x, 11 %x, 14 %x\n\n",
+	printf("Registers are: 4 %x, 11 %x, 14 %x\n\n",
 		cs->cs_preg[4], cs->cs_preg[11], cs->cs_preg[14]);
 #endif
 



CVS commit: src/sys/arch

2023-09-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 23 12:29:25 UTC 2023

Modified Files:
src/sys/arch/mac68k/dev: zs.c
src/sys/arch/macppc/dev: zs.c

Log Message:
change zsprintf to printf. It was defined as printf in include/z8530var.h
up to rev 1.4, then removed with conversion to MI 8530 SCC driver back in 1997.

Fixes build with ZSMACDEBUG option enabled for mac68k and macppc.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/mac68k/dev/zs.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/macppc/dev/zs.c

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