mirror of
https://github.com/NVIDIA/open-gpu-kernel-modules.git
synced 2026-03-08 22:59:49 +00:00
525.53
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
Copyright (c) 2016-2019 NVIDIA Corporation
|
||||
Copyright (c) 2016-2022 NVIDIA Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
@@ -30,32 +30,66 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const uvm_page_mask_t *prefetch_pages_mask;
|
||||
uvm_page_mask_t prefetch_pages_mask;
|
||||
|
||||
uvm_processor_id_t residency;
|
||||
} uvm_perf_prefetch_hint_t;
|
||||
|
||||
// Global initialization/cleanup functions
|
||||
// Encapsulates a counter tree built on top of a page mask bitmap in which each
|
||||
// leaf represents a page in the block. It contains leaf_count and level_count
|
||||
// so that it can use some macros for perf trees.
|
||||
typedef struct
|
||||
{
|
||||
uvm_page_mask_t pages;
|
||||
|
||||
uvm_page_index_t offset;
|
||||
|
||||
NvU16 leaf_count;
|
||||
|
||||
NvU8 level_count;
|
||||
} uvm_perf_prefetch_bitmap_tree_t;
|
||||
|
||||
// Iterator for the bitmap tree. It contains level_idx and node_idx so that it
|
||||
// can use some macros for perf trees.
|
||||
typedef struct
|
||||
{
|
||||
s8 level_idx;
|
||||
|
||||
uvm_page_index_t node_idx;
|
||||
} uvm_perf_prefetch_bitmap_tree_iter_t;
|
||||
|
||||
// Global initialization function (no clean up needed).
|
||||
NV_STATUS uvm_perf_prefetch_init(void);
|
||||
void uvm_perf_prefetch_exit(void);
|
||||
|
||||
// VA space Initialization/cleanup functions
|
||||
NV_STATUS uvm_perf_prefetch_load(uvm_va_space_t *va_space);
|
||||
void uvm_perf_prefetch_unload(uvm_va_space_t *va_space);
|
||||
// Return a hint with the pages that may be prefetched in the block.
|
||||
// The faulted_pages mask and faulted_region are the pages being migrated to
|
||||
// the given residency.
|
||||
// va_block_context must not be NULL, va_block_context->policy must be valid,
|
||||
// and if the va_block is a HMM block, va_block_context->hmm.vma must be valid
|
||||
// which also means the va_block_context->mm is not NULL, retained, and locked
|
||||
// for at least read.
|
||||
// Locking: The caller must hold the va_space lock and va_block lock.
|
||||
void uvm_perf_prefetch_get_hint(uvm_va_block_t *va_block,
|
||||
uvm_va_block_context_t *va_block_context,
|
||||
uvm_processor_id_t new_residency,
|
||||
const uvm_page_mask_t *faulted_pages,
|
||||
uvm_va_block_region_t faulted_region,
|
||||
uvm_perf_prefetch_bitmap_tree_t *bitmap_tree,
|
||||
uvm_perf_prefetch_hint_t *out_hint);
|
||||
|
||||
// Obtain a hint with the pages that may be prefetched in the block
|
||||
uvm_perf_prefetch_hint_t uvm_perf_prefetch_get_hint(uvm_va_block_t *va_block,
|
||||
const uvm_page_mask_t *new_residency_mask);
|
||||
void uvm_perf_prefetch_bitmap_tree_iter_init(const uvm_perf_prefetch_bitmap_tree_t *bitmap_tree,
|
||||
uvm_page_index_t page_index,
|
||||
uvm_perf_prefetch_bitmap_tree_iter_t *iter);
|
||||
uvm_va_block_region_t uvm_perf_prefetch_bitmap_tree_iter_get_range(const uvm_perf_prefetch_bitmap_tree_t *bitmap_tree,
|
||||
const uvm_perf_prefetch_bitmap_tree_iter_t *iter);
|
||||
NvU16 uvm_perf_prefetch_bitmap_tree_iter_get_count(const uvm_perf_prefetch_bitmap_tree_t *bitmap_tree,
|
||||
const uvm_perf_prefetch_bitmap_tree_iter_t *iter);
|
||||
|
||||
// Notify that the given mask of pages within region is going to migrate to
|
||||
// the given residency. The caller must hold the va_space lock.
|
||||
void uvm_perf_prefetch_prenotify_fault_migrations(uvm_va_block_t *va_block,
|
||||
uvm_va_block_context_t *va_block_context,
|
||||
uvm_processor_id_t new_residency,
|
||||
const uvm_page_mask_t *migrate_pages,
|
||||
uvm_va_block_region_t region);
|
||||
|
||||
#define UVM_PERF_PREFETCH_HINT_NONE() \
|
||||
(uvm_perf_prefetch_hint_t){ NULL, UVM_ID_INVALID }
|
||||
#define uvm_perf_prefetch_bitmap_tree_traverse_counters(counter,tree,page,iter) \
|
||||
for (uvm_perf_prefetch_bitmap_tree_iter_init((tree), (page), (iter)), \
|
||||
(counter) = uvm_perf_prefetch_bitmap_tree_iter_get_count((tree), (iter)); \
|
||||
(iter)->level_idx >= 0; \
|
||||
(counter) = --(iter)->level_idx < 0? 0: \
|
||||
uvm_perf_prefetch_bitmap_tree_iter_get_count((tree), (iter)))
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user