Re: [PATCH] softirq: Be more verbose on t->state BUG()

From: Eugeniu Rosca
Date: Tue Mar 16 2021 - 11:11:36 EST


Hello Thomas,

On Tue, Mar 16, 2021 at 03:31:50PM +0100, Thomas Gleixner wrote:
> On Mon, Mar 15 2021 at 16:44, Eugeniu Rosca wrote:
> > From: Dirk Behme <dirk.behme@xxxxxxxxxxxx>
> >
> > In case this BUG() is hit, it helps debugging a lot to get an idea
> > what tasklet is the root cause. So, be slightly more verbose here.
> >
> > Signed-off-by: Dirk Behme <dirk.behme@xxxxxxxxxxxx>
> > Signed-off-by: Eugeniu Rosca <erosca@xxxxxxxxxxxxxx>
> > ---
> > kernel/softirq.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/softirq.c b/kernel/softirq.c
> > index 9908ec4a9bfe..a6b602ad48d6 100644
> > --- a/kernel/softirq.c
> > +++ b/kernel/softirq.c
> > @@ -550,9 +550,13 @@ static void tasklet_action_common(struct softirq_action *a,
> >
> > if (tasklet_trylock(t)) {
> > if (!atomic_read(&t->count)) {
> > - if (!test_and_clear_bit(TASKLET_STATE_SCHED,
> > - &t->state))
> > + if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state)) {
> > + if (t->use_callback)
> > + pr_emerg("tasklet failed, cb: %pS\n", t->callback);
> > + else
> > + pr_emerg("tasklet failed, func: %pS\n", t->func);
> > BUG();
> > + }
> > if (t->use_callback)
> > t->callback(t);
> > else
>
> This belongs into unreadable land and actually the BUG() should just be
> replaced by a WARN_ONCE(). Something like the below. Hmm?

Many thanks for the quick and constructive reply.

If no other comments in the next days, I will resubmit your proposal as
v2, marked with 'Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>'.

Alternatively, feel free to author the patch and submit it with us in Cc.

Thanks again.

--
Best regards,
Eugeniu Rosca