Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Change the place to check if a context switch doesn...



details:   https://anonhg.NetBSD.org/src/rev/f615445427e9
branches:  trunk
changeset: 365406:f615445427e9
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Aug 14 01:06:01 2018 +0000

description:
Change the place to check if a context switch doesn't happen within a pserialize read section

The previous place (pserialize_switchpoint) was not a good place because at that
point a suspect thread is already switched so that a backtrace gotten on
a KASSERT failure doesn't point out where a context switch happens.

diffstat:

 sys/kern/kern_synch.c      |  9 +++++++--
 sys/kern/subr_pserialize.c |  7 ++-----
 2 files changed, 9 insertions(+), 7 deletions(-)

diffs (58 lines):

diff -r f18942927001 -r f615445427e9 sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c     Mon Aug 13 22:59:52 2018 +0000
+++ b/sys/kern/kern_synch.c     Tue Aug 14 01:06:01 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_synch.c,v 1.317 2018/07/24 15:09:37 bouyer Exp $  */
+/*     $NetBSD: kern_synch.c,v 1.318 2018/08/14 01:06:01 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.317 2018/07/24 15:09:37 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.318 2018/08/14 01:06:01 ozaki-r Exp $");
 
 #include "opt_kstack.h"
 #include "opt_dtrace.h"
@@ -699,6 +699,11 @@
                        (*dtrace_vtime_switch_func)(newl);
                }
 
+               /*
+                * We must ensure not to come here from inside a read section.
+                */
+               KASSERT(pserialize_not_in_read_section());
+
                /* Switch to the new LWP.. */
 #ifdef MULTIPROCESSOR
                KASSERT(curlwp == ci->ci_curlwp);
diff -r f18942927001 -r f615445427e9 sys/kern/subr_pserialize.c
--- a/sys/kern/subr_pserialize.c        Mon Aug 13 22:59:52 2018 +0000
+++ b/sys/kern/subr_pserialize.c        Tue Aug 14 01:06:01 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pserialize.c,v 1.11 2018/04/16 20:25:21 hannken Exp $     */
+/*     $NetBSD: subr_pserialize.c,v 1.12 2018/08/14 01:06:01 ozaki-r Exp $     */
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.11 2018/04/16 20:25:21 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.12 2018/08/14 01:06:01 ozaki-r Exp $");
 
 #include <sys/param.h>
 
@@ -248,9 +248,6 @@
        pserialize_t psz, next;
        cpuid_t cid;
 
-       /* We must to ensure not to come here from inside a read section. */
-       KASSERT(pserialize_not_in_read_section());
-
        /*
         * If no updates pending, bail out.  No need to lock in order to
         * test psz_work_todo; the only ill effect of missing an update



Home | Main Index | Thread Index | Old Index