From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Thu, 19 May 2016 17:12:34 +0200
Subject: [PATCH] kernel/rtmutex: only warn once on a try lock from bad
 context
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.2-rt5.tar.xz

One warning should be enough to get one motivated to fix this. It is
possible that this happens more than once and so starts flooding the
output. Later the prints will be suppressed so we only get half of it.
Depending on the console system used it might not be helpfull.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/locking/rtmutex.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1479,7 +1479,7 @@ EXPORT_SYMBOL_GPL(rt_mutex_timed_lock);
 int __sched rt_mutex_trylock(struct rt_mutex *lock)
 {
 #ifdef CONFIG_PREEMPT_RT_FULL
-	if (WARN_ON(in_irq() || in_nmi()))
+	if (WARN_ON_ONCE(in_irq() || in_nmi()))
 #else
 	if (WARN_ON(in_irq() || in_nmi() || in_serving_softirq()))
 #endif
