git: f9e62419f6da - main - hwpmc: Reenable PME before reenabling counters.

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Wed, 15 Jun 2022 15:48:45 UTC
The branch main has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=f9e62419f6daf226a7116be2601842f8f07b1928

commit f9e62419f6daf226a7116be2601842f8f07b1928
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2022-06-15 15:39:37 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2022-06-15 15:48:38 +0000

    hwpmc: Reenable PME before reenabling counters.
    
    Doing otherwise may lead to lost interrupts, that in combination
    with hardware PMCs freezing may leave them frozen forever.  It may
    also slightly improve profiling accuracy.
    
    MFC after:      2 weeks
---
 sys/dev/hwpmc/hwpmc_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/hwpmc/hwpmc_core.c b/sys/dev/hwpmc/hwpmc_core.c
index 8575abdea214..7ec22c36019c 100644
--- a/sys/dev/hwpmc/hwpmc_core.c
+++ b/sys/dev/hwpmc/hwpmc_core.c
@@ -1204,6 +1204,9 @@ core2_intr(struct trapframe *tf)
 	else
 		counter_u64_add(pmc_stats.pm_intr_ignored, 1);
 
+	if (found_interrupt)
+		lapic_reenable_pmc();
+
 	/*
 	 * Reenable all non-stalled PMCs.
 	 */
@@ -1224,9 +1227,6 @@ core2_intr(struct trapframe *tf)
 	    (uintmax_t) rdmsr(IA_GLOBAL_CTRL),
 	    (uintmax_t) rdmsr(IA_GLOBAL_STATUS));
 
-	if (found_interrupt)
-		lapic_reenable_pmc();
-
 	return (found_interrupt);
 }