mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
drm/xe: Bump prefetch BO LRU for already-valid ranges
A valid prefetch range skips migration and binding, so nothing refreshes its backing BOs on the LRU. Add xe_svm_range_prefetch_lru_bump(), which re-faults with no_dma_map and bumps each backing BO, and call it on the valid path. v2 - Make function failsafe (Matt/Sashiko AI comment) - Add stub for function Suggested-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20261001033602.3166274-10-himal.prasad.ghimiray@intel.com Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
508444b9f6
commit
fdfed8609d
|
|
@ -1659,6 +1659,40 @@ void xe_svm_devmem_lru_bump(struct drm_pagemap_devmem *devmem_allocation)
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* xe_svm_range_prefetch_lru_bump() - Bump the TTM LRU for an already-valid range
|
||||
* @vm: Pointer to the struct xe_vm
|
||||
* @vma: Pointer to the VMA covering the range
|
||||
* @range: Pointer to the xe SVM range structure
|
||||
* @dpagemap: Target pagemap of the prefetch, or %NULL for system memory
|
||||
*
|
||||
* A valid range skips migration and binding, so nothing else refreshes its
|
||||
* backing BOs on the LRU. Re-fault the CPU pages without touching the DMA
|
||||
* mappings (@no_dma_map) and move each backing BO to the LRU tail.
|
||||
*
|
||||
* Prefetching is a best-effort optimization, so any failure is ignored; a
|
||||
* later fault will refault the range.
|
||||
*/
|
||||
void xe_svm_range_prefetch_lru_bump(struct xe_vm *vm, struct xe_vma *vma,
|
||||
struct xe_svm_range *range,
|
||||
struct drm_pagemap *dpagemap)
|
||||
{
|
||||
struct drm_gpusvm_ctx ctx = {
|
||||
.read_only = xe_vma_read_only(vma),
|
||||
.device_private_page_owner =
|
||||
xe_svm_private_page_owner(vm, !dpagemap),
|
||||
.no_dma_map = 1,
|
||||
.devmem_fn = xe_svm_devmem_lru_bump,
|
||||
};
|
||||
|
||||
guard(mutex)(&range->lock);
|
||||
|
||||
if (xe_svm_range_is_removed(range))
|
||||
return;
|
||||
|
||||
xe_svm_range_get_pages(vm, range, &ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
* xe_svm_ranges_zap_ptes_in_range - clear ptes of svm ranges in input range
|
||||
* @vm: Pointer to the xe_vm structure
|
||||
|
|
|
|||
|
|
@ -130,6 +130,10 @@ int xe_svm_range_get_pages(struct xe_vm *vm, struct xe_svm_range *range,
|
|||
|
||||
void xe_svm_devmem_lru_bump(struct drm_pagemap_devmem *devmem_allocation);
|
||||
|
||||
void xe_svm_range_prefetch_lru_bump(struct xe_vm *vm, struct xe_vma *vma,
|
||||
struct xe_svm_range *range,
|
||||
struct drm_pagemap *dpagemap);
|
||||
|
||||
bool xe_svm_range_needs_migrate_to_vram(struct xe_svm_range *range, struct xe_vma *vma,
|
||||
const struct drm_pagemap *dpagemap);
|
||||
|
||||
|
|
@ -363,6 +367,13 @@ void xe_svm_devmem_lru_bump(struct drm_pagemap_devmem *devmem_allocation)
|
|||
{
|
||||
}
|
||||
|
||||
static inline
|
||||
void xe_svm_range_prefetch_lru_bump(struct xe_vm *vm, struct xe_vma *vma,
|
||||
struct xe_svm_range *range,
|
||||
struct drm_pagemap *dpagemap)
|
||||
{
|
||||
}
|
||||
|
||||
static inline struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)
|
||||
{
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -2570,6 +2570,11 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_vma_ops *vops,
|
|||
dpagemap, &valid_pages)) {
|
||||
xe_svm_range_debug(svm_range, "PREFETCH - RANGE IS VALID");
|
||||
xe_assert(vm->xe, valid_pages);
|
||||
|
||||
if (dpagemap)
|
||||
xe_svm_range_prefetch_lru_bump(vm, vma, svm_range,
|
||||
dpagemap);
|
||||
|
||||
need_put = true;
|
||||
goto check_next_range;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user