Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Nov 2019 21:52:30 +0100
From:      Peter Eriksson <pen@lysator.liu.se>
To:        freebsd-current@freebsd.org
Subject:   Best way to print something from the kernel at 1s intervals? 
Message-ID:  <E6B8A0DA-5F4D-4B08-A376-0AE65575A6F9@lysator.liu.se>

next in thread | raw e-mail | index | archive | help
I=E2=80=99ve been looking into the =E2=80=9Ckernel looks to be hung at =
reboot=E2=80=9D problem at bit. Adding a lot of printf() calls to the =
relevant parts it looks like it actually isn=E2=80=99t hung but busy =
unmounting filesystems (which we have thousands of), flushing disk =
caches, calling registered callbacks and stuff and sometimes it takes a =
bit longer than usual - probably due to ZFS having stuff queued up that =
needs to be written to disk before it finishes=E2=80=A6

Anyway, I=E2=80=99d like to propose that we add some kind of =
counter/printf() calls in that code area so we can see that things are =
indeed progressing. However, I=E2=80=99d probably prefer not to print =
_every_ filesystem (or registered callbacks - a lot of those...) - that =
generates a lot of output (tried that :-) but something like:

Unmounting filesystems:
1234 done
(With the "1234 done=E2=80=9D updated something like once per second).

What=E2=80=99s the right/best way to do that from the kernel? In user =
space I=E2=80=99d just call time(&t) at some convenient points and only =
print something if =E2=80=9Ct=E2=80=9D has changed. :-)

- Peter




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E6B8A0DA-5F4D-4B08-A376-0AE65575A6F9>