mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 21:23:23 +00:00
drm/amdgpu: Surface svm_default_granularity, a RW module parameter
Enables users to update SVM's default granularity, used in buffer migration and handling of recoverable page faults. Param value is set in terms of log(numPages(buffer)), e.g. 9 for a 2 MIB buffer Signed-off-by: Ramesh Errabolu <Ramesh.Errabolu@amd.com> Reviewed-by: Philip Yang <Philip.Yang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
e8397d327e
commit
01be2b62c0
@ -237,6 +237,7 @@ extern int sched_policy;
|
||||
extern bool debug_evictions;
|
||||
extern bool no_system_mem_limit;
|
||||
extern int halt_if_hws_hang;
|
||||
extern uint amdgpu_svm_default_granularity;
|
||||
#else
|
||||
static const int __maybe_unused sched_policy = KFD_SCHED_POLICY_HWS;
|
||||
static const bool __maybe_unused debug_evictions; /* = false */
|
||||
|
@ -169,6 +169,16 @@ uint amdgpu_sdma_phase_quantum = 32;
|
||||
char *amdgpu_disable_cu;
|
||||
char *amdgpu_virtual_display;
|
||||
bool enforce_isolation;
|
||||
|
||||
/* Specifies the default granularity for SVM, used in buffer
|
||||
* migration and restoration of backing memory when handling
|
||||
* recoverable page faults.
|
||||
*
|
||||
* The value is given as log(numPages(buffer)); for a 2 MiB
|
||||
* buffer it computes to be 9
|
||||
*/
|
||||
uint amdgpu_svm_default_granularity = 9;
|
||||
|
||||
/*
|
||||
* OverDrive(bit 14) disabled by default
|
||||
* GFX DCS(bit 19) disabled by default
|
||||
@ -320,6 +330,13 @@ module_param_named(pcie_gen2, amdgpu_pcie_gen2, int, 0444);
|
||||
MODULE_PARM_DESC(msi, "MSI support (1 = enable, 0 = disable, -1 = auto)");
|
||||
module_param_named(msi, amdgpu_msi, int, 0444);
|
||||
|
||||
/**
|
||||
* DOC: svm_default_granularity (uint)
|
||||
* Used in buffer migration and handling of recoverable page faults
|
||||
*/
|
||||
MODULE_PARM_DESC(svm_default_granularity, "SVM's default granularity in log(2^Pages), default 9 = 2^9 = 2 MiB");
|
||||
module_param_named(svm_default_granularity, amdgpu_svm_default_granularity, uint, 0644);
|
||||
|
||||
/**
|
||||
* DOC: lockup_timeout (string)
|
||||
* Set GPU scheduler timeout value in ms.
|
||||
|
@ -868,6 +868,12 @@ struct svm_range_list {
|
||||
struct task_struct *faulting_task;
|
||||
/* check point ts decides if page fault recovery need be dropped */
|
||||
uint64_t checkpoint_ts[MAX_GPU_INSTANCE];
|
||||
|
||||
/* Default granularity to use in buffer migration
|
||||
* and restoration of backing memory while handling
|
||||
* recoverable page faults
|
||||
*/
|
||||
uint8_t default_granularity;
|
||||
};
|
||||
|
||||
/* Process data */
|
||||
|
@ -309,12 +309,13 @@ static void svm_range_free(struct svm_range *prange, bool do_unmap)
|
||||
}
|
||||
|
||||
static void
|
||||
svm_range_set_default_attributes(int32_t *location, int32_t *prefetch_loc,
|
||||
uint8_t *granularity, uint32_t *flags)
|
||||
svm_range_set_default_attributes(struct svm_range_list *svms, int32_t *location,
|
||||
int32_t *prefetch_loc, uint8_t *granularity,
|
||||
uint32_t *flags)
|
||||
{
|
||||
*location = KFD_IOCTL_SVM_LOCATION_UNDEFINED;
|
||||
*prefetch_loc = KFD_IOCTL_SVM_LOCATION_UNDEFINED;
|
||||
*granularity = 9;
|
||||
*granularity = svms->default_granularity;
|
||||
*flags =
|
||||
KFD_IOCTL_SVM_FLAG_HOST_ACCESS | KFD_IOCTL_SVM_FLAG_COHERENT;
|
||||
}
|
||||
@ -358,7 +359,7 @@ svm_range *svm_range_new(struct svm_range_list *svms, uint64_t start,
|
||||
bitmap_copy(prange->bitmap_access, svms->bitmap_supported,
|
||||
MAX_GPU_INSTANCE);
|
||||
|
||||
svm_range_set_default_attributes(&prange->preferred_loc,
|
||||
svm_range_set_default_attributes(svms, &prange->preferred_loc,
|
||||
&prange->prefetch_loc,
|
||||
&prange->granularity, &prange->flags);
|
||||
|
||||
@ -2703,9 +2704,10 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr,
|
||||
*is_heap_stack = vma_is_initial_heap(vma) || vma_is_initial_stack(vma);
|
||||
|
||||
start_limit = max(vma->vm_start >> PAGE_SHIFT,
|
||||
(unsigned long)ALIGN_DOWN(addr, 2UL << 8));
|
||||
(unsigned long)ALIGN_DOWN(addr, 1UL << p->svms.default_granularity));
|
||||
end_limit = min(vma->vm_end >> PAGE_SHIFT,
|
||||
(unsigned long)ALIGN(addr + 1, 2UL << 8));
|
||||
(unsigned long)ALIGN(addr + 1, 1UL << p->svms.default_granularity));
|
||||
|
||||
/* First range that starts after the fault address */
|
||||
node = interval_tree_iter_first(&p->svms.objects, addr + 1, ULONG_MAX);
|
||||
if (node) {
|
||||
@ -3249,6 +3251,12 @@ int svm_range_list_init(struct kfd_process *p)
|
||||
if (KFD_IS_SVM_API_SUPPORTED(p->pdds[i]->dev->adev))
|
||||
bitmap_set(svms->bitmap_supported, i, 1);
|
||||
|
||||
/* Value of default granularity cannot exceed 0x1B, the
|
||||
* number of pages supported by a 4-level paging table
|
||||
*/
|
||||
svms->default_granularity = min_t(u8, amdgpu_svm_default_granularity, 0x1B);
|
||||
pr_debug("Default SVM Granularity to use: %d\n", svms->default_granularity);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3776,7 +3784,7 @@ svm_range_get_attr(struct kfd_process *p, struct mm_struct *mm,
|
||||
node = interval_tree_iter_first(&svms->objects, start, last);
|
||||
if (!node) {
|
||||
pr_debug("range attrs not found return default values\n");
|
||||
svm_range_set_default_attributes(&location, &prefetch_loc,
|
||||
svm_range_set_default_attributes(svms, &location, &prefetch_loc,
|
||||
&granularity, &flags_and);
|
||||
flags_or = flags_and;
|
||||
if (p->xnack_enabled)
|
||||
|
Loading…
x
Reference in New Issue
Block a user