Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Implement high priority (XC_HIGHPRI) xcall(9) mechanism ...
details: https://anonhg.NetBSD.org/src/rev/c2a8a9f8f575
branches: trunk
changeset: 755809:c2a8a9f8f575
user: rmind <rmind%NetBSD.org@localhost>
date: Tue Jun 22 18:29:01 2010 +0000
description:
Implement high priority (XC_HIGHPRI) xcall(9) mechanism - a facility
to execute functions from software interrupt context, at SOFTINT_CLOCK.
Functions must be lightweight. Will be used for passive serialization.
OK ad@.
diffstat:
sys/arch/alpha/alpha/ipifuncs.c | 34 +++-
sys/arch/alpha/include/intr.h | 5 +-
sys/arch/powerpc/pic/ipi.c | 28 ++-
sys/arch/powerpc/pic/ipivar.h | 5 +-
sys/arch/sparc/sparc/cpu.c | 11 +-
sys/arch/sparc64/sparc64/ipifuncs.c | 17 +-
sys/arch/vax/include/cpu.h | 3 +-
sys/arch/vax/vax/multicpu.c | 28 ++-
sys/arch/x86/include/intrdefs.h | 6 +-
sys/arch/x86/x86/ipi.c | 35 +++-
sys/kern/subr_xcall.c | 341 ++++++++++++++++++++++++++---------
sys/sys/xcall.h | 5 +-
12 files changed, 393 insertions(+), 125 deletions(-)
diffs (truncated from 910 to 300 lines):
diff -r df59e6b4bef3 -r c2a8a9f8f575 sys/arch/alpha/alpha/ipifuncs.c
--- a/sys/arch/alpha/alpha/ipifuncs.c Tue Jun 22 18:26:05 2010 +0000
+++ b/sys/arch/alpha/alpha/ipifuncs.c Tue Jun 22 18:29:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipifuncs.c,v 1.41 2009/10/26 03:51:42 thorpej Exp $ */
+/* $NetBSD: ipifuncs.c,v 1.42 2010/06/22 18:29:01 rmind Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.41 2009/10/26 03:51:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.42 2010/06/22 18:29:01 rmind Exp $");
/*
* Interprocessor interrupt handlers.
@@ -64,6 +64,7 @@
void alpha_ipi_synch_fpu(struct cpu_info *, struct trapframe *);
void alpha_ipi_discard_fpu(struct cpu_info *, struct trapframe *);
void alpha_ipi_pause(struct cpu_info *, struct trapframe *);
+void alpha_ipi_xcall(struct cpu_info *, struct trapframe *);
/*
* NOTE: This table must be kept in order with the bit definitions
@@ -78,6 +79,7 @@
alpha_ipi_synch_fpu,
alpha_ipi_discard_fpu,
alpha_ipi_pause,
+ alpha_ipi_xcall
};
const char *ipinames[ALPHA_NIPIS] = {
@@ -89,6 +91,7 @@
"synch fpu ipi",
"discard fpu ipi",
"pause ipi",
+ "xcall ipi"
};
/*
@@ -309,3 +312,30 @@
/* Do an IMB on the way out, in case the kernel text was changed. */
alpha_pal_imb();
}
+
+/*
+ * MD support for xcall(9) interface.
+ */
+
+static void
+alpha_ipi_xcall(struct cpu_info *ci, struct trapframe *framep)
+{
+
+ xc_ipi_handler();
+}
+
+void
+xc_send_ipi(struct cpu_info *ci)
+{
+
+ KASSERT(kpreempt_disabled());
+ KASSERT(curcpu() != ci);
+
+ if (ci) {
+ /* Unicast: remote CPU. */
+ alpha_send_ipi(ci->ci_cpuid, ALPHA_IPI_XCALL);
+ } else {
+ /* Broadcast: all, but local CPU (caller will handle it). */
+ alpha_broadcast_ipi(ALPHA_IPI_XCALL);
+ }
+}
diff -r df59e6b4bef3 -r c2a8a9f8f575 sys/arch/alpha/include/intr.h
--- a/sys/arch/alpha/include/intr.h Tue Jun 22 18:26:05 2010 +0000
+++ b/sys/arch/alpha/include/intr.h Tue Jun 22 18:29:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.67 2009/10/26 03:51:43 thorpej Exp $ */
+/* $NetBSD: intr.h,v 1.68 2010/06/22 18:29:02 rmind Exp $ */
/*-
* Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -165,8 +165,9 @@
#define ALPHA_IPI_SYNCH_FPU (1UL << 5)
#define ALPHA_IPI_DISCARD_FPU (1UL << 6)
#define ALPHA_IPI_PAUSE (1UL << 7)
+#define ALPHA_IPI_XCALL (1UL << 8)
-#define ALPHA_NIPIS 8 /* must not exceed 64 */
+#define ALPHA_NIPIS 9 /* must not exceed 64 */
struct cpu_info;
struct trapframe;
diff -r df59e6b4bef3 -r c2a8a9f8f575 sys/arch/powerpc/pic/ipi.c
--- a/sys/arch/powerpc/pic/ipi.c Tue Jun 22 18:26:05 2010 +0000
+++ b/sys/arch/powerpc/pic/ipi.c Tue Jun 22 18:29:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipi.c,v 1.4 2008/04/28 20:23:32 martin Exp $ */
+/* $NetBSD: ipi.c,v 1.5 2010/06/22 18:29:02 rmind Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipi.c,v 1.4 2008/04/28 20:23:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipi.c,v 1.5 2010/06/22 18:29:02 rmind Exp $");
#include "opt_multiprocessor.h"
#include "opt_pic.h"
@@ -76,6 +76,9 @@
save_vec_cpu();
#endif
+ if (ipi & PPC_IPI_XCALL)
+ xc_ipi_handler();
+
if (ipi & PPC_IPI_HALT) {
aprint_normal("halting CPU %d\n", cpu_id);
msr = (mfmsr() & ~PSL_EE) | PSL_POW;
@@ -84,7 +87,28 @@
mtmsr(msr);
}
}
+
return 1;
}
+/*
+ * MD support for xcall(9) interface.
+ */
+
+void
+xc_send_ipi(struct cpu_info *ci)
+{
+
+ KASSERT(kpreempt_disabled());
+ KASSERT(curcpu() != ci);
+
+ if (ci) {
+ /* Unicast: remote CPU. */
+ ppc_send_ipi(ci->ci_cpuid, PPC_IPI_XCALL);
+ } else {
+ /* Broadcast: all, but local CPU (caller will handle it). */
+ ppc_send_ipi(IPI_T_NOTME, PPC_IPI_XCALL);
+ }
+}
+
#endif /*MULTIPROCESSOR*/
diff -r df59e6b4bef3 -r c2a8a9f8f575 sys/arch/powerpc/pic/ipivar.h
--- a/sys/arch/powerpc/pic/ipivar.h Tue Jun 22 18:26:05 2010 +0000
+++ b/sys/arch/powerpc/pic/ipivar.h Tue Jun 22 18:29:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipivar.h,v 1.3 2008/04/28 20:23:32 martin Exp $ */
+/* $NetBSD: ipivar.h,v 1.4 2010/06/22 18:29:02 rmind Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipivar.h,v 1.3 2008/04/28 20:23:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipivar.h,v 1.4 2010/06/22 18:29:02 rmind Exp $");
#ifndef _IPI_VAR_H_
#define _IPI_VAR_H_
@@ -51,6 +51,7 @@
#define PPC_IPI_HALT 0x0001
#define PPC_IPI_FLUSH_FPU 0x0002
#define PPC_IPI_FLUSH_VEC 0x0004
+#define PPC_IPI_XCALL 0x0008
/* OpenPIC */
void setup_openpic_ipi(void);
diff -r df59e6b4bef3 -r c2a8a9f8f575 sys/arch/sparc/sparc/cpu.c
--- a/sys/arch/sparc/sparc/cpu.c Tue Jun 22 18:26:05 2010 +0000
+++ b/sys/arch/sparc/sparc/cpu.c Tue Jun 22 18:29:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.222 2010/05/31 03:16:47 mrg Exp $ */
+/* $NetBSD: cpu.c,v 1.223 2010/06/22 18:29:02 rmind Exp $ */
/*
* Copyright (c) 1996
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.222 2010/05/31 03:16:47 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.223 2010/06/22 18:29:02 rmind Exp $");
#include "opt_multiprocessor.h"
#include "opt_lockdebug.h"
@@ -63,11 +63,8 @@
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
-#include <sys/simplelock.h>
#include <sys/kernel.h>
-#if 0
#include <sys/xcall.h>
-#endif
#include <uvm/uvm.h>
@@ -640,9 +637,8 @@
mutex_spin_exit(&xpmsg_mutex);
}
-#if 0
/*
- * MI interface to call xc_ipi_handler() everywhere.
+ * MD support for MI xcall(9) interface.
*/
void
xc_send_ipi(struct cpu_info *target)
@@ -658,7 +654,6 @@
cpuset = CPUSET_ALL & ~(1 << cpuinfo.ci_cpuid);
XCALL0(xc_ipi_handler, cpuset);
}
-#endif
/*
* Tell all CPUs other than the current one to enter the PROM idle loop.
diff -r df59e6b4bef3 -r c2a8a9f8f575 sys/arch/sparc64/sparc64/ipifuncs.c
--- a/sys/arch/sparc64/sparc64/ipifuncs.c Tue Jun 22 18:26:05 2010 +0000
+++ b/sys/arch/sparc64/sparc64/ipifuncs.c Tue Jun 22 18:29:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipifuncs.c,v 1.38 2010/05/29 21:59:34 martin Exp $ */
+/* $NetBSD: ipifuncs.c,v 1.39 2010/06/22 18:29:02 rmind Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -27,14 +27,14 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.38 2010/05/29 21:59:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.39 2010/06/22 18:29:02 rmind Exp $");
#include "opt_ddb.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
-#include <sys/simplelock.h>
+#include <sys/xcall.h>
#include <machine/db_machdep.h>
@@ -463,6 +463,10 @@
printf("\n");
}
+/*
+ * MD support for xcall(9) interface.
+ */
+
void
sparc64_generic_xcall(struct cpu_info *target, ipi_c_call_func_t func,
void *arg)
@@ -478,14 +482,9 @@
}
}
-#if 0
-/* XXX: remove once a public prototype is available */
-void xc_ipi_handler(void);
-void xc_send_ipi(struct cpu_info *);
-
void
xc_send_ipi(struct cpu_info *target)
{
+
sparc64_generic_xcall(target, (ipi_c_call_func_t)xc_ipi_handler, NULL);
}
-#endif
diff -r df59e6b4bef3 -r c2a8a9f8f575 sys/arch/vax/include/cpu.h
--- a/sys/arch/vax/include/cpu.h Tue Jun 22 18:26:05 2010 +0000
+++ b/sys/arch/vax/include/cpu.h Tue Jun 22 18:29:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.87 2009/12/12 14:44:09 tsutsui Exp $ */
+/* $NetBSD: cpu.h,v 1.88 2010/06/22 18:29:02 rmind Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
@@ -101,6 +101,7 @@
#define IPI_RUNNING 3 /* This CPU just started to run */
#define IPI_TBIA 4 /* Flush the TLB */
#define IPI_DDB 5 /* Jump into the DDB loop */
+#define IPI_XCALL 6 /* Helper for xcall(9) */
#define IPI_DEST_MASTER -1 /* Destination is mastercpu */
#define IPI_DEST_ALL -2 /* Broadcast */
diff -r df59e6b4bef3 -r c2a8a9f8f575 sys/arch/vax/vax/multicpu.c
--- a/sys/arch/vax/vax/multicpu.c Tue Jun 22 18:26:05 2010 +0000
+++ b/sys/arch/vax/vax/multicpu.c Tue Jun 22 18:29:01 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: multicpu.c,v 1.28 2009/11/26 00:19:23 matt Exp $ */
Home |
Main Index |
Thread Index |
Old Index