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

Steven Rostedt
2022-02-08T19:38:20Z

On Tue, 8 Feb 2022 10:42:00 -0800
Namhyung Kim <namhyung@kernel.org> 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@kernel.org>
> Cc: Lai Jiangshan <jiangshanlai@gmail.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> 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