Module Name: src Committed By: thorpej Date: Wed May 5 15:34:54 UTC 2021
Modified Files: src/sys/arch/alpha/alpha: interrupt.c machdep.c Log Message: Disable preemption around the main work of badaddr_read() and delay(); they both use "current CPU" resources. To generate a diff of this commit: cvs rdiff -u -r1.96 -r1.97 src/sys/arch/alpha/alpha/interrupt.c cvs rdiff -u -r1.369 -r1.370 src/sys/arch/alpha/alpha/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/alpha/alpha/interrupt.c diff -u src/sys/arch/alpha/alpha/interrupt.c:1.96 src/sys/arch/alpha/alpha/interrupt.c:1.97 --- src/sys/arch/alpha/alpha/interrupt.c:1.96 Wed May 5 14:58:57 2021 +++ src/sys/arch/alpha/alpha/interrupt.c Wed May 5 15:34:54 2021 @@ -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); } Index: src/sys/arch/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.369 src/sys/arch/alpha/alpha/machdep.c:1.370 --- src/sys/arch/alpha/alpha/machdep.c:1.369 Thu Oct 15 01:00:01 2020 +++ src/sys/arch/alpha/alpha/machdep.c Wed May 5 15:34:54 2021 @@ -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