Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Preserve pcu(9) state in fork.



details:   https://anonhg.NetBSD.org/src/rev/ce140d491342
branches:  trunk
changeset: 744713:ce140d491342
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Feb 11 03:14:49 2020 +0000

description:
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

diffstat:

 sys/kern/kern_lwp.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 46c3ba1ea16c -r ce140d491342 sys/kern/kern_lwp.c
--- a/sys/kern/kern_lwp.c       Tue Feb 11 03:12:06 2020 +0000
+++ b/sys/kern/kern_lwp.c       Tue Feb 11 03:14:49 2020 +0000
@@ -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 @@
         * 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);



Home | Main Index | Thread Index | Old Index