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

From: Rodney W. Grimes <freebsd-rwg_at_gndrsh.dnsmgr.net>
Date: Fri, 29 Nov 2019 11:15:03 -0800 (PST)
> > 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. :-)
> 
> How about updated every 128 unmounts?
> 
> if ((i & 0x7f) == i) printf("%i done\n:");

if ((i & 0x7f) == 0) printf("%i done\n:");

> > 
> > - Peter
> 
> -- 
> Rod Grimes                                                 rgrimes_at_freebsd.org
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
> 

-- 
Rod Grimes                                                 rgrimes_at_freebsd.org
Received on Fri Nov 29 2019 - 18:15:06 UTC

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