Module Name:    src
Committed By:   riastradh
Date:           Tue Feb 11 03:14:49 UTC 2020

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

Log Message:
Preserve pcu(9) state in fork.

There should perhaps be a pcu_fork operation to keep this factored
neatly but this will be simpler to pull up.

In practical terms, this may not affect most architecture that use
pcu(9) -- alpha, arm32, mips, powerpc, riscv -- but it does affect
aarch64, in which v8-v15 are callee-saves, and GCC actually takes
advantage of them, and for more than just floating-point data too.

XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/sys/kern/kern_lwp.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_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.223 src/sys/kern/kern_lwp.c:1.224
--- src/sys/kern/kern_lwp.c:1.223	Wed Jan 29 15:47:52 2020
+++ src/sys/kern/kern_lwp.c	Tue Feb 11 03:14:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.223 2020/01/29 15:47:52 ad Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.224 2020/02/11 03:14:49 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019, 2020
@@ -211,7 +211,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.223 2020/01/29 15:47:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.224 2020/02/11 03:14:49 riastradh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -890,6 +890,7 @@ lwp_create(lwp_t *l1, proc_t *p2, vaddr_
 	 * the MD cpu_lwp_fork() can copy the saved state to the new LWP.
 	 */
 	pcu_save_all(l1);
+	l2->l_pcu_valid = l1->l_pcu_valid;
 
 	uvm_lwp_setuarea(l2, uaddr);
 	uvm_lwp_fork(l1, l2, stack, stacksize, func, (arg != NULL) ? arg : l2);

Reply via email to