aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Horne <mhorne@FreeBSD.org>2023-06-16 16:38:26 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2023-07-17 16:45:38 +0000
commit3c4860d3eeed3ef56be988ec1afdcfb2fba9f3e0 (patch)
treea56443d57be379ddce99e5b1c836d63e5677abef
parented942d5a173870e786fd422c9edfbe5037626b4b (diff)
downloadsrc-3c4860d3eeed3ef56be988ec1afdcfb2fba9f3e0.tar.gz
src-3c4860d3eeed3ef56be988ec1afdcfb2fba9f3e0.zip
hwpmc: add error for HWPMC_DEBUG without KTR
The option is a no-op otherwise, but this is not necessarily obvious. Failing the compile gives the user a hint. Reviewed by: jkoshy, emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40544 (cherry picked from commit 569f89b2f442e2187f750a5892a1662390364cc6)
-rw-r--r--sys/sys/pmc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/sys/pmc.h b/sys/sys/pmc.h
index 1983dbb91578..2384a3a13919 100644
--- a/sys/sys/pmc.h
+++ b/sys/sys/pmc.h
@@ -1070,6 +1070,12 @@ extern struct pmc_cpu **pmc_pcpu;
extern struct pmc_driverstats pmc_stats;
#if defined(HWPMC_DEBUG)
+
+/* HWPMC_DEBUG without KTR will compile but is a no-op. */
+#if !defined(KTR) || !defined(KTR_COMPILE) || ((KTR_COMPILE & KTR_SUBSYS) == 0)
+#error "HWPMC_DEBUG requires KTR and KTR_COMPILE=KTR_SUBSYS -- see ktr(4)"
+#endif
+
#include <sys/ktr.h>
/* debug flags, major flag groups */