Blob Blame History Raw
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Thu, 29 Jan 2015 15:10:08 +0100
Subject: block/mq: don't complete requests via IPI
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
Git-commit: da77ceac3d20f27310a07a7c346a4ee6b40d6c28
Patch-mainline: Queued in subsystem maintainer repository
References: SLE Realtime Extension

The IPI runs in hardirq context and there are sleeping locks. Assume caches are
shared and complete them on the local CPU.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 block/blk-mq.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -647,6 +649,13 @@
 
 static inline bool blk_mq_complete_need_ipi(struct request *rq)
 {
+#ifdef CONFIG_PREEMPT_RT
+	/*
+	 * Avoid SMP function calls for completions because they acquire
+	 * sleeping spinlocks on RT.
+	 */
+	return false;
+#else
 	int cpu = raw_smp_processor_id();
 
 	if (!IS_ENABLED(CONFIG_SMP) ||
@@ -661,6 +670,7 @@
 
 	/* don't try to IPI to an offline CPU */
 	return cpu_online(rq->mq_ctx->cpu);
+#endif
 }
 
 bool blk_mq_complete_request_remote(struct request *rq)