On Tue, Oct 25, 2022 at 07:52:07AM +0300, Ville Syrjälä wrote: > On Fri, Oct 21, 2022 at 08:22:41PM +0300, Ville Syrjälä wrote: > > On Mon, Aug 22, 2022 at 01:18:22PM +0200, Peter Zijlstra wrote: > > > +#ifdef CONFIG_LOCKDEP > > > + /* > > > + * It's dangerous to freeze with locks held; there be dragons there. > > > + */ > > > + if (!(state & __TASK_FREEZABLE_UNSAFE)) > > > + WARN_ON_ONCE(debug_locks && p->lockdep_depth); > > > +#endif > > > > We now seem to be hitting this sporadically in the intel gfx CI. > > > > I've spotted it on two machines so far: > > https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12270/shard-tglb7/igt@gem_ctx_isolation@preservation-s3@xxxxxxxxx > > https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_109950v1/shard-snb5/igt@kms_flip@flip-vs-suspend-interruptible@xxxxxxxxxxx > > Sadly no luck in reproducing this locally so far. In the meantime > I added the following patch into our topic/core-for-CI branch in > the hopes of CI stumbling on it again and dumping a bit more data: > > --- a/kernel/freezer.c > +++ b/kernel/freezer.c > @@ -125,8 +125,16 @@ static int __set_task_frozen(struct task_struct *p, void *arg) > /* > * It's dangerous to freeze with locks held; there be dragons there. > */ > - if (!(state & __TASK_FREEZABLE_UNSAFE)) > - WARN_ON_ONCE(debug_locks && p->lockdep_depth); > + if (!(state & __TASK_FREEZABLE_UNSAFE)) { > + static bool warned = false; > + > + if (!warned && debug_locks && p->lockdep_depth) { > + debug_show_held_locks(p); > + WARN(1, "%s/%d holding locks while freezing\n", > + p->comm, task_pid_nr(p)); > + warned = true; > + } > + } > #endif > > WRITE_ONCE(p->__state, TASK_FROZEN); That seems reasonable. But note that this constraint isn't new; the previous freezer had much the same constraint but perhaps it wasn't triggered for mysterious raisins. see the previous try_to_freeze_unsafe() function.