From: "Christian König" <deathsimple@vodafone.de>
To: alexdeucher@gmail.com
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH 2/2] drm/radeon: fix userptr BO unpin bug
Date: Fri, 1 May 2015 12:34:13 +0200 [thread overview]
Message-ID: <1430476453-3045-2-git-send-email-deathsimple@vodafone.de> (raw)
In-Reply-To: <1430476453-3045-1-git-send-email-deathsimple@vodafone.de>
From: "monk.liu" <monk.liu@amd.com>
Fixing a memory leak with userptrs.
Signed-off-by: monk.liu <monk.liu@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
CC: stable@vger.kernel.org
---
drivers/gpu/drm/radeon/radeon_ttm.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index b292aca..e661841 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -606,13 +606,18 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
dma_unmap_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction);
for_each_sg(ttm->sg->sgl, sg, ttm->sg->nents, i) {
+ int len = sg->length >> PAGE_SHIFT;
struct page *page = sg_page(sg);
+ while (len > 0) {
+ if (!(gtt->userflags & RADEON_GEM_USERPTR_READONLY))
+ set_page_dirty(page);
- if (!(gtt->userflags & RADEON_GEM_USERPTR_READONLY))
- set_page_dirty(page);
+ mark_page_accessed(page);
+ page_cache_release(page);
- mark_page_accessed(page);
- page_cache_release(page);
+ page++;
+ len--;
+ }
}
sg_free_table(ttm->sg);
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-05-01 10:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-01 10:34 [PATCH 1/2] drm/radeon: disable semaphores for UVD V1 Christian König
2015-05-01 10:34 ` Christian König [this message]
2015-05-01 16:40 ` [PATCH 2/2] drm/radeon: fix userptr BO unpin bug Ilia Mirkin
2015-05-01 15:13 ` [PATCH 1/2] drm/radeon: disable semaphores for UVD V1 Alex Deucher
2015-05-01 16:13 ` Christian König
2015-05-01 16:24 ` Alex Deucher
2015-05-01 16:31 ` 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=1430476453-3045-2-git-send-email-deathsimple@vodafone.de \
--to=deathsimple@vodafone.de \
--cc=alexdeucher@gmail.com \
--cc=dri-devel@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