Lines Matching defs:pg

34 #include <sys/pg.h>
107 static group_t *pg_hw; /* top level pg hw group */
226 pghw_init(pghw_t *pg, cpu_t *cp, pghw_type_t hw)
237 pghw_set_add(hwset, pg);
238 pg->pghw_hw = hw;
239 pg->pghw_generation = 0;
240 pg->pghw_instance =
242 pghw_kstat_create(pg);
247 switch (pg->pghw_hw) {
249 pg->pghw_handle =
253 pg->pghw_handle =
257 pg->pghw_handle = (pghw_handle_t)NULL;
265 pghw_fini(pghw_t *pg)
269 pghw_cmt_fini(pg);
271 hwset = pghw_set_lookup(pg->pghw_hw);
274 pghw_set_remove(hwset, pg);
275 pg->pghw_instance = (id_t)PGHW_INSTANCE_ANON;
276 pg->pghw_hw = (pghw_type_t)-1;
278 if (pg->pghw_kstat != NULL)
279 kstat_delete(pg->pghw_kstat);
287 pghw_cmt_fini(pghw_t *pg)
292 if (pg->pghw_cpulist != NULL) {
293 kmem_free(pg->pghw_cpulist,
294 pg->pghw_cpulist_len);
295 pg->pghw_cpulist = NULL;
301 if (pg->pghw_cu_kstat != NULL) {
302 kstat_delete(pg->pghw_cu_kstat);
303 pg->pghw_cu_kstat = NULL;
325 * Find the pg representing the hw sharing relationship in which
332 pghw_t *pg;
335 while ((pg = group_iterate(&cp->cpu_pg->pgs, &i)) != NULL) {
336 if (pg->pghw_hw == hw)
337 return (pg);
351 pghw_t *pg;
358 while ((pg = group_iterate(set, &i)) != NULL) {
359 if (pg->pghw_instance == id)
360 return (pg);
444 pghw_set_add(group_t *hwset, pghw_t *pg)
446 (void) group_add(hwset, pg, GRP_RESIZE);
453 pghw_set_remove(group_t *hwset, pghw_t *pg)
457 result = group_remove(hwset, pg, GRP_RESIZE);
497 pghw_kstat_create(pghw_t *pg)
499 char *sharing = pghw_type_string(pg->pghw_hw);
505 (void) strncpy(name, pghw_type_string(pg->pghw_hw), KSTAT_STRLEN + 1);
511 if ((pg->pghw_kstat = kstat_create("pg", ((pg_t *)pg)->pg_id,
512 "pg", "pg",
517 pg->pghw_kstat->ks_data_size += PG_CLASS_NAME_MAX;
518 pg->pghw_kstat->ks_data_size += PGHW_KSTAT_STR_LEN_MAX;
519 pg->pghw_kstat->ks_data_size += PGHW_KSTAT_STR_LEN_MAX;
520 pg->pghw_kstat->ks_lock = &pghw_kstat_lock;
521 pg->pghw_kstat->ks_data = &pghw_kstat;
522 pg->pghw_kstat->ks_update = pghw_kstat_update;
523 pg->pghw_kstat->ks_private = pg;
524 kstat_install(pg->pghw_kstat);
531 * Create a physical pg kstat
533 if ((pg->pghw_cu_kstat = kstat_create("pg_hw_perf", ((pg_t *)pg)->pg_id,
538 pg->pghw_cu_kstat->ks_lock = &pghw_kstat_lock;
539 pg->pghw_cu_kstat->ks_data = &pghw_cu_kstat;
540 pg->pghw_cu_kstat->ks_update = pghw_cu_kstat_update;
541 pg->pghw_cu_kstat->ks_private = pg;
542 pg->pghw_cu_kstat->ks_data_size += strlen(sharing) + 1;
544 pg->pghw_cu_kstat->ks_data_size += PGHW_KSTAT_STR_LEN_MAX;
545 pg->pghw_cu_kstat->ks_data_size += pg_cpulist_maxlen;
546 kstat_install(pg->pghw_cu_kstat);
554 pghw_t *pg = ksp->ks_private;
559 pgsp->pg_id.value.ui32 = ((pg_t *)pg)->pg_id;
560 pgsp->pg_ncpus.value.ui32 = GROUP_SIZE(&((pg_t *)pg)->pg_cpus);
561 pgsp->pg_instance_id.value.ui32 = pg->pghw_instance;
562 kstat_named_setstr(&pgsp->pg_class, ((pg_t *)pg)->pg_class->pgc_name);
563 kstat_named_setstr(&pgsp->pg_hw, pghw_type_string(pg->pghw_hw));
564 kstat_named_setstr(&pgsp->pg_policy, pg_policy_name((pg_t *)pg));
572 pghw_t *pg = ksp->ks_private;
573 pghw_util_t *hw_util = &pg->pghw_stats;
586 pgsp->pg_id.value.i32 = ((pg_t *)pg)->pg_id;
587 pgsp->pg_parent_id.value.i32 = (int)pghw_parent_id(pg);
589 pgsp->pg_ncpus.value.ui32 = GROUP_SIZE(&((pg_t *)pg)->pg_cpus);
596 pghw_cpulist_alloc(pg);
598 if (pg->pghw_kstat_gen != pg->pghw_generation) {
610 pg->pghw_kstat_gen = pg->pghw_generation;
620 if (pg->pghw_cpulist != NULL &&
621 *(pg->pghw_cpulist) == '\0') {
622 (void) group2intlist(&(((pg_t *)pg)->pg_cpus),
623 pg->pghw_cpulist, pg->pghw_cpulist_len, cpu2id);
627 cu_pg_update(pg);
632 pgsp->pg_generation.value.ui32 = pg->pghw_kstat_gen;
633 if (pg->pghw_cpulist != NULL)
634 kstat_named_setstr(&pgsp->pg_cpus, pg->pghw_cpulist);
639 pghw_type_string(pg->pghw_hw));
661 * Update the string representation of CPUs in PG (pg->pghw_cpulist).
668 * field is used to detect whether CPUs within the pg may have changed.
671 pghw_cpulist_alloc(pghw_t *pg)
673 uint_t ncpus = GROUP_SIZE(&((pg_t *)pg)->pg_cpus);
681 if (pg->pghw_cpulist != NULL &&
682 pg->pghw_kstat_gen != pg->pghw_generation) {
683 if (len <= pg->pghw_cpulist_len) {
689 *(pg->pghw_cpulist) = '\0';
695 ASSERT(strlen(pg->pghw_cpulist) < pg->pghw_cpulist_len);
696 kmem_free(pg->pghw_cpulist, pg->pghw_cpulist_len);
697 pg->pghw_cpulist = NULL;
698 pg->pghw_cpulist_len = 0;
702 if (pg->pghw_cpulist == NULL) {
712 pg->pghw_cpulist = kmem_zalloc(len, KM_NOSLEEP);
713 if (pg->pghw_cpulist != NULL)
714 pg->pghw_cpulist_len = len;
737 pg_t *pg = (pg_t *)pghw;
740 if (pg != NULL && strcmp(pg->pg_class->pgc_name, "cmt") == 0) {
741 pg_cmt_t *cmt = (pg_cmt_t *)pg;