Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Implement ipi_trigger_multi(9); requested by cherry@.
details: https://anonhg.NetBSD.org/src/rev/9777dabe22a9
branches: trunk
changeset: 335652:9777dabe22a9
user: rmind <rmind%NetBSD.org@localhost>
date: Sun Jan 18 23:16:35 2015 +0000
description:
Implement ipi_trigger_multi(9); requested by cherry@.
diffstat:
sys/kern/subr_ipi.c | 34 ++++++++++++++++++++++++++++++++--
sys/sys/ipi.h | 3 ++-
2 files changed, 34 insertions(+), 3 deletions(-)
diffs (79 lines):
diff -r 67533834e7b9 -r 9777dabe22a9 sys/kern/subr_ipi.c
--- a/sys/kern/subr_ipi.c Sun Jan 18 20:18:07 2015 +0000
+++ b/sys/kern/subr_ipi.c Sun Jan 18 23:16:35 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_ipi.c,v 1.2 2014/05/25 15:34:19 rmind Exp $ */
+/* $NetBSD: subr_ipi.c,v 1.3 2015/01/18 23:16:35 rmind Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_ipi.c,v 1.2 2014/05/25 15:34:19 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_ipi.c,v 1.3 2015/01/18 23:16:35 rmind Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -45,6 +45,7 @@
#include <sys/evcnt.h>
#include <sys/cpu.h>
#include <sys/ipi.h>
+#include <sys/intr.h>
#include <sys/kcpuset.h>
#include <sys/kmem.h>
#include <sys/lock.h>
@@ -188,6 +189,35 @@
}
/*
+ * ipi_trigger_multi: same as ipi_trigger() but sends to the multiple
+ * CPUs given the target CPU set.
+ */
+void
+ipi_trigger_multi(u_int ipi_id, const kcpuset_t *target)
+{
+ const cpuid_t selfid = cpu_index(curcpu());
+ CPU_INFO_ITERATOR cii;
+ struct cpu_info *ci;
+
+ KASSERT(kpreempt_disabled());
+ KASSERT(target != NULL);
+
+ for (CPU_INFO_FOREACH(cii, ci)) {
+ const cpuid_t cpuid = cpu_index(ci);
+
+ if (!kcpuset_isset(target, cpuid) || cpuid == selfid) {
+ continue;
+ }
+ ipi_trigger(ipi_id, ci);
+ }
+ if (kcpuset_isset(target, selfid)) {
+ int s = splhigh();
+ ipi_cpu_handler();
+ splx(s);
+ }
+}
+
+/*
* put_msg: insert message into the mailbox.
*/
static inline void
diff -r 67533834e7b9 -r 9777dabe22a9 sys/sys/ipi.h
--- a/sys/sys/ipi.h Sun Jan 18 20:18:07 2015 +0000
+++ b/sys/sys/ipi.h Sun Jan 18 23:16:35 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipi.h,v 1.2 2014/05/25 15:34:19 rmind Exp $ */
+/* $NetBSD: ipi.h,v 1.3 2015/01/18 23:16:35 rmind Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -67,6 +67,7 @@
u_int ipi_register(ipi_func_t, void *);
void ipi_unregister(u_int);
void ipi_trigger(u_int, struct cpu_info *);
+void ipi_trigger_multi(u_int, const kcpuset_t *);
/* Public interface: synchronous IPIs. */
void ipi_unicast(ipi_msg_t *, struct cpu_info *);
Home |
Main Index |
Thread Index |
Old Index