Here is a patch to create processor groups for idle(c-state) domain.
The patch is against Eric's pad policy patch(which is not committed
into pad-gate?). And from kstat output, we already have four idle
power domains while we have one active power domain now.

Thanks,
-Aubrey

module: pg                              instance: 3
name:   pg                              class:    pg
        crtime                          40.266315426
        hardware                        CPU PM Active Power Domain
        id                              3
        instance_id                     0
        ncpus                           8
        pg_class                        cmt
        snaptime                        733.024561714

module: pg                              instance: 4
name:   pg                              class:    pg
        crtime                          40.266828159
        hardware                        CPU PM Idle Power Domain
        id                              4
        instance_id                     0
        ncpus                           2
        pg_class                        cmt
        snaptime                        733.024696286

module: pg                              instance: 6
name:   pg                              class:    pg
        crtime                          44.461243528
        hardware                        CPU PM Idle Power Domain
        id                              6
        instance_id                     1
        ncpus                           2
        pg_class                        cmt
        snaptime                        733.024980929

module: pg                              instance: 8
name:   pg                              class:    pg
        crtime                          44.509325885
        hardware                        CPU PM Idle Power Domain
        id                              8
        instance_id                     2
        ncpus                           2
        pg_class                        cmt
        snaptime                        733.025245554

module: pg                              instance: 10
name:   pg                              class:    pg
        crtime                          44.569613983
        hardware                        CPU PM Idle Power Domain
        id                              10
        instance_id                     3
        ncpus                           2
        pg_class                        cmt
        snaptime                        733.025510271


==================================================
diff -r 401eba565d86 usr/src/uts/i86pc/io/cpudrv/cpudrv_mach.c
--- a/usr/src/uts/i86pc/io/cpudrv/cpudrv_mach.c Thu Oct 09 15:46:03 2008 +0800
+++ b/usr/src/uts/i86pc/io/cpudrv/cpudrv_mach.c Thu Oct 09 22:42:20 2008 +0800
@@ -733,6 +733,27 @@
 }

 /*
+ * Return a C-State domain ID for the specified CPU
+ */
+id_t
+cpudrv_pm_idle_domain_id(struct cpu *cp)
+{
+       cpudrv_devstate_t       *cpudsp;
+       cpudrv_cstate_domain_t  *domain;
+       cpudrv_mach_state_t     *mach_state;
+       dev_info_t              *dip;
+       int                     instance;
+
+       dip = cp->cpu_m.mcpu_dip;
+       instance = ddi_get_instance(dip);
+       cpudsp = ddi_get_soft_state(cpudrv_state, instance);
+       mach_state = cpudsp->mach_state;
+       domain = mach_state->cstate_domain_node->cdn_domain;
+
+       return ((id_t)domain->cd_domain);
+}
+
+/*
  * Enumerate the speeds for the specified CPU's pstate domain
  * The caller is expected to free the storage associated with
  * the speeds array, which is allocated here.
diff -r 401eba565d86 usr/src/uts/i86pc/os/cpupm.c
--- a/usr/src/uts/i86pc/os/cpupm.c      Thu Oct 09 15:46:03 2008 +0800
+++ b/usr/src/uts/i86pc/os/cpupm.c      Thu Oct 09 22:42:20 2008 +0800
@@ -69,9 +69,16 @@

 /*
  * This callback is used by the kernel to call into the CPU driver
- * to determine a given CPUs dependency domain information.
+ * to determine a given CPUs p-state dependency domain information.
  */
 id_t (*cpupm_active_domain_id)(struct cpu *);
+
+/*
+ * This callback is used by the kernel to call into the CPU driver
+ * to determine a given CPUs c-state dependency domain information.
+ */
+id_t (*cpupm_idle_domain_id)(struct cpu *);
+

 /*
  * This callback is used by the kernel to call into the CPU driver
@@ -293,16 +300,14 @@
 id_t
 cpupm_plat_domain_id(struct cpu *cp, cpupm_dtype_t type)
 {
-       /*
-        * Idle domain support unimplemented
-        */
-       if (type != CPUPM_DTYPE_ACTIVE)
-               return (CPUPM_NO_DOMAIN);
-
-       if (cpupm_active_domain_id)
-               return (cpupm_active_domain_id(cp));
-       else
-               return (CPUPM_NO_DOMAIN);
+       if (type == CPUPM_DTYPE_ACTIVE) {
+               if (cpupm_active_domain_id)
+                       return (cpupm_active_domain_id(cp));
+       } else if (type == CPUPM_DTYPE_IDLE) {
+               if (cpupm_idle_domain_id)
+                       return (cpupm_idle_domain_id(cp));
+       }
+       return (CPUPM_NO_DOMAIN);
 }

 /*ARGSUSED*/
diff -r 401eba565d86 usr/src/uts/i86pc/sys/cpudrv_mach.h
--- a/usr/src/uts/i86pc/sys/cpudrv_mach.h       Thu Oct 09 15:46:03 2008 +0800
+++ b/usr/src/uts/i86pc/sys/cpudrv_mach.h       Thu Oct 09 22:42:20 2008 +0800
@@ -89,6 +89,7 @@
        cpupm_get_topspeed = cpudrv_pm_get_topspeed; \
        cpupm_set_topspeed = cpudrv_pm_set_topspeed; \
        cpupm_active_domain_id = cpudrv_pm_active_domain_id; \
+       cpupm_idle_domain_id = cpudrv_pm_idle_domain_id; \
        cpupm_enumerate_active_speeds = cpudrv_pm_enumerate_active_speeds; \
        cpupm_change_speed = cpudrv_pm_change_state; \
 }
@@ -268,6 +269,7 @@
 extern void cpudrv_pstate_domain_init(cpudrv_devstate_t *, uint32_t, uint32_t);
 extern void cpudrv_free_pstate_domains(void);
 extern id_t cpudrv_pm_active_domain_id(struct cpu *);
+extern id_t cpudrv_pm_idle_domain_id(struct cpu *);
 extern uint_t cpudrv_pm_enumerate_active_speeds(struct cpu *, int **);
 extern int cpudrv_pm_change_state(struct cpu *, int);
 #ifdef  __cplusplus
diff -r 401eba565d86 usr/src/uts/i86pc/sys/cpupm.h
--- a/usr/src/uts/i86pc/sys/cpupm.h     Thu Oct 09 15:46:03 2008 +0800
+++ b/usr/src/uts/i86pc/sys/cpupm.h     Thu Oct 09 22:42:20 2008 +0800
@@ -69,6 +69,7 @@
 extern int (*cpupm_get_topspeed)(void *);
 extern void (*cpupm_set_topspeed)(void *, int);
 extern id_t (*cpupm_active_domain_id)(struct cpu *);
+extern id_t (*cpupm_idle_domain_id)(struct cpu *);
 extern uint_t (*cpupm_enumerate_active_speeds)(struct cpu *, int **);
 extern int  (*cpupm_change_speed)(struct cpu *, int);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pg_info.diff
Type: application/octet-stream
Size: 3716 bytes
Desc: pg_info.diff
URL: 
<http://mail.opensolaris.org/pipermail/tesla-dev/attachments/20081009/8676c2a9/attachment.obj>

Reply via email to