Best way to print something from the kernel at 1s intervals?

From: Peter Eriksson <pen_at_lysator.liu.se>
Date: Thu, 28 Nov 2019 21:52:30 +0100
I’ve been looking into the “kernel looks to be hung at reboot” problem at bit. Adding a lot of printf() calls to the relevant parts it looks like it actually isn’t 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…

Anyway, I’d 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’d 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” updated something like once per second).

What’s the right/best way to do that from the kernel? In user space I’d just call time(&t) at some convenient points and only print something if “t” has changed. :-)

- Peter
Received on Thu Nov 28 2019 - 19:52:37 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:22 UTC