From patchwork Fri May 1 10:34:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 6309241 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 15588BEEE1 for ; Fri, 1 May 2015 10:34:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0DA9C2042B for ; Fri, 1 May 2015 10:34:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0BD3120225 for ; Fri, 1 May 2015 10:34:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 99D536E628; Fri, 1 May 2015 03:34:20 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pegasos-out.vodafone.de (pegasos-out.vodafone.de [80.84.1.38]) by gabe.freedesktop.org (Postfix) with ESMTP id 55EFF6E62A for ; Fri, 1 May 2015 03:34:19 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by pegasos-out.vodafone.de (Rohrpostix1 Daemon) with ESMTP id B572026080D; Fri, 1 May 2015 12:34:16 +0200 (CEST) X-Virus-Scanned: amavisd-new at vodafone.de X-Spam-Score: -0.054 X-Spam-Level: X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Authentication-Results: rohrpostix1.prod.vfnet.de (amavisd-new); dkim=pass header.i=@vodafone.de Received: from pegasos-out.vodafone.de ([127.0.0.1]) by localhost (rohrpostix1.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WV3WnwXYg-Ep; Fri, 1 May 2015 12:34:15 +0200 (CEST) Received: from smtp-03.vodafone.de (smtp-03.vodafone.de [10.215.254.38]) by pegasos-out.vodafone.de (Rohrpostix1 Daemon) with ESMTP id 372A426043C; Fri, 1 May 2015 12:34:15 +0200 (CEST) X-DKIM: OpenDKIM Filter v2.6.8 pegasos-out.vodafone.de 372A426043C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafone.de; s=mail; t=1430476455; bh=XwhoAZwc9IUsW+snSU7Zq7W5pHCQ0/Pk8pXUexMkK04=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=I+0CiGjwn8X7fu5D0cChdNEY9seH5NUeLw33TjPOoL94CdNYiHcnO62H4srPgVHFz sdFDCLkwfHa1Xyz7KqzPNHrJiTFxszDexuyquyCg+9jxiFiCq25CH1E4WJHN8P11sp +bC1qxO5KGiBrq2oWTQgPDa8UuZ2rd/us7H5KDUY= X-Virus-Scanned: amavisd-new at vodafone.de Received: from smtp-03.vodafone.de ([127.0.0.1]) by localhost (xsmail-dmz7.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EL-W+1A2Se0u; Fri, 1 May 2015 12:34:14 +0200 (CEST) From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: alexdeucher@gmail.com Subject: [PATCH 2/2] drm/radeon: fix userptr BO unpin bug Date: Fri, 1 May 2015 12:34:13 +0200 Message-Id: <1430476453-3045-2-git-send-email-deathsimple@vodafone.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430476453-3045-1-git-send-email-deathsimple@vodafone.de> References: <1430476453-3045-1-git-send-email-deathsimple@vodafone.de> MIME-Version: 1.0 Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "monk.liu" Fixing a memory leak with userptrs. Signed-off-by: monk.liu Signed-off-by: Christian König 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);