[patch] dynticks: core, NMI watchdog fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew: find below a fix for a bug that could cause lockups if NO_HZ, 
lockdep and the NMI watchdog are all activated. This patch comes after 
dynticks-core.patch. Compile and boot tested.

	Ingo

----------------->
Subject: dynticks: core, NMI watchdog fix
From: Ingo Molnar <[email protected]>

fix an NMI-watchdog interaction: we dont want to call
hrtimer_update_jiffies() in NMI contexts ...

create __irq_enter() (which is symmetric to __irq_exit())
and use it in nmi_enter() and irq_enter().

[ Note: like __irq_exit() it needs to be a macro because
  hardirq.h is included early on and types like struct
  task_struct are not available yet. ]

Signed-off-by: Ingo Molnar <[email protected]>
--
 include/linux/hardirq.h |   12 +++++++++++-
 kernel/softirq.c        |    5 +----
 2 files changed, 12 insertions(+), 5 deletions(-)

Index: linux/include/linux/hardirq.h
===================================================================
--- linux.orig/include/linux/hardirq.h
+++ linux/include/linux/hardirq.h
@@ -106,6 +106,16 @@ static inline void account_system_vtime(
  * always balanced, so the interrupted value of ->hardirq_context
  * will always be restored.
  */
+#define __irq_enter()					\
+	do {						\
+		account_system_vtime(current);		\
+		add_preempt_count(HARDIRQ_OFFSET);	\
+		trace_hardirq_enter();			\
+	} while (0)
+
+/*
+ * Enter irq context (on NO_HZ, update jiffies):
+ */
 extern void irq_enter(void);
 
 /*
@@ -123,7 +133,7 @@ extern void irq_enter(void);
  */
 extern void irq_exit(void);
 
-#define nmi_enter()		do { lockdep_off(); irq_enter(); } while (0)
+#define nmi_enter()		do { lockdep_off(); __irq_enter(); } while (0)
 #define nmi_exit()		do { __irq_exit(); lockdep_on(); } while (0)
 
 #endif /* LINUX_HARDIRQ_H */
Index: linux/kernel/softirq.c
===================================================================
--- linux.orig/kernel/softirq.c
+++ linux/kernel/softirq.c
@@ -278,10 +278,7 @@ EXPORT_SYMBOL(do_softirq);
  */
 void irq_enter(void)
 {
-	account_system_vtime(current);
-	add_preempt_count(HARDIRQ_OFFSET);
-	trace_hardirq_enter();
-
+	__irq_enter();
 #ifdef CONFIG_NO_HZ
 	if (idle_cpu(smp_processor_id()))
 		hrtimer_update_jiffies();
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux