AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Kuehling, Felix" <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
	<ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu: fix huge page handling on Vega10
Date: Mon, 12 Nov 2018 23:50:52 +0000	[thread overview]
Message-ID: <076d08d0-bdf8-4c59-88aa-0d45383e66cb@amd.com> (raw)
In-Reply-To: <20181112170942.10674-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>

On 2018-11-12 12:09 p.m., Christian König wrote:
> We accidentially set the huge flag on the parent instead of the childs.
> This caused some VM faults under memory pressure.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>

I got a bit confused when re-reading this code. Maybe part of it is that
cursor.entry is not really an entry (as in PTE), but a page table.
cursor.pfn identifies the entry within the table. Maybe renaming
cursor.entry to something like cursor.table would make it slightly more
intuitive.

Regards,
  Felix


>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 352b30409060..dad0e2342df9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1632,13 +1632,6 @@ static int amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,
>  			continue;
>  		}
>  
> -		/* First check if the entry is already handled */
> -		if (cursor.pfn < frag_start) {
> -			cursor.entry->huge = true;
> -			amdgpu_vm_pt_next(adev, &cursor);
> -			continue;
> -		}
> -
>  		/* If it isn't already handled it can't be a huge page */
>  		if (cursor.entry->huge) {
>  			/* Add the entry to the relocated list to update it. */
> @@ -1701,8 +1694,17 @@ static int amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,
>  			}
>  		} while (frag_start < entry_end);
>  
> -		if (frag >= shift)
> +		if (amdgpu_vm_pt_descendant(adev, &cursor)) {
> +			/* Mark all child entries as huge */
> +			while (cursor.pfn < frag_start) {
> +				cursor.entry->huge = true;
> +				amdgpu_vm_pt_next(adev, &cursor);
> +			}
> +
> +		} else if (frag >= shift) {
> +			/* or just move on to the next on the same level. */
>  			amdgpu_vm_pt_next(adev, &cursor);
> +		}
>  	}
>  
>  	return 0;
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-11-12 23:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12 17:09 [PATCH] drm/amdgpu: fix huge page handling on Vega10 Christian König
     [not found] ` <20181112170942.10674-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-11-12 17:16   ` Alex Deucher
     [not found]     ` <CADnq5_MORq4h3zMq_YF+_8HjMyqn61AweLxwYfr+oo4kfkxdfA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-11-12 21:45       ` Samuel Pitoiset
     [not found]         ` <f460f333-e31c-2347-4d96-dd04d7416451-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-11-13  8:14           ` Christian König
     [not found]             ` <34255c9f-b167-f8bc-7ce9-e1e75123cef4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-11-13  9:08               ` Samuel Pitoiset
2018-11-12 23:50   ` Kuehling, Felix [this message]
     [not found]     ` <076d08d0-bdf8-4c59-88aa-0d45383e66cb-5C7GfCeVMHo@public.gmane.org>
2018-11-13  7:47       ` Christian König

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=076d08d0-bdf8-4c59-88aa-0d45383e66cb@amd.com \
    --to=felix.kuehling-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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