Claudio Jeker <clau...@openbsd.org> wrote: > On Mon, Jun 19, 2023 at 06:41:14PM -0500, Scott Cheloha wrote: > > > On Jun 19, 2023, at 18:07, Theo de Raadt <dera...@openbsd.org> wrote: > > > > > > Make sure to STOP all kernel profiling before attempting to > > > suspend or hibernate your machine. Otherwise I expect it > > > will hang. > > > > > > It is completely acceptable if it produces wrong results, but it must > > > not hang the system. > > > > The hang is present in -current, with or > > without this patch. > > > > I am working to figure it out. > > I don't think the suspend or hibernate code has any code to disable > kernel profiling. This is bad since these code paths are extremly > sensitive and try not to do side-effects. > > So in the suspend/hibernate code path we should disable profiling early > on. It makes no sense to try to run gprof collection in those code paths.
Yes, that's right. It will be somewhere in kern/subr_suspend.c Be careful that the "stop profiling" and "restart profiling" are at the correct places. The sleep_state() function has a bunch of unrolling goto's which are not 100% reflexive, so be careful.