Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/alpha Disable preemption around the main work...



details:   https://anonhg.NetBSD.org/src/rev/caa3edb8119e
branches:  trunk
changeset: 379036:caa3edb8119e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed May 05 15:34:54 2021 +0000

description:
Disable preemption around the main work of badaddr_read() and delay();
they both use "current CPU" resources.

diffstat:

 sys/arch/alpha/alpha/interrupt.c |  10 ++++++++--
 sys/arch/alpha/alpha/machdep.c   |   9 +++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

diffs (75 lines):

diff -r 14c1ae88ded2 -r caa3edb8119e sys/arch/alpha/alpha/interrupt.c
--- a/sys/arch/alpha/alpha/interrupt.c  Wed May 05 14:58:57 2021 +0000
+++ b/sys/arch/alpha/alpha/interrupt.c  Wed May 05 15:34:54 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.96 2021/05/05 14:58:57 thorpej Exp $ */
+/* $NetBSD: interrupt.c,v 1.97 2021/05/05 15:34:54 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.96 2021/05/05 14:58:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.97 2021/05/05 15:34:54 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -383,6 +383,9 @@ badaddr(void *addr, size_t size)
 int
 badaddr_read(void *addr, size_t size, void *rptr)
 {
+       lwp_t * const l = curlwp;
+       KPREEMPT_DISABLE(l);
+
        struct mchkinfo *mcp = &curcpu()->ci_mcinfo;
        long rcpt;
        int rv;
@@ -450,6 +453,9 @@ badaddr_read(void *addr, size_t size, vo
                        break;
                }
        }
+
+       KPREEMPT_ENABLE(l);
+
        /* Return non-zero (i.e. true) if it's a bad address. */
        return (rv);
 }
diff -r 14c1ae88ded2 -r caa3edb8119e sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c    Wed May 05 14:58:57 2021 +0000
+++ b/sys/arch/alpha/alpha/machdep.c    Wed May 05 15:34:54 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.369 2020/10/15 01:00:01 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.370 2021/05/05 15:34:54 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2019, 2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.369 2020/10/15 01:00:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.370 2021/05/05 15:34:54 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1706,6 +1706,9 @@ delay(unsigned long n)
                return;
        }
 
+       lwp_t * const l = curlwp;
+       KPREEMPT_DISABLE(l);
+
        pcc0 = alpha_rpcc() & 0xffffffffUL;
        cycles = 0;
        usec = 0;
@@ -1734,6 +1737,8 @@ delay(unsigned long n)
                }
                pcc0 = pcc1;
        }
+
+       KPREEMPT_ENABLE(l);
 }
 
 #ifdef EXEC_ECOFF



Home | Main Index | Thread Index | Old Index