/* *OneofthesestructuresisallocatedwhenaGSEGismmaped.The *structureispointedtobythevma->vm_private_datafieldinthevmastruct.
*/ struct gru_vma_data {
spinlock_t vd_lock; /* Serialize access to vma */ struct list_head vd_head; /* head of linked list of gts */ long vd_user_options;/* misc user option flags */ int vd_cbr_au_count; int vd_dsr_au_count; unsignedchar vd_tlb_preload_count;
};
/* *OneoftheseisallocatedforeachthreadaccessingammapedGRU.Alinked *listofthesestructureishungoffthestructgru_vma_datainthemm_struct.
*/ struct gru_thread_state { struct list_head ts_next; /* list - head at vma-private */ struct mutex ts_ctxlock; /* load/unload CTX lock */ struct mm_struct *ts_mm; /* mm currently mapped to
context */ struct vm_area_struct *ts_vma; /* vma of GRU context */ struct gru_state *ts_gru; /* GRU where the context is
loaded */ struct gru_mm_struct *ts_gms; /* asid & ioproc struct */ unsignedchar ts_tlb_preload_count; /* TLB preload pages */ unsignedlong ts_cbr_map; /* map of allocated CBRs */ unsignedlong ts_dsr_map; /* map of allocated DATA
resources */ unsignedlong ts_steal_jiffies;/* jiffies when context last
stolen */ long ts_user_options;/* misc user option flags */
pid_t ts_tgid_owner; /* task that is using the
context - for migration */ short ts_user_blade_id;/* user selected blade */ signedchar ts_user_chiplet_id;/* user selected chiplet */ unsignedshort ts_sizeavail; /* Pagesizes in use */ int ts_tsid; /* thread that owns the
structure */ int ts_tlb_int_select;/* target cpu if interrupts
enabled */ int ts_ctxnum; /* context number where the
context is loaded */
refcount_t ts_refcnt; /* reference count GTS */ unsignedchar ts_dsr_au_count;/* Number of DSR resources
required for contest */ unsignedchar ts_cbr_au_count;/* Number of CBR resources
required for contest */ signedchar ts_cch_req_slice;/* CCH packet slice */ signedchar ts_blade; /* If >= 0, migrate context if
ref from different blade */ signedchar ts_force_cch_reload; signedchar ts_cbr_idx[GRU_CBR_AU];/* CBR numbers of each
allocated CB */ int ts_data_valid; /* Indicates if ts_gdata has
valid data */ struct gru_gseg_statistics ustats; /* User statistics */ unsignedlong ts_gdata[]; /* save area for GRU data (CB,
DS, CBE) */
};
/* *OneoftheseexistsforeachGRUchiplet.
*/ struct gru_state { struct gru_blade_state *gs_blade; /* GRU state for entire
blade */ unsignedlong gs_gru_base_paddr; /* Physical address of
gru segments (64) */ void *gs_gru_base_vaddr; /* Virtual address of
gru segments (64) */ unsignedshort gs_gid; /* unique GRU number */ unsignedshort gs_blade_id; /* blade of GRU */ unsignedchar gs_chiplet_id; /* blade chiplet of GRU */ unsignedchar gs_tgh_local_shift; /* used to pick TGH for
local flush */ unsignedchar gs_tgh_first_remote; /* starting TGH# for
remote flush */
spinlock_t gs_asid_lock; /* lock used for
assigning asids */
spinlock_t gs_lock; /* lock used for
assigning contexts */
/* -- the following are protected by the gs_asid_lock spinlock ---- */ unsignedint gs_asid; /* Next availe ASID */ unsignedint gs_asid_limit; /* Limit of available
ASIDs */ unsignedint gs_asid_gen; /* asid generation.
Inc on wrap */
/* --- the following fields are protected by the gs_lock spinlock --- */ unsignedlong gs_context_map; /* bitmap to manage
contexts in use */ unsignedlong gs_cbr_map; /* bitmap to manage CB
resources */ unsignedlong gs_dsr_map; /* bitmap used to manage
DATA resources */ unsignedint gs_reserved_cbrs; /* Number of kernel-
reserved cbrs */ unsignedint gs_reserved_dsr_bytes; /* Bytes of kernel-
reserved dsrs */ unsignedshort gs_active_contexts; /* number of contexts
in use */ struct gru_thread_state *gs_gts[GRU_NUM_CCH]; /* GTS currently using
the context */ int gs_irq[GRU_NUM_TFM]; /* Interrupt irqs */
};
/* *ThisstructurecontainstheGRUstateforalltheGRUsonablade.
*/ struct gru_blade_state { void *kernel_cb; /* First kernel
reserved cb */ void *kernel_dsr; /* First kernel
reserved DSR */ struct rw_semaphore bs_kgts_sema; /* lock for kgts */ struct gru_thread_state *bs_kgts; /* GTS for kernel use */
/* ---- the following are used for managing kernel async GRU CBRs --- */ int bs_async_dsr_bytes; /* DSRs for async */ int bs_async_cbrs; /* CBRs AU for async */ struct completion *bs_async_wq;
/* ---- the following are protected by the bs_lock spinlock ---- */
spinlock_t bs_lock; /* lock used for
stealing contexts */ int bs_lru_ctxnum; /* STEAL - last context
stolen */ struct gru_state *bs_lru_gru; /* STEAL - last gru
stolen */
/* Given a blade# & chiplet#, get a pointer to the GRU */ #define get_gru(b, c) (&gru_base[b]->bs_grus[c])
/* Number of bytes to save/restore when unloading/loading GRU contexts */ #define DSR_BYTES(dsr) ((dsr) * GRU_DSR_AU_BYTES) #define CBR_BYTES(cbr) ((cbr) * GRU_HANDLE_BYTES * GRU_CBR_AU_SIZE * 2)
/* Convert a user CB number to the actual CBRNUM */ #define thread_cbr_number(gts, n) ((gts)->ts_cbr_idx[(n) / GRU_CBR_AU_SIZE] \
* GRU_CBR_AU_SIZE + (n) % GRU_CBR_AU_SIZE)
/* Convert a gid to a pointer to the GRU */ #define GID_TO_GRU(gid) \
(gru_base[(gid) / GRU_CHIPLETS_PER_BLADE] ? \
(&gru_base[(gid) / GRU_CHIPLETS_PER_BLADE]-> \
bs_grus[(gid) % GRU_CHIPLETS_PER_BLADE]) : \
NULL)
/* Scan all active GRUs in a GRU bitmap */ #define for_each_gru_in_bitmap(gid, map) \
for_each_set_bit((gid), (map), GRU_MAX_GRUS)
/* Scan all active GRUs on a specific blade */ #define for_each_gru_on_blade(gru, nid, i) \ for ((gru) = gru_base[nid]->bs_grus, (i) = 0; \
(i) < GRU_CHIPLETS_PER_BLADE; \
(i)++, (gru)++)
/* Scan all GRUs */ #define foreach_gid(gid) \ for ((gid) = 0; (gid) < gru_max_gids; (gid)++)
/* Scan all active GTSs on a gru. Note: must hold ss_lock to use this macro. */ #define for_each_gts_on_gru(gts, gru, ctxnum) \ for ((ctxnum) = 0; (ctxnum) < GRU_NUM_CCH; (ctxnum)++) \ if (((gts) = (gru)->gs_gts[ctxnum]))
/* Scan each CBR whose bit is set in a TFM (or copy of) */ #define for_each_cbr_in_tfm(i, map) \
for_each_set_bit((i), (map), GRU_NUM_CBE)
/* Scan each CBR in a CBR bitmap. Note: multiple CBRs in an allocation unit */ #define for_each_cbr_in_allocation_map(i, map, k) \
for_each_set_bit((k), (map), GRU_CBR_AU) \ for ((i) = (k)*GRU_CBR_AU_SIZE; \
(i) < ((k) + 1) * GRU_CBR_AU_SIZE; (i)++)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.