lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 12 Feb 2009 09:19:23 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Frederic Weisbecker <fweisbec@...il.com>
Cc:	Thomas Gleixner <tglx@...x.de>,
	LKML <linux-kernel@...r.kernel.org>,
	rt-users <linux-rt-users@...r.kernel.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Carsten Emde <ce@...g.ch>, Clark Williams <williams@...hat.com>
Subject: [patch] rt: fix ipi kfree(), introduce IPI_SOFTIRQ


* Ingo Molnar <mingo@...e.hu> wrote:

> hm, that's a complex one - we do kfree() from IPI context, [...]

The patch below might do the trick - it offloads this to a softirq.
Not tested yet.

	Ingo

------------------>
Subject: rt: fix ipi kfree(), introduce IPI_SOFTIRQ
From: Ingo Molnar <mingo@...e.hu>
Date: Thu Feb 12 09:06:11 CET 2009

in 2.6.28 generic_smp_call_function_interrupt() grew a kfree(),
which is a rather complex, sleepable method under -rt. But the
IPI code runs as a hardirq - which cannot run such code.

So defer this work to a softirq context instead. It still stays
on the same CPU so the percpu IPI assumptions are upheld.

Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
 include/linux/interrupt.h |    1 +
 include/linux/smp.h       |    3 +++
 init/main.c               |    1 +
 kernel/smp.c              |   15 +++++++++++++--
 4 files changed, 18 insertions(+), 2 deletions(-)

Index: tip/include/linux/interrupt.h
===================================================================
--- tip.orig/include/linux/interrupt.h
+++ tip/include/linux/interrupt.h
@@ -257,6 +257,7 @@ enum
 	SCHED_SOFTIRQ,
 	HRTIMER_SOFTIRQ,
 	RCU_SOFTIRQ,	/* Preferable RCU should always be the last softirq */
+	IPI_SOFTIRQ,
 	/* Entries after this are ignored in split softirq mode */
 	MAX_SOFTIRQ,
 
Index: tip/include/linux/smp.h
===================================================================
--- tip.orig/include/linux/smp.h
+++ tip/include/linux/smp.h
@@ -104,6 +104,9 @@ void ipi_call_lock(void);
 void ipi_call_unlock(void);
 void ipi_call_lock_irq(void);
 void ipi_call_unlock_irq(void);
+void ipi_init(void);
+#else
+static inline void ipi_init(void) { }
 #endif
 
 /*
Index: tip/init/main.c
===================================================================
--- tip.orig/init/main.c
+++ tip/init/main.c
@@ -606,6 +606,7 @@ asmlinkage void __init start_kernel(void
 	/* init some links before init_ISA_irqs() */
 	early_irq_init();
 	init_IRQ();
+	ipi_init();
 	pidhash_init();
 	init_timers();
 	hrtimers_init();
Index: tip/kernel/smp.c
===================================================================
--- tip.orig/kernel/smp.c
+++ tip/kernel/smp.c
@@ -4,12 +4,13 @@
  * (C) Jens Axboe <jens.axboe@...cle.com> 2008
  *
  */
+#include <linux/smp.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/percpu.h>
-#include <linux/rcupdate.h>
 #include <linux/rculist.h>
-#include <linux/smp.h>
+#include <linux/rcupdate.h>
+#include <linux/interrupt.h>
 
 static DEFINE_PER_CPU(struct call_single_queue, call_single_queue);
 static LIST_HEAD(call_function_queue);
@@ -152,6 +153,11 @@ void generic_smp_call_function_interrupt
  */
 void generic_smp_call_function_single_interrupt(void)
 {
+	raise_softirq_irqoff(IPI_SOFTIRQ);
+}
+
+static void run_generic_smp_call_function_single(struct softirq_action *h)
+{
 	struct call_single_queue *q = &__get_cpu_var(call_single_queue);
 	LIST_HEAD(list);
 
@@ -430,3 +436,8 @@ void ipi_call_unlock_irq(void)
 {
 	spin_unlock_irq(&call_function_lock);
 }
+
+void __init ipi_init(void)
+{
+	open_softirq(IPI_SOFTIRQ, run_generic_smp_call_function_single);
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ