dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: zhoucm1 <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: "Nicolai Hähnle"
	<nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	"Nicolai Hähnle" <nicolai.haehnle-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH v2] drm/amd/amdgpu: add check that shadow page tables are GPU-accessible
Date: Fri, 16 Dec 2016 10:48:19 +0800	[thread overview]
Message-ID: <585355F3.9040009@amd.com> (raw)
In-Reply-To: <1481824743-11139-1-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>



On 2016年12月16日 01:59, Nicolai Hähnle wrote:
> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>
> Skip amdgpu_gem_va_update_vm otherwise. Also clean up the check for the
> non-shadow page tables using the new helper function.
>
> This fixes a crash with the stack trace:
>
> amdgpu_gem_va_update_vm
> -> amdgpu_vm_update_page_directory
>   -> amdgpu_ttm_bind
>    -> amdgpu_gtt_mgr_alloc
>
> v2: actually check bo->shadow instead of just checking bo twice
>
> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 4e1eb05..9bd1b4e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -464,26 +464,29 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
>   
>   unreserve:
>   	amdgpu_bo_unreserve(robj);
>   out:
>   	drm_gem_object_unreference_unlocked(gobj);
>   	return r;
>   }
>   
>   static int amdgpu_gem_va_check(void *param, struct amdgpu_bo *bo)
>   {
> -	unsigned domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type);
> -
>   	/* if anything is swapped out don't swap it in here,
>   	   just abort and wait for the next CS */
> +	if (!amdgpu_bo_gpu_accessible(bo))
> +		return -ERESTARTSYS;
> +
> +	if (bo->shadow && !amdgpu_bo_gpu_accessible(bo->shadow))
> +		return -ERESTARTSYS;
>   
> -	return domain == AMDGPU_GEM_DOMAIN_CPU ? -ERESTARTSYS : 0;
> +	return 0;
>   }
>   
>   /**
>    * amdgpu_gem_va_update_vm -update the bo_va in its VM
>    *
>    * @adev: amdgpu_device pointer
>    * @bo_va: bo_va to update
>    *
>    * Update the bo_va directly after setting it's address. Errors are not
>    * vital here, so they are not reported back to userspace.

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2016-12-16  2:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-15 17:10 [PATCH 0/5] drm/ttm, amdgpu: fix crashes due to shadow page table evictions Nicolai Hähnle
     [not found] ` <1481821815-9971-1-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-15 17:10   ` [PATCH 1/5] drm/ttm: add evict parameter to ttm_bo_driver::move_notify Nicolai Hähnle
     [not found]     ` <1481821815-9971-2-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-16  2:49       ` zhoucm1
     [not found]         ` <5853564E.5020005-5C7GfCeVMHo@public.gmane.org>
2016-12-21 15:12           ` Nicolai Hähnle
     [not found]             ` <8f68adf1-52bc-b2ef-2fa7-79a8f9695164-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-03 11:42               ` Christian König
2016-12-15 17:10   ` [PATCH 2/5] drm/amd/amdgpu: move eviction counting to amdgpu_bo_move_notify Nicolai Hähnle
     [not found]     ` <1481821815-9971-3-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-16  2:50       ` zhoucm1
2016-12-15 17:10   ` [PATCH 3/5] drm/amd/amdgpu: add amdgpu_bo_gpu_accessible helper function Nicolai Hähnle
     [not found]     ` <1481821815-9971-4-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-16  2:48       ` zhoucm1
2016-12-15 17:10   ` [PATCH 4/5] drm/amd/amdgpu: add check that shadow page directory is GPU-accessible Nicolai Hähnle
     [not found]     ` <1481821815-9971-5-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-16  2:49       ` zhoucm1
2016-12-15 17:10   ` [PATCH 5/5] drm/amd/amdgpu: add check that shadow page tables are GPU-accessible Nicolai Hähnle
     [not found]     ` <1481821815-9971-6-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-15 17:59       ` [PATCH v2] " Nicolai Hähnle
     [not found]         ` <1481824743-11139-1-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-16  2:48           ` zhoucm1 [this message]
2016-12-16  2:07       ` [PATCH 5/5] " zhoucm1

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=585355F3.9040009@amd.com \
    --to=david1.zhou-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=nicolai.haehnle-5C7GfCeVMHo@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