Skip to content

Topology

include/smp/topology.h View source View on GitHub
struct topology_contract {
    enum topology_level   scope;
    enum topology_caller  caller;
};
struct topology_cache_info {
    uint8_t   level;
    uint8_t   type;
    uint32_t  size_kb;
    uint32_t  line_size;
    uint32_t  cores_sharing;
};
struct topology_package_info {
    uint32_t         package_id;
    struct cpu_mask  cores;
};
struct topology_node {
    enum topology_level   level;
    uint64_t              id;
    uint64_t              parent;
    struct topology_node  *parent_node;
    int32_t               first_child;
    int32_t               nr_children;
    struct cpu_mask       cpus;
    struct cpu_mask       idle;
    struct cpu_mask       rt_sched_rq_active;
    struct core           *core;
    union {
        struct numa_node              *numa;
        struct topology_cache_info    *cache;
        struct topology_package_info  *package;
    } data;
};
struct topology {
    struct topology_node  *level[TOPOLOGY_LEVEL_MAX];
    uint16_t              count[TOPOLOGY_LEVEL_MAX];
};
enum topology_level {
    TOPOLOGY_LEVEL_SMT,
    TOPOLOGY_LEVEL_CORE,
    TOPOLOGY_LEVEL_NUMA,
    TOPOLOGY_LEVEL_LLC,
    TOPOLOGY_LEVEL_PACKAGE,
    TOPOLOGY_LEVEL_MACHINE,
    TOPOLOGY_LEVEL_MAX,
    TOPOLOGY_LEVEL_DOMAIN,
};
enum topology_caller {
    TOPC_NONE = 0,
    TOPC_IRQL = 1 << 0,
    TOPC_PINNED = 1 << 1,
    TOPC_IRQ = 1 << 2,
    TOPC_IFLAG = 1 << 3,
    TOPC_ANY = TOPC_IRQL | TOPC_PINNED | TOPC_IRQ | TOPC_IFLAG,
};
void topology_mark_core_idle(cpu_id_t cpu_id, bool idle);
struct core * topology_find_idle_core(struct core *local_core, enum topology_level max_search);
struct core * * topology_get_smts_under_numa(struct topology_node *numa, size_t *count);
const char * topology_level_name(enum topology_level l);
bool topology_contract_verify(struct topology_contract c);