Re: Q: dmesg: dt: 443 probes

2021-05-04 Thread Patrick Wildt
Am Tue, May 04, 2021 at 03:38:14PM - schrieb Stuart Henderson:
> On 2021-05-04, Why 42? The lists account.  wrote:
> >
> > On Mon, May 03, 2021 at 12:59:27AM +0200, Patrick Wildt wrote:
> >> > ...
> >> > But when I do (as root): "sysctl kern.allowdt=1" it returns this error:
> >> > sysctl: kern.allowdt: Operation not permitted
> >> 
> >> Similarly to kern.allowkmem, you can only set it when the securelevel is
> >> still 'low'.  That's for security.  You need to add kern.allowdt=1 to
> >> sysctl.conf, and then reboot.  Then it'll be enabled after reboot.
> >
> > Thanks Patrick! After the reboot I was able to experiment with btrace.
> >
> > Do you use it, do you have any examples that might help to get started?
> 
> Here's one example:
> https://marc.info/?l=openbsd-bugs=158583371404603=2

That's exactly the one I use.  Though with varying hz (1-60)



Re: Q: dmesg: dt: 443 probes

2021-05-04 Thread Stuart Henderson
On 2021-05-04, Why 42? The lists account.  wrote:
>
> On Mon, May 03, 2021 at 12:59:27AM +0200, Patrick Wildt wrote:
>> > ...
>> > But when I do (as root): "sysctl kern.allowdt=1" it returns this error:
>> > sysctl: kern.allowdt: Operation not permitted
>> 
>> Similarly to kern.allowkmem, you can only set it when the securelevel is
>> still 'low'.  That's for security.  You need to add kern.allowdt=1 to
>> sysctl.conf, and then reboot.  Then it'll be enabled after reboot.
>
> Thanks Patrick! After the reboot I was able to experiment with btrace.
>
> Do you use it, do you have any examples that might help to get started?

Here's one example:
https://marc.info/?l=openbsd-bugs=158583371404603=2




Re: Q: dmesg: dt: 443 probes

2021-05-04 Thread Why 42? The lists account.


On Mon, May 03, 2021 at 12:59:27AM +0200, Patrick Wildt wrote:
> > ...
> > But when I do (as root): "sysctl kern.allowdt=1" it returns this error:
> > sysctl: kern.allowdt: Operation not permitted
> 
> Similarly to kern.allowkmem, you can only set it when the securelevel is
> still 'low'.  That's for security.  You need to add kern.allowdt=1 to
> sysctl.conf, and then reboot.  Then it'll be enabled after reboot.

Thanks Patrick! After the reboot I was able to experiment with btrace.

Do you use it, do you have any examples that might help to get started?

Using the bfptrace reference guide:
https://github.com/iovisor/bpftrace/blob/master/docs/reference_guide.md
I was able to get a simple "Hello World" to run, but more than that
seemed to cause me some problems e.g.
> # btrace -e 'BEGIN{ @enq = 0 } tracepoint:sched:enqueue { @enq = @enq + 1; } 
> interval:s:10 { printf("sched_enqueue: %d\n", @enq) ; @enq = 0; }'
> btrace:1:77: syntax error:
> BEGIN{ @enq = 0 } tracepoint:sched:enqueue { @enq = @enq + 1; } interval:s:10 
> { printf("sched_enqueue: %d\n", @enq) ; @enq = 0; }
> ^
Doesn't seem to like the interval syntax?

Or this one which does run but then takes an assertion failure:
> # btrace -e 'BEGIN{ @enq = 0 } tracepoint:sched:enqueue { @enq = 
> lhist(retval, 0, 1000, 100); }'
> assertion "hist->hstep == step" failed: file 
> "/usr/src/usr.sbin/btrace/map.c", line 246, function "hist_increment"
> zsh: abort (core dumped)  btrace -e 

Thanks again in any case!

Cheers,
Robb.



Re: Q: dmesg: dt: 443 probes

2021-05-02 Thread Patrick Wildt
Am Sun, May 02, 2021 at 11:49:10PM +0200 schrieb Why 42? The lists account.:
> 
> Actually I do notice one thing, having just upgraded to:
> kern.version=OpenBSD 6.9-current (GENERIC.MP) #492: Sat May  1 17:37:28 MDT 
> 2021
> 
> I checked the output from dmesg and I have a new boot time message:
> dt: 443 probes
> 
> man dt tells me that dt is dynamic tracing and that I can enable it by
> setting kern.allowdt.
> 
> But when I do (as root): "sysctl kern.allowdt=1" it returns this error:
> sysctl: kern.allowdt: Operation not permitted

Similarly to kern.allowkmem, you can only set it when the securelevel is
still 'low'.  That's for security.  You need to add kern.allowdt=1 to
sysctl.conf, and then reboot.  Then it'll be enabled after reboot.

> What am I missing?
> 
> Cheers,
> Robb.
> 
> FYI: This is on an Intel NUC:
> bios0 at mainbus0: SMBIOS rev. 3.2 @ 0x7a9a4000 (77 entries)
> bios0: vendor Intel Corp. version "BECFL357.86A.0087.2020.1209.1115" date 
> 12/09/2020
> bios0: Intel(R) Client Systems NUC8i5BEH
> 



Q: dmesg: dt: 443 probes

2021-05-02 Thread Why 42? The lists account.


Actually I do notice one thing, having just upgraded to:
kern.version=OpenBSD 6.9-current (GENERIC.MP) #492: Sat May  1 17:37:28 MDT 2021

I checked the output from dmesg and I have a new boot time message:
dt: 443 probes

man dt tells me that dt is dynamic tracing and that I can enable it by
setting kern.allowdt.

But when I do (as root): "sysctl kern.allowdt=1" it returns this error:
sysctl: kern.allowdt: Operation not permitted

What am I missing?

Cheers,
Robb.

FYI: This is on an Intel NUC:
bios0 at mainbus0: SMBIOS rev. 3.2 @ 0x7a9a4000 (77 entries)
bios0: vendor Intel Corp. version "BECFL357.86A.0087.2020.1209.1115" date 
12/09/2020
bios0: Intel(R) Client Systems NUC8i5BEH