Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/sparc cpu_intr_p(): use cpuinfo (always the s...



details:   https://anonhg.NetBSD.org/src/rev/f8d79be1c508
branches:  trunk
changeset: 1008442:f8d79be1c508
user:      ad <ad%NetBSD.org@localhost>
date:      Sun Mar 22 21:21:07 2020 +0000

description:
cpu_intr_p(): use cpuinfo (always the same VA) for preemption safety.

diffstat:

 sys/arch/sparc/sparc/intr.c |  21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)

diffs (41 lines):

diff -r d3401763f3a3 -r f8d79be1c508 sys/arch/sparc/sparc/intr.c
--- a/sys/arch/sparc/sparc/intr.c       Sun Mar 22 21:13:35 2020 +0000
+++ b/sys/arch/sparc/sparc/intr.c       Sun Mar 22 21:21:07 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.c,v 1.124 2020/03/14 13:34:43 ad Exp $ */
+/*     $NetBSD: intr.c,v 1.125 2020/03/22 21:21:07 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.124 2020/03/14 13:34:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.125 2020/03/22 21:21:07 ad Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
@@ -889,17 +889,10 @@
 bool
 cpu_intr_p(void)
 {
-       uint64_t ncsw;
-       int idepth;
-       lwp_t *l;
 
-       l = curlwp;
-       do {
-               ncsw = l->l_ncsw;
-               __insn_barrier();
-               idepth = curcpu()->ci_idepth;
-               __insn_barrier();
-       } while (__predict_false(ncsw != l->l_ncsw));
-
-       return idepth != 0;
+       /* 
+        * cpuinfo is the same VA on every CPU.  Even if preempted it will
+        * give the correct answer.
+        */
+       return cpuinfo.ci_idepth != 0;
 }



Home | Main Index | Thread Index | Old Index