[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250225113032.5e01922d@gandalf.local.home>
Date: Tue, 25 Feb 2025 11:30:32 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Ran Xiaokai <ranxiaokai627@....com>
Cc: mhiramat@...nel.org, mathieu.desnoyers@...icios.com,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
ran.xiaokai@....com.cn, yang.guang5@....com.cn, Wang Yong
<wang.yong12@....com.cn>
Subject: Re: [PATCH] tracing/osnoise: Fix possible recursive locking for
cpus_read_lock()
On Tue, 25 Feb 2025 12:31:32 +0000
Ran Xiaokai <ranxiaokai627@....com> wrote:
> @@ -2097,7 +2096,7 @@ static void osnoise_hotplug_workfn(struct
> work_struct *dummy)
> return;
>
> guard(mutex)(&interface_lock);
> - guard(cpus_read_lock)();
> + cpus_read_lock();
>
> if (!cpu_online(cpu))
> return;
This is buggy. You removed the guard, and right below we have an error exit
that will leave this function without unlocking the cpus_read_lock().
> @@ -2105,7 +2104,12 @@ static void osnoise_hotplug_workfn(struct
> work_struct *dummy)
> if (!cpumask_test_cpu(cpu, &osnoise_cpumask))
> return;
>
> - start_kthread(cpu);
> + if (start_kthread(cpu)) {
> + cpus_read_unlock();
> + stop_per_cpu_kthreads();
> + return;
If all you want to do is to unlock before calling stop_per_cpu_kthreads(),
then this should simply be:
if (start_kthread(cpu)) {
cpus_read_unlock();
stop_per_cpu_kthreads();
cpus_read_lock(); // The guard() above will unlock this
return;
}
But I still have to verify that this is indeed the issue here.
-- Steve
> + }
> + cpus_read_unlock();
> }
>
> static DECLARE_WORK(osnoise_hotplug_work, osnoise_hotplug_workfn);
Powered by blists - more mailing lists