From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Hellstrom Subject: Re: [PATCH] drm/ttm: fix the tt_populated check in ttm_tt_destroy() Date: Tue, 17 Sep 2013 08:40:30 +0200 Message-ID: <5237F95E.5040302@vmware.com> References: <1379391675-15976-1-git-send-email-skeggsb@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from smtp-outbound-2.vmware.com (smtp-outbound-2.vmware.com [208.91.2.13]) by gabe.freedesktop.org (Postfix) with ESMTP id C523CE5C1A for ; Mon, 16 Sep 2013 23:42:34 -0700 (PDT) In-Reply-To: <1379391675-15976-1-git-send-email-skeggsb@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Ben Skeggs Cc: Jerome Glisse , Ben Skeggs , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On 09/17/2013 06:21 AM, Ben Skeggs wrote: > From: Ben Skeggs > > 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 > Cc: Jerome Glisse > Cc: Thomas Hellstrom > --- > 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