pg.c revision b885580b43755ee4ea1e280b85428893d2ba9291
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * CDDL HEADER START
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * The contents of this file are subject to the terms of the
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * Common Development and Distribution License (the "License").
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * You may not use this file except in compliance with the License.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * See the License for the specific language governing permissions
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * and limitations under the License.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * When distributing Covered Code, include this CDDL HEADER in each
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * If applicable, add the following below this CDDL HEADER, with the
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * fields enclosed by brackets "[]" replaced with your own identifying
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * information: Portions Copyright [yyyy] [name of copyright owner]
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * CDDL HEADER END
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * Use is subject to license terms.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * Processor groups
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * With the introduction of Chip Multi-Threaded (CMT) processor architectures,
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * it is no longer necessarily true that a given physical processor module
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * will present itself as a single schedulable entity (cpu_t). Rather, each
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * chip and/or processor core may present itself as one or more "logical" CPUs.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * The logical CPUs presented may share physical components such as caches,
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * data pipes, execution pipelines, FPUs, etc. It is advantageous to have the
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * kernel be aware of the relationships existing between logical CPUs so that
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * the appropriate optmizations may be employed.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * The processor group abstraction represents a set of logical CPUs that
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * generally share some sort of physical or characteristic relationship.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * In the case of a physical sharing relationship, the CPUs in the group may
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * share a pipeline, cache or floating point unit. In the case of a logical
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * relationship, a PG may represent the set of CPUs in a processor set, or the
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * set of CPUs running at a particular clock speed.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * The generic processor group structure, pg_t, contains the elements generic
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * to a group of CPUs. Depending on the nature of the CPU relationship
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * (LOGICAL or PHYSICAL), a pointer to a pg may be recast to a "view" of that
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * PG where more specific data is represented.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * As an example, a PG representing a PHYSICAL relationship, may be recast to
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * a pghw_t, where data further describing the hardware sharing relationship
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * is maintained. See pghw.c and pghw.h for details on physical PGs.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * At this time a more specialized casting of a PG representing a LOGICAL
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * relationship has not been implemented, but the architecture allows for this
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * in the future.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * Processor Group Classes
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * Processor group consumers may wish to maintain and associate specific
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * data with the PGs they create. For this reason, a mechanism for creating
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * class specific PGs exists. Classes may overload the default functions for
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * creating, destroying, and associating CPUs with PGs, and may also register
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * class specific callbacks to be invoked when the CPU related system
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * configuration changes. Class specific data is stored/associated with
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * PGs by incorporating the pg_t (or pghw_t, as appropriate), as the first
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * element of a class specific PG object. In memory, such a structure may look
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * ----------------------- - - -
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * | common | | | | <--(pg_t *)
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * ----------------------- | | -
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * | HW specific | | | <-----(pghw_t *)
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * ----------------------- | -
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * | class specific | | <-------(pg_cmt_t *)
static void pg_null_op();
static int pg_nclasses;
pg_init(void)
extern void pg_cmt_class_init();
extern void pg_cmt_cpu_startup();
pg_cpu0_init();
pg_cpu0_init(void)
extern void pghw_physid_create();
pg_cpu0_reinit(void)
if (pg_nclasses == 0) {
KM_SLEEP);
return (cid);
pg_t *
group_iter_t i;
group_iter_init(&i);
return (pg);
return (NULL);
cpu_t *
return (cpu);
return (B_FALSE);
return (B_TRUE);
pg_t *
return (pg);
int err;
int err;
static cpu_pg_t *
pg_cpu_data_alloc(void)
return (pgd);
cpu_pg_t *
pg_cid_t i;
for (i = 0; i < pg_nclasses; i++)
return (cpu_pg);
pg_cid_t i;
for (i = 0; i < pg_nclasses; i++)
pg_cid_t i;
for (i = 0; i < pg_nclasses; i++)
pg_cid_t i;
for (i = 0; i < pg_nclasses; i++)
for (i = 0; i < pg_nclasses; i++)
for (i = 0; i < pg_nclasses; i++)
for (i = 0; i < pg_nclasses; i++)
char *str;
return (str);
static pg_t *
int i, sz;
for (i = 0; i < sz; i++) {
int i, sz;
for (i = 0; i < sz; i++) {