[PATCH 7/8] kernel: add generic softirq interface for triggering a remote softirq

From: Jens Axboe
Date: Thu Feb 07 2008 - 04:23:23 EST


This only works for the block softirq, due to the hackish method of
the arch implementations.

Signed-off-by: Jens Axboe <jens.axboe@xxxxxxxxxx>
---
include/linux/smp.h | 5 +++++
kernel/softirq.c | 7 +++++++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/linux/smp.h b/include/linux/smp.h
index 55232cc..2b546c0 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -61,6 +61,7 @@ int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
* Call a function on all processors
*/
int on_each_cpu(void (*func) (void *info), void *info, int retry, int wait);
+extern void FASTCALL(raise_softirq_on_cpu(int cpu, unsigned int nr));

#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */
#define MSG_ALL 0x8001
@@ -112,6 +113,10 @@ static inline void smp_send_reschedule(int cpu) { }
})
#define smp_call_function_mask(mask, func, info, wait) \
(up_smp_call_function(func, info))
+#define raise_softirq_on_cpu(cpu, nr) do { \
+ WARN_ON(!irqs_disabled()); \
+ raise_softirq_irqoff((nr)); \
+} while (0)

#endif /* !SMP */

diff --git a/kernel/softirq.c b/kernel/softirq.c
index d7837d4..0bad5c3 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -663,4 +663,11 @@ int on_each_cpu(void (*func) (void *info), void *info, int retry, int wait)
return ret;
}
EXPORT_SYMBOL(on_each_cpu);
+
+extern void arch_raise_softirq_on_cpu(int, unsigned int);
+void fastcall raise_softirq_on_cpu(int cpu, unsigned int nr)
+{
+ BUG_ON(nr != BLOCK_SOFTIRQ);
+ arch_raise_softirq_on_cpu(cpu, nr);
+}
#endif
--
1.5.4.22.g7a20

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/