History log of /freebsd/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (Results 1 – 25 of 231)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# ba9cff7a 23-Jan-2025 Mark Johnston <markj@FreeBSD.org>

dtrace: Use size_t instead of uintptr_t to represent buffer offsets

This eases porting of DTrace to CHERI, where uintptr_t and size_t aren't
interchangeable.

No functional change intended.

Reviewe

dtrace: Use size_t instead of uintptr_t to represent buffer offsets

This eases porting of DTrace to CHERI, where uintptr_t and size_t aren't
interchangeable.

No functional change intended.

Reviewed by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D48625

show more ...


Revision tags: release/14.2.0
# 5d12db2d 22-Nov-2024 Mark Johnston <markj@FreeBSD.org>

dtrace: Avoid excessive pcpu allocations

We were previously allocating MAXCPU structures for several purposes,
but this is generally unnecessary and is quite excessive, especially
after MAXCPU was b

dtrace: Avoid excessive pcpu allocations

We were previously allocating MAXCPU structures for several purposes,
but this is generally unnecessary and is quite excessive, especially
after MAXCPU was bumped to 1024 on amd64 and arm64. We already are
careful to allocate only as many per-CPU tracing buffers as are needed;
extend this to other allocations.

For example, in a 2-vCPU VM, the size of a consumer state structure
drops from 64KB to 128B. The size of the per-consumer `dts_buffer` and
`dts_aggbuffer` arrays shrink similarly. Ditto for pre-allocations of
local and global D variable storage space.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D47667

show more ...


Revision tags: release/13.4.0
# 82283cad 24-Jul-2024 Mark Johnston <markj@FreeBSD.org>

dtrace: Avoid including dtrace_isa.c directly into dtrace.c

This was done in the original DTrace import, presumably because that
made it a bit easier to handle includes. However, this can cause
dtr

dtrace: Avoid including dtrace_isa.c directly into dtrace.c

This was done in the original DTrace import, presumably because that
made it a bit easier to handle includes. However, this can cause
dtrace_getpcstack() to be inlined into dtrace_probe(), resulting in a
missing frame in stack traces since dtrace_getpcstack() takes care to
bump "aframes" to account for its own stack frame.

To avoid this, compile dtrace_isa.c separately on all platforms. Add
requisite includes.

MFC after: 2 weeks
Sponsored by: Innovate UK

show more ...


Revision tags: release/14.1.0
# b9827c00 21-Apr-2024 Andriy Gapon <avg@FreeBSD.org>

Revert "dtrace: make 'ring' and 'fill' policies imply 'noswitch' flag"

This reverts commit e92491d95ff3500e140eafa614e88ca84ffb0d26.

The general idea looked good to me. In particular, it allowed t

Revert "dtrace: make 'ring' and 'fill' policies imply 'noswitch' flag"

This reverts commit e92491d95ff3500e140eafa614e88ca84ffb0d26.

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
MFC after: immediately

show more ...


Revision tags: release/13.3.0, release/14.0.0, release/13.2.0, release/12.4.0, release/13.1.0
# e92491d9 24-Dec-2021 Andriy Gapon <avg@FreeBSD.org>

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

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.

show more ...


# 8527bb2a 06-Sep-2023 Domagoj Stolfa <domagoj.stolfa@gmail.com>

dtrace: Fix a kernel panic in printm()

When using printm(), one should always pass a scratch pointer to it.
This is achieved by calling printm with memref

BEGIN { printm(fixed_len, memref(ptr, va

dtrace: Fix a kernel panic in printm()

When using printm(), one should always pass a scratch pointer to it.
This is achieved by calling printm with memref

BEGIN { printm(fixed_len, memref(ptr, var_len)); }

which will return a pointer to the DTrace scratch space of size
sizeof(uintptr_t) * 2. However, one can easily call printm() as follows

BEGIN { printm(10, (void *)NULL); }

and panic the kernel as a result. This commit does two things:

(1) adds a new macro DTRACE_INSCRATCHPTR(mstate, ptr, howmany) which
checks if a certain pointer is in the DTrace scratch space;
(2) uses DTRACE_INSCRATCHPTR() to implement a check on printm()'s DIFO
return value in order to avoid the panic and sets CPU_DTRACE_BADADDR
if the address is not in the scratch space.

Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D41722

show more ...


# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 7c5bc69a 24-Jan-2023 Domagoj Stolfa <domagoj.stolfa@gmail.com>

dtrace: Improve a verifier error message

Using '%r0' in efunc causes it to parse %r as a 'r' specifier.

This diff just adds a '%' in front of '%r0' in order to create the
correct output.

Reviewed

dtrace: Improve a verifier error message

Using '%r0' in efunc causes it to parse %r as a 'r' specifier.

This diff just adds a '%' in front of '%r0' in order to create the
correct output.

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38176

show more ...


# bdd101c4 04-Oct-2022 Mark Johnston <markj@FreeBSD.org>

dtrace: Add a "regs" variable

This allows invop-based providers (i.e., fbt and kinst) to expose the
register file of the CPU at the point where the probe fired. It does
not work for SDT providers b

dtrace: Add a "regs" variable

This allows invop-based providers (i.e., fbt and kinst) to expose the
register file of the CPU at the point where the probe fired. It does
not work for SDT providers because their probes are implemented as plain
function calls and so don't save registers. It's not clear what
semantics "regs" should have for them anyway.

This is akin to "uregs", which nominally provides access to the
userspace registers. In fact, DIF already had a DIF_VAR_REGS variable
defined, it was simply unimplemented.

Usage example: print the contents of %rdi upon each call to
amd64_syscall():

fbt::amd64_syscall:entry {printf("%x", regs[R_RDI]);}

Note that the R_* constants are defined in /usr/lib/dtrace/regs_x86.d.
Currently there are no similar definitions for non-x86 platforms.

Reviewed by: christos
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36799

show more ...


# bd0e3cc2 19-Jul-2022 Dimitry Andric <dim@FreeBSD.org>

Adjust dtrace_getf_barrier() definition to avoid clang 15 warning

With clang 15, the following -Werror warnings is produced:

sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c:17019:20: er

Adjust dtrace_getf_barrier() definition to avoid clang 15 warning

With clang 15, the following -Werror warnings is produced:

sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c:17019:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
dtrace_getf_barrier()
^
void

This is because dtrace_getf_barrier() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after: 3 days

show more ...


# 35eb9b10 02-Jun-2022 Mitchell Horne <mhorne@FreeBSD.org>

Use KERNEL_PANICKED() in more places

This is slightly more optimized than checking panicstr directly. For
most of these instances performance doesn't matter, but let's make
KERNEL_PANICKED() the com

Use KERNEL_PANICKED() in more places

This is slightly more optimized than checking panicstr directly. For
most of these instances performance doesn't matter, but let's make
KERNEL_PANICKED() the common idiom.

Reviewed by: mjg
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D35373

show more ...


# f17ef286 22-Feb-2022 Mateusz Guzik <mjg@FreeBSD.org>

fd: rename fget*_locked to fget*_noref

This gets rid of the error prone naming where fget_unlocked returns with
a ref held, while fget_locked requires a lock but provides nothing in
terms of making

fd: rename fget*_locked to fget*_noref

This gets rid of the error prone naming where fget_unlocked returns with
a ref held, while fget_locked requires a lock but provides nothing in
terms of making sure the file lives past unlock.

No functional changes.

show more ...


# 7fdf0e88 11-Jan-2022 Andriy Gapon <avg@FreeBSD.org>

dtrace: add a knob to control maximum size of principal buffers

We had a hardcoded limit of 1/128-th of physical memory that was further
subdivided between all CPUs as principal buffers are allocate

dtrace: add a knob to control maximum size of principal buffers

We had a hardcoded limit of 1/128-th of physical memory that was further
subdivided between all CPUs as principal buffers are allocated on the
per-CPU basis. Actually, the buffers could use up 1/64-th of the
memmory because with the default switch policy there are two buffers per
CPU.

This commit allows to change that limit.

Note that the discussed limit is per dtrace command invocation.
The idea is to limit the size of a single malloc(9) call, not the total
memory size used by DTrace buffers.

Reviewed by: markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D33648

show more ...


# 30ec3138 17-Dec-2021 Domagoj Stolfa <domagoj.stolfa@gmail.com>

dtrace: Disable getf() as it is broken on FreeBSD

getf() on FreeBSD calls _sx_slock(), _sx_sunlock() and fget_locked().
Furthermore, it does not set the per-core fault flag, meaning it
usually ends

dtrace: Disable getf() as it is broken on FreeBSD

getf() on FreeBSD calls _sx_slock(), _sx_sunlock() and fget_locked().
Furthermore, it does not set the per-core fault flag, meaning it
usually ends up in a double fault panic once getf() does get called,
especially from fbt.

Reviewing the DTrace Toolkit + a number of other scripts scattered
around FreeBSD, I have not been able to find one use of getf(). Given
how broken the implementation currently is, we disable it until it
can be implemented properly.

Also comment out a test in aggs/tst.subr.d for getf().

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33378

show more ...


Revision tags: release/12.3.0
# b1a217a3 16-Aug-2021 Ed Maste <emaste@FreeBSD.org>

sys/cddl: remove extraneous semicolons

Fixes: 5a1b490d502e ("FreeBSD changes to vendor source.")
Fixes: 91eaf3e1831d ("Custom DTrace kernel module...")
MFC after: 1 week
Sponsored by: The FreeBSD

sys/cddl: remove extraneous semicolons

Fixes: 5a1b490d502e ("FreeBSD changes to vendor source.")
Fixes: 91eaf3e1831d ("Custom DTrace kernel module...")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

show more ...


# 66b8eced 08-Aug-2021 Konstantin Belousov <kib@FreeBSD.org>

dtrace: use %zu format specifier for data of size_t type

Sponsored by: The FreeBSD Foundation


Revision tags: release/13.0.0
# fb581531 22-Mar-2021 Robert Watson <rwatson@FreeBSD.org>

Teach DTrace that unaligned accesses are OK on aarch64, not just x86.

MFC after: 3 days
Reviewed: andrew
Differential Revision: https://reviews.freebsd.org/D29369


# f222a6b8 18-Dec-2020 Bryan Drewery <bdrewery@FreeBSD.org>

dtrace: Fix /"string" == NULL/ comparisons using an uninitialized value.

A test of this is funcs/tst.strtok.d which has this filter:

BEGIN
/(this->field = strtok(this->str, ",")) == NULL/

dtrace: Fix /"string" == NULL/ comparisons using an uninitialized value.

A test of this is funcs/tst.strtok.d which has this filter:

BEGIN
/(this->field = strtok(this->str, ",")) == NULL/
{
exit(1);
}
The test will randomly fail with exit status of 1 indicating that this->field
was NULL even though printing it out shows it is not.

This is compiled to the DTrace instruction set:
// Pushed arguments not shown here
// call strtok() and set result into %r1
07: 2f001f01 call DIF_SUBR(31), %r1 ! strtok
// set thread local scalar this->field from %r1
08: 39050101 stls %r1, DT_VAR(1281) ! DT_VAR(1281) = "field"
// Prepare for the == comparison
// Set right side of %r2 to NULL
09: 25000102 setx DT_INTEGER[1], %r2 ! 0x0
// string compare %r1 (strtok result) to %r2
10: 27010200 scmp %r1, %r2

In this case only %r1 is loaded with a string limit set to lim1. %r2 being
NULL does not get loaded and does not set lim2. Then we call dtrace_strncmp()
with MIN(lim1, lim2) resulting in passing 0 and comparing neither side.
dtrace_strncmp() handles this case fine and it already has been while
being lucky with what lim2 was [un]initialized as.

Reviewed by: markj, Don Morris <dgmorris AT earthlink.net>
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D27671

show more ...


Revision tags: release/12.2.0
# e2515283 27-Aug-2020 Glen Barber <gjb@FreeBSD.org>

MFH

Sponsored by: Rubicon Communications, LLC (netgate.com)


# 9e5787d2 25-Aug-2020 Matt Macy <mmacy@FreeBSD.org>

Merge OpenZFS support in to HEAD.

The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.

I would a

Merge OpenZFS support in to HEAD.

The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.

I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.

Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.

Improvements include:
project quotas, encrypted datasets,
allocation classes, vectorized raidz,
vectorized checksums, various command line
improvements, zstd compression.

Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.

Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25872

show more ...


# 4dc16f43 27-Jun-2020 Matt Macy <mmacy@FreeBSD.org>

Fix "current" variable name conflict with openzfs

The variable "current" is an alias for curthread
in openzfs. Rename all variable uses of current
in dtrace.c to curstate.


Revision tags: release/11.4.0, release/12.1.0, release/11.3.0
# 9a696dc6 04-Apr-2019 Alan Somers <asomers@FreeBSD.org>

MFHead@r345880


# a8a16c71 04-Apr-2019 Conrad Meyer <cem@FreeBSD.org>

Replace read_random(9) with more appropriate arc4rand(9) KPIs

Reviewed by: ae, delphij
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D19760


Revision tags: release/12.0.0, release/11.2.0
# 87c1cb45 10-Apr-2018 Mark Johnston <markj@FreeBSD.org>

Correct a comment.

Submitted by: Domagoj Stolfa
X-MFC with: r332364
Sponsored by: DARPA, AFRL


# 85931364 10-Apr-2018 Mark Johnston <markj@FreeBSD.org>

Assert that dtrace_probe() doesn't re-enter itself.

This helps catch cases where an instrumented function is called while
in probe context.

Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
M

Assert that dtrace_probe() doesn't re-enter itself.

This helps catch cases where an instrumented function is called while
in probe context.

Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC after: 2 weeks
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D14863

show more ...


12345678910