From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Hellstrom Subject: Re: [PATCH 1/2] drm/ttm: ensure ttm_mem_io_free is called on bo destruction Date: Thu, 04 Nov 2010 12:24:29 +0100 Message-ID: <4CD297ED.8050907@shipmail.org> References: <1288829027-23239-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-1.vmware.com (smtp-outbound-1.vmware.com [65.115.85.69]) by gabe.freedesktop.org (Postfix) with ESMTP id 668329E74F for ; Thu, 4 Nov 2010 04:24:39 -0700 (PDT) In-Reply-To: <1288829027-23239-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: Ben Skeggs , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On 11/04/2010 01:03 AM, Ben Skeggs wrote: > From: Ben Skeggs > > Nouveau will start to use ttm_mem_io_reserve to allocate BAR VM space > for VRAM mappings, and without this call GPU address space gets leaked. > > Signed-off-by: Ben Skeggs > --- > drivers/gpu/drm/ttm/ttm_bo.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c > index dfa163b..c373cf9 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo.c > +++ b/drivers/gpu/drm/ttm/ttm_bo.c > @@ -472,6 +472,7 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo) > wake_up_all(&bo->event_queue); > spin_unlock(&glob->lru_lock); > > + ttm_mem_io_free(bo->bdev,&tmp_mem); > ttm_bo_mem_put(bo,&tmp_mem); > } > > Ideally this should be done after the last VMA is closed, but since we don't count VMAs currently. This place is just as good. However, the mem members are strictly protected by bo::reserve, so we should place this before we unreserve in the same function, Please use drm-next where ttm_bo_mem_put() is placed just before the unreserve as well. /Thomas