From: Tom Zanussi <zanussi@kernel.org>
To: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org
Cc: rostedt@goodmis.org, tglx@linutronix.de, C.Emde@osadl.org,
jkacur@redhat.com, bigeasy@linutronix.de,
daniel.wagner@siemens.com, julia@ni.com, amartin@nvidia.com
Subject: [PATCH 04/13] locking/rt-mutex: Flush block plug on __down_read()
Date: Mon, 8 Apr 2019 14:14:06 -0500 [thread overview]
Message-ID: <79f9717af336849789ff62bab08a5c05d78ae1f8.1554737688.git.tom.zanussi@linux.intel.com> (raw)
In-Reply-To: <cover.1554737688.git.tom.zanussi@linux.intel.com>
In-Reply-To: <cover.1554737688.git.tom.zanussi@linux.intel.com>
4.14.109-rt58-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Scott Wood <swood@redhat.com>
[ Upstream commit 0d5d32425a0cab4a282dd79fc953d76a3ab17072 ]
__down_read() bypasses the rtmutex frontend to call
rt_mutex_slowlock_locked() directly, and thus it needs to call
blk_schedule_flush_flug() itself.
Cc: stable-rt@vger.kernel.org
Signed-off-by: Scott Wood <swood@redhat.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Conflicts:
kernel/locking/rwsem-rt.c
---
kernel/locking/rtmutex.c | 2 +-
kernel/locking/rwsem-rt.c | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 2cf515877b8e..1177f2815040 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1946,7 +1946,7 @@ rt_mutex_fastlock(struct rt_mutex *lock, int state,
* If rt_mutex blocks, the function sched_submit_work will not call
* blk_schedule_flush_plug (because tsk_is_pi_blocked would be true).
* We must call blk_schedule_flush_plug here, if we don't call it,
- * a deadlock in device mapper may happen.
+ * a deadlock in I/O may happen.
*/
if (unlikely(blk_needs_flush_plug(current)))
blk_schedule_flush_plug(current);
diff --git a/kernel/locking/rwsem-rt.c b/kernel/locking/rwsem-rt.c
index 26991ddb6c5a..dbdde2476b1c 100644
--- a/kernel/locking/rwsem-rt.c
+++ b/kernel/locking/rwsem-rt.c
@@ -1,5 +1,6 @@
/*
*/
+#include <linux/blkdev.h>
#include <linux/rwsem.h>
#include <linux/sched/debug.h>
#include <linux/sched/signal.h>
@@ -86,6 +87,14 @@ void __sched __down_read(struct rw_semaphore *sem)
if (__down_read_trylock(sem))
return;
+ /*
+ * If rt_mutex blocks, the function sched_submit_work will not call
+ * blk_schedule_flush_plug (because tsk_is_pi_blocked would be true).
+ * We must call blk_schedule_flush_plug here, if we don't call it,
+ * a deadlock in I/O may happen.
+ */
+ if (unlikely(blk_needs_flush_plug(current)))
+ blk_schedule_flush_plug(current);
might_sleep();
raw_spin_lock_irq(&m->wait_lock);
--
2.14.1
next prev parent reply other threads:[~2019-04-08 19:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 19:14 [PATCH 00/13] Linux 4.14.109-rt58-rc1 Tom Zanussi
2019-04-08 19:14 ` [PATCH 01/13] arm64: fpsimd: use preemp_disable in addition to local_bh_disable() Tom Zanussi
2019-04-08 19:14 ` [PATCH 02/13] sched/fair: Robustify CFS-bandwidth timer locking Tom Zanussi
2019-04-08 19:14 ` [PATCH 03/13] sched/fair: Make the hrtimers non-hard again Tom Zanussi
2019-04-08 19:14 ` Tom Zanussi [this message]
2019-04-08 19:14 ` [PATCH 05/13] rtmutex/rwlock: preserve state like a sleeping lock Tom Zanussi
2019-04-08 19:14 ` [PATCH 06/13] softirq: Avoid "local_softirq_pending" messages if ksoftirqd is blocked Tom Zanussi
2019-04-08 19:14 ` [PATCH 07/13] softirq: Avoid "local_softirq_pending" messages if task is in cpu_chill() Tom Zanussi
2019-04-08 19:14 ` [PATCH 08/13] hrtimer: Don't lose state " Tom Zanussi
2019-04-08 19:14 ` [PATCH 09/13] x86: lazy-preempt: properly check against preempt-mask Tom Zanussi
2019-04-08 19:14 ` [PATCH 10/13] hrtimer: cpu_chill(): save task state in ->saved_state() Tom Zanussi
2019-04-08 19:14 ` [PATCH 11/13] tty/sysrq: Convert show_lock to raw_spinlock_t Tom Zanussi
2019-04-08 19:14 ` [PATCH 12/13] powerpc/pseries/iommu: Use a locallock instead local_irq_save() Tom Zanussi
2019-04-08 19:14 ` [PATCH 13/13] Linux 4.14.109-rt58 Tom Zanussi
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=79f9717af336849789ff62bab08a5c05d78ae1f8.1554737688.git.tom.zanussi@linux.intel.com \
--to=zanussi@kernel.org \
--cc=C.Emde@osadl.org \
--cc=amartin@nvidia.com \
--cc=bigeasy@linutronix.de \
--cc=daniel.wagner@siemens.com \
--cc=jkacur@redhat.com \
--cc=julia@ni.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--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;
as well as URLs for NNTP newsgroup(s).