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/e07c7a87cedd
branches:  trunk
changeset: 746146:e07c7a87cedd
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 b7bbe2338458 -r e07c7a87cedd 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