user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: "Štěpán Němec" <stepnem@smrk.net>
To: Eric Wong <e@80x24.org>
Cc: meta@public-inbox.org
Subject: OpenBSD debugging
Date: Mon, 27 Nov 2023 12:20:01 +0100	[thread overview]
Message-ID: <20231023222143+0200.165893-stepnem@smrk.net> (raw)
In-Reply-To: <20231023195818.M543558@dcvr>


I apologize for the late response.

On Mon, 23 Oct 2023 19:58:18 +0000
Eric Wong wrote:

> Thanks for the info.  Just curious, what HW specs (ncpus, RAM)
> is available on that system?  I wonder if that affects timing
> somehow...

dmesg:
https://dmesgd.nycbug.org/index.cgi?do=view&id=7357
ncpus = 2 (so it's running the MP (multiprocessor) kernel), 1GB RAM

>> (And again, if you want to have a look yourself, I'd be
>> happy to give you access to the machine; still the same
>> testing OC VM.)
>
> Unfortunately, my *BSD debugging knowledge is far behind my
> Linux; so I'm not sure how much help it'd be...

If nothing else, you could do some tests on an otherwise
idle machine with good Internet connectivity (unless the
connection issues you keep mentioning are mainly on your
end, that is).

> Some examples of things I miss on OpenBSD:
>
> * /proc/$PID/fdinfo/$FD_OF_EPOLL on Linux is immensely helpful
>   for knowing what and how epoll is watching target FDs.  I'm
>   not sure if there's a way to introspect kqueue like that

Yeah, most likely there isn't, though I'm not quite sure
what exactly "like that" entails.  Care to expand a bit upon
the immense usefulness mentioned, i.e., how this helps you
specifically?

OpenBSD fstat(1) prints the kqueue memory addresses, so I
suppose a sufficiently determined individual could get
arbitrary info from the running kernel based on that,
although at that point there are probably better ways to get
the address than running fstat...

As for existing tools I'm aware of, there's ddb(4) which can
dump structures etc. (it has access to kernel symbols), but
it's not very convenient for casual debugging/introspection,
as it stops everything until you continue from the kernel
debugger, so it will mess up the clock etc.

Then there's bt(5)/btrace(8), which is a bpftrace clone.
It's a work in progress and nowhere near Linux
feature-/coverage-wise, but when it works it's nice.

AFAIK the most you can currently get from it by default is
entry and return for syscalls and a couple dozen static
tracepoints.  It's possible to enable entry/return for all
kernel functions with a custom kernel (which, depending on
circumstances, isn't as bad as it sounds: compiling an
OpenBSD kernel from scratch is a matter of (tens of) minutes
even on a weak machine; it took about 40 minutes in the
above VM, single-threaded).

Unfortunately there's no support for arbitrary argument
access (though it seems to be on TODO), you need to add a
custom tracepoint for that (which can be easy enough,
e.g. <https://flak.tedunangst.com/post/probing-my-ssds-latency>,
but again requires a kernel compile).

> * Linux strace decodes more struct args info than kdump

strace is certainly more featureful, though in the specific
case of kqueue/kevent I think kdump does show everything one
would expect to see?

> * ability to control pathname of core dumps

Yeah, the way the OpenBSD knobs have evolved (i.e., sane
behavior attainable only for processes with altered U/GID)
seems pretty weird, and even though I suspect at least some
developers would be able to entertain the thought that the
situation isn't optimal (despite the way the recent misc@
thread you participated in turned out), I don't see a good
way to improve it without some redesign, i.e. breaking
backwards compatibility (adding further knobs on top of
kern.nosuidcoredump would make matters even messier IMO).

That said, if it's critical for your use case, I think we could
patch it locally in the VM easily enough, now that I've set it
up for kernel compilation anyway.

Same for any custom bt tracepoints or other adjustments I'd
be able to help with.

In summary, if you ever feel the VM could be of use, just
let me know; if you consider your resources better spent
elsewhere I certainly understand.

-- 
Štěpán

  reply	other threads:[~2023-11-27 11:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18 15:01 imapd.t failing on OpenBSD, bisects to 13a2088c74fd (kqnotify: drop EV_CLEAR (edge triggering)) Štěpán Němec
2023-10-18 19:06 ` Eric Wong
2023-10-18 19:18   ` Štěpán Němec
2023-10-18 21:23     ` Eric Wong
2023-10-19  8:43       ` Štěpán Němec
2023-10-23 19:58         ` Eric Wong
2023-11-27 11:20           ` Štěpán Němec [this message]
2023-11-29 22:38             ` OpenBSD debugging Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231023222143+0200.165893-stepnem@smrk.net \
    --to=stepnem@smrk.net \
    --cc=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).