[PATCH 2/5] drm/amdkfd: check child range to drain retry fault
Felix Kuehling
felix.kuehling at amd.com
Wed Nov 10 03:26:01 UTC 2021
On 2021-11-09 6:04 p.m., Philip Yang wrote:
> If unmapping partial range, the parent prange list op is update
> notifier, child range list op is unmap range, need check child range to
> set drain retry fault flag.
>
> Signed-off-by: Philip Yang <Philip.Yang at amd.com>
I think this could be simplified by simply setting
svms->drain_pagefaults in svm_range_unmap_from_cpu. The mmap lock
ensures that this is serialized with the deferred list worker reading
and clearing svms->drain_pagefaults. You can also use READ_ONCE and
WRITE_ONCE to be safe.
Regards,
Felix
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 77239b06b236..64f642935600 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -2049,8 +2049,19 @@ svm_range_add_list_work(struct svm_range_list *svms, struct svm_range *prange,
> * before the range is freed to avoid straggler interrupts on
> * unmapped memory causing "phantom faults".
> */
> - if (op == SVM_OP_UNMAP_RANGE)
> + if (op == SVM_OP_UNMAP_RANGE) {
> + pr_debug("set range drain_pagefaults true\n");
> svms->drain_pagefaults = true;
> + } else {
> + struct svm_range *pchild;
> +
> + list_for_each_entry(pchild, &prange->child_list, child_list)
> + if (pchild->work_item.op == SVM_OP_UNMAP_RANGE) {
> + pr_debug("set child drain_pagefaults true\n");
> + svms->drain_pagefaults = true;
> + }
> + }
> +
> /* if prange is on the deferred list */
> if (!list_empty(&prange->deferred_list)) {
> pr_debug("update exist prange 0x%p work op %d\n", prange, op);
More information about the amd-gfx
mailing list