AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: Philip Yang <Philip.Yang@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/5] drm/amdkfd: check child range to drain retry fault
Date: Tue, 9 Nov 2021 22:26:01 -0500	[thread overview]
Message-ID: <d4bc4acf-ff14-5370-16bd-8cec6253c09c@amd.com> (raw)
In-Reply-To: <20211109230432.3947-2-Philip.Yang@amd.com>


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@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);

  reply	other threads:[~2021-11-10  3:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 23:04 [PATCH 1/5] drm/amdgpu: handle IH ring1 overflow Philip Yang
2021-11-09 23:04 ` [PATCH 2/5] drm/amdkfd: check child range to drain retry fault Philip Yang
2021-11-10  3:26   ` Felix Kuehling [this message]
2021-11-11 21:55     ` philip yang
2021-11-09 23:04 ` [PATCH 3/5] drm/amdkfd: restore pages race with vma remove Philip Yang
2021-11-10  3:52   ` Felix Kuehling
2021-11-09 23:04 ` [PATCH 4/5] drm/amdkfd: restore pages race with process termination Philip Yang
2021-11-10  4:16   ` Felix Kuehling
2021-11-15 20:50     ` philip yang
2021-11-09 23:04 ` [PATCH 5/5] drm/amdkfd: svm deferred work pin mm Philip Yang
2021-11-10  4:51   ` Felix Kuehling
2021-11-10 10:15 ` [PATCH 1/5] drm/amdgpu: handle IH ring1 overflow Christian König
2021-11-10 13:59   ` philip yang
2021-11-10 14:31     ` Christian König
2021-11-10 14:44       ` philip yang
2021-11-10 14:54         ` Christian König
2021-11-10 15:45           ` philip yang
2021-11-10 15:48             ` Christian König
2021-11-10 23:36       ` Felix Kuehling
2021-11-11  7:00         ` Christian König
2021-11-11 12:13           ` Felix Kuehling
2021-11-11 13:43             ` Christian König
2021-11-11 13:57               ` Felix Kuehling
2021-11-11 21:31                 ` philip yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d4bc4acf-ff14-5370-16bd-8cec6253c09c@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=Philip.Yang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox