From: Steven Rostedt <rostedt@goodmis.org>
To: Ran Xiaokai <ranxiaokai627@163.com>
Cc: mhiramat@kernel.org, mathieu.desnoyers@efficios.com,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
ran.xiaokai@zte.com.cn, yang.guang5@zte.com.cn,
Wang Yong <wang.yong12@zte.com.cn>
Subject: Re: [PATCH] tracing/osnoise: Fix possible recursive locking for cpus_read_lock()
Date: Tue, 25 Feb 2025 11:30:32 -0500 [thread overview]
Message-ID: <20250225113032.5e01922d@gandalf.local.home> (raw)
In-Reply-To: <20250225123132.2583820-1-ranxiaokai627@163.com>
On Tue, 25 Feb 2025 12:31:32 +0000
Ran Xiaokai <ranxiaokai627@163.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);
next prev parent reply other threads:[~2025-02-25 16:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 12:31 [PATCH] tracing/osnoise: Fix possible recursive locking for cpus_read_lock() Ran Xiaokai
2025-02-25 16:30 ` Steven Rostedt [this message]
2025-02-26 3:42 ` Ran Xiaokai
2025-02-26 15:05 ` Steven Rostedt
2025-03-17 12:28 ` Ran Xiaokai
2025-02-27 7:40 ` Vishal Chourasia
2025-03-17 12:52 ` Ran Xiaokai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250225113032.5e01922d@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=ran.xiaokai@zte.com.cn \
--cc=ranxiaokai627@163.com \
--cc=wang.yong12@zte.com.cn \
--cc=yang.guang5@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox