Module Name:    src
Committed By:   ryo
Date:           Thu Dec 22 06:59:33 UTC 2022

Modified Files:
        src/sys/dev/tprof: tprof_armv7.c tprof_armv8.c

Log Message:
Even if an overflow interrupt is occured for a counter outside tprof management,
the bit of onverflow status register must be cleared to prevent an interrupt 
storm.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/tprof/tprof_armv7.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/tprof/tprof_armv8.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/dev/tprof/tprof_armv7.c
diff -u src/sys/dev/tprof/tprof_armv7.c:1.11 src/sys/dev/tprof/tprof_armv7.c:1.12
--- src/sys/dev/tprof/tprof_armv7.c:1.11	Sat Dec  3 20:24:21 2022
+++ src/sys/dev/tprof/tprof_armv7.c	Thu Dec 22 06:59:32 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: tprof_armv7.c,v 1.11 2022/12/03 20:24:21 ryo Exp $ */
+/* $NetBSD: tprof_armv7.c,v 1.12 2022/12/22 06:59:32 ryo Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tprof_armv7.c,v 1.11 2022/12/03 20:24:21 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tprof_armv7.c,v 1.12 2022/12/22 06:59:32 ryo Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -225,7 +225,7 @@ armv7_pmu_intr(void *priv)
 	tprof_backend_softc_t *sc = pmu_intr_arg;
 	tprof_frame_info_t tfi;
 	int bit;
-	const uint32_t pmovs = armreg_pmovsr_read() & PMOVS_P;
+	const uint32_t pmovs = armreg_pmovsr_read();
 
 	uint64_t *counters_offset =
 	    percpu_getptr_remote(sc->sc_ctr_offset_percpu, curcpu());
@@ -248,7 +248,7 @@ armv7_pmu_intr(void *priv)
 			    tfi.tfi_pc >= VM_MIN_KERNEL_ADDRESS &&
 			    tfi.tfi_pc < VM_MAX_KERNEL_ADDRESS;
 			tprof_sample(NULL, &tfi);
-		} else {
+		} else if (ISSET(sc->sc_ctr_ovf_mask, __BIT(bit))) {
 			/* counter has overflowed */
 			counters_offset[bit] += __BIT(32);
 		}

Index: src/sys/dev/tprof/tprof_armv8.c
diff -u src/sys/dev/tprof/tprof_armv8.c:1.18 src/sys/dev/tprof/tprof_armv8.c:1.19
--- src/sys/dev/tprof/tprof_armv8.c:1.18	Thu Dec  1 00:32:52 2022
+++ src/sys/dev/tprof/tprof_armv8.c	Thu Dec 22 06:59:32 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: tprof_armv8.c,v 1.18 2022/12/01 00:32:52 ryo Exp $ */
+/* $NetBSD: tprof_armv8.c,v 1.19 2022/12/22 06:59:32 ryo Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tprof_armv8.c,v 1.18 2022/12/01 00:32:52 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tprof_armv8.c,v 1.19 2022/12/22 06:59:32 ryo Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -197,7 +197,7 @@ armv8_pmu_intr(void *priv)
 	tprof_backend_softc_t *sc = pmu_intr_arg;
 	tprof_frame_info_t tfi;
 	int bit;
-	const uint32_t pmovs = reg_pmovsset_el0_read() & PMOVS_P;
+	const uint32_t pmovs = reg_pmovsset_el0_read();
 
 	uint64_t *counters_offset =
 	    percpu_getptr_remote(sc->sc_ctr_offset_percpu, curcpu());
@@ -220,7 +220,7 @@ armv8_pmu_intr(void *priv)
 			    tfi.tfi_pc >= VM_MIN_KERNEL_ADDRESS &&
 			    tfi.tfi_pc < VM_MAX_KERNEL_ADDRESS;
 			tprof_sample(NULL, &tfi);
-		} else {
+		} else if (ISSET(sc->sc_ctr_ovf_mask, __BIT(bit))) {
 			/* counter has overflowed */
 			counters_offset[bit] += __BIT(32);
 		}

Reply via email to