From: Daniel Jordan <daniel.m.jordan@oracle.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
Steffen Klassert <steffen.klassert@secunet.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Thomas Gleixner <tglx@linutronix.de>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Daniel Jordan <daniel.m.jordan@oracle.com>
Subject: [PATCH v2 4/5] padata: always acquire cpu_hotplug_lock before pinst->lock
Date: Wed, 28 Aug 2019 18:14:24 -0400 [thread overview]
Message-ID: <20190828221425.22701-5-daniel.m.jordan@oracle.com> (raw)
In-Reply-To: <20190828221425.22701-1-daniel.m.jordan@oracle.com>
lockdep complains when...
# echo 0 > /sys/devices/system/cpu/cpu1/online
# echo ff > /sys/kernel/pcrypt/pencrypt/parallel_cpumask
======================================================
WARNING: possible circular locking dependency detected
5.3.0-rc5-padata-base+ #6 Not tainted
------------------------------------------------------
bash/258 is trying to acquire lock:
00000000c43f7f29 (cpu_hotplug_lock.rw_sem){++++}, at: padata_set_cpumask+0x30/0x130
but task is already holding lock:
00000000676aa31d (&pinst->lock){+.+.}, at: padata_set_cpumask+0x2b/0x130
which lock already depends on the new lock.
padata doesn't take cpu_hotplug_lock and pinst->lock in a consistent
order. Which should be first? CPU hotplug calls into padata with
cpu_hotplug_lock already held, so it should have priority.
Fixes: 6751fb3c0e0c ("padata: Use get_online_cpus/put_online_cpus")
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
kernel/padata.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/padata.c b/kernel/padata.c
index 6adce3b203fe..75e668fedd8d 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -603,8 +603,8 @@ int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
struct cpumask *serial_mask, *parallel_mask;
int err = -EINVAL;
- mutex_lock(&pinst->lock);
get_online_cpus();
+ mutex_lock(&pinst->lock);
switch (cpumask_type) {
case PADATA_CPU_PARALLEL:
@@ -622,8 +622,8 @@ int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
err = __padata_set_cpumasks(pinst, parallel_mask, serial_mask);
out:
- put_online_cpus();
mutex_unlock(&pinst->lock);
+ put_online_cpus();
return err;
}
--
2.23.0
next prev parent reply other threads:[~2019-08-29 0:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-28 22:14 [PATCH v2 0/5] padata flushing and CPU hotplug fixes Daniel Jordan
2019-08-28 22:14 ` [PATCH v2 1/5] padata: make flushing work with async users Daniel Jordan
2019-09-05 4:17 ` Herbert Xu
2019-09-05 22:37 ` Daniel Jordan
2019-09-18 20:37 ` Daniel Jordan
2019-08-28 22:14 ` [PATCH v2 2/5] padata: remove reorder_objects Daniel Jordan
2019-08-28 22:14 ` [PATCH v2 3/5] padata: get rid of padata_remove_cpu() for real Daniel Jordan
2019-08-28 22:14 ` Daniel Jordan [this message]
2019-08-28 22:14 ` [PATCH v2 5/5] padata: validate cpumask without removed CPU during offline Daniel Jordan
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=20190828221425.22701-5-daniel.m.jordan@oracle.com \
--to=daniel.m.jordan@oracle.com \
--cc=bigeasy@linutronix.de \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=tglx@linutronix.de \
/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®