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
This commit is contained in:
Mitchell Horne
2023-06-16 13:38:26 -03:00
parent 3977781b98
commit 569f89b2f4
+6
View File
@@ -1069,6 +1069,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>
#define __pmcdbg_used /* unused variable annotation */