git: 438ca68cef3c - main - netinet: default mib counter probe points off

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Wed, 20 Nov 2024 09:09:58 UTC
The branch main has been updated by kp:

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

commit 438ca68cef3c678de1c01630266831a59818e208
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-11-18 09:43:46 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-11-20 08:52:48 +0000

    netinet: default mib counter probe points off
    
    Disable the IP/IP6/ICMP/... counter probe points by default.
    They are kept enabled in debug builds, and can be enabled with
    'options KDTRACE_MIB_SDT'.
    
    Requested by:   glebius
    Reviewed by:    glebius
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D47657
---
 sys/conf/options         | 2 +-
 sys/conf/std.debug       | 1 +
 sys/conf/std.nodebug     | 1 +
 sys/netinet/in_kdtrace.c | 2 +-
 sys/netinet/in_kdtrace.h | 2 +-
 sys/sys/sdt.h            | 2 +-
 6 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/conf/options b/sys/conf/options
index 0e959c3b9828..61d29a2b74fa 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -143,7 +143,7 @@ GEOM_ZERO	opt_geom.h
 IFLIB		opt_iflib.h
 KDTRACE_HOOKS	opt_global.h
 KDTRACE_FRAME	opt_kdtrace.h
-KDTRACE_NO_MIB_SDT	opt_global.h
+KDTRACE_MIB_SDT	opt_global.h
 KN_HASHSIZE	opt_kqueue.h
 KSTACK_MAX_PAGES
 KSTACK_PAGES
diff --git a/sys/conf/std.debug b/sys/conf/std.debug
index 53789f269b80..f5ed5582c78d 100644
--- a/sys/conf/std.debug
+++ b/sys/conf/std.debug
@@ -15,3 +15,4 @@ options 	WITNESS_SKIPSPIN	# Don't run witness on spinlocks for speed
 options 	MALLOC_DEBUG_MAXZONES=8	# Separate malloc(9) zones
 options 	VERBOSE_SYSINIT=0	# Support debug.verbose_sysinit, off by default
 options		ALT_BREAK_TO_DEBUGGER	# Enter debugger on keyboard escape sequence
+options		KDTRACE_MIB_SDT		# Add SDT probes to network counters
diff --git a/sys/conf/std.nodebug b/sys/conf/std.nodebug
index 38eb77c8d3a7..4035e28d2a62 100644
--- a/sys/conf/std.nodebug
+++ b/sys/conf/std.nodebug
@@ -15,6 +15,7 @@ nooptions	COVERAGE
 nooptions	KCOV
 nooptions	MALLOC_DEBUG_MAXZONES
 nooptions	QUEUE_MACRO_DEBUG_TRASH
+nooptions	KDTRACE_MIB_SDT
 
 # Net80211 debugging
 nooptions	IEEE80211_DEBUG
diff --git a/sys/netinet/in_kdtrace.c b/sys/netinet/in_kdtrace.c
index bfa57bd8bf1e..7e0b9a6a9373 100644
--- a/sys/netinet/in_kdtrace.c
+++ b/sys/netinet/in_kdtrace.c
@@ -36,7 +36,7 @@ SDT_PROVIDER_DEFINE(tcp);
 SDT_PROVIDER_DEFINE(udp);
 SDT_PROVIDER_DEFINE(udplite);
 
-#ifndef KDTRACE_NO_MIB_SDT
+#ifdef KDTRACE_MIB_SDT
 #define MIB_PROBE_IP(name) \
     SDT_PROBE_DEFINE1(mib, ip, count, name, \
         "int")
diff --git a/sys/netinet/in_kdtrace.h b/sys/netinet/in_kdtrace.h
index 3fb82ad961dd..7b0d433c60d8 100644
--- a/sys/netinet/in_kdtrace.h
+++ b/sys/netinet/in_kdtrace.h
@@ -54,7 +54,7 @@ SDT_PROVIDER_DECLARE(tcp);
 SDT_PROVIDER_DECLARE(udp);
 SDT_PROVIDER_DECLARE(udplite);
 
-#ifndef KDTRACE_NO_MIB_SDT
+#ifdef KDTRACE_MIB_SDT
 SDT_PROVIDER_DECLARE(mib);
 
 SDT_PROBE_DECLARE(mib, ip, count, ips_total);
diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h
index 5fa612fcf632..cd45bc1a1ffd 100644
--- a/sys/sys/sdt.h
+++ b/sys/sys/sdt.h
@@ -357,7 +357,7 @@ __sdt_probe##uniq:;							\
 	    (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,		\
 	    (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5)
 
-#ifndef KDTRACE_NO_MIB_SDT
+#ifdef KDTRACE_MIB_SDT
 #define	MIB_SDT_PROBE1(...)	SDT_PROBE1(mib, __VA_ARGS__)
 #define	MIB_SDT_PROBE2(...)	SDT_PROBE2(mib, __VA_ARGS__)
 #else