On Tuesday, October 30, 2007 8:46 AM, tesla-dev-bounces at opensolaris.org
wrote:

> Author: Eric Saxe <eric.saxe at sun.com>
> Repository: /hg/tesla/powertop
> Latest revision: 2c52bfdef0d0c2d112c11b2603676010a3ca98eb Total
> changesets: 1 Log message:
> cpu_change_speed, cstate_transition DTrace probes
> 
> Files:
>       update: usr/src/uts/common/io/cpudrv.c
>       update: usr/src/uts/i86pc/os/mp_machdep.c
>       update: usr/src/uts/i86pc/os/mp_pc.c

I think I got the changeset. ;-). See below.

As for P-state, I'm glad cpu_change_speed probe is added to the common
code staff.
That means it will work on SPARC as well. (I know nothing about SPARC, I
don't know if it supports speed change).

But as for C-state, the probes are only added to the i86pc staff.
Does SPARC support C-state or the similar state? Or will you add the
probes later?

----snip----
 extern void real_mode_start(void);
@@ -68,8 +69,8 @@ mach_cpucontext_init(void)
         * setup secondary cpu bios boot up vector
         */
        *vec = (ushort_t)((caddr_t)
-               ((struct rm_platter *)rm_platter_va)->rm_code -
rm_platter_va
-               + ((ulong_t)rm_platter_va & 0xf));
+           ((struct rm_platter *)rm_platter_va)->rm_code -
rm_platter_va
+           + ((ulong_t)rm_platter_va & 0xf));
        vec[1] = (ushort_t)(rm_platter_pa >> 4);
        warm_reset_vector = vec;
 ----snip----

And take a look at this change, I only see white space difference.
Did I miss anything? Or Did I do something wrong?

Thanks,
-Aubrey
========================================================================
===
diff -r 4866b8311a88 -r 2c52bfdef0d0 usr/src/uts/common/io/cpudrv.c
--- a/usr/src/uts/common/io/cpudrv.c    Mon Oct 01 22:40:41 2007 -0700
+++ b/usr/src/uts/common/io/cpudrv.c    Mon Oct 29 17:44:26 2007 -0700
@@ -50,6 +50,7 @@
 #include <sys/cpudrv.h>
 #include <sys/cpudrv_plat.h>
 #include <sys/msacct.h>
+#include <sys/sdt.h>
 
 /*
  * CPU power management
@@ -534,6 +535,13 @@ cpudrv_power(dev_info_t *dip, int comp, 
        }
 
        /*
+        * DTrace probe to fire when changing to a new speed
+        */
+       DTRACE_PROBE2(cpu_change_speed, processorid_t, cpudsp->cpu_id,
+           uint_t, new_spd->speed);
+
+
+       /*
         * Reset idle threshold time for the new power level.
         */
        if ((cpupm->cur_spd != NULL) && (level <
cpupm->cur_spd->pm_level)) {
diff -r 4866b8311a88 -r 2c52bfdef0d0 usr/src/uts/i86pc/os/mp_machdep.c
--- a/usr/src/uts/i86pc/os/mp_machdep.c Mon Oct 01 22:40:41 2007 -0700
+++ b/usr/src/uts/i86pc/os/mp_machdep.c Mon Oct 29 17:44:26 2007 -0700
@@ -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))
 
@@ -565,9 +566,13 @@ cpu_idle_mwait(void)
         */
        i86_monitor(mcpu_mwait, 0, 0);
        if (*mcpu_mwait == MWAIT_HALTED) {
+               DTRACE_PROBE1(cstate_transition, uint_t, 1);
+
                tlb_going_idle();
                i86_mwait(0, 0);
                tlb_service();
+
+               DTRACE_PROBE1(cstate_transition, uint_t, 0);
        }
 
        /*
diff -r 4866b8311a88 -r 2c52bfdef0d0 usr/src/uts/i86pc/os/mp_pc.c
--- a/usr/src/uts/i86pc/os/mp_pc.c      Mon Oct 01 22:40:41 2007 -0700
+++ b/usr/src/uts/i86pc/os/mp_pc.c      Mon Oct 29 17:44:26 2007 -0700
@@ -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);
@@ -68,8 +69,8 @@ mach_cpucontext_init(void)
         * setup secondary cpu bios boot up vector
         */
        *vec = (ushort_t)((caddr_t)
-               ((struct rm_platter *)rm_platter_va)->rm_code -
rm_platter_va
-               + ((ulong_t)rm_platter_va & 0xf));
+           ((struct rm_platter *)rm_platter_va)->rm_code -
rm_platter_va
+           + ((ulong_t)rm_platter_va & 0xf));
        vec[1] = (ushort_t)(rm_platter_pa >> 4);
        warm_reset_vector = vec;
 
@@ -245,9 +246,13 @@ void
 void
 mach_cpu_idle(void)
 {
+       DTRACE_PROBE1(cstate_transition, uint_t, 1);
+
        tlb_going_idle();
        i86_halt();
        tlb_service();
+
+       DTRACE_PROBE1(cstate_transition, uint_t, 0);
 }
 
 void

Reply via email to