Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/tprof Even if an overflow interrupt is occured for a...



details:   https://anonhg.NetBSD.org/src/rev/1c889d6942d7
branches:  trunk
changeset: 372723:1c889d6942d7
user:      ryo <ryo%NetBSD.org@localhost>
date:      Thu Dec 22 06:59:32 2022 +0000

description:
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.

diffstat:

 sys/dev/tprof/tprof_armv7.c |  8 ++++----
 sys/dev/tprof/tprof_armv8.c |  8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (72 lines):

diff -r 6c07f361ada4 -r 1c889d6942d7 sys/dev/tprof/tprof_armv7.c
--- a/sys/dev/tprof/tprof_armv7.c       Thu Dec 22 06:58:47 2022 +0000
+++ b/sys/dev/tprof/tprof_armv7.c       Thu Dec 22 06:59:32 2022 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
        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 @@
                            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);
                }
diff -r 6c07f361ada4 -r 1c889d6942d7 sys/dev/tprof/tprof_armv8.c
--- a/sys/dev/tprof/tprof_armv8.c       Thu Dec 22 06:58:47 2022 +0000
+++ b/sys/dev/tprof/tprof_armv8.c       Thu Dec 22 06:59:32 2022 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
        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 @@
                            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);
                }



Home | Main Index | Thread Index | Old Index