public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Srivatsa Vaddagiri <vatsa@in.ibm.com>
To: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Myron Stowe <myron.stowe@hp.com>,
	Jens Axboe <axboe@kernel.dk>, Dipankar <dipankar@in.ibm.com>,
	Andrew Morton <akpm@osdl.org>, Gautham shenoy <ego@in.ibm.com>
Subject: Re: workqueue deadlock
Date: Thu, 7 Dec 2006 11:47:01 +0530	[thread overview]
Message-ID: <20061207061701.GA25744@in.ibm.com> (raw)
In-Reply-To: <200612061726.14587.bjorn.helgaas@hp.com>

On Wed, Dec 06, 2006 at 05:26:14PM -0700, Bjorn Helgaas wrote:
> loadkeys is holding the cpu_hotplug lock (acquired in flush_workqueue())
> and waiting in flush_cpu_workqueue() until the cpu_workqueue drains.
> 
> But events/4 is responsible for draining it, and it is blocked waiting
> to acquire the cpu_hotplug lock.
> 
> In current upstream, the cpu_hotplug lock has been replaced with
> workqueue_mutex, but it looks to me like the same deadlock is still
> possible.

Yes I think so too.

> Is there some rule that workqueue functions shouldn't try to
> flush a workqueue?  

In general, workqueue functions wanting to flush workqueue seems wierd
to me. But in this case, I think the requirement is to block until all
queued work is complete, which is what flush_workqueue is supposed to
do. Hence I dont see any way to avoid it ..

> Or should flush_workqueue() be smarter by
> releasing the workqueue_mutex once in a while?

IMHO, rehauling lock_cpu_hotplug() to support scenarios like this is a
better approach. 

	- Make it rw-sem
	- Make it per-cpu mutex, which could be either:

		http://lkml.org/lkml/2006/11/30/110 - Ingo's suggestion
		http://lkml.org/lkml/2006/10/26/65 - Gautham's work based on RCU

In Ingo's suggestion, I really dont know if the task_struct
modifications is a good thing (to support recursive requirements).
Gautham's patches avoid modifications to task_struct, is fast but can
starve writers (who want to bring down/up a CPU).

-- 
Regards,
vatsa

  reply	other threads:[~2006-12-07  6:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-07  0:26 workqueue deadlock Bjorn Helgaas
2006-12-07  6:17 ` Srivatsa Vaddagiri [this message]
2006-12-07  6:45   ` Srivatsa Vaddagiri
2006-12-07 18:51 ` Andrew Morton
2006-12-07 19:37   ` Andrew Morton
2006-12-08  2:53     ` Srivatsa Vaddagiri
2006-12-08  4:54       ` Andrew Morton
2006-12-08  7:58         ` Srivatsa Vaddagiri
2006-12-09 10:26         ` Ingo Molnar
2006-12-09 19:47           ` Andrew Morton
2006-12-10  8:26             ` Ingo Molnar
2006-12-10  8:43               ` Andrew Morton
2006-12-10 11:49                 ` Ingo Molnar
2006-12-10 12:16                   ` Andrew Morton
2006-12-10 12:19                     ` Ingo Molnar
2006-12-10 12:34                       ` Andrew Morton
2006-12-11  6:09                         ` Ingo Molnar
2006-12-10 14:18                     ` Rafael J. Wysocki
2006-12-11  6:52                       ` Dipankar Sarma
2006-12-11 16:34                         ` Rafael J. Wysocki
2006-12-11  5:45                     ` Srivatsa Vaddagiri
2006-12-11  6:03                       ` Andrew Morton
2006-12-11  4:58               ` Srivatsa Vaddagiri

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=20061207061701.GA25744@in.ibm.com \
    --to=vatsa@in.ibm.com \
    --cc=akpm@osdl.org \
    --cc=axboe@kernel.dk \
    --cc=bjorn.helgaas@hp.com \
    --cc=dipankar@in.ibm.com \
    --cc=ego@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=myron.stowe@hp.com \
    /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