Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src DTrace: Add support for a simulated solaris_cpu[] data struc...
details: https://anonhg.NetBSD.org/src/rev/1cae04d0440a
branches: trunk
changeset: 752950:1cae04d0440a
user: darran <darran%NetBSD.org@localhost>
date: Fri Mar 12 21:37:37 2010 +0000
description:
DTrace: Add support for a simulated solaris_cpu[] data structure per
cpu. Needed for the FBT provider amongst other features.
diffstat:
external/cddl/osnet/sys/kern/mod.c | 9 +++-
external/cddl/osnet/sys/kern/opensolaris.c | 67 ++++++++++++++++++++++++++++++
external/cddl/osnet/sys/sys/cpuvar.h | 62 +++++++++++++++++++++++++++-
sys/modules/solaris/Makefile | 3 +-
4 files changed, 137 insertions(+), 4 deletions(-)
diffs (211 lines):
diff -r 7efdb016052a -r 1cae04d0440a external/cddl/osnet/sys/kern/mod.c
--- a/external/cddl/osnet/sys/kern/mod.c Fri Mar 12 21:36:52 2010 +0000
+++ b/external/cddl/osnet/sys/kern/mod.c Fri Mar 12 21:37:37 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mod.c,v 1.1 2009/08/07 20:57:57 haad Exp $ */
+/* $NetBSD: mod.c,v 1.2 2010/03/12 21:37:37 darran Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mod.c,v 1.1 2009/08/07 20:57:57 haad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mod.c,v 1.2 2010/03/12 21:37:37 darran Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -35,6 +35,9 @@
#include <sys/kthread.h>
#include <sys/callb.h>
+void opensolaris_init(void *);
+void opensolaris_fini(void *);
+
MODULE(MODULE_CLASS_MISC, solaris, NULL);
static int
@@ -47,9 +50,11 @@
case MODULE_CMD_INIT:
callb_init(NULL);
taskq_init();
+ opensolaris_init(NULL);
break;
case MODULE_CMD_FINI:
+ opensolaris_fini(NULL);
taskq_fini();
callb_fini(NULL);
break;
diff -r 7efdb016052a -r 1cae04d0440a external/cddl/osnet/sys/kern/opensolaris.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/cddl/osnet/sys/kern/opensolaris.c Fri Mar 12 21:37:37 2010 +0000
@@ -0,0 +1,67 @@
+/* $NetBSD: opensolaris.c,v 1.1 2010/03/12 21:37:37 darran Exp $ */
+/*-
+ * Copyright 2007 John Birrell <jb%FreeBSD.org@localhost>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/cddl/compat/opensolaris/kern/opensolaris.c,v 1.4.2.2 2009/08/13 13:56:05 trasz Exp $
+ *
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/conf.h>
+#include <sys/cpuvar.h>
+#include <sys/errno.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/misc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+
+cpu_core_t cpu_core[MAXCPUS];
+solaris_cpu_t solaris_cpu[MAXCPUS];
+
+/*
+ * OpenSolaris subsystem initialisation.
+ */
+void
+opensolaris_init(void *dummy)
+{
+ int i;
+
+ /*
+ * "Enable" all CPUs even though they may not exist just so
+ * that the asserts work. On FreeBSD, if a CPU exists, it is
+ * enabled.
+ */
+ for (i = 0; i < MAXCPUS; i++) {
+ solaris_cpu[i].cpuid = i;
+ solaris_cpu[i].cpu_flags &= CPU_ENABLE;
+ }
+
+}
+
+void
+opensolaris_fini(void *dummy)
+{
+}
diff -r 7efdb016052a -r 1cae04d0440a external/cddl/osnet/sys/sys/cpuvar.h
--- a/external/cddl/osnet/sys/sys/cpuvar.h Fri Mar 12 21:36:52 2010 +0000
+++ b/external/cddl/osnet/sys/sys/cpuvar.h Fri Mar 12 21:37:37 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuvar.h,v 1.5 2010/03/01 11:19:39 darran Exp $ */
+/* $NetBSD: cpuvar.h,v 1.6 2010/03/12 21:37:37 darran Exp $ */
/*
* CDDL HEADER START
@@ -33,6 +33,25 @@
#include <sys/cpuvar_defs.h>
#ifdef _KERNEL
+
+typedef struct {
+ int cpuid;
+ struct cyc_cpu *cpu_cyclic;
+ uint32_t cpu_flags;
+ uint_t cpu_intr_actv;
+ uintptr_t cpu_profile_pc;
+ uintptr_t cpu_profile_upc;
+ uintptr_t cpu_dtrace_caller; /* DTrace: caller, if any */
+ hrtime_t cpu_dtrace_chillmark; /* DTrace: chill mark time */
+ hrtime_t cpu_dtrace_chilled; /* DTrace: total chill time */
+} solaris_cpu_t;
+
+/* Some code may choose to redefine this if pcpu_t would be more useful. */
+#define cpu_t solaris_cpu_t
+#define cpu_id cpuid
+
+extern solaris_cpu_t solaris_cpu[];
+
#define CPU_CACHE_COHERENCE_SIZE 64
/*
@@ -82,6 +101,47 @@
CPU_DTRACE_BADSTACK)
#define CPU_DTRACE_ERROR (CPU_DTRACE_FAULT | CPU_DTRACE_DROP)
+/*
+ * Flags in the CPU structure.
+ *
+ * These are protected by cpu_lock (except during creation).
+ *
+ * Offlined-CPUs have three stages of being offline:
+ *
+ * CPU_ENABLE indicates that the CPU is participating in I/O interrupts
+ * that can be directed at a number of different CPUs. If CPU_ENABLE
+ * is off, the CPU will not be given interrupts that can be sent elsewhere,
+ * but will still get interrupts from devices associated with that CPU only,
+ * and from other CPUs.
+ *
+ * CPU_OFFLINE indicates that the dispatcher should not allow any threads
+ * other than interrupt threads to run on that CPU. A CPU will not have
+ * CPU_OFFLINE set if there are any bound threads (besides interrupts).
+ *
+ * CPU_QUIESCED is set if p_offline was able to completely turn idle the
+ * CPU and it will not have to run interrupt threads. In this case it'll
+ * stay in the idle loop until CPU_QUIESCED is turned off.
+ *
+ * CPU_FROZEN is used only by CPR to mark CPUs that have been successfully
+ * suspended (in the suspend path), or have yet to be resumed (in the resume
+ * case).
+ *
+ * On some platforms CPUs can be individually powered off.
+ * The following flags are set for powered off CPUs: CPU_QUIESCED,
+ * CPU_OFFLINE, and CPU_POWEROFF. The following flags are cleared:
+ * CPU_RUNNING, CPU_READY, CPU_EXISTS, and CPU_ENABLE.
+ */
+#define CPU_RUNNING 0x001 /* CPU running */
+#define CPU_READY 0x002 /* CPU ready for cross-calls */
+#define CPU_QUIESCED 0x004 /* CPU will stay in idle */
+#define CPU_EXISTS 0x008 /* CPU is configured */
+#define CPU_ENABLE 0x010 /* CPU enabled for interrupts */
+#define CPU_OFFLINE 0x020 /* CPU offline via p_online */
+#define CPU_POWEROFF 0x040 /* CPU is powered off */
+#define CPU_FROZEN 0x080 /* CPU is frozen via CPR suspend */
+#define CPU_SPARE 0x100 /* CPU offline available for use */
+#define CPU_FAULTED 0x200 /* CPU offline diagnosed faulty */
+
typedef enum {
CPU_INIT,
CPU_CONFIG,
diff -r 7efdb016052a -r 1cae04d0440a sys/modules/solaris/Makefile
--- a/sys/modules/solaris/Makefile Fri Mar 12 21:36:52 2010 +0000
+++ b/sys/modules/solaris/Makefile Fri Mar 12 21:37:37 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2009/08/10 22:55:08 haad Exp $
+# $NetBSD: Makefile,v 1.4 2010/03/12 21:37:37 darran Exp $
.include "../Makefile.inc"
@@ -64,6 +64,7 @@
SRCS+= printf.c
SRCS+= taskq.c
SRCS+= vfs.c
+SRCS+= opensolaris.c
WARNS= 0
NOGCCERROR= yes
Home |
Main Index |
Thread Index |
Old Index