linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Suren Baghdasaryan <surenb@google.com>
Cc: mingo@redhat.com, hannes@cmpxchg.org, will@kernel.org,
	akpm@linux-foundation.org, tglx@linutronix.de,
	ben.dooks@codethink.co.uk, cl@rock-chips.com, ke.wang@unisoc.com,
	shakeelb@google.com, linux-kernel@vger.kernel.org,
	kernel-team@android.com
Subject: Re: [PATCH 1/1] kthread: break dependency between worker->lock and task_struct->pi_lock
Date: Tue, 28 Apr 2020 18:31:25 +0200	[thread overview]
Message-ID: <20200428163125.GC16910@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20200427184358.191624-1-surenb@google.com>

On Mon, Apr 27, 2020 at 11:43:58AM -0700, Suren Baghdasaryan wrote:
> A number of kthread-related functions indirectly take task_struct->pi_lock
> while holding worker->lock in the call chain like this:
>     spin_lock(&worker->lock)
>     kthread_insert_work
>     wake_up_process
>     try_to_wake_up
>     raw_spin_lock_irqsave(&p->pi_lock, flags)
> 
> This lock dependency exists whenever kthread_insert_work is called either
> directly or indirectly via __kthread_queue_delayed_work in the following
> functions:
>     kthread_queue_work
>     kthread_delayed_work_timer_fn
>     kthread_queue_delayed_work
>     kthread_flush_work
>     kthread_mod_delayed_work
> 
> This creates possibilities for circular dependencies like the one reported
> at: https://lkml.org/lkml/2020/4/24/954

Please, do not use lkml.org links.

Also, ideally, we'd pull that kthread_queue_delayed_work() out from
under rq->lock.

In fact, looking at it, WTH is the delayed branch of
kthread_queue_delayed_work() under that lock? That whole
delayed_work_list thing smells like bong-hits.

  reply	other threads:[~2020-04-28 16:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27 18:43 [PATCH 1/1] kthread: break dependency between worker->lock and task_struct->pi_lock Suren Baghdasaryan
2020-04-28 16:31 ` Peter Zijlstra [this message]
2020-04-28 18:04   ` Suren Baghdasaryan
2020-04-30 17:57     ` Suren Baghdasaryan

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=20200428163125.GC16910@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=ben.dooks@codethink.co.uk \
    --cc=cl@rock-chips.com \
    --cc=hannes@cmpxchg.org \
    --cc=ke.wang@unisoc.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=shakeelb@google.com \
    --cc=surenb@google.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).