aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Mashtizadeh <ali@mashtizadeh.com>2026-04-07 23:33:03 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2026-04-09 16:35:26 +0000
commitf86ba3eec5961c0217b5458663e0eae5bbad314e (patch)
tree4f8b0dabd553f344c91401ba95e88bcce324b339
parent7a1aaca06c3384f90202dafa60440081d67d00fd (diff)
hwpmc: prevent IBS fetch from getting stuck
Both fetch and op IBS sampling have the same problem where we need to rewrite the control MSR to ensure sampling continues at the correct rate. I also like this because it resets the counter reducing the chances that we collect a sample inside the NMI handler. Reported by: Aalok Agarwal Reviewed by: mhorne Sponsored by: Netflix Fixes: e51ef8ae490f ("hwpmc: Initial support for AMD IBS") Pull Request: https://github.com/freebsd/freebsd-src/pull/2130
-rw-r--r--sys/dev/hwpmc/hwpmc_ibs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/dev/hwpmc/hwpmc_ibs.c b/sys/dev/hwpmc/hwpmc_ibs.c
index ec1afcb47666..a230288f157e 100644
--- a/sys/dev/hwpmc/hwpmc_ibs.c
+++ b/sys/dev/hwpmc/hwpmc_ibs.c
@@ -342,6 +342,8 @@ pmc_ibs_process_fetch(struct pmc *pm, struct trapframe *tf, uint64_t config)
}
pmc_process_interrupt_mp(PMC_HR, pm, tf, &mpd);
+
+ wrmsr(IBS_FETCH_CTL, pm->pm_md.pm_ibs.ibs_ctl | IBS_FETCH_CTL_ENABLE);
}
static void