On Mon, 24 Aug 2026 21:30:37 +0000
sashiko-bot@kernel.org wrote:
[Severity: High]
Can holding osn_var->lock while calling kthread_stop() cause a deadlock?
kthread_stop() blocks waiting for the target kthread to exit. However, if
the kthread is currently handling a migration request in
osnoise_migration_pending() (shown slightly earlier in the diff), it will
attempt to acquire this same osn_var->lock before it can clear its state and
exit:
This code has a lot of nastiness in the locking with regard to the thread.
I haven't looked deeply at your patch, but the fact that Sashiko pointed
out a possible deadlock I think you may be hitting the mess I was hitting.
Have you looked at this thread: https://lore.kernel.org/all/20240820130001.124768-1-tglozar@redhat.com/ (local)
It has some tests I ran along with tracing that detected issues. Of course,
everything needs to be run with lockdep enabled too.
-- Steve