linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lai Jiangshan <jiangshanlai@gmail.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Lai Jiangshan <laijs@linux.alibaba.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH 1/2] workqueue: pin the pool while it is managing
Date: Thu, 28 May 2020 16:35:56 +0800	[thread overview]
Message-ID: <CAJhGHyCa=GTb5rXsfO1DrJ8aT4WMrh6r8t9m-PCwDkHapfQG7w@mail.gmail.com> (raw)
In-Reply-To: <20200528080844.37wgxcy77uu7pmmz@linutronix.de>

On Thu, May 28, 2020 at 4:08 PM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> On 2020-05-28 03:06:55 [+0000], Lai Jiangshan wrote:
> > So that put_unbound_pool() can ensure all workers in idle,
> > no unfinished manager. And it doens't need to wait any manager
> > and can go to delete all the idle workers straight away.
> >
> > Also removes manager waitqueue, because it is unneeded and as
> > Sebastian Andrzej Siewior said:
> >
> >   The workqueue code has it's internal spinlock (pool::lock) and also
> >   implicit spinlock usage in the wq_manager waitqueue. These spinlocks
> >   are converted to 'sleeping' spinlocks on a RT-kernel.
> >
> >   Workqueue functions can be invoked from contexts which are truly atomic
> >   even on a PREEMPT_RT enabled kernel. Taking sleeping locks from such
> >   contexts is forbidden.
> >
> >   pool::lock can be converted to a raw spinlock as the lock held times
> >   are short. But the workqueue manager waitqueue is handled inside of
> >   pool::lock held regions which again violates the lock nesting rules
> >   of raw and regular spinlocks.
>
> This seems to work for my test case I had test my chance. And lockdep
> didn't complain so…
>
> If you prefer this over my 1/2 what do we do about 2/2? Do you want me
> to repost it?

I think we can just wait until Tejun reviews them.

If there is something wrong that I missed in my patch, your patches
are the best choice.

If I need to update my patch, I will repost the 3 patches
(2 of mine, the 2/2 of yours). At least I forgot to add
"Reported-by Sebastian Andrzej Siewior <bigeasy@linutronix.de>"
in the patch.

If Tejun queues my patches right away, you can rebase the 2/2
of yours and repost it.

Lai

>
> Sebastian

  reply	other threads:[~2020-05-28  8:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 19:46 [PATCH v2 0/2] workqueue: Make the workqueue code PREEMPT_RT safe Sebastian Andrzej Siewior
2020-05-27 19:46 ` [PATCH v2 1/2] workqueue: Use rcuwait for wq_manager_wait Sebastian Andrzej Siewior
2020-05-28  3:06   ` [PATCH 1/2] workqueue: pin the pool while it is managing Lai Jiangshan
2020-05-28  3:06     ` [PATCH 2/2] workqueue: remove useless POOL_MANAGER_ACTIVE Lai Jiangshan
2020-05-28  8:08     ` [PATCH 1/2] workqueue: pin the pool while it is managing Sebastian Andrzej Siewior
2020-05-28  8:35       ` Lai Jiangshan [this message]
2020-05-28 14:35     ` Tejun Heo
2020-05-29  5:33       ` Lai Jiangshan
2020-05-27 19:46 ` [PATCH v2 2/2] workqueue: Convert the pool::lock and wq_mayday_lock to raw_spinlock_t Sebastian Andrzej Siewior
2020-05-28  0:33   ` Lai Jiangshan
2020-05-29 14:04   ` Tejun Heo
2020-05-27 22:57 ` [PATCH v2 0/2] workqueue: Make the workqueue code PREEMPT_RT safe Linus Torvalds

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='CAJhGHyCa=GTb5rXsfO1DrJ8aT4WMrh6r8t9m-PCwDkHapfQG7w@mail.gmail.com' \
    --to=jiangshanlai@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=laijs@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.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).