On Fri, 08 Mar 2024 13:38:20 -0500 Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > +static DEFINE_MUTEX(wait_mutex); > + > +static bool wait_woken_prepare(struct trace_iterator *iter, int *wait_index) > +{ > + bool woken = false; > + > + mutex_lock(&wait_mutex); > + if (iter->waking) > + woken = true; > + *wait_index = iter->wait_index; > + mutex_unlock(&wait_mutex); > + > + return woken; > +} The last patch adds this code after a prepare_to_wait(), which triggered the warning: do not call blocking ops when !TASK_RUNNING; state=1 set at [<00000000797e3e20>] prepare_to_wait+0x48/0xf0 Which is correct. The prepare_to_wait() set task state to TASK_INTERRUPTIBLE, so I can not call a mutex after that. I'll send a v2 where I switch this over to spin locks. -- Steve > + > +static bool wait_woken_check(struct trace_iterator *iter, int *wait_index) > +{ > + bool woken = false; > + > + mutex_lock(&wait_mutex); > + if (iter->waking || *wait_index != iter->wait_index) > + woken = true; > + mutex_unlock(&wait_mutex); > + > + return woken; > +} > + > +static void wait_woken_set(struct trace_iterator *iter) > +{ > + mutex_lock(&wait_mutex); > + iter->waking++; > + iter->wait_index++; > + mutex_unlock(&wait_mutex); > +} > + > +static void wait_woken_clear(struct trace_iterator *iter) > +{ > + mutex_lock(&wait_mutex); > + iter->waking--; > + mutex_unlock(&wait_mutex); > +} > +