Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jul 2023 16:49:36 GMT
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 3c4860d3eeed - stable/13 - hwpmc: add error for HWPMC_DEBUG without KTR
Message-ID:  <202307171649.36HGna6W081313@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mhorne:

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

commit 3c4860d3eeed3ef56be988ec1afdcfb2fba9f3e0
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2023-06-16 16:38:26 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2023-07-17 16:45:38 +0000

    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)
---
 sys/sys/pmc.h | 6 ++++++
 1 file changed, 6 insertions(+)

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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307171649.36HGna6W081313>