History log of /openbsd-src/sys/dev/dt/dt_dev.c (Results 1 – 25 of 42)
Revision Date Author Comments
# 8ce4994e 04-Dec-2024 mpi <mpi@openbsd.org>

Disallow enabling the same probe multiple times.

From Christian Ludwig.


# bb6b0345 26-Nov-2024 mpi <mpi@openbsd.org>

Generate a single event when timers advance for more than one tick.

Also report the number of events missed due to recursions or skipped ticks
to btrace(8).

From Christian Ludwig.


# 18b19e82 05-Nov-2024 mpi <mpi@openbsd.org>

Tweak softc initialization:

- move softintr_establish(), which allocates memory, into dtalloc()
- Use M_DEVBUF consistently for all memory chunks in the softc.
- Do not check for NULL before calling

Tweak softc initialization:

- move softintr_establish(), which allocates memory, into dtalloc()
- Use M_DEVBUF consistently for all memory chunks in the softc.
- Do not check for NULL before calling free(9).

Reviewed by Christian Ludwig, ok miod@

show more ...


# cc4b6028 02-Nov-2024 mpi <mpi@openbsd.org>

Use lowercase in locking comments when not refering to a global lock.

Also talk about thread rather than proc which might be confusing.


# f5199088 02-Nov-2024 mpi <mpi@openbsd.org>

Use a ringbuffer per CPU instead of a ringbuffer per PCB.

Get rid of the per-ringbuffer mutex. Use a variable to prevent against
recursion. Allow to process more events in the same timeframe.

Fro

Use a ringbuffer per CPU instead of a ringbuffer per PCB.

Get rid of the per-ringbuffer mutex. Use a variable to prevent against
recursion. Allow to process more events in the same timeframe.

From Christian Ludwig.

show more ...


# 9d5d5c61 06-Sep-2024 mpi <mpi@openbsd.org>

Allow tracing interrupts by defering the wakeup(9) to a different context.

It is currently not safe to call wakeup(9) in interrupt handlers at a priority
higher than IPL_SCHED. As long as dt(4) rel

Allow tracing interrupts by defering the wakeup(9) to a different context.

It is currently not safe to call wakeup(9) in interrupt handlers at a priority
higher than IPL_SCHED. As long as dt(4) relies on generic kernel primitives
we have to play tricks to be able to inspect more parts of the kernel. In this
case defer the wakeup(9) to a custom soft-interrupt. This will be good enough
as long as we don't add tracepoints to the soft-interrupt machinery. A more
complex & viable solution would be to not rely on the kernel generic IPC to
avoid recursion.

From visa@ and Christian Ludwig, ok claudio@

show more ...


# 11c54b09 22-Aug-2024 mvs <mvs@openbsd.org>

Introduce sysctl_securelevel() to modify `securelevel' mp-safe. Keep
KERN_SECURELVL locked until existing `securelevel' checks became moved
out of kernel lock.

Make sysctl_securelevel_int() mp-safe

Introduce sysctl_securelevel() to modify `securelevel' mp-safe. Keep
KERN_SECURELVL locked until existing `securelevel' checks became moved
out of kernel lock.

Make sysctl_securelevel_int() mp-safe by using atomic_load_int(9) to
unlocked read-only access for `securelevel'.

Unlock KERN_ALLOWDT. `allowdt' is the atomically accessed integer used
only once in dtopen().

ok mpi

show more ...


# baa78d7b 21-Aug-2024 mpi <mpi@openbsd.org>

Read events from all PCBs as long as there's no error.

From Christian Ludwig.


# 9ff65b2b 18-Aug-2024 mpi <mpi@openbsd.org>

Get rid of intermediate copy before passing events to userland.

From Christian Ludwig with some tweaks.


# c2c0b0cf 06-Apr-2024 mpi <mpi@openbsd.org>

Remove (unused) in-kernel event filtering, it's currently dead code.

All events are currently exported to userland in order to support complex
filters. If this becomes a bottleneck it should be pos

Remove (unused) in-kernel event filtering, it's currently dead code.

All events are currently exported to userland in order to support complex
filters. If this becomes a bottleneck it should be possible to translate
(some) user-land filters to in-kernel fitlers.

Prodded by a diff from Christian Ludwig to also trace the tracing program.

ok claudio@

show more ...


# a79ed6b1 29-Feb-2024 cheloha <cheloha@openbsd.org>

dt(4): interval, profile: schedule clockintr relative to start of recording

For the interval and profile providers, schedule the first clock
interrupt to occur dp_nsecs nanoseconds after the start o

dt(4): interval, profile: schedule clockintr relative to start of recording

For the interval and profile providers, schedule the first clock
interrupt to occur dp_nsecs nanoseconds after the start of recording.
This makes the interval between the start of recording and the first
event consistent across runs.

With input from claudio@. Simplified by claudio@.

Thread: https://marc.info/?l=openbsd-tech&m=170879058205043&w=2

ok mpi@ claudio@

show more ...


# 173b2281 18-Feb-2024 cheloha <cheloha@openbsd.org>

dt(4): profile: remove clock interrupt staggering

Clock interrupt staggering makes profiling more expensive on average.

Remove it.

Thread: https://marc.info/?l=openbsd-tech&m=170751016121770&w=2

dt(4): profile: remove clock interrupt staggering

Clock interrupt staggering makes profiling more expensive on average.

Remove it.

Thread: https://marc.info/?l=openbsd-tech&m=170751016121770&w=2

ok mpi@

show more ...


# c56c27b6 09-Feb-2024 cheloha <cheloha@openbsd.org>

dt(4): move interval/profile entry points to dedicated clockintr callback

To improve the utility of dt(4)'s interval and profile probes we need
to move the probe entry points from the fixed-frequenc

dt(4): move interval/profile entry points to dedicated clockintr callback

To improve the utility of dt(4)'s interval and profile probes we need
to move the probe entry points from the fixed-frequency hardclock() to
a dedicated clock interrupt callback so that the probes can fire at
arbitrary frequencies.

- Remove entry points for interval/profile probes from hardclock().

- Merge dt_prov_profile_enter(), dt_prov_interval_enter(), and
dt_prov_profile_fire() into one function, dt_clock(). This is
the now-unified callback for interval/profile probes. dt_clock()
will consume multiple events during a single execution if it is
delayed, but on platforms with high quality interrupt clocks this
should be rare.

- Each struct dt_pcb gets its own clockintr handle, dp_clockintr.

- In struct dt_pcb, replace dp_maxtick/dp_nticks with dp_nsecs,
the PCB's sampling period. Aynchronous probes must initialize
dp_nsecs to a non-zero value during dtpv_alloc().

- In struct dt_pcb, replace dp_cpuid with dp_cpu so that
dt_ioctl_record_start() knows where to bind the PCB's
dp_clockintr.

- dt_ioctl_record_start() binds, staggers, and starts all
interval/profile PCBs on the given dt_softc. Each dp_clockintr
is given a reference to its enclosing PCB so that dt_clock()
doesn't need to search for it. The staggering sort-of simulates
the current behavior under hardclock().

- dt_ioctl_record_stop() unbinds all interval/profile PCBs. The
CL_BARRIER ensures that dp_clockintr's PCB reference is not in
use by dt_clock() so that the PCB may be safely freed upon
return from dt_ioctl_record_stop(). Blocking while holding
dt_lock is not ideal, but in practice blocking in this spot is
rare and dt_clock() completes quickly on all but the oldest
hardware. An extremely unlucky thread could block for every
interval/profile PCB on the softc, but this is implausible.

DT_FA_PROFILE values are up-to-date for amd64, i386, and macppc.
Somebody with the right hardware needs to check-and-maybe-fix the
values on octeon, powerpc64, and sparc64.

Joint effort with mpi@.

Thread: https://marc.info/?l=openbsd-tech&m=170629371821879&w=2

ok mpi@

show more ...


# c57c5c68 02-Jan-2024 bluhm <bluhm@openbsd.org>

Prevent simultaneous dt(4) open.

Syskaller has hit the assertion "dtlookup(unit) == NULL" by opening
dt(4) device in two parallel threads. Convert kassert into if
condition. Move check that device

Prevent simultaneous dt(4) open.

Syskaller has hit the assertion "dtlookup(unit) == NULL" by opening
dt(4) device in two parallel threads. Convert kassert into if
condition. Move check that device is not used after sleep points
in malloc. The list dtdev_list is protected by kernel lock which
is released during sleep.

Reported-by: syzbot+6d66c21f796c817948f0@syzkaller.appspotmail.com
OK miod@

show more ...


# f2e7dc09 14-Jul-2023 claudio <claudio@openbsd.org>

struct sleep_state is no longer used, remove it.
Also remove the priority argument to sleep_finish() the code can use
the p_flag P_SINTR flag to know if the signal check is needed or not.
OK cheloha@

struct sleep_state is no longer used, remove it.
Also remove the priority argument to sleep_finish() the code can use
the p_flag P_SINTR flag to know if the signal check is needed or not.
OK cheloha@ kettenis@ mpi@

show more ...


# b2536c64 28-Jun-2023 claudio <claudio@openbsd.org>

First step at removing struct sleep_state.

Pass the timeout and sleep priority not only to sleep_setup() but also
to sleep_finish(). With that sls_timeout and sls_catch can be removed
from struct sl

First step at removing struct sleep_state.

Pass the timeout and sleep priority not only to sleep_setup() but also
to sleep_finish(). With that sls_timeout and sls_catch can be removed
from struct sleep_state.

The timeout is now setup first thing in sleep_finish() and no longer as
last thing in sleep_setup(). This should not cause a noticeable difference
since the code run between sleep_setup() and sleep_finish() is minimal.

OK kettenis@

show more ...


# a28bb56f 26-Apr-2023 claudio <claudio@openbsd.org>

Implement dt(4) utrace support on amd64 and i386.

This adds stacktrace_save_utrace() to extract and save the userland stack
which is stubbed out on most archs. alpha and riscv64 do not even implemen

Implement dt(4) utrace support on amd64 and i386.

This adds stacktrace_save_utrace() to extract and save the userland stack
which is stubbed out on most archs. alpha and riscv64 do not even implement
dt(4) and stacktrace_save_at() so the stubs are excluded there.

Additionally add a new ioctl DTIOCGETAUXBASE which allows btrace to
fetch the AUX_BASE vallue from the AUX vector of a process.

OK mpi@ (some time ago) discussed with kettenis@

show more ...


# cd5e5223 10-Mar-2023 bluhm <bluhm@openbsd.org>

Add new dt(4) ioctl DTIOCGARGS to get the types of probe arguments.
They are already tracked as strings in the kernel. Export them to
userland using one ioctl(2) for all arguments of each probe.
OK

Add new dt(4) ioctl DTIOCGARGS to get the types of probe arguments.
They are already tracked as strings in the kernel. Export them to
userland using one ioctl(2) for all arguments of each probe.
OK mpi@

show more ...


# c5d97e14 10-Mar-2023 claudio <claudio@openbsd.org>

Add the necessary stack offsets for macppc so dt(4).
Tested on a G5 and G4 macppc.
OK miod@


# f6782744 10-Mar-2023 claudio <claudio@openbsd.org>

Update the stack offset for the profile probe to account for the clockintr
API functions. Fixes flamegraphs on archs I could test.
OK bluhm@ miod@


# c860ffec 27-Feb-2022 bluhm <bluhm@openbsd.org>

Fix whitespace and uninitialized variable in dt(4).
OK mpi@


# 14cb6e73 22-Feb-2022 deraadt <deraadt@openbsd.org>

Since other exported commandnames were increased to 24 and graduated into
proper strings, adapt dt's exported string in the same way.
Old/new files/tools will not work the same way.
That this interfa

Since other exported commandnames were increased to 24 and graduated into
proper strings, adapt dt's exported string in the same way.
Old/new files/tools will not work the same way.
That this interface needs to also change was pointed out by jsg

show more ...


# d6e57b0d 20-Jan-2022 visa <visa@openbsd.org>

dt: Add frame skip parameters for octeon

OK mpi@


# 4b1a56af 09-Jan-2022 jsg <jsg@openbsd.org>

spelling
feedback and ok tb@ jmc@ ok ratchov@


# 7f01505d 21-Dec-2021 bluhm <bluhm@openbsd.org>

Do not print "dt: 451 probes" at boot in dmesg. Btrace device dt(4)
is enabled by default, this line does not provide much information.
requested by kettenis@ deraadt@; OK mpi@


12