From: Tejun Heo <tj@kernel.org>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: linux-kernel@vger.kernel.org, dm-devel@redhat.com,
Andrew Morton <akpm@linux-foundation.org>,
Lisa Du <chunlingdu1@gmail.com>,
Mandeep Singh Baines <msb@chromium.org>
Subject: Re: work item migration bug when a CPU is disabled
Date: Wed, 19 Feb 2014 19:29:58 -0500 [thread overview]
Message-ID: <20140220002958.GX10134@htj.dyndns.org> (raw)
In-Reply-To: <alpine.LRH.2.02.1402182040100.28214@file01.intranet.prod.int.rdu2.redhat.com>
Hello, Mikulas.
On Tue, Feb 18, 2014 at 08:57:11PM -0500, Mikulas Patocka wrote:
> Hi Tejun
>
> Two years ago, I reported a bug in workqueues - a work item that is
> supposed to be bound to a specific CPU can be migrated to a different CPU
> when the origianl CPU is disabled by writing zero to
> /sys/devices/system/cpu/cpu*/online
>
> This causes crashes in dm-crypt, because it assumes that a work item stays
> on the same CPU.
For better or worse, per-cpu workqueues have never guaranteed that
cpus won't go down while a work item is executing. If a workqueue
user needs such guarantee, it's required to use one of the CPU down
hooks to cancel and flush such work items. This is partly because
workqueue itself doesn't distinguish work items which need to be bound
for correctness and just use affinity as optimization. The
distinction is made by the user.
It has certain benefits as it makes clear in the code local to the
specific user that it's incurring latency in CPU down operations which
happen to be fairly hot in certain configurations. Besides, it's not
really clear what behavior workqueue can enforce - should it try to
drain as in wq shutdown sequence, or should it trigger WARN if work
items are requeueing, or should it just leave them hanging until CPU
comes back again? If we do the last, what about the ones which are
using percpu workqeueus as optimization?
So, if dm-crypt is depending on affinity and not taking care of it via
cpu hotplug hooks, it's something which should be fixed from dm-crypt
side.
Thanks.
--
tejun
prev parent reply other threads:[~2014-02-20 0:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 1:57 Mikulas Patocka
2014-02-20 0:29 ` Tejun Heo [this message]
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=20140220002958.GX10134@htj.dyndns.org \
--to=tj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=chunlingdu1@gmail.com \
--cc=dm-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=msb@chromium.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
all inboxes | Powered by JetHome®