git: f12a50fed2df - stable/13 - Revert "dtrace: make 'ring' and 'fill' policies imply 'noswitch' flag"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 21 Apr 2024 12:29:25 UTC
The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=f12a50fed2df3994b05d7c8702f06bb117c156d6 commit f12a50fed2df3994b05d7c8702f06bb117c156d6 Author: Andriy Gapon <avg@FreeBSD.org> AuthorDate: 2024-04-21 10:07:36 +0000 Commit: Andriy Gapon <avg@FreeBSD.org> CommitDate: 2024-04-21 12:28:59 +0000 Revert "dtrace: make 'ring' and 'fill' policies imply 'noswitch' flag" This reverts commit e92491d95ff3500e140eafa614e88ca84ffb0d26. It was cherry-picked as f0ed49921c2891733b7ee65679a8dcba5398e3b6. The general idea looked good to me. In particular, it allowed to save some memory and avoid memory allocation failures when a large buffer size was requested along with ring and fill policies. But I didn't take into account that the second, supposedly unused buffer, was actually used as the scratch buffer. The scratch buffer is used as a temporary space for DTrace subroutines like copyin, copyinstr, and alloca. I think that the change can be fixed by allocating a separate smaller buffer for the scratch buffer, but that fix would require more work than I am able to do now. Hence the revert. Reported by: Domagoj Stolfa Diagnosed by: Domagoj Stolfa, markj (cherry picked from commit b9827c007a7a39c7aeef73f8efc217b7b0099464) --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index 17d9536b2428..6ae0322ebb0f 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -12055,6 +12055,7 @@ 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(); @@ -14862,10 +14863,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 | DTRACEBUF_NOSWITCH; + flags |= DTRACEBUF_RING; if (opt[DTRACEOPT_BUFPOLICY] == DTRACEOPT_BUFPOLICY_FILL) - flags |= DTRACEBUF_FILL | DTRACEBUF_NOSWITCH; + flags |= DTRACEBUF_FILL; if (state != dtrace_anon.dta_state || state->dts_activity != DTRACE_ACTIVITY_ACTIVE)