Re: [PATCH 04/12] workqueue: Protect lockdep functions with #ifdef

From: Steven Rostedt
Date: Tue Feb 08 2022 - 14:38:19 EST


On Tue, 8 Feb 2022 10:42:00 -0800
Namhyung Kim <namhyung@xxxxxxxxxx> wrote:

> With upcoming lock tracepoints config, it'd define some of lockdep
> functions without enabling CONFIG_LOCKDEP actually. The existing code
> assumes those functions will be removed by the preprocessor but it's
> not the case anymore. Let's protect the code with #ifdef's explicitly.
>
> Cc: Tejun Heo <tj@xxxxxxxxxx>
> Cc: Lai Jiangshan <jiangshanlai@xxxxxxxxx>
> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> ---
> kernel/workqueue.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 33f1106b4f99..405e27385f74 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -2279,8 +2279,11 @@ __acquires(&pool->lock)
>
> raw_spin_unlock_irq(&pool->lock);
>
> +#ifdef CONFIG_LOCKDEP
> lock_map_acquire(&pwq->wq->lockdep_map);
> lock_map_acquire(&lockdep_map);
> +#endif

Same here:

lock_map_acquire_raw() ?

That is always a nop when CONFIG_LOCKDEP is not set.

-- Steve