CVS commit: src/lib/libpthread

2020-06-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jun  4 04:40:01 UTC 2020

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

Log Message:
Nix trailing whitespace.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/lib/libpthread/pthread_cond.c

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

Modified files:

Index: src/lib/libpthread/pthread_cond.c
diff -u src/lib/libpthread/pthread_cond.c:1.71 src/lib/libpthread/pthread_cond.c:1.72
--- src/lib/libpthread/pthread_cond.c:1.71	Wed Jun  3 22:10:24 2020
+++ src/lib/libpthread/pthread_cond.c	Thu Jun  4 04:40:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cond.c,v 1.71 2020/06/03 22:10:24 ad Exp $	*/
+/*	$NetBSD: pthread_cond.c,v 1.72 2020/06/04 04:40:01 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_cond.c,v 1.71 2020/06/03 22:10:24 ad Exp $");
+__RCSID("$NetBSD: pthread_cond.c,v 1.72 2020/06/04 04:40:01 riastradh Exp $");
 
 #include 
 #include 
@@ -61,7 +61,7 @@ pthread_cond_getclock(const pthread_cond
 	pthread__error(EINVAL, "Invalid condition variable",
 	cond->ptc_magic == _PT_COND_MAGIC);
 
-	return cond->ptc_private ? 
+	return cond->ptc_private ?
 	*(clockid_t *)cond->ptc_private : CLOCK_REALTIME;
 }
 
@@ -185,7 +185,7 @@ pthread_cond_timedwait(pthread_cond_t *c
 		pthread_cond_broadcast(cond);
 
 		/*
-		 * Might have raced with another thread to do the wakeup. 
+		 * Might have raced with another thread to do the wakeup.
 		 * In any case there will be a wakeup for sure.  Eat it and
 		 * wait for pt_condwait to clear.
 		 */



CVS commit: src/lib/libpthread

2020-06-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jun  4 04:40:01 UTC 2020

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

Log Message:
Nix trailing whitespace.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/lib/libpthread/pthread_cond.c

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



CVS commit: src/sys/dev/acpi

2020-06-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jun  4 03:14:36 UTC 2020

Modified Files:
src/sys/dev/acpi: acpi_cpu_cstate.c

Log Message:
Nix trailing whitespace.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/acpi/acpi_cpu_cstate.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/acpi/acpi_cpu_cstate.c
diff -u src/sys/dev/acpi/acpi_cpu_cstate.c:1.61 src/sys/dev/acpi/acpi_cpu_cstate.c:1.62
--- src/sys/dev/acpi/acpi_cpu_cstate.c:1.61	Sun May 31 01:39:33 2020
+++ src/sys/dev/acpi/acpi_cpu_cstate.c	Thu Jun  4 03:14:36 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_cstate.c,v 1.61 2020/05/31 01:39:33 ad Exp $ */
+/* $NetBSD: acpi_cpu_cstate.c,v 1.62 2020/06/04 03:14:36 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen 
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.61 2020/05/31 01:39:33 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.62 2020/06/04 03:14:36 riastradh Exp $");
 
 #include 
 #include 
@@ -744,8 +744,8 @@ acpicpu_cstate_idle_enter(struct acpicpu
 #ifdef notyet
 	/*
 	 * XXX This has a significant performance impact because the ACPI
-	 * timer seems very slow and with many CPUs becomes a chokepoint. 
-	 * Better to use the TSC (if invariant) or APIC timer instead. 
+	 * timer seems very slow and with many CPUs becomes a chokepoint.
+	 * Better to use the TSC (if invariant) or APIC timer instead.
 	 * Proably even getbintime().  Disabled for now as no functional
 	 * change - only C1 sleep is enabled.
 	 */



CVS commit: src/sys/dev/acpi

2020-06-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jun  4 03:14:36 UTC 2020

Modified Files:
src/sys/dev/acpi: acpi_cpu_cstate.c

Log Message:
Nix trailing whitespace.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/acpi/acpi_cpu_cstate.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

2020-06-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jun  4 03:12:26 UTC 2020

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

Log Message:
Nix trailing whitespace.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/sys/kern/vfs_lookup.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/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.222 src/sys/kern/vfs_lookup.c:1.223
--- src/sys/kern/vfs_lookup.c:1.222	Sat May 30 20:23:25 2020
+++ src/sys/kern/vfs_lookup.c	Thu Jun  4 03:12:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.222 2020/05/30 20:23:25 ad Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.223 2020/06/04 03:12:26 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.222 2020/05/30 20:23:25 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.223 2020/06/04 03:12:26 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -817,7 +817,7 @@ namei_follow(struct namei_state *state, 
 		/* Keep absolute symbolic links inside emulation root */
 		searchdir = ndp->ni_erootdir;
 		if (searchdir == NULL ||
-		(ndp->ni_pnbuf[1] == '.' 
+		(ndp->ni_pnbuf[1] == '.'
 		 && ndp->ni_pnbuf[2] == '.'
 		 && ndp->ni_pnbuf[3] == '/')) {
 			ndp->ni_erootdir = NULL;
@@ -971,7 +971,7 @@ lookup_crossmount(struct namei_state *st
 break;
 			}
 
-			/* 
+			/*
 			 * Check to see if something is still mounted on it.
 			 */
 			if ((mp = foundobj->v_mountedhere) == NULL) {
@@ -1048,7 +1048,7 @@ lookup_crossmount(struct namei_state *st
 
 /*
  * Call VOP_LOOKUP for a single lookup; return a new search directory
- * (used when crossing mountpoints up or searching union mounts down) and 
+ * (used when crossing mountpoints up or searching union mounts down) and
  * the found object, which for create operations may be NULL on success.
  *
  * Note that the new search directory may be null, which means the
@@ -1268,7 +1268,7 @@ done:
 }
 
 /*
- * Parse out the first path name component that we need to to consider. 
+ * Parse out the first path name component that we need to to consider.
  *
  * While doing this, attempt to use the name cache to fast-forward through
  * as many "easy" to find components of the path as possible.
@@ -1440,7 +1440,7 @@ lookup_fastforward(struct namei_state *s
 		/*
 		 * If we exited the loop above having successfully located
 		 * the last component with a zero error code, and it's not a
-		 * symbolic link, then the parent directory is not needed. 
+		 * symbolic link, then the parent directory is not needed.
 		 * Release reference to the starting parent and make the
 		 * terminal parent disappear into thin air.
 		 */
@@ -2258,7 +2258,7 @@ namei_simple_kernel(const char *path, na
 }
 
 int
-nameiat_simple_kernel(struct vnode *dvp, const char *path, 
+nameiat_simple_kernel(struct vnode *dvp, const char *path,
 	namei_simple_flags_t sflags, struct vnode **vp_ret)
 {
 	struct nameidata nd;



CVS commit: src/sys/kern

2020-06-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jun  4 03:12:26 UTC 2020

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

Log Message:
Nix trailing whitespace.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/sys/kern/vfs_lookup.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/evbmips/cavium

2020-06-03 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Jun  4 03:08:59 UTC 2020

Modified Files:
src/sys/arch/evbmips/cavium: machdep.c

Log Message:
Only clear BSS up to "end" symbol, not all the way to mips_round_page(end).
U-Boot puts some data immediately after the BSS section cleared in the ELF
segments, and we don't want to overwrite that.

XXX: Stop using mips_round_page(end) on all MIPS?


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbmips/cavium/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/evbmips/cavium/machdep.c
diff -u src/sys/arch/evbmips/cavium/machdep.c:1.11 src/sys/arch/evbmips/cavium/machdep.c:1.12
--- src/sys/arch/evbmips/cavium/machdep.c:1.11	Sun May 31 14:05:21 2020
+++ src/sys/arch/evbmips/cavium/machdep.c	Thu Jun  4 03:08:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.11 2020/05/31 14:05:21 simonb Exp $	*/
+/*	$NetBSD: machdep.c,v 1.12 2020/06/04 03:08:59 simonb Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -115,7 +115,7 @@
 #include "opt_cavium.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.11 2020/05/31 14:05:21 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.12 2020/06/04 03:08:59 simonb Exp $");
 
 #include 
 #include 
@@ -154,7 +154,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 
 #include 
 
-static void	mach_init_bss(void);
 static void	mach_init_vector(void);
 static void	mach_init_bus_space(void);
 static void	mach_init_console(void);
@@ -191,8 +190,11 @@ mach_init(uint64_t arg0, uint64_t arg1, 
 	uint64_t btinfo_paddr;
 	u_quad_t memsize;
 	int corefreq;
+	extern char edata[], end[];
+
+	/* clear the BSS segment */
+	memset(edata, 0, end - edata);
 
-	mach_init_bss();
 
 	KASSERT(MIPS_XKPHYS_P(arg3));
 	btinfo_paddr = mips3_ld(arg3 + OCTEON_BTINFO_PADDR_OFFSET);
@@ -270,17 +272,6 @@ consinit(void)
 }
 
 void
-mach_init_bss(void)
-{
-	extern char edata[], end[];
-
-	/*
-	 * Clear the BSS segment.
-	 */
-	memset(edata, 0, mips_round_page(end) - (uintptr_t)edata);
-}
-
-void
 mach_init_vector(void)
 {
 



CVS commit: src/sys/arch/evbmips/cavium

2020-06-03 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Jun  4 03:08:59 UTC 2020

Modified Files:
src/sys/arch/evbmips/cavium: machdep.c

Log Message:
Only clear BSS up to "end" symbol, not all the way to mips_round_page(end).
U-Boot puts some data immediately after the BSS section cleared in the ELF
segments, and we don't want to overwrite that.

XXX: Stop using mips_round_page(end) on all MIPS?


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbmips/cavium/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/kern

2020-06-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jun  4 03:08:33 UTC 2020

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

Log Message:
Nix trailing whitespace.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/kern/vfs_cache.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/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.146 src/sys/kern/vfs_cache.c:1.147
--- src/sys/kern/vfs_cache.c:1.146	Sat May 30 20:16:14 2020
+++ src/sys/kern/vfs_cache.c	Thu Jun  4 03:08:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.146 2020/05/30 20:16:14 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.147 2020/06/04 03:08:33 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -98,7 +98,7 @@
  *  ...
  *   ^
  *   |- vi_nc_tree
- *   |   
+ *   |
  *  +o+   +-+   +-+
  *  |  VDIR   |   |  VCHR   |   |  VREG   |
  *  |  vnode  o-+ |  vnode  o-+ |  vnode  o--+
@@ -172,7 +172,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.146 2020/05/30 20:16:14 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.147 2020/06/04 03:08:33 riastradh Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -416,7 +416,7 @@ cache_lookup_entry(struct vnode *dvp, co
 	/*
 	 * Search the RB tree for the key.  This is an inlined lookup
 	 * tailored for exactly what's needed here (64-bit key and so on)
-	 * that is quite a bit faster than using rb_tree_find_node(). 
+	 * that is quite a bit faster than using rb_tree_find_node().
 	 *
 	 * For a matching key memcmp() needs to be called once to confirm
 	 * that the correct name has been found.  Very rarely there will be
@@ -435,7 +435,7 @@ cache_lookup_entry(struct vnode *dvp, co
 			if (__predict_true(diff == 0)) {
 break;
 			}
-			node = node->rb_nodes[diff < 0];			
+			node = node->rb_nodes[diff < 0];
 		} else {
 			node = node->rb_nodes[ncp->nc_key < key];
 		}
@@ -745,7 +745,7 @@ cache_lookup_linked(struct vnode *dvp, c
 	}
 	if (newlock) {
 		*plock = newlock;
-	}	
+	}
 	*vn_ret = ncp->nc_vp;
 	return true;
 }
@@ -1312,7 +1312,7 @@ cache_activate(struct namecache *ncp)
 
 /*
  * Try to balance the LRU lists.  Pick some victim entries, and re-queue
- * them from the head of the active list to the tail of the inactive list. 
+ * them from the head of the active list to the tail of the inactive list.
  */
 static void
 cache_deactivate(void)



CVS commit: src/sys/kern

2020-06-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jun  4 03:08:33 UTC 2020

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

Log Message:
Nix trailing whitespace.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/kern/vfs_cache.c

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



CVS commit: src

2020-06-03 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jun  4 00:45:32 UTC 2020

Modified Files:
src/external/bsd/jemalloc/dist/src: tsd.c
src/external/bsd/jemalloc/include/jemalloc/internal:
jemalloc_internal_defs.h
src/lib/libpthread: pthread.c

Log Message:
If _malloc_thread_cleanup is implement, call it from libpthread.
Provide the hook from modern jemalloc to avoid using TSD for the thread
destruction cleanup as it can result in reentrancy crashes if fork is
called from a thread that never called malloc as it will result in a
late malloc from the pre-fork synchronisation handler.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/jemalloc/dist/src/tsd.c
cvs rdiff -u -r1.12 -r1.13 \
src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
cvs rdiff -u -r1.173 -r1.174 src/lib/libpthread/pthread.c

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



CVS commit: src

2020-06-03 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jun  4 00:45:32 UTC 2020

Modified Files:
src/external/bsd/jemalloc/dist/src: tsd.c
src/external/bsd/jemalloc/include/jemalloc/internal:
jemalloc_internal_defs.h
src/lib/libpthread: pthread.c

Log Message:
If _malloc_thread_cleanup is implement, call it from libpthread.
Provide the hook from modern jemalloc to avoid using TSD for the thread
destruction cleanup as it can result in reentrancy crashes if fork is
called from a thread that never called malloc as it will result in a
late malloc from the pre-fork synchronisation handler.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/jemalloc/dist/src/tsd.c
cvs rdiff -u -r1.12 -r1.13 \
src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
cvs rdiff -u -r1.173 -r1.174 src/lib/libpthread/pthread.c

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

Modified files:

Index: src/external/bsd/jemalloc/dist/src/tsd.c
diff -u src/external/bsd/jemalloc/dist/src/tsd.c:1.2 src/external/bsd/jemalloc/dist/src/tsd.c:1.3
--- src/external/bsd/jemalloc/dist/src/tsd.c:1.2	Wed Apr 24 14:34:21 2019
+++ src/external/bsd/jemalloc/dist/src/tsd.c	Thu Jun  4 00:45:32 2020
@@ -169,6 +169,10 @@ malloc_tsd_dalloc(void *wrapper) {
 	a0dalloc(wrapper);
 }
 
+__BEGIN_DECLS
+void _malloc_thread_cleanup(void);
+__END_DECLS
+
 #if defined(JEMALLOC_MALLOC_THREAD_CLEANUP) || defined(_WIN32)
 #ifndef _WIN32
 JEMALLOC_EXPORT

Index: src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
diff -u src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h:1.12 src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h:1.13
--- src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h:1.12	Tue Apr 21 22:27:09 2020
+++ src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h	Thu Jun  4 00:45:32 2020
@@ -138,7 +138,7 @@
  * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
  * malloc_tsd.
  */
-/* #undef JEMALLOC_MALLOC_THREAD_CLEANUP */
+#define JEMALLOC_MALLOC_THREAD_CLEANUP
 
 /*
  * Defined if threaded initialization is known to be safe on this platform.

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.173 src/lib/libpthread/pthread.c:1.174
--- src/lib/libpthread/pthread.c:1.173	Wed Jun  3 22:10:24 2020
+++ src/lib/libpthread/pthread.c	Thu Jun  4 00:45:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.173 2020/06/03 22:10:24 ad Exp $	*/
+/*	$NetBSD: pthread.c,v 1.174 2020/06/04 00:45:32 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.173 2020/06/03 22:10:24 ad Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.174 2020/06/04 00:45:32 joerg Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -66,6 +66,10 @@ __RCSID("$NetBSD: pthread.c,v 1.173 2020
 #include "pthread_makelwp.h"
 #include "reentrant.h"
 
+__BEGIN_DECLS
+void _malloc_thread_cleanup(void) __weak;
+__END_DECLS
+
 pthread_rwlock_t pthread__alltree_lock = PTHREAD_RWLOCK_INITIALIZER;
 static rb_tree_t	pthread__alltree;
 
@@ -677,6 +681,9 @@ pthread_exit(void *retval)
 	/* Perform cleanup of thread-specific data */
 	pthread__destroy_tsd(self);
 
+	if (_malloc_thread_cleanup)
+		_malloc_thread_cleanup();
+
 	/*
 	 * Signal our exit.  Our stack and pthread_t won't be reused until
 	 * pthread_create() can see from kernel info that this LWP is gone.



Re: [stos, again] Re: CVS commit: src/sys/arch/amd64

2020-06-03 Thread Kamil Rytarowski
On 04.06.2020 00:42, Andrew Doran wrote:
> On Wed, Jun 03, 2020 at 02:03:22AM +0200, Kamil Rytarowski wrote:
> 
>> On 03.06.2020 01:49, Andrew Doran wrote:
>>> On the assembly thing recall that recently you expressed a desire to remove
>>> all of the amd64 assembly string functions from libc because of sanitizers -
>>> I invested my time to do up a little demo to try and show you why that's not
>>> a good idea:
>>>
>>> http://mail-index.netbsd.org/port-amd64/2020/04/19/msg003226.html
>>
>> Please note that interceptors for string functions are not just some
>> extra burden, but also very useful approach to feedback a fuzzer through
>> additional coverage.
>>
>> At least libFuzzer and honggfuzz wrap many kinds of string functions and
>> use it for fuzzing. We should add a special mode in KCOV to feedback
>> userland (syzkaller) with traces from string functions.
>>
>> https://github.com/google/honggfuzz/blob/bbb476eec95ad927d6d7d3d367d2b3e38eed3569/libhfuzz/memorycmp.c#L24
> 
> No argument from me there at all.  I think that's a great idea and was
> looking at the interceptors in TSAN recently to see how they work.
> 
> Andrew
> 

My note was not about switching away from ASM functions for certain
functions, but rather giving an option to disable them under a sanitizer
and adding an interceptor that can be useful for feedbacking a fuzzer.
It's still not clear whether we will create such interface in KCOV as it
has to be coordinated with Google+Linux as we would like to have a
compatible interface for syzkaller.

TSAN - do you mean the userland ones?

BTW. There is a work-in-progress MKSANITIZER support for TSan, but it
used to create unkillable processes (kernel bug). Basically when using a
TSanitized userland applications, you will quickly end up with such
processes (from AFAIR calling ls(1) and other simple applications are
enough).

If you are interested, I can share a reproducer.


Re: [stos, again] Re: CVS commit: src/sys/arch/amd64

2020-06-03 Thread Andrew Doran
Maxime,

I read your e-mail carefully and conclude that the best way forward here is
put this one to core@ for a technical decision.

Cheers,
Andrew

On Wed, Jun 03, 2020 at 08:25:32AM +0200, Maxime Villard wrote:
> Le 03/06/2020 ? 01:49, Andrew Doran a ?crit?:
> > On Tue, Jun 02, 2020 at 08:41:53AM +0200, Maxime Villard wrote:
> > 
> > > Le 02/06/2020 ? 00:58, Andrew Doran a ?crit?:
> > > > Module Name:src
> > > > Committed By:   ad
> > > > Date:   Mon Jun  1 22:58:06 UTC 2020
> > > > 
> > > > Modified Files:
> > > > src/sys/arch/amd64/amd64: cpufunc.S
> > > > src/sys/arch/amd64/include: frameasm.h
> > > > 
> > > > Log Message:
> > > > Reported-by: syzbot+6dd5a230d19f0cbc7...@syzkaller.appspotmail.com
> > > > 
> > > > Instrument STOS/MOVS for KMSAN to unbreak it.
> > > > 
> > > > 
> > > > To generate a diff of this commit:
> > > > cvs rdiff -u -r1.58 -r1.59 src/sys/arch/amd64/amd64/cpufunc.S
> > > > cvs rdiff -u -r1.49 -r1.50 src/sys/arch/amd64/include/frameasm.h
> > > > 
> > > > Please note that diffs are not public domain; they are subject to the
> > > > copyright notices on the relevant files.
> > > 
> > > Can you just stop ignoring the remarks that are made?
> > 
> > That's up to you Maxime.  If you habitually make it difficult for people to
> > come to a reasonable compromise with you, then you're asking to not be taken
> > seriously and will find yourself being ignored.
> 
> You are confused. I asked for KMSAN to be unbroken, and proposed an 
> alternative,
> which is atomic_load_relaxed. You were free to explain why my point was a bad
> idea or why it didn't matter, but you refused, and just added a hack on top of
> another. I'm afraid that's up to you.
> 
> But whatever, it doesn't matter. Thanks for reverting the pmap.c changes, it
> is more correct now than before.
> 
> > > I said explicitly
> > > that adding manual instrumentation here is _wrong_.
> > 
> > I don't share your assessment in the general sense.  It should be possible
> > to instrument assembly code because KMSAN is useful AND we can't get by
> > without assembly - there are some things that C just can't do (or do well
> > enough).
> > 
> > On the assembly thing recall that recently you expressed a desire to remove
> > all of the amd64 assembly string functions from libc because of sanitizers -
> > I invested my time to do up a little demo to try and show you why that's not
> > a good idea:
> > 
> > http://mail-index.netbsd.org/port-amd64/2020/04/19/msg003226.html
> 
> I saw, yes. I answered explaining that a conversation with Ryo Shimizu had
> changed my mind a bit, and seeing your results (which as far as I can tell
> do not indicate a performance improvement significant enough to not be
> considered as noise), I asked you whether it was that relevant. You didn't
> follow up though.
> 
> > The system is a balancing act.  There are lots of factors to be taken into
> > account: maintainability, tooling like KMSAN, user's varying needs, the
> > capabilites of different machines, performance, feature set and so on, and
> > dare I say it even the enjoyment of the people working on the project is
> > important too.  Myopic focus on one factor only to the detriment of others
> > is no good.
> 
> I am well aware of that.
> 
> > > The kMSan ASM fixups
> > > are limited to args/returns, and that is part of a sensical policy that
> > > _should not_ be changed without a good reason.
> > > 
> > > x86_movs/x86_stos have strictly _no reason_ to exist. Of the 18 
> > > conversions
> > > you made to them in pmap.c, not one is justified. memcpy/memset were all
> > > correct.
> > 
> > I introduced these functions as a compromise because you were unhappy with
> > use of memcpy() to copy PDEs.  See:
> > 
> > http://mail-index.netbsd.org/port-amd64/2020/05/23/msg003280.html
> > 
> > You wrote:
> > 
> > In the [XXX] window, the PTEs could be used by userland.  If you
> > copied them using memcpy(), some parts of the bytes could contain
> > stale values.
> 
> Sure, I was explicitly referring to SVS, which has an unusual way of
> accessing PTEs (contrary to pmap), which is why it needs special atomic
> care that other places do not.
> 
> > Live PDEs are also copied in pmap.c so I made a change there too.  After
> > that I decided "why not" and used the new functions everywhere PDEs/PTEs or
> > pages are block zeroed / copied.  But I'm also happy with memcpy()/memset().
> > Either way will work.  In fairness I do work too fast sometimes.
> > 
> > > The only reason you made these big unneeded changes is for SVS not to take
> > > the bus lock,
> > 
> > There is no bus lock on x86 (not since the 1990s anyway).
> > 
> > > but as was said already, atomic_load_relaxed will do what
> > > you want without the need for these functions.
> > > 
> > > Please revert _both changes now_, this one and the previous one which
> > > introduced both functions, and let's use atomic_load_relaxed.
> > 
> > You're focusing on only 

Re: [stos, again] Re: CVS commit: src/sys/arch/amd64

2020-06-03 Thread Andrew Doran
On Wed, Jun 03, 2020 at 02:03:22AM +0200, Kamil Rytarowski wrote:

> On 03.06.2020 01:49, Andrew Doran wrote:
> > On the assembly thing recall that recently you expressed a desire to remove
> > all of the amd64 assembly string functions from libc because of sanitizers -
> > I invested my time to do up a little demo to try and show you why that's not
> > a good idea:
> > 
> > http://mail-index.netbsd.org/port-amd64/2020/04/19/msg003226.html
> 
> Please note that interceptors for string functions are not just some
> extra burden, but also very useful approach to feedback a fuzzer through
> additional coverage.
>
> At least libFuzzer and honggfuzz wrap many kinds of string functions and
> use it for fuzzing. We should add a special mode in KCOV to feedback
> userland (syzkaller) with traces from string functions.
> 
> https://github.com/google/honggfuzz/blob/bbb476eec95ad927d6d7d3d367d2b3e38eed3569/libhfuzz/memorycmp.c#L24

No argument from me there at all.  I think that's a great idea and was
looking at the interceptors in TSAN recently to see how they work.

Andrew


CVS commit: src/sys/rump/librump/rumpkern

2020-06-03 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Jun  3 22:25:49 UTC 2020

Modified Files:
src/sys/rump/librump/rumpkern: vm.c

Log Message:
PR kern/55032 (rump/rumpkern/t_vm:uvmwait test case now fails)

Work around issues with rump's pagedaemon emulation, including one that's
sensitive to timing effects (i.e. scheduler changes).  While here tidy up
some other stuff around the emulation of page alloc/free.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/rump/librump/rumpkern/vm.c

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



CVS commit: src/sys/rump/librump/rumpkern

2020-06-03 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Jun  3 22:25:49 UTC 2020

Modified Files:
src/sys/rump/librump/rumpkern: vm.c

Log Message:
PR kern/55032 (rump/rumpkern/t_vm:uvmwait test case now fails)

Work around issues with rump's pagedaemon emulation, including one that's
sensitive to timing effects (i.e. scheduler changes).  While here tidy up
some other stuff around the emulation of page alloc/free.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.187 src/sys/rump/librump/rumpkern/vm.c:1.188
--- src/sys/rump/librump/rumpkern/vm.c:1.187	Tue Mar 17 18:31:38 2020
+++ src/sys/rump/librump/rumpkern/vm.c	Wed Jun  3 22:25:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.187 2020/03/17 18:31:38 ad Exp $	*/
+/*	$NetBSD: vm.c,v 1.188 2020/06/03 22:25:49 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.187 2020/03/17 18:31:38 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.188 2020/06/03 22:25:49 ad Exp $");
 
 #include 
 #include 
@@ -69,7 +69,6 @@ __KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.187
 #include 
 
 kmutex_t vmpage_lruqueue_lock; /* non-free page lock */
-kmutex_t uvm_fpageqlock; /* free page lock, non-gpl license */
 kmutex_t uvm_swap_data_lock;
 
 struct uvmexp uvmexp;
@@ -172,13 +171,6 @@ uvm_pagealloc_strat(struct uvm_object *u
 	pg->offset = off;
 	pg->uobject = uobj;
 
-	if (UVM_OBJ_IS_VNODE(uobj) && uobj->uo_npages == 0) {
-		struct vnode *vp = (struct vnode *)uobj;
-		mutex_enter(vp->v_interlock);
-		vp->v_iflag |= VI_PAGES;
-		mutex_exit(vp->v_interlock);
-	}
-
 	if (radix_tree_insert_node(>uo_pages, off >> PAGE_SHIFT,
 	pg) != 0) {
 		pool_cache_put(, pg);
@@ -186,6 +178,16 @@ uvm_pagealloc_strat(struct uvm_object *u
 	}
 	uobj->uo_npages++;
 
+	if (UVM_OBJ_IS_VNODE(uobj)) {
+		if (uobj->uo_npages == 0) {
+			struct vnode *vp = (struct vnode *)uobj;
+			mutex_enter(vp->v_interlock);
+			vp->v_iflag |= VI_PAGES;
+			mutex_exit(vp->v_interlock);
+		}
+		pg->flags |= PG_FILE;
+	}
+
 	pg->flags = PG_CLEAN|PG_BUSY|PG_FAKE;
 	if (flags & UVM_PGA_ZERO) {
 		uvm_pagezero(pg);
@@ -201,6 +203,8 @@ uvm_pagealloc_strat(struct uvm_object *u
 		mutex_enter(_lruqueue_lock);
 		TAILQ_INSERT_TAIL(_lruqueue, pg, pageq.queue);
 		mutex_exit(_lruqueue_lock);
+	} else {
+		pg->flags |= PG_AOBJ;
 	}
 
 	return pg;
@@ -220,10 +224,7 @@ uvm_pagefree(struct vm_page *pg)
 	KASSERT(rw_write_held(uobj->vmobjlock));
 
 	mutex_enter(>interlock);
-	if (pg->pqflags & PQ_WANTED) {
-		pg->pqflags &= ~PQ_WANTED;
-		wakeup(pg);
-	}
+	uvm_pagewakeup(pg);
 	mutex_exit(>interlock);
 
 	uobj->uo_npages--;
@@ -367,11 +368,8 @@ uvm_init(void)
 	mutex_init(, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(_lruqueue_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(_swap_data_lock, MUTEX_DEFAULT, IPL_NONE);
-
-	/* just to appease linkage */
-	mutex_init(_fpageqlock, MUTEX_SPIN, IPL_VM);
-
 	mutex_init(, MUTEX_DEFAULT, IPL_NONE);
+
 	cv_init(, "pdaemon");
 	cv_init(, "oomwait");
 
@@ -1141,16 +1139,14 @@ uvm_pageout(void *arg)
 
 	mutex_enter();
 	for (;;) {
-		if (!NEED_PAGEDAEMON()) {
-			kernel_map->flags &= ~VM_MAP_WANTVA;
-		}
-
 		if (pdaemon_waiters) {
 			pdaemon_waiters = 0;
 			cv_broadcast();
 		}
-
-		cv_wait(, );
+		if (!NEED_PAGEDAEMON()) {
+			kernel_map->flags &= ~VM_MAP_WANTVA;
+			cv_wait(, );
+		}
 		uvmexp.pdwoke++;
 
 		/* tell the world that we are hungry */
@@ -1202,22 +1198,6 @@ uvm_pageout(void *arg)
 		mutex_exit(_lruqueue_lock);
 
 		/*
-		 * Ok, someone is running with an object lock held.
-		 * We want to yield the host CPU to make sure the
-		 * thread is not parked on the host.  nanosleep
-		 * for the smallest possible time and hope we're back in
-		 * the game soon.
-		 */
-		if (cleaned == 0) {
-			rumpuser_clock_sleep(RUMPUSER_CLOCK_RELWALL, 0, 1);
-
-			skip = 0;
-
-			/* and here we go again */
-			goto again;
-		}
-
-		/*
 		 * And of course we need to reclaim the page cache
 		 * again to actually release memory.
 		 */
@@ -1249,8 +1229,6 @@ uvm_pageout(void *arg)
 		mutex_enter();
 		if (!succ && cleaned == 0 && pdaemon_waiters &&
 		uvmexp.paging == 0) {
-			rumpuser_dprintf("pagedaemoness: failed to reclaim "
-			"memory ... sleeping (deadlock?)\n");
 			kpause("pddlk", false, hz, );
 		}
 	}



CVS commit: src/lib/libpthread

2020-06-03 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Jun  3 22:10:24 UTC 2020

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

Log Message:
Deal with a couple of problems with threads being awoken early due to
timeouts or cancellation where:

- The restarting thread calls _lwp_exit() before another thread gets around
  to waking it with _lwp_unpark(), leading to ESRCH (observed by joerg@).
  (I may have removed a similar check mistakenly over the weekend.)

- The restarting thread considers itself gone off the sleep queue but
  at the same time another thread is part way through waking it, and hasn't
  fully completed that operation yet by setting thread->pt_mutexwait = 0.
  I think that could have potentially lead to the list of waiters getting
  messed up given the right circumstances.


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.70 -r1.71 src/lib/libpthread/pthread_cond.c
cvs rdiff -u -r1.78 -r1.79 src/lib/libpthread/pthread_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/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.172 src/lib/libpthread/pthread.c:1.173
--- src/lib/libpthread/pthread.c:1.172	Tue Jun  2 00:29:53 2020
+++ src/lib/libpthread/pthread.c	Wed Jun  3 22:10:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.172 2020/06/02 00:29:53 joerg Exp $	*/
+/*	$NetBSD: pthread.c,v 1.173 2020/06/03 22:10:24 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.172 2020/06/02 00:29:53 joerg Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.173 2020/06/03 22:10:24 ad Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -599,9 +599,12 @@ pthread_resume_np(pthread_t thread)
 }
 
 /*
- * In case the thread is exiting at an inopportune time leaving waiters not
- * awoken (because cancelled, for instance) make sure we have no waiters
- * left.
+ * Wake all deferred waiters hanging off self.
+ *
+ * It's possible for threads to have called _lwp_exit() before we wake them,
+ * because of cancellation and timeout, so ESRCH is tolerated here.  If a
+ * thread exits and its LID is reused, and the a thread receives an wakeup
+ * meant for the previous incarnation of the LID, no harm will be done.
  */
 void
 pthread__clear_waiters(pthread_t self)
@@ -620,7 +623,7 @@ pthread__clear_waiters(pthread_t self)
 		rv = _lwp_unpark(self->pt_waiters[0], NULL);
 		self->pt_waiters[0] = 0;
 		self->pt_nwaiters = 0;
-		if (rv != 0) {
+		if (rv != 0 && errno != ESRCH) {
 			pthread__errorfunc(__FILE__, __LINE__, __func__,
 			"_lwp_unpark failed: %d", errno);
 		}
@@ -629,7 +632,7 @@ pthread__clear_waiters(pthread_t self)
 		rv = _lwp_unpark_all(self->pt_waiters, self->pt_nwaiters, NULL);
 		self->pt_waiters[0] = 0;
 		self->pt_nwaiters = 0;
-		if (rv != 0) {
+		if (rv != 0 && errno != ESRCH) {
 			pthread__errorfunc(__FILE__, __LINE__, __func__,
 			"_lwp_unpark_all failed: %d", errno);
 		}
@@ -1195,6 +1198,7 @@ pthread__park(pthread_t self, pthread_mu
 			switch (rv = errno) {
 			case EINTR:
 			case EALREADY:
+			case ESRCH:
 rv = 0;
 break;
 			case ETIMEDOUT:

Index: src/lib/libpthread/pthread_cond.c
diff -u src/lib/libpthread/pthread_cond.c:1.70 src/lib/libpthread/pthread_cond.c:1.71
--- src/lib/libpthread/pthread_cond.c:1.70	Mon Jun  1 11:44:59 2020
+++ src/lib/libpthread/pthread_cond.c	Wed Jun  3 22:10:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cond.c,v 1.70 2020/06/01 11:44:59 ad Exp $	*/
+/*	$NetBSD: pthread_cond.c,v 1.71 2020/06/03 22:10:24 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_cond.c,v 1.70 2020/06/01 11:44:59 ad Exp $");
+__RCSID("$NetBSD: pthread_cond.c,v 1.71 2020/06/03 22:10:24 ad Exp $");
 
 #include 
 #include 
@@ -112,7 +112,7 @@ pthread_cond_timedwait(pthread_cond_t *c
 		   const struct timespec *abstime)
 {
 	pthread_t self, next, waiters;
-	int retval;
+	int retval, cancel;
 	clockid_t clkid = pthread_cond_getclock(cond);
 
 	if (__predict_false(__uselibcstub))
@@ -126,6 +126,7 @@ pthread_cond_timedwait(pthread_cond_t *c
 	mutex->ptm_owner != NULL);
 
 	self = pthread__self();
+	pthread__assert(!self->pt_condwait);
 
 	if (__predict_false(self->pt_cancel)) {
 		pthread__cancelled();
@@ -165,24 +166,42 @@ pthread_cond_timedwait(pthread_cond_t *c
 retval = errno;
 			}
 		}
-	} while (self->pt_condwait && !self->pt_cancel && !retval);
+		cancel = self->pt_cancel;
+	} while (self->pt_condwait && !cancel && !retval);
 
 	/*
-	 * If we have cancelled then exit.  POSIX dictates that
-	 * the mutex must be held when we action the cancellation.
+	 * If this thread absorbed a wakeup from pthread_cond_signal() and
+	 * cannot take the wakeup, we must ensure that another 

CVS commit: src/lib/libpthread

2020-06-03 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Jun  3 22:10:24 UTC 2020

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

Log Message:
Deal with a couple of problems with threads being awoken early due to
timeouts or cancellation where:

- The restarting thread calls _lwp_exit() before another thread gets around
  to waking it with _lwp_unpark(), leading to ESRCH (observed by joerg@).
  (I may have removed a similar check mistakenly over the weekend.)

- The restarting thread considers itself gone off the sleep queue but
  at the same time another thread is part way through waking it, and hasn't
  fully completed that operation yet by setting thread->pt_mutexwait = 0.
  I think that could have potentially lead to the list of waiters getting
  messed up given the right circumstances.


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.70 -r1.71 src/lib/libpthread/pthread_cond.c
cvs rdiff -u -r1.78 -r1.79 src/lib/libpthread/pthread_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/dev/fdt

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 19:55:13 UTC 2020

Modified Files:
src/sys/dev/fdt: cpufreq_dt.c

Log Message:
Re-enable "set cpufreq at boot" code.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/fdt/cpufreq_dt.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/fdt

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 19:55:13 UTC 2020

Modified Files:
src/sys/dev/fdt: cpufreq_dt.c

Log Message:
Re-enable "set cpufreq at boot" code.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/fdt/cpufreq_dt.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/fdt/cpufreq_dt.c
diff -u src/sys/dev/fdt/cpufreq_dt.c:1.16 src/sys/dev/fdt/cpufreq_dt.c:1.17
--- src/sys/dev/fdt/cpufreq_dt.c:1.16	Wed Jun  3 15:47:22 2020
+++ src/sys/dev/fdt/cpufreq_dt.c	Wed Jun  3 19:55:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufreq_dt.c,v 1.16 2020/06/03 15:47:22 jmcneill Exp $ */
+/* $NetBSD: cpufreq_dt.c,v 1.17 2020/06/03 19:55:13 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.16 2020/06/03 15:47:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.17 2020/06/03 19:55:13 jmcneill Exp $");
 
 #include 
 #include 
@@ -532,7 +532,6 @@ cpufreq_dt_init(device_t self)
 
 	cpufreq_dt_init_sysctl(sc);
 
-#if notyet
 	if (sc->sc_nopp > 0) {
 		struct cpufreq_dt_opp * const opp = >sc_opp[0];
 
@@ -540,7 +539,6 @@ cpufreq_dt_init(device_t self)
 		opp->freq_khz / 1000, opp->freq_khz % 1000, opp->voltage_uv);
 		cpufreq_dt_set_rate(sc, opp->freq_khz);
 	}
-#endif
 }
 
 static int



CVS commit: src/sys/arch/arm/ti

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 19:16:23 UTC 2020

Modified Files:
src/sys/arch/arm/ti: ti_motg.c

Log Message:
PR# port-evbarm/55263: BeagleBone Black too many interrupts on CPU when
using 5V DC power cable

Handle vbus status change events, and don't busy spin in the hard intr
handler when we see a vbus error (this will always be set when VBUS is not
present).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/ti/ti_motg.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/arm/ti

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 19:16:23 UTC 2020

Modified Files:
src/sys/arch/arm/ti: ti_motg.c

Log Message:
PR# port-evbarm/55263: BeagleBone Black too many interrupts on CPU when
using 5V DC power cable

Handle vbus status change events, and don't busy spin in the hard intr
handler when we see a vbus error (this will always be set when VBUS is not
present).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/ti/ti_motg.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/arm/ti/ti_motg.c
diff -u src/sys/arch/arm/ti/ti_motg.c:1.1 src/sys/arch/arm/ti/ti_motg.c:1.2
--- src/sys/arch/arm/ti/ti_motg.c:1.1	Sun Oct 27 16:31:26 2019
+++ src/sys/arch/arm/ti/ti_motg.c	Wed Jun  3 19:16:23 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_motg.c,v 1.1 2019/10/27 16:31:26 jmcneill Exp $ */
+/* $NetBSD: ti_motg.c,v 1.2 2020/06/03 19:16:23 jmcneill Exp $ */
 /*
  * Copyright (c) 2013 Manuel Bouyer.  All rights reserved.
  *
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_motg.c,v 1.1 2019/10/27 16:31:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_motg.c,v 1.2 2020/06/03 19:16:23 jmcneill Exp $");
 
 #include 
 #include 
@@ -187,8 +187,7 @@ ti_motg_intr(void *v)
 {
 	struct ti_motg_softc *sc = v;
 	uint32_t stat, stat0, stat1;
-	int rv = 0;
-	int i;
+	int rv;
 
 	MOTGHIST_FUNC(); MOTGHIST_CALLED();
 
@@ -198,34 +197,18 @@ ti_motg_intr(void *v)
 	stat1 = TIOTG_USBC_READ4(sc, USBCTRL_IRQ_STAT1);
 	DPRINTF("USB %jd 0x%jx 0x%jx stat %jd",
 	sc->sc_ctrlport, stat0, stat1, stat);
-	/* try to deal with vbus errors */
-	if (stat1 & MUSB2_MASK_IVBUSERR ) {
-		stat1 &= ~MUSB2_MASK_IVBUSERR;
-		for (i = 0; i < 1000; i++) {
-			TIOTG_USBC_WRITE4(sc, USBCTRL_IRQ_STAT1,
-			MUSB2_MASK_IVBUSERR);
-			motg_intr_vbus(>sc_motg, stat & 0x1);
-			delay(1000);
-			stat = TIOTG_USBC_READ4(sc, USBCTRL_STAT);
-			if (stat & 0x1)
-break;
-		}
-	}
+
 	if (stat0) {
 		TIOTG_USBC_WRITE4(sc, USBCTRL_IRQ_STAT0, stat0);
 	}
 	if (stat1) {
 		TIOTG_USBC_WRITE4(sc, USBCTRL_IRQ_STAT1, stat1);
 	}
-	if ((stat & 0x1) == 0) {
-		mutex_spin_exit(>sc_motg.sc_intr_lock);
-		aprint_error_dev(sc->sc_motg.sc_dev, ": vbus error\n");
-		return 1;
-	}
-	if (stat0 != 0 || stat1 != 0) {
-		rv = motg_intr(>sc_motg, ((stat0 >> 16) & 0x),
-			stat0 & 0x, stat1 & 0xff);
+	if (stat1 & USBCTRL_IRQ_STAT1_DRVVBUS) {
+		motg_intr_vbus(>sc_motg, stat & 0x1);
 	}
+	rv = motg_intr(>sc_motg, ((stat0 >> 16) & 0x),
+		stat0 & 0x, stat1 & 0xff);
 	mutex_spin_exit(>sc_motg.sc_intr_lock);
 	return rv;
 }



CVS commit: src/sys/arch/arm/ti

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 18:26:06 UTC 2020

Modified Files:
src/sys/arch/arm/ti: ti_dpll_clock.c

Log Message:
Fix dpll clock setting on am335x


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/ti/ti_dpll_clock.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/arm/ti

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 18:26:06 UTC 2020

Modified Files:
src/sys/arch/arm/ti: ti_dpll_clock.c

Log Message:
Fix dpll clock setting on am335x


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/ti/ti_dpll_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/arm/ti/ti_dpll_clock.c
diff -u src/sys/arch/arm/ti/ti_dpll_clock.c:1.2 src/sys/arch/arm/ti/ti_dpll_clock.c:1.3
--- src/sys/arch/arm/ti/ti_dpll_clock.c:1.2	Tue Oct 29 22:19:13 2019
+++ src/sys/arch/arm/ti/ti_dpll_clock.c	Wed Jun  3 18:26:06 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_dpll_clock.c,v 1.2 2019/10/29 22:19:13 jmcneill Exp $ */
+/* $NetBSD: ti_dpll_clock.c,v 1.3 2020/06/03 18:26:06 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_dpll_clock.c,v 1.2 2019/10/29 22:19:13 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_dpll_clock.c,v 1.3 2020/06/03 18:26:06 jmcneill Exp $");
 
 #include 
 #include 
@@ -267,7 +267,7 @@ am3_dpll_clock_set_rate(void *priv, stru
 	control |= __SHIFTIN(AM3_DPLL_EN_NM_BYPASS, AM3_DPLL_EN);
 	WR4(sc, REG_CONTROL, control);
 
-	while ((RD4(sc, REG_IDLEST) & AM3_ST_MN_BYPASS) != 0)
+	while (RD4(sc, REG_IDLEST) != AM3_ST_MN_BYPASS)
 		;
 
 	mult_div1 = __SHIFTIN(mult, DPLL_MULT);
@@ -278,7 +278,7 @@ am3_dpll_clock_set_rate(void *priv, stru
 	control |= __SHIFTIN(AM3_DPLL_EN_LOCK, AM3_DPLL_EN);
 	WR4(sc, REG_CONTROL, control);
 
-	while ((RD4(sc, REG_IDLEST) & AM3_ST_DPLL_CLK) != 0)
+	while (RD4(sc, REG_IDLEST) != AM3_ST_DPLL_CLK)
 		;
 
 	return 0;



CVS commit: src/sys/dev/ic

2020-06-03 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Jun  3 18:25:26 UTC 2020

Modified Files:
src/sys/dev/ic: wdc.c

Log Message:
Don't print an error message on spurious interrupt. Way too noisy for Xen.


To generate a diff of this commit:
cvs rdiff -u -r1.302 -r1.303 src/sys/dev/ic/wdc.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/ic/wdc.c
diff -u src/sys/dev/ic/wdc.c:1.302 src/sys/dev/ic/wdc.c:1.303
--- src/sys/dev/ic/wdc.c:1.302	Sat May 30 13:23:14 2020
+++ src/sys/dev/ic/wdc.c	Wed Jun  3 18:25:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc.c,v 1.302 2020/05/30 13:23:14 jdolecek Exp $ */
+/*	$NetBSD: wdc.c,v 1.303 2020/06/03 18:25:26 bouyer Exp $ */
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.302 2020/05/30 13:23:14 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.303 2020/06/03 18:25:26 bouyer Exp $");
 
 #include "opt_ata.h"
 #include "opt_wdc.h"
@@ -892,10 +892,8 @@ wdcintr(void *arg)
 		return (0);
 	}
 
-	if ((chp->ch_flags & ATACH_IRQ_WAIT) == 0) {
-		__wdcerror(chp, "irq not expected");
+	if ((chp->ch_flags & ATACH_IRQ_WAIT) == 0)
 		goto ignore;
-	}
 
 	xfer = ata_queue_get_active_xfer(chp);
 	if (xfer == NULL) {



CVS commit: src/sys/dev/ic

2020-06-03 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Jun  3 18:25:26 UTC 2020

Modified Files:
src/sys/dev/ic: wdc.c

Log Message:
Don't print an error message on spurious interrupt. Way too noisy for Xen.


To generate a diff of this commit:
cvs rdiff -u -r1.302 -r1.303 src/sys/dev/ic/wdc.c

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



CVS commit: src/tests/lib/libarchive

2020-06-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun  3 18:07:26 UTC 2020

Modified Files:
src/tests/lib/libarchive: t_libarchive.sh

Log Message:
Skip this test on machines where it would cause serious swapping.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libarchive/t_libarchive.sh

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



CVS commit: src/tests/lib/libarchive

2020-06-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun  3 18:07:26 UTC 2020

Modified Files:
src/tests/lib/libarchive: t_libarchive.sh

Log Message:
Skip this test on machines where it would cause serious swapping.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libarchive/t_libarchive.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/lib/libarchive/t_libarchive.sh
diff -u src/tests/lib/libarchive/t_libarchive.sh:1.3 src/tests/lib/libarchive/t_libarchive.sh:1.4
--- src/tests/lib/libarchive/t_libarchive.sh:1.3	Thu Mar 12 12:57:45 2020
+++ src/tests/lib/libarchive/t_libarchive.sh	Wed Jun  3 18:07:26 2020
@@ -1,4 +1,4 @@
-#   $NetBSD: t_libarchive.sh,v 1.3 2020/03/12 12:57:45 martin Exp $
+#   $NetBSD: t_libarchive.sh,v 1.4 2020/06/03 18:07:26 martin Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -35,6 +35,10 @@ libarchive_head()
 
 libarchive_body()
 {
+	local m=$(( $( sysctl -n hw.usermem64 ) / 1024 / 1024 ))
+	if [ $m -lt 400 ]; then
+		atf_skip "too few RAM"
+	fi
 	local d=$(atf_get_srcdir)
 	atf_check -s exit:0 -o 'not-match:^Details for failing tests:.*' \
 	"$d/h_libarchive" -r "$d"



CVS commit: src/sys/arch/arm/ti

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 18:02:03 UTC 2020

Modified Files:
src/sys/arch/arm/ti: ti_cpufreq.c

Log Message:
Fix SoC revision detection. BeagleBone Black reports 1GHz as a supported
frequency again.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/ti/ti_cpufreq.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/arm/ti/ti_cpufreq.c
diff -u src/sys/arch/arm/ti/ti_cpufreq.c:1.2 src/sys/arch/arm/ti/ti_cpufreq.c:1.3
--- src/sys/arch/arm/ti/ti_cpufreq.c:1.2	Tue Oct 29 10:54:10 2019
+++ src/sys/arch/arm/ti/ti_cpufreq.c	Wed Jun  3 18:02:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_cpufreq.c,v 1.2 2019/10/29 10:54:10 jmcneill Exp $ */
+/* $NetBSD: ti_cpufreq.c,v 1.3 2020/06/03 18:02:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_cpufreq.c,v 1.2 2019/10/29 10:54:10 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_cpufreq.c,v 1.3 2020/06/03 18:02:03 jmcneill Exp $");
 
 #include 
 #include 
@@ -62,7 +62,7 @@ am33xx_opp_supported(const int opp_table
 	int len;
 
 	syscon_lock(ti_opp_syscon);
-	rev = __SHIFTOUT(syscon_read_4(ti_opp_syscon, AM33XX_REV_OFFSET), AM33XX_REV_MASK);
+	rev = __BIT(__SHIFTOUT(syscon_read_4(ti_opp_syscon, AM33XX_REV_OFFSET), AM33XX_REV_MASK));
 	efuse = __SHIFTOUT(syscon_read_4(ti_opp_syscon, AM33XX_EFUSE_OFFSET), AM33XX_EFUSE_MASK);
 	syscon_unlock(ti_opp_syscon);
 



CVS commit: src/sys/arch/arm/ti

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 18:02:03 UTC 2020

Modified Files:
src/sys/arch/arm/ti: ti_cpufreq.c

Log Message:
Fix SoC revision detection. BeagleBone Black reports 1GHz as a supported
frequency again.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/ti/ti_cpufreq.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/arm/ti

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 16:00:00 UTC 2020

Modified Files:
src/sys/arch/arm/ti: ti_gpio.c ti_iic.c

Log Message:
If we can't find a hwmod name, use the device type and mmio address


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/ti_gpio.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/ti/ti_iic.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/arm/ti/ti_gpio.c
diff -u src/sys/arch/arm/ti/ti_gpio.c:1.3 src/sys/arch/arm/ti/ti_gpio.c:1.4
--- src/sys/arch/arm/ti/ti_gpio.c:1.3	Sun Nov  3 11:34:40 2019
+++ src/sys/arch/arm/ti/ti_gpio.c	Wed Jun  3 16:00:00 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_gpio.c,v 1.3 2019/11/03 11:34:40 jmcneill Exp $ */
+/* $NetBSD: ti_gpio.c,v 1.4 2020/06/03 16:00:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_gpio.c,v 1.3 2019/11/03 11:34:40 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_gpio.c,v 1.4 2020/06/03 16:00:00 jmcneill Exp $");
 
 #include 
 #include 
@@ -518,6 +518,8 @@ ti_gpio_attach(device_t parent, device_t
 	sc->sc_modname = fdtbus_get_string(phandle, "ti,hwmods");
 	if (sc->sc_modname == NULL)
 		sc->sc_modname = fdtbus_get_string(OF_parent(phandle), "ti,hwmods");
+	if (sc->sc_modname == NULL)
+		sc->sc_modname = kmem_asprintf("gpio@%" PRIxBUSADDR, addr);
 
 	aprint_naive("\n");
 	aprint_normal(": GPIO (%s)\n", sc->sc_modname);

Index: src/sys/arch/arm/ti/ti_iic.c
diff -u src/sys/arch/arm/ti/ti_iic.c:1.5 src/sys/arch/arm/ti/ti_iic.c:1.6
--- src/sys/arch/arm/ti/ti_iic.c:1.5	Thu May 14 08:34:20 2020
+++ src/sys/arch/arm/ti/ti_iic.c	Wed Jun  3 16:00:00 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_iic.c,v 1.5 2020/05/14 08:34:20 msaitoh Exp $ */
+/* $NetBSD: ti_iic.c,v 1.6 2020/06/03 16:00:00 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2013 Manuel Bouyer.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.5 2020/05/14 08:34:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_iic.c,v 1.6 2020/06/03 16:00:00 jmcneill Exp $");
 
 #include 
 #include 
@@ -292,7 +292,11 @@ ti_iic_attach(device_t parent, device_t 
 	sc->sc_rxthres = sc->sc_txthres = fifo >> 1;
 
 	aprint_naive("\n");
-	aprint_normal(": I2C controller (%s), %d-bytes FIFO\n", modname, fifo);
+	if (modname != NULL)
+		aprint_normal(": I2C controller (%s), %d-bytes FIFO\n", modname, fifo);
+	else
+		aprint_normal(": I2C controller (i2c@%" PRIxBUSADDR "), %d-bytes FIFO\n",
+		addr, fifo);
 
 	ti_iic_reset(sc);
 	ti_iic_flush(sc);



CVS commit: src/sys/arch/arm/ti

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 16:00:00 UTC 2020

Modified Files:
src/sys/arch/arm/ti: ti_gpio.c ti_iic.c

Log Message:
If we can't find a hwmod name, use the device type and mmio address


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/ti_gpio.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/ti/ti_iic.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/arm/ti

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 15:59:22 UTC 2020

Modified Files:
src/sys/arch/arm/ti: ti_rng.c

Log Message:
Add a line break before rnd_attach_source so the "entropy: ready" announcement 
does not get mixed with device prints


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/ti_rng.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/arm/ti/ti_rng.c
diff -u src/sys/arch/arm/ti/ti_rng.c:1.3 src/sys/arch/arm/ti/ti_rng.c:1.4
--- src/sys/arch/arm/ti/ti_rng.c:1.3	Thu Apr 30 03:40:53 2020
+++ src/sys/arch/arm/ti/ti_rng.c	Wed Jun  3 15:59:22 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ti_rng.c,v 1.3 2020/04/30 03:40:53 riastradh Exp $ */
+/* $NetBSD: ti_rng.c,v 1.4 2020/06/03 15:59:22 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ti_rng.c,v 1.3 2020/04/30 03:40:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ti_rng.c,v 1.4 2020/06/03 15:59:22 jmcneill Exp $");
 
 #include 
 #include 
@@ -112,12 +112,12 @@ ti_rng_attach(device_t parent, device_t 
 		TRNG_CONTROL_ENABLE);
 	}
 
+	aprint_naive("\n");
+	aprint_normal(": RNG\n");
+
 	rndsource_setcb(>sc_rndsource, ti_rng_callback, sc);
 	rnd_attach_source(>sc_rndsource, device_xname(self), RND_TYPE_RNG,
 	RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
-
-	aprint_naive("\n");
-	aprint_normal(": RNG\n");
 }
 
 static void



CVS commit: src/sys/arch/arm/ti

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 15:59:22 UTC 2020

Modified Files:
src/sys/arch/arm/ti: ti_rng.c

Log Message:
Add a line break before rnd_attach_source so the "entropy: ready" announcement 
does not get mixed with device prints


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/ti_rng.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/fdt

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 15:47:23 UTC 2020

Modified Files:
src/sys/dev/fdt: cpufreq_dt.c

Log Message:
Disable setting cpufreq at boot for now


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/fdt/cpufreq_dt.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/fdt

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 15:47:23 UTC 2020

Modified Files:
src/sys/dev/fdt: cpufreq_dt.c

Log Message:
Disable setting cpufreq at boot for now


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/fdt/cpufreq_dt.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/fdt/cpufreq_dt.c
diff -u src/sys/dev/fdt/cpufreq_dt.c:1.15 src/sys/dev/fdt/cpufreq_dt.c:1.16
--- src/sys/dev/fdt/cpufreq_dt.c:1.15	Wed Jun  3 15:44:45 2020
+++ src/sys/dev/fdt/cpufreq_dt.c	Wed Jun  3 15:47:22 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufreq_dt.c,v 1.15 2020/06/03 15:44:45 jmcneill Exp $ */
+/* $NetBSD: cpufreq_dt.c,v 1.16 2020/06/03 15:47:22 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.15 2020/06/03 15:44:45 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.16 2020/06/03 15:47:22 jmcneill Exp $");
 
 #include 
 #include 
@@ -532,6 +532,7 @@ cpufreq_dt_init(device_t self)
 
 	cpufreq_dt_init_sysctl(sc);
 
+#if notyet
 	if (sc->sc_nopp > 0) {
 		struct cpufreq_dt_opp * const opp = >sc_opp[0];
 
@@ -539,6 +540,7 @@ cpufreq_dt_init(device_t self)
 		opp->freq_khz / 1000, opp->freq_khz % 1000, opp->voltage_uv);
 		cpufreq_dt_set_rate(sc, opp->freq_khz);
 	}
+#endif
 }
 
 static int



CVS commit: src/sys/dev/fdt

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 15:44:45 UTC 2020

Modified Files:
src/sys/dev/fdt: cpufreq_dt.c

Log Message:
Highest speed is first opp, not last


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/fdt/cpufreq_dt.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/fdt/cpufreq_dt.c
diff -u src/sys/dev/fdt/cpufreq_dt.c:1.14 src/sys/dev/fdt/cpufreq_dt.c:1.15
--- src/sys/dev/fdt/cpufreq_dt.c:1.14	Tue Jun  2 11:40:02 2020
+++ src/sys/dev/fdt/cpufreq_dt.c	Wed Jun  3 15:44:45 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufreq_dt.c,v 1.14 2020/06/02 11:40:02 jmcneill Exp $ */
+/* $NetBSD: cpufreq_dt.c,v 1.15 2020/06/03 15:44:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.14 2020/06/02 11:40:02 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.15 2020/06/03 15:44:45 jmcneill Exp $");
 
 #include 
 #include 
@@ -533,7 +533,7 @@ cpufreq_dt_init(device_t self)
 	cpufreq_dt_init_sysctl(sc);
 
 	if (sc->sc_nopp > 0) {
-		struct cpufreq_dt_opp * const opp = >sc_opp[sc->sc_nopp - 1];
+		struct cpufreq_dt_opp * const opp = >sc_opp[0];
 
 		aprint_normal_dev(sc->sc_dev, "rate: %u.%03u MHz, %u uV\n",
 		opp->freq_khz / 1000, opp->freq_khz % 1000, opp->voltage_uv);



CVS commit: src/sys/dev/fdt

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 15:44:45 UTC 2020

Modified Files:
src/sys/dev/fdt: cpufreq_dt.c

Log Message:
Highest speed is first opp, not last


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/fdt/cpufreq_dt.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/usb

2020-06-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun  3 15:38:02 UTC 2020

Modified Files:
src/sys/dev/usb: ohci.c ohcireg.h

Log Message:
Convert ohcireg.h to __BITS.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/usb/ohcireg.h

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

Modified files:

Index: src/sys/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.309 src/sys/dev/usb/ohci.c:1.310
--- src/sys/dev/usb/ohci.c:1.309	Tue May 26 07:03:22 2020
+++ src/sys/dev/usb/ohci.c	Wed Jun  3 15:38:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.309 2020/05/26 07:03:22 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.310 2020/06/03 15:38:02 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.309 2020/05/26 07:03:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.310 2020/06/03 15:38:02 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -607,9 +607,12 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
 
 	usb_syncmem(dma, 0, len,
 	rd ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
-	const uint32_t tdflags = HTOO32(
-	(rd ? OHCI_TD_IN : OHCI_TD_OUT) |
-	OHCI_TD_NOCC | OHCI_TD_TOGGLE_CARRY | OHCI_TD_NOINTR);
+ 	const uint32_t tdflags = HTOO32(
+	OHCI_TD_SET_DP(rd ? OHCI_TD_DP_IN : OHCI_TD_DP_OUT) |
+	OHCI_TD_SET_CC(OHCI_TD_NOCC) |
+	OHCI_TD_SET_TOGGLE(OHCI_TD_TOGGLE_CARRY) |
+	OHCI_TD_SET_DI(OHCI_TD_NOINTR)
+	);
 
 	size_t curoffs = 0;
 	for (size_t j = 1; len != 0;) {
@@ -803,7 +806,7 @@ ohci_init(ohci_softc_t *sc)
 	"ohcixfer", NULL, IPL_USB, NULL, NULL, NULL);
 
 	rev = OREAD4(sc, OHCI_REVISION);
-	aprint_normal("OHCI version %d.%d%s\n",
+	aprint_normal("OHCI version %" __PRIuBITS ".%" __PRIuBITS "%s\n",
 	OHCI_REV_HI(rev), OHCI_REV_LO(rev),
 	OHCI_REV_LEGACY(rev) ? ", legacy support" : "");
 
@@ -927,16 +930,21 @@ ohci_init(ohci_softc_t *sc)
 		if ((ctl & OHCI_IR) == 0) {
 			aprint_error_dev(sc->sc_dev,
 			"SMM does not respond, resetting\n");
-			OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET | rwc);
+			OWRITE4(sc, OHCI_CONTROL,
+			OHCI_SET_HCFS(OHCI_HCFS_RESET) | rwc);
 			goto reset;
 		}
 #if 0
-/* Don't bother trying to reuse the BIOS init, we'll reset it anyway. */
-	} else if ((ctl & OHCI_HCFS_MASK) != OHCI_HCFS_RESET) {
+	/*
+	 * Don't bother trying to reuse the BIOS init, we'll reset it
+	 * anyway.
+	 */
+	} else if (OHCI_GET_HCFS(ctl) != OHCI_HCFS_RESET) {
 		/* BIOS started controller. */
 		DPRINTF("BIOS active", 0, 0, 0, 0);
-		if ((ctl & OHCI_HCFS_MASK) != OHCI_HCFS_OPERATIONAL) {
-			OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_OPERATIONAL | rwc);
+		if (OHCI_GET_HCFS(ctl) != OHCI_HCFS_OPERATIONAL) {
+			OWRITE4(sc, OHCI_CONTROL,
+			OHCI_SET_HCFS(OHCI_HCFS_OPERATIONAL) | rwc);
 			usb_delay_ms(>sc_bus, USB_RESUME_DELAY);
 		}
 #endif
@@ -952,7 +960,7 @@ ohci_init(ohci_softc_t *sc)
 	 * without it some controllers do not start.
 	 */
 	DPRINTF("sc %#jx: resetting", (uintptr_t)sc, 0, 0, 0);
-	OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET | rwc);
+	OWRITE4(sc, OHCI_CONTROL, OHCI_SET_HCFS(OHCI_HCFS_RESET) | rwc);
 	usb_delay_ms(>sc_bus, USB_BUS_RESET_DELAY);
 
 	/* We now own the host controller and the bus has been reset. */
@@ -987,7 +995,8 @@ ohci_init(ohci_softc_t *sc)
 	ctl = OREAD4(sc, OHCI_CONTROL);
 	ctl &= ~(OHCI_CBSR_MASK | OHCI_LES | OHCI_HCFS_MASK | OHCI_IR);
 	ctl |= OHCI_PLE | OHCI_IE | OHCI_CLE | OHCI_BLE |
-		OHCI_RATIO_1_4 | OHCI_HCFS_OPERATIONAL | rwc;
+		OHCI_CBSR_SET(OHCI_RATIO_1_4) |
+		OHCI_SET_HCFS(OHCI_HCFS_OPERATIONAL) | rwc;
 	/* And finally start it! */
 	OWRITE4(sc, OHCI_CONTROL, ctl);
 
@@ -996,8 +1005,8 @@ ohci_init(ohci_softc_t *sc)
 	 * registers that should be set earlier, but that the
 	 * controller ignores when in the SUSPEND state.
 	 */
-	ival = OHCI_GET_IVAL(fm);
-	fm = (OREAD4(sc, OHCI_FM_INTERVAL) & OHCI_FIT) ^ OHCI_FIT;
+	ival = OHCI_FM_GET_IVAL(fm);
+	fm = (OREAD4(sc, OHCI_FM_INTERVAL) & OHCI_FM_FIT) ^ OHCI_FM_FIT;
 	fm |= OHCI_FSMPS(ival) | ival;
 	OWRITE4(sc, OHCI_FM_INTERVAL, fm);
 	per = OHCI_PERIODIC(ival); /* 90% periodic */
@@ -1005,19 +1014,19 @@ ohci_init(ohci_softc_t *sc)
 
 	if (sc->sc_flags & OHCIF_SUPERIO) {
 		/* no overcurrent protection */
-		desca |= OHCI_NOCP;
+		desca |= OHCI_RHD_NOCP;
 		/*
 		 * Clear NoPowerSwitching and PowerOnToPowerGoodTime meaning
 		 * that
 		 *  - ports are always power switched
 		 *  - don't wait for powered root hub port
 		 */
-		desca &= ~(__SHIFTIN(0xff, OHCI_POTPGT_MASK) | OHCI_NPS);
+		desca &= ~(OHCI_RHD_POTPGT_MASK | OHCI_RHD_NPS);
 	}
 
 	/* Fiddle the No OverCurrent Protection bit to avoid chip bug. */
-	OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca | OHCI_NOCP);
-	OWRITE4(sc, OHCI_RH_STATUS, OHCI_LPSC); /* Enable port power */
+	OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca | 

CVS commit: src/sys/dev/usb

2020-06-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jun  3 15:38:02 UTC 2020

Modified Files:
src/sys/dev/usb: ohci.c ohcireg.h

Log Message:
Convert ohcireg.h to __BITS.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/usb/ohcireg.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/arm/ti

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 14:56:10 UTC 2020

Modified Files:
src/sys/arch/arm/ti: am3_prcm.c ti_prcm.c

Log Message:
Catch up to clock changes in last dts import.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/ti/am3_prcm.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/ti_prcm.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/arm/ti/am3_prcm.c
diff -u src/sys/arch/arm/ti/am3_prcm.c:1.12 src/sys/arch/arm/ti/am3_prcm.c:1.13
--- src/sys/arch/arm/ti/am3_prcm.c:1.12	Fri Nov 29 20:54:00 2019
+++ src/sys/arch/arm/ti/am3_prcm.c	Wed Jun  3 14:56:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: am3_prcm.c,v 1.12 2019/11/29 20:54:00 jmcneill Exp $ */
+/* $NetBSD: am3_prcm.c,v 1.13 2020/06/03 14:56:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v 1.12 2019/11/29 20:54:00 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v 1.13 2020/06/03 14:56:09 jmcneill Exp $");
 
 #include 
 #include 
@@ -65,6 +65,11 @@ __KERNEL_RCSID(1, "$NetBSD: am3_prcm.c,v
 
 #define	DPLL_DISP_RATE29700
 
+struct am3_prcm_softc {
+	struct ti_prcm_softc	sc_prcm;	/* must be first */
+	bus_addr_t		sc_regbase;
+};
+
 static int am3_prcm_match(device_t, cfdata_t, void *);
 static void am3_prcm_attach(device_t, device_t, void *);
 
@@ -133,7 +138,17 @@ static const char * const compatible[] =
 	NULL
 };
 
-CFATTACH_DECL_NEW(am3_prcm, sizeof(struct ti_prcm_softc),
+static const char * const cm_compatible[] = {
+	"ti,omap4-cm",
+	NULL
+};
+
+static const char * const clkctrl_compatible[] = {
+	"ti,clkctrl",
+	NULL
+};
+
+CFATTACH_DECL_NEW(am3_prcm, sizeof(struct am3_prcm_softc),
 	am3_prcm_match, am3_prcm_attach, NULL, NULL);
 
 static struct ti_prcm_clk am3_prcm_clks[] = {
@@ -146,6 +161,7 @@ static struct ti_prcm_clk am3_prcm_clks[
 	TI_PRCM_FIXED_FACTOR("PERIPH_CLK", 1, 1, "FIXED_48MHZ"),
 	TI_PRCM_FIXED_FACTOR("MMC_CLK", 1, 1, "FIXED_96MHZ"),
 
+	AM3_PRCM_HWMOD_WKUP("uart0", 0xb4, "PERIPH_CLK"),
 	AM3_PRCM_HWMOD_PER("uart1", 0x6c, "PERIPH_CLK"),
 	AM3_PRCM_HWMOD_PER("uart2", 0x70, "PERIPH_CLK"),
 	AM3_PRCM_HWMOD_PER("uart3", 0x74, "PERIPH_CLK"),
@@ -187,6 +203,53 @@ static struct ti_prcm_clk am3_prcm_clks[
 	AM3_PRCM_HWMOD_PER_DISP("lcdc", 0x18, "DISPLAY_CLK"),
 };
 
+static struct clk *
+am3_prcm_clock_decode(device_t dev, int cc_phandle, const void *data, size_t len)
+{
+	struct am3_prcm_softc * const sc = device_private(dev);
+	const u_int *cells = data;
+	bus_addr_t regbase;
+	u_int n;
+
+	if (len != 8)
+		return NULL;
+
+	bus_size_t regoff = be32toh(cells[0]);
+	const u_int clock_index = be32toh(cells[1]);
+
+	/* XXX not sure how to handle this yet */
+	if (clock_index != 0)
+		return NULL;
+
+	/*
+	 * Register offset in specifier is relative to base address of the
+	 * clock node. Translate this to an address relative to the start
+	 * of PRCM space.
+	 */
+	if (fdtbus_get_reg(cc_phandle, 0, , NULL) != 0)
+		return NULL;
+	regoff += (regbase - sc->sc_regbase);
+
+	/*
+	 * Look for a matching hwmod.
+	 */
+	for (n = 0; n < sc->sc_prcm.sc_nclks; n++) {
+		struct ti_prcm_clk *tclk = >sc_prcm.sc_clks[n];
+		if (tclk->type != TI_PRCM_HWMOD)
+			continue;
+
+		if (tclk->u.hwmod.reg == regoff)
+			return >base;
+	}
+
+	/* Not found */
+	return NULL;
+}
+
+static const struct fdtbus_clock_controller_func am3_prcm_clock_fdt_funcs = {
+	.decode = am3_prcm_clock_decode
+};
+
 static int
 am3_prcm_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -198,24 +261,43 @@ am3_prcm_match(device_t parent, cfdata_t
 static void
 am3_prcm_attach(device_t parent, device_t self, void *aux)
 {
-	struct ti_prcm_softc * const sc = device_private(self);
+	struct am3_prcm_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
-	int clocks;
+	const int phandle = faa->faa_phandle;
+	int clocks, child, cm_child;
 
-	sc->sc_dev = self;
-	sc->sc_phandle = faa->faa_phandle;
-	sc->sc_bst = faa->faa_bst;
+	if (fdtbus_get_reg(phandle, 0, >sc_regbase, NULL) != 0) {
+		aprint_error(": couldn't get registers\n");
+		return;
+	}
 
-	sc->sc_clks = am3_prcm_clks;
-	sc->sc_nclks = __arraycount(am3_prcm_clks);
+	sc->sc_prcm.sc_dev = self;
+	sc->sc_prcm.sc_phandle = phandle;
+	sc->sc_prcm.sc_bst = faa->faa_bst;
+	sc->sc_prcm.sc_clks = am3_prcm_clks;
+	sc->sc_prcm.sc_nclks = __arraycount(am3_prcm_clks);
 
-	if (ti_prcm_attach(sc) != 0)
+	if (ti_prcm_attach(>sc_prcm) != 0)
 		return;
 
 	aprint_naive("\n");
 	aprint_normal(": AM3xxx PRCM\n");
 
-	clocks = of_find_firstchild_byname(sc->sc_phandle, "clocks");
+	for (child = OF_child(phandle); child; child = OF_peer(child)) {
+		if (of_match_compatible(child, cm_compatible) == 0)
+			continue;
+
+		for (cm_child =	OF_child(child); cm_child; cm_child = OF_peer(cm_child)) {
+			if (of_match_compatible(cm_child, clkctrl_compatible) == 

CVS commit: src/sys/arch/arm/ti

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 14:56:10 UTC 2020

Modified Files:
src/sys/arch/arm/ti: am3_prcm.c ti_prcm.c

Log Message:
Catch up to clock changes in last dts import.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/ti/am3_prcm.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/ti_prcm.c

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



CVS commit: src/share/misc

2020-06-03 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Wed Jun  3 14:19:10 UTC 2020

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add FHRP, GLBP, HSRP


To generate a diff of this commit:
cvs rdiff -u -r1.304 -r1.305 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.304 src/share/misc/acronyms.comp:1.305
--- src/share/misc/acronyms.comp:1.304	Mon May 18 20:28:44 2020
+++ src/share/misc/acronyms.comp	Wed Jun  3 14:19:10 2020
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.304 2020/05/18 20:28:44 sevan Exp $
+$NetBSD: acronyms.comp,v 1.305 2020/06/03 14:19:10 sevan Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -579,6 +579,7 @@ FFS	Fast File System
 FFS	find first set
 FFT	fast Fourier transform
 FG	floating gate
+FHRP	first hop redundancy protocol
 FHSS	frequency hop spread spectrum
 FID	frequency identifier
 FIFO	first in, first out
@@ -628,6 +629,7 @@ GHES	generic hardware error source
 GIC	generic interrupt controller
 GID	group identifier
 GIF	graphics interchange format
+GLBP	gateway load balancing protocol
 GMCH	graphics and memory controller hub
 GNU	GNU's Not Unix
 GOP	graphics output protocol
@@ -678,6 +680,7 @@ HPD	hot plug detection
 HPET	high precision event timer
 HSM	hardware security module
 HSM	hierarchical storage management 
+HSRP	hot standby router protocol
 HT	hyper-threading
 HTC	hardware thermal control
 HTCC	high temperature co-fired ceramic



CVS commit: src/share/misc

2020-06-03 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Wed Jun  3 14:19:10 UTC 2020

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add FHRP, GLBP, HSRP


To generate a diff of this commit:
cvs rdiff -u -r1.304 -r1.305 src/share/misc/acronyms.comp

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



CVS commit: src/usr.bin/calendar/calendars

2020-06-03 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Wed Jun  3 14:10:56 UTC 2020

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday

Log Message:
Add Allen Ginsberg


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/calendar/calendars/calendar.birthday

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

Modified files:

Index: src/usr.bin/calendar/calendars/calendar.birthday
diff -u src/usr.bin/calendar/calendars/calendar.birthday:1.43 src/usr.bin/calendar/calendars/calendar.birthday:1.44
--- src/usr.bin/calendar/calendars/calendar.birthday:1.43	Mon May 18 20:57:06 2020
+++ src/usr.bin/calendar/calendars/calendar.birthday	Wed Jun  3 14:10:56 2020
@@ -112,6 +112,7 @@
 03/31	Rene Descartes born, 1596, mathematician & philosopher
 04/01	Alan Jay Perlis was born in Pittsburgh, Pennsylvania, 1922
 04/03	Washington Irving born, 1783
+04/05	Irwin Allen Ginsberg died in New York City, 1997
 04/05	Thomas Hobbes born, 1588, philosopher
 04/07	Florian Schneider-Esleben was born in Baden-Wurttemberg, Germany, 1947
 04/08	Buddha born, 563 BC
@@ -160,6 +161,7 @@
 06/01	Brigham Young born, 1801
 06/01	Marilyn Monroe born, 1928
 06/03	Henry James born, 1811
+06/03	Irwin Allen Ginsberg was born in Newark, New Jersey, 1926
 06/07	(Eugene Henri) Paul Gaugin born, 1848
 06/07	Alan Mathison Turing died, 1954
 06/07	George Bryan "Beau" Brummel born, 1778



CVS commit: src/usr.bin/calendar/calendars

2020-06-03 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Wed Jun  3 14:10:56 UTC 2020

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday

Log Message:
Add Allen Ginsberg


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/calendar/calendars/calendar.birthday

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



CVS commit: src/sys/arch/arm/imx/fdt

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 13:14:01 UTC 2020

Modified Files:
src/sys/arch/arm/imx/fdt: files.imx6

Log Message:
defflag SOC_IMX6DL and SOC_IMX6Q


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/imx/fdt/files.imx6

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



CVS commit: src/sys/arch/arm/imx/fdt

2020-06-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun  3 13:14:01 UTC 2020

Modified Files:
src/sys/arch/arm/imx/fdt: files.imx6

Log Message:
defflag SOC_IMX6DL and SOC_IMX6Q


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/imx/fdt/files.imx6

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/arm/imx/fdt/files.imx6
diff -u src/sys/arch/arm/imx/fdt/files.imx6:1.11 src/sys/arch/arm/imx/fdt/files.imx6:1.12
--- src/sys/arch/arm/imx/fdt/files.imx6:1.11	Sat May 23 13:39:24 2020
+++ src/sys/arch/arm/imx/fdt/files.imx6	Wed Jun  3 13:14:01 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.11 2020/05/23 13:39:24 rin Exp $
+#	$NetBSD: files.imx6,v 1.12 2020/06/03 13:14:01 jmcneill Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -7,6 +7,8 @@ file	arch/arm/imx/fdt/imx6_platform.c	so
 
 # SOC parameters
 defflag	opt_soc.h			SOC_IMX
+defflag	opt_soc.h			SOC_IMX6DL: SOC_IMX
+defflag	opt_soc.h			SOC_IMX6Q: SOC_IMX
 defflag	opt_soc.h			SOC_IMX6QDL: SOC_IMX
 
 # Clock



CVS commit: src/usr.sbin/postinstall

2020-06-03 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jun  3 11:47:47 UTC 2020

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
Ensure the dhcpcd log socket is removed.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/postinstall/postinstall.in

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/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.22 src/usr.sbin/postinstall/postinstall.in:1.23
--- src/usr.sbin/postinstall/postinstall.in:1.22	Sun May 31 13:45:47 2020
+++ src/usr.sbin/postinstall/postinstall.in	Wed Jun  3 11:47:46 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.22 2020/05/31 13:45:47 roy Exp $
+# $NetBSD: postinstall.in,v 1.23 2020/06/03 11:47:46 roy Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -996,7 +996,7 @@ do_dhcpcd()
 
 	# Ensure chroot is now empty
 	for dir in \
-		$(find ${chroot_dir} -type f) \
+		$(find ${chroot_dir} ! -type d) \
 		$(find ${chroot_dir} -type d -mindepth 1 | sort -r)
 	do
 		echo "/var/chroot/dhcpcd${dir##${chroot_dir}}"



CVS commit: src/usr.sbin/postinstall

2020-06-03 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jun  3 11:47:47 UTC 2020

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
Ensure the dhcpcd log socket is removed.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/postinstall/postinstall.in

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



CVS commit: src/sys/arch/arc/stand/boot

2020-06-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Jun  3 11:33:38 UTC 2020

Modified Files:
src/sys/arch/arc/stand/boot: Makefile

Log Message:
Explicitly strip debug info on calling objdump for ecoff boot binaries.

As noted by martin@ on tech-toolchain@, release binaries are built
with MKDEBUG=yes so standalone binaries should explicitly remove
debug info generated by -g option.
 https://mail-index.netbsd.org/tech-toolchain/2020/06/02/msg003809.html

Should be pulled up to netbsd-9.
(ARC BIOS gets confused by debug info sections in ecoff binaries
 and boot binary in 9.0 doesn't work)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arc/stand/boot/Makefile

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

Modified files:

Index: src/sys/arch/arc/stand/boot/Makefile
diff -u src/sys/arch/arc/stand/boot/Makefile:1.17 src/sys/arch/arc/stand/boot/Makefile:1.18
--- src/sys/arch/arc/stand/boot/Makefile:1.17	Sat Apr  8 19:53:20 2017
+++ src/sys/arch/arc/stand/boot/Makefile	Wed Jun  3 11:33:38 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.17 2017/04/08 19:53:20 christos Exp $
+# $NetBSD: Makefile,v 1.18 2020/06/03 11:33:38 tsutsui Exp $
 
 .include 
 
@@ -62,7 +62,7 @@ ${PROG}: ${OBJS} ${LIBS}
 	-e start -o ${PROG}.elf ${OBJS} ${LIBS}
 	@${SIZE} ${PROG}.elf
 	${OBJCOPY} --impure -O ecoff-littlemips \
-	-R .pdr -R .mdebug.abi32 -R .comment -R .ident \
+	-R .pdr -R .mdebug.abi32 -R .comment -R .ident --strip-debug \
 	${PROG}.elf ${.TARGET}
 
 CLEANFILES+=	${PROG}.elf ${PROG}.map



CVS commit: src/sys/arch/arc/stand/boot

2020-06-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Jun  3 11:33:38 UTC 2020

Modified Files:
src/sys/arch/arc/stand/boot: Makefile

Log Message:
Explicitly strip debug info on calling objdump for ecoff boot binaries.

As noted by martin@ on tech-toolchain@, release binaries are built
with MKDEBUG=yes so standalone binaries should explicitly remove
debug info generated by -g option.
 https://mail-index.netbsd.org/tech-toolchain/2020/06/02/msg003809.html

Should be pulled up to netbsd-9.
(ARC BIOS gets confused by debug info sections in ecoff binaries
 and boot binary in 9.0 doesn't work)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arc/stand/boot/Makefile

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



CVS commit: src/distrib/utils/x_gzip

2020-06-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun  3 07:06:18 UTC 2020

Modified Files:
src/distrib/utils/x_gzip: Makefile

Log Message:
Manifest that we need liblzma only when USE_XZ_SETS is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/distrib/utils/x_gzip/Makefile

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



CVS commit: src/distrib/utils/x_gzip

2020-06-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun  3 07:06:18 UTC 2020

Modified Files:
src/distrib/utils/x_gzip: Makefile

Log Message:
Manifest that we need liblzma only when USE_XZ_SETS is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/distrib/utils/x_gzip/Makefile

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

Modified files:

Index: src/distrib/utils/x_gzip/Makefile
diff -u src/distrib/utils/x_gzip/Makefile:1.10 src/distrib/utils/x_gzip/Makefile:1.11
--- src/distrib/utils/x_gzip/Makefile:1.10	Fri Oct 26 22:28:59 2018
+++ src/distrib/utils/x_gzip/Makefile	Wed Jun  3 07:06:18 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2018/10/26 22:28:59 christos Exp $
+#	$NetBSD: Makefile,v 1.11 2020/06/03 07:06:18 rin Exp $
 # Build a tiny limited gzip (i.e. for tiny boot media)
 
 SRCDIR= ${.CURDIR}/../../../usr.bin/gzip
@@ -15,8 +15,12 @@ CPPFLAGS+=	${"${USE_XZ_SETS:Uno}"!="no":
 
 # for crunched binaries this does not take effect, also check the
 # LIBS entry in the lists file
-DPADD=		${LIBZ} ${LIBLZMA}
-LDADD=		-lz -llzma
+DPADD=		${LIBZ}
+LDADD=		-lz
+.if ${USE_XZ_SETS:Uno} != "no"
+DPADD+=		${LIBLZMA}
+LDADD+=		-llzma
+.endif
 
 .include 
 



CVS commit: src/distrib/evbarm/instkernel/ramdisk

2020-06-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun  3 06:36:44 UTC 2020

Modified Files:
src/distrib/evbarm/instkernel/ramdisk: list

Log Message:
x_gzip need liblzma for xz support.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/distrib/evbarm/instkernel/ramdisk/list

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

Modified files:

Index: src/distrib/evbarm/instkernel/ramdisk/list
diff -u src/distrib/evbarm/instkernel/ramdisk/list:1.27 src/distrib/evbarm/instkernel/ramdisk/list:1.28
--- src/distrib/evbarm/instkernel/ramdisk/list:1.27	Mon Nov  2 17:40:20 2015
+++ src/distrib/evbarm/instkernel/ramdisk/list	Wed Jun  3 06:36:44 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: list,v 1.27 2015/11/02 17:40:20 riz Exp $
+#	$NetBSD: list,v 1.28 2020/06/03 06:36:44 rin Exp $
 
 SRCDIRS	bin sbin external/bsd/less/bin usr.bin usr.sbin
 
@@ -68,7 +68,7 @@ SPECIAL	ifconfig	srcdir	distrib/utils/x_
 SPECIAL	route		srcdir	distrib/utils/x_route
 SPECIAL	umount		srcdir	distrib/utils/x_umount
 
-LIBS	libhack.o -ledit -lutil -lcurses -lterminfo -lrmt -lcrypt -ll -lm -lz -lprop
+LIBS	libhack.o -ledit -lutil -lcurses -lterminfo -lrmt -lcrypt -ll -lm -lz -llzma -lprop
 
 # init invokes the shell as -sh
 ARGVLN	sh -sh



CVS commit: src/distrib/evbarm/instkernel/ramdisk

2020-06-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun  3 06:36:44 UTC 2020

Modified Files:
src/distrib/evbarm/instkernel/ramdisk: list

Log Message:
x_gzip need liblzma for xz support.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/distrib/evbarm/instkernel/ramdisk/list

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



Re: [stos, again] Re: CVS commit: src/sys/arch/amd64

2020-06-03 Thread Maxime Villard

Le 03/06/2020 à 02:03, Kamil Rytarowski a écrit :

On 03.06.2020 01:49, Andrew Doran wrote:

On the assembly thing recall that recently you expressed a desire to remove
all of the amd64 assembly string functions from libc because of sanitizers -
I invested my time to do up a little demo to try and show you why that's not
a good idea:

http://mail-index.netbsd.org/port-amd64/2020/04/19/msg003226.html


Please note that interceptors for string functions are not just some
extra burden, but also very useful approach to feedback a fuzzer through
additional coverage.

At least libFuzzer and honggfuzz wrap many kinds of string functions and
use it for fuzzing. We should add a special mode in KCOV to feedback
userland (syzkaller) with traces from string functions.

https://github.com/google/honggfuzz/blob/bbb476eec95ad927d6d7d3d367d2b3e38eed3569/libhfuzz/memorycmp.c#L24


Yes, and not just that either.

When you use ASM instead of C, you basically prevent _any kind_ of useful
transformation the compiler could make.

It includes sanitizers, but also coverage as you said; and also retpoline,
PAC, BTI, CET, SafeStack, and in short, a very big bunch of modern
features.

Favoring C rather than ASM in the general sense offers much bigger
benefits than just "it accomodates kMSan".

Maxime


Re: [stos, again] Re: CVS commit: src/sys/arch/amd64

2020-06-03 Thread Maxime Villard

Le 03/06/2020 à 01:49, Andrew Doran a écrit :

On Tue, Jun 02, 2020 at 08:41:53AM +0200, Maxime Villard wrote:


Le 02/06/2020 ? 00:58, Andrew Doran a ?crit?:

Module Name:src
Committed By:   ad
Date:   Mon Jun  1 22:58:06 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S
src/sys/arch/amd64/include: frameasm.h

Log Message:
Reported-by: syzbot+6dd5a230d19f0cbc7...@syzkaller.appspotmail.com

Instrument STOS/MOVS for KMSAN to unbreak it.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/amd64/include/frameasm.h

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


Can you just stop ignoring the remarks that are made?


That's up to you Maxime.  If you habitually make it difficult for people to
come to a reasonable compromise with you, then you're asking to not be taken
seriously and will find yourself being ignored.


You are confused. I asked for KMSAN to be unbroken, and proposed an alternative,
which is atomic_load_relaxed. You were free to explain why my point was a bad
idea or why it didn't matter, but you refused, and just added a hack on top of
another. I'm afraid that's up to you.

But whatever, it doesn't matter. Thanks for reverting the pmap.c changes, it
is more correct now than before.


I said explicitly
that adding manual instrumentation here is _wrong_.


I don't share your assessment in the general sense.  It should be possible
to instrument assembly code because KMSAN is useful AND we can't get by
without assembly - there are some things that C just can't do (or do well
enough).

On the assembly thing recall that recently you expressed a desire to remove
all of the amd64 assembly string functions from libc because of sanitizers -
I invested my time to do up a little demo to try and show you why that's not
a good idea:

http://mail-index.netbsd.org/port-amd64/2020/04/19/msg003226.html


I saw, yes. I answered explaining that a conversation with Ryo Shimizu had
changed my mind a bit, and seeing your results (which as far as I can tell
do not indicate a performance improvement significant enough to not be
considered as noise), I asked you whether it was that relevant. You didn't
follow up though.


The system is a balancing act.  There are lots of factors to be taken into
account: maintainability, tooling like KMSAN, user's varying needs, the
capabilites of different machines, performance, feature set and so on, and
dare I say it even the enjoyment of the people working on the project is
important too.  Myopic focus on one factor only to the detriment of others
is no good.


I am well aware of that.


The kMSan ASM fixups
are limited to args/returns, and that is part of a sensical policy that
_should not_ be changed without a good reason.

x86_movs/x86_stos have strictly _no reason_ to exist. Of the 18 conversions
you made to them in pmap.c, not one is justified. memcpy/memset were all
correct.


I introduced these functions as a compromise because you were unhappy with
use of memcpy() to copy PDEs.  See:

http://mail-index.netbsd.org/port-amd64/2020/05/23/msg003280.html

You wrote:

In the [XXX] window, the PTEs could be used by userland.  If you
copied them using memcpy(), some parts of the bytes could contain
stale values.


Sure, I was explicitly referring to SVS, which has an unusual way of
accessing PTEs (contrary to pmap), which is why it needs special atomic
care that other places do not.


Live PDEs are also copied in pmap.c so I made a change there too.  After
that I decided "why not" and used the new functions everywhere PDEs/PTEs or
pages are block zeroed / copied.  But I'm also happy with memcpy()/memset().
Either way will work.  In fairness I do work too fast sometimes.


The only reason you made these big unneeded changes is for SVS not to take
the bus lock,


There is no bus lock on x86 (not since the 1990s anyway).


but as was said already, atomic_load_relaxed will do what
you want without the need for these functions.

Please revert _both changes now_, this one and the previous one which
introduced both functions, and let's use atomic_load_relaxed.


You're focusing on only one factor.  I'll explain in detail.  Here is the
original code I replaced:

 685 static inline pt_entry_t
 686 svs_pte_atomic_read(struct pmap *pmap, size_t idx)
 687 {
 688/*
 689 * XXX: We don't have a basic atomic_fetch_64 function?
 690 */
 691return atomic_cas_64(>pm_pdir[idx], 666, 666);
 692 }
...
 717/* User slots. */
 718for (i = 0; i < PDIR_SLOT_USERLIM; i++) {
 719pte = svs_pte_atomic_read(pmap, i);
 720ci->ci_svs_updir[i] = pte;
 721}

There's no need for an atomic op there because fetches on x86 are by
definition atomic, and it