summaryrefslogtreecommitdiff
path: root/usr/src/uts
diff options
context:
space:
mode:
authoresaxe <none@none>2008-01-18 15:00:55 -0800
committeresaxe <none@none>2008-01-18 15:00:55 -0800
commitc210ded489f4b4bd3e26ba118f5603c41a5c8c02 (patch)
tree83af1b195cf03c6cd3b3e466dea7a232ddc45301 /usr/src/uts
parentfdb7141f0274bca1975db87dfb070b4e3c89b6f5 (diff)
downloadillumos-gate-c210ded489f4b4bd3e26ba118f5603c41a5c8c02.tar.gz
6635705 static DTrace probe points for CPU power management state transitions
6643464 need static DTrace probe for cyclic tracing, firing events
Diffstat (limited to 'usr/src/uts')
-rw-r--r--usr/src/uts/common/io/cpudrv.c9
-rw-r--r--usr/src/uts/common/os/cyclic.c20
-rw-r--r--usr/src/uts/i86pc/os/mp_machdep.c7
-rw-r--r--usr/src/uts/i86pc/os/mp_pc.c7
-rw-r--r--usr/src/uts/intel/sys/cpu.h14
-rw-r--r--usr/src/uts/sun4u/os/mach_startup.c22
-rw-r--r--usr/src/uts/sun4v/os/mach_startup.c18
7 files changed, 87 insertions, 10 deletions
diff --git a/usr/src/uts/common/io/cpudrv.c b/usr/src/uts/common/io/cpudrv.c
index e0095d40e9..3edf61efd8 100644
--- a/usr/src/uts/common/io/cpudrv.c
+++ b/usr/src/uts/common/io/cpudrv.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -44,6 +44,7 @@
#include <sys/systm.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
+#include <sys/sdt.h>
#include <sys/machsystm.h>
#include <sys/x_call.h>
@@ -534,6 +535,12 @@ cpudrv_power(dev_info_t *dip, int comp, int level)
}
/*
+ * DTrace probe point for CPU speed change transition
+ */
+ DTRACE_PROBE3(cpu__change__speed, cpudrv_devstate_t *, cpudsp,
+ cpudrv_pm_t *, cpupm, cpudrv_pm_spd_t *, new_spd);
+
+ /*
* Reset idle threshold time for the new power level.
*/
if ((cpupm->cur_spd != NULL) && (level < cpupm->cur_spd->pm_level)) {
diff --git a/usr/src/uts/common/os/cyclic.c b/usr/src/uts/common/os/cyclic.c
index 54b906c3a3..61ac9ac5b8 100644
--- a/usr/src/uts/common/os/cyclic.c
+++ b/usr/src/uts/common/os/cyclic.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -559,6 +558,7 @@
#include <sys/kmem.h>
#include <sys/cmn_err.h>
#include <sys/ddi.h>
+#include <sys/sdt.h>
#ifdef CYCLIC_TRACE
@@ -802,7 +802,11 @@ cyclic_expire(cyc_cpu_t *cpu, cyc_index_t ndx, cyclic_t *cyclic)
void *arg = cyclic->cy_arg;
CYC_TRACE(cpu, CY_HIGH_LEVEL, "handler-in", handler, arg);
+ DTRACE_PROBE1(cyclic__start, cyclic_t *, cyclic);
+
(*handler)(arg);
+
+ DTRACE_PROBE1(cyclic__end, cyclic_t *, cyclic);
CYC_TRACE(cpu, CY_HIGH_LEVEL, "handler-out", handler, arg);
return;
@@ -970,7 +974,11 @@ cyclic_remove_pend(cyc_cpu_t *cpu, cyc_level_t level, cyclic_t *cyclic)
*/
for (i = 0; i < rpend; i++) {
CYC_TRACE(cpu, level, "rpend-in", handler, arg);
+ DTRACE_PROBE1(cyclic__start, cyclic_t *, cyclic);
+
(*handler)(arg);
+
+ DTRACE_PROBE1(cyclic__end, cyclic_t *, cyclic);
CYC_TRACE(cpu, level, "rpend-out", handler, arg);
}
@@ -1087,7 +1095,11 @@ top:
*/
do {
CYC_TRACE(cpu, level, "handler-in", handler, arg);
+ DTRACE_PROBE1(cyclic__start, cyclic_t *, cyclic);
+
(*handler)(arg);
+
+ DTRACE_PROBE1(cyclic__end, cyclic_t *, cyclic);
CYC_TRACE(cpu, level, "handler-out", handler, arg);
reread:
pend = cyclic->cy_pend;
diff --git a/usr/src/uts/i86pc/os/mp_machdep.c b/usr/src/uts/i86pc/os/mp_machdep.c
index 93332f1382..9c8d746858 100644
--- a/usr/src/uts/i86pc/os/mp_machdep.c
+++ b/usr/src/uts/i86pc/os/mp_machdep.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -53,6 +53,7 @@
#include <sys/mach_intr.h>
#include <vm/hat_i86.h>
#include <sys/kdi_machimpl.h>
+#include <sys/sdt.h>
#define OFFSETOF(s, m) (size_t)(&(((s *)0)->m))
@@ -567,9 +568,13 @@ cpu_idle_mwait(void)
*/
i86_monitor(mcpu_mwait, 0, 0);
if (*mcpu_mwait == MWAIT_HALTED) {
+ DTRACE_PROBE1(idle__state__transition, uint_t, IDLE_STATE_C1);
+
tlb_going_idle();
i86_mwait(0, 0);
tlb_service();
+
+ DTRACE_PROBE1(idle__state__transition, uint_t, IDLE_STATE_C0);
}
/*
diff --git a/usr/src/uts/i86pc/os/mp_pc.c b/usr/src/uts/i86pc/os/mp_pc.c
index 2fc0ca3efc..2e1be6f5c3 100644
--- a/usr/src/uts/i86pc/os/mp_pc.c
+++ b/usr/src/uts/i86pc/os/mp_pc.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -43,6 +43,7 @@
#include <sys/mach_mmu.h>
#include <sys/promif.h>
#include <sys/cpu.h>
+#include <sys/sdt.h>
#include <vm/hat_i86.h>
extern void real_mode_start(void);
@@ -257,9 +258,13 @@ mach_cpu_halt(char *msg)
void
mach_cpu_idle(void)
{
+ DTRACE_PROBE1(idle__state__transition, uint_t, IDLE_STATE_C1);
+
tlb_going_idle();
i86_halt();
tlb_service();
+
+ DTRACE_PROBE1(idle__state__transition, uint_t, IDLE_STATE_C0);
}
void
diff --git a/usr/src/uts/intel/sys/cpu.h b/usr/src/uts/intel/sys/cpu.h
index 9a4217d1ee..26fc7bd21b 100644
--- a/usr/src/uts/intel/sys/cpu.h
+++ b/usr/src/uts/intel/sys/cpu.h
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -79,6 +79,18 @@ extern int xpv_panicking;
#define SMT_PAUSE() ht_pause()
#endif
+/*
+ *
+ * C-state defines for the idle_state_transition DTrace probe
+ *
+ * The probe fires when the CPU undergoes an idle state change (e.g. C-state)
+ * The agument passed is the C-state to which the CPU is transitioning.
+ *
+ * The states are defined here.
+ */
+#define IDLE_STATE_C0 0
+#define IDLE_STATE_C1 1
+
#endif /* _KERNEL */
#ifdef __cplusplus
diff --git a/usr/src/uts/sun4u/os/mach_startup.c b/usr/src/uts/sun4u/os/mach_startup.c
index d2605b75c5..aea900d5e3 100644
--- a/usr/src/uts/sun4u/os/mach_startup.c
+++ b/usr/src/uts/sun4u/os/mach_startup.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -86,6 +86,17 @@ int64_t fpras_interval = -1;
#pragma weak cpu_halt_cpu
extern void cpu_halt_cpu();
+/*
+ * Defines for the idle_state_transition DTrace probe
+ *
+ * The probe fires when the CPU undergoes an idle state change (e.g. halting)
+ * The agument passed is the state to which the CPU is transitioning.
+ *
+ * The states are defined here.
+ */
+#define IDLE_STATE_NORMAL 0
+#define IDLE_STATE_HALTED 1
+
int enable_halt_idle_cpus = 1; /* global switch */
void
@@ -300,9 +311,16 @@ cpu_halt(void)
/*
* Halt the strand.
*/
- if (&cpu_halt_cpu)
+ if (&cpu_halt_cpu) {
+ DTRACE_PROBE1(idle__state__transition,
+ uint_t, IDLE_STATE_HALTED);
+
cpu_halt_cpu();
+ DTRACE_PROBE1(idle__state__transition,
+ uint_t, IDLE_STATE_NORMAL);
+ }
+
/*
* We're no longer halted
*/
diff --git a/usr/src/uts/sun4v/os/mach_startup.c b/usr/src/uts/sun4v/os/mach_startup.c
index 7446aff433..a1cd660904 100644
--- a/usr/src/uts/sun4v/os/mach_startup.c
+++ b/usr/src/uts/sun4v/os/mach_startup.c
@@ -42,6 +42,7 @@
#include <sys/cpu_module.h>
#include <sys/mutex_impl.h>
#include <vm/vm_dep.h>
+#include <sys/sdt.h>
#ifdef TRAPTRACE
int mach_htraptrace_enable = 1;
@@ -59,6 +60,17 @@ extern void sfmmu_set_tsbs(void);
*/
static int enable_halt_idle_cpus = 1;
+/*
+ * Defines for the idle_state_transition DTrace probe
+ *
+ * The probe fires when the CPU undergoes an idle state change (e.g. hv yield)
+ * The agument passed is the state to which the CPU is transitioning.
+ *
+ * The states are defined here.
+ */
+#define IDLE_STATE_NORMAL 0
+#define IDLE_STATE_YIELDED 1
+
#define SUN4V_CLOCK_TICK_THRESHOLD 64
#define SUN4V_CLOCK_TICK_NCPUS 64
@@ -170,7 +182,13 @@ cpu_halt(void)
while (*p == 0 &&
((hset_update && CPU_IN_SET(cp->cp_mach->mc_haltset, cpun)) ||
(!hset_update && (CPU->cpu_flags & CPU_OFFLINE)))) {
+
+ DTRACE_PROBE1(idle__state__transition,
+ uint_t, IDLE_STATE_YIELDED);
(void) hv_cpu_yield();
+ DTRACE_PROBE1(idle__state__transition,
+ uint_t, IDLE_STATE_NORMAL);
+
enable_vec_intr(s);
s = disable_vec_intr();
}