<div dir="ltr"><div>I've tested applying v2 of this patch against a v5.3 tagged kernel and it appears to fix the issue I reported.</div><div><br></div><div>Thanks,</div><div>-Joe<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 3, 2019 at 12:07 PM Yang, Philip <<a href="mailto:Philip.Yang@amd.com">Philip.Yang@amd.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">user_pages array should be freed regardless if user pages are<br>
invalidated after bo is created because HMM change to always allocate<br>
user pages array to get user pages while parsing user page bo.<br>
<br>
Don't need to to get user pages while creating bo because user pages<br>
will only be used after parsing user page bo.<br>
<br>
Bugzilla: <a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1844962" rel="noreferrer" target="_blank">https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1844962</a><br>
<br>
Signed-off-by: Philip Yang <<a href="mailto:Philip.Yang@amd.com" target="_blank">Philip.Yang@amd.com</a>><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 23 +----------------------<br>
2 files changed, 2 insertions(+), 23 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c<br>
index 49b767b7238f..e861de259def 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c<br>
@@ -498,7 +498,7 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,<br>
if (r)<br>
return r;<br>
<br>
- if (binding_userptr) {<br>
+ if (lobj->user_pages) {<br>
kvfree(lobj->user_pages);<br>
lobj->user_pages = NULL;<br>
}<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c<br>
index a828e3d0bfbd..3ccd61d69964 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c<br>
@@ -283,7 +283,6 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,<br>
int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,<br>
struct drm_file *filp)<br>
{<br>
- struct ttm_operation_ctx ctx = { true, false };<br>
struct amdgpu_device *adev = dev->dev_private;<br>
struct drm_amdgpu_gem_userptr *args = data;<br>
struct drm_gem_object *gobj;<br>
@@ -326,32 +325,12 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,<br>
goto release_object;<br>
}<br>
<br>
- if (args->flags & AMDGPU_GEM_USERPTR_VALIDATE) {<br>
- r = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages);<br>
- if (r)<br>
- goto release_object;<br>
-<br>
- r = amdgpu_bo_reserve(bo, true);<br>
- if (r)<br>
- goto user_pages_done;<br>
-<br>
- amdgpu_bo_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_GTT);<br>
- r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);<br>
- amdgpu_bo_unreserve(bo);<br>
- if (r)<br>
- goto user_pages_done;<br>
- }<br>
-<br>
r = drm_gem_handle_create(filp, gobj, &handle);<br>
if (r)<br>
- goto user_pages_done;<br>
+ goto release_object;<br>
<br>
args->handle = handle;<br>
<br>
-user_pages_done:<br>
- if (args->flags & AMDGPU_GEM_USERPTR_VALIDATE)<br>
- amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm);<br>
-<br>
release_object:<br>
drm_gem_object_put_unlocked(gobj);<br>
<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div>