git: e92491d95ff3 - main - dtrace: make 'ring' and 'fill' policies imply 'noswitch' flag

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Sun, 28 Jan 2024 13:15:41 UTC
The branch main has been updated by avg:

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

commit e92491d95ff3500e140eafa614e88ca84ffb0d26
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2021-12-24 09:38:38 +0000
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2024-01-28 13:15:17 +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.
---
 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 ce02676e0dc1..83c0648b23b1 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
@@ -12058,7 +12058,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();
@@ -14866,10 +14865,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)