Re: [PATCH 2/2 v3] lib: debugobjects: touch watchdog to avoid softlockup when !CONFIG_PREEMPT

From: Thomas Gleixner
Date: Wed Jan 17 2018 - 07:21:56 EST


On Thu, 4 Jan 2018, Yang Shi wrote:

> There are nested loops on debug objects free path, sometimes it may take
> over hundred thousands of loops, then cause soft lockup with !CONFIG_PREEMPT
> occasionally, like below:

Please trim back traces. The whole module info and whatever is completely
irrelevant.

> @@ -768,6 +771,10 @@ static void __debug_check_no_obj_freed(const void *address, unsigned long size)
> debug_objects_maxchain = cnt;
>
> max_loops += cnt;
> +
> + if (max_loops > 10000 && ((max_loops % 10000) == 0)
> + && suppress_lockup != 0)
> + touch_softlockup_watchdog();

This is voodoo programming.

There are two things which can be done here:

1) The collected objects can be put on a global free list and work
scheduled to free them piecewise.

2) We can do a cond_resched() if not in atomic context and interrupts are
enabled.

I rather prefer to make that stuff robust than having crystal ball
constants and magic debugfs knobs.

Thanks,

tglx