git: f0ed49921c28 - stable/13 - dtrace: make 'ring' and 'fill' policies imply 'noswitch' flag

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Sat, 17 Feb 2024 19:22:39 UTC
The branch stable/13 has been updated by avg:

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

commit f0ed49921c2891733b7ee65679a8dcba5398e3b6
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2021-12-24 09:38:38 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2024-02-17 19:22:08 +0000

    dtrace: make 'ring' and 'fill' policies imply 'noswitch' flag
    
    This should disable allocation of the second per-CPU principal buffer
    which is never used.  This will also enable additional asserts
    for buffers that are never switched.
    
    (cherry picked from commit e92491d95ff3500e140eafa614e88ca84ffb0d26)
---
 sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
index 6ae0322ebb0f..17d9536b2428 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
@@ -12055,7 +12055,6 @@ dtrace_buffer_switch(dtrace_buffer_t *buf)
 	hrtime_t now;
 
 	ASSERT(!(buf->dtb_flags & DTRACEBUF_NOSWITCH));
-	ASSERT(!(buf->dtb_flags & DTRACEBUF_RING));
 
 	cookie = dtrace_interrupt_disable();
 	now = dtrace_gethrtime();
@@ -14863,10 +14862,10 @@ dtrace_state_buffer(dtrace_state_t *state, dtrace_buffer_t *buf, int which)
 
 	if (which == DTRACEOPT_BUFSIZE) {
 		if (opt[DTRACEOPT_BUFPOLICY] == DTRACEOPT_BUFPOLICY_RING)
-			flags |= DTRACEBUF_RING;
+			flags |= DTRACEBUF_RING | DTRACEBUF_NOSWITCH;
 
 		if (opt[DTRACEOPT_BUFPOLICY] == DTRACEOPT_BUFPOLICY_FILL)
-			flags |= DTRACEBUF_FILL;
+			flags |= DTRACEBUF_FILL | DTRACEBUF_NOSWITCH;
 
 		if (state != dtrace_anon.dta_state ||
 		    state->dts_activity != DTRACE_ACTIVITY_ACTIVE)