From: Thomas Hellstrom <thellstrom@vmware.com>
To: Ben Skeggs <skeggsb@gmail.com>
Cc: Jerome Glisse <jglisse@redhat.com>,
Ben Skeggs <bskeggs@redhat.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/ttm: fix the tt_populated check in ttm_tt_destroy()
Date: Tue, 17 Sep 2013 08:40:30 +0200 [thread overview]
Message-ID: <5237F95E.5040302@vmware.com> (raw)
In-Reply-To: <1379391675-15976-1-git-send-email-skeggsb@gmail.com>
On 09/17/2013 06:21 AM, Ben Skeggs wrote:
> From: Ben Skeggs <bskeggs@redhat.com>
>
> After a vmalloc failure in ttm_dma_tt_alloc_page_directory(),
> ttm_dma_tt_init() will call ttm_tt_destroy() to cleanup, and end up
> inside the driver's unpopulate() hook when populate() has never yet
> been called.
>
> On nouveau, the first issue to be hit because of this is that
> dma_address[] may be a NULL pointer. After working around this,
> ttm_pool_unpopulate() may potentially hit the same issue with
> the pages[] array.
>
> It seems to make more sense to avoid calling unpopulate on already
> unpopulated TTMs than to add checks to all the implementations.
>
> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
> Cc: Jerome Glisse <jglisse@redhat.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> ---
> drivers/gpu/drm/ttm/ttm_tt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> index 5e93a52..210d503 100644
> --- a/drivers/gpu/drm/ttm/ttm_tt.c
> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> @@ -170,7 +170,7 @@ void ttm_tt_destroy(struct ttm_tt *ttm)
> ttm_tt_unbind(ttm);
> }
>
> - if (likely(ttm->pages != NULL)) {
> + if (ttm->state == tt_unbound) {
> ttm->bdev->driver->ttm_tt_unpopulate(ttm);
> }
>
Looks good to me.
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
prev parent reply other threads:[~2013-09-17 6:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-17 4:21 [PATCH] drm/ttm: fix the tt_populated check in ttm_tt_destroy() Ben Skeggs
2013-09-17 6:40 ` Thomas Hellstrom [this message]
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=5237F95E.5040302@vmware.com \
--to=thellstrom@vmware.com \
--cc=bskeggs@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jglisse@redhat.com \
--cc=skeggsb@gmail.com \
/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