From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Gautham R Shenoy <ego@in.ibm.com>,
Max Krasnyansky <maxk@qualcomm.com>, Paul Jackson <pj@sgi.com>,
Paul Menage <menage@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Vegard Nossum <vegard.nossum@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] workqueues: make get_online_cpus() useable for work->func()
Date: Mon, 30 Jun 2008 15:43:49 +0200 [thread overview]
Message-ID: <20080630134349.GB7686@osiris.boeblingen.de.ibm.com> (raw)
In-Reply-To: <20080629165131.GA11215@tv-sign.ru>
On Sun, Jun 29, 2008 at 08:51:31PM +0400, Oleg Nesterov wrote:
> workqueue_cpu_callback(CPU_DEAD) flushes cwq->thread under
> cpu_maps_update_begin(). This means that the multithreaded workqueues can't
> use get_online_cpus() due to the possible deadlock, very bad and very old
> problem.
>
> Introduce the new state, CPU_POST_DEAD, which is called after
> cpu_hotplug_done() but before cpu_maps_update_done().
>
> Change workqueue_cpu_callback() to use CPU_POST_DEAD instead of CPU_DEAD.
> This means that create/destroy functions can't rely on get_online_cpus()
> any longer and should take cpu_add_remove_lock instead.
Ah, nice!
> --- 26-rc2/kernel/cpu.c~WQ_4_GET_ONLINE_CPUS 2008-05-18 15:44:18.000000000 +0400
> +++ 26-rc2/kernel/cpu.c 2008-06-29 20:03:19.000000000 +0400
> @@ -261,6 +261,11 @@ out_allowed:
> set_cpus_allowed_ptr(current, &old_allowed);
> out_release:
> cpu_hotplug_done();
> + if (!err) {
This should be (!err && !cpu_online(cpu)), no?
This is because it might be that __stop_machine_run() succeeded, but
take_cpu_down() failed and therefore our cpu is still online.
Which in turn is not good when doing this:
> + if (raw_notifier_call_chain(&cpu_chain, CPU_POST_DEAD | mod,
> + hcpu) == NOTIFY_BAD)
> + BUG();
> + }
next prev parent reply other threads:[~2008-06-30 13:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-29 16:51 Oleg Nesterov
2008-06-30 13:43 ` Heiko Carstens [this message]
2008-06-30 22:14 ` Heiko Carstens
2008-07-01 5:21 ` Gautham R Shenoy
2008-07-02 8:31 ` Andrew Morton
2008-07-02 16:40 ` Oleg Nesterov
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=20080630134349.GB7686@osiris.boeblingen.de.ibm.com \
--to=heiko.carstens@de.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=ego@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maxk@qualcomm.com \
--cc=menage@google.com \
--cc=oleg@tv-sign.ru \
--cc=peterz@infradead.org \
--cc=pj@sgi.com \
--cc=vegard.nossum@gmail.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
all inboxes | Powered by JetHome®