From patchwork Tue May 23 00:14:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 9741655 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9E71D60210 for ; Tue, 23 May 2017 01:01:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93BD0286EC for ; Tue, 23 May 2017 01:01:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 884A528779; Tue, 23 May 2017 01:01:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3D623286EC for ; Tue, 23 May 2017 01:01:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 453886E2EC; Tue, 23 May 2017 01:00:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 214BE89DE6 for ; Tue, 23 May 2017 00:15:28 +0000 (UTC) Received: by mail-lf0-x242.google.com with SMTP id 99so6669575lfu.2 for ; Mon, 22 May 2017 17:15:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=mGt1ShMie1dp+fBKggbyEmnHUjm0hz1qsJWrc5al88I=; b=M+olZIvZnvlhig+ZJHxx0s4Ekqh2ERyIKBo/ZeW/cypfSmEEJHno8hpzLFSPHpMuH8 Tz7Av31AJC/DMofpwnUlxHTXSIJVCvnfdnRIpt9FrxygkF7sE8tMiCgsZrjDp69fUhkA IyzB9gSxAoaLyaag0VDaCGePOE1axPm9FiHMVCCOHX0XLY2Th3Zd/wg5HctSkKVu2gnI y2P+KZxnlfcNh556RvbZwHYop5wXx5M+A0ONKJbmcHXoC4FOdNuRCadcX6ugQAiVRl7h ajlKSgEo/ohj+GuqL+wvWMIz6T5nDXF3WgbsuPm1U+5I7Y8owj1tgT31TxMcag3RlRiS 1AVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=mGt1ShMie1dp+fBKggbyEmnHUjm0hz1qsJWrc5al88I=; b=H4Cmf2iUFImRDy97ws9Tbt9+3yxWFnGE79SZRBc4uHXVFd/jsLonrHqjR1qSIshzFM k+oAPQ3kTmYViEJ05xeuDeeB2qdMrdv7b+WyXlinHsQey/ySxqGj/Se8CNsunqC0zdsg ae0pzNso6jFvGF5k8GDl7iOlz1SW0HtDrxIQjQ5kfLShi+aTD40Y67N2I4ZHiHBN7Sob wZNmPrm9EO3T0BHFWgu7Q0vDvY/i5fIx5ayZS6OxFisF+w0wWLG0Aq/QQlcR438gH/6a gSgTR3MEzKTaYxvvzeDiD3JwBRDi4GmN8Lt7bnEG1CYu8eHFGTP2344wVTWIMLG9e/hV J74g== X-Gm-Message-State: AODbwcAv4h4eTYcNj1g9fxf0EiYFSO/heJv3amGk1knHzkobyXx3LjZ3 MRZx2Np8Cq12gw== X-Received: by 10.46.80.4 with SMTP id e4mr6652952ljb.36.1495498526610; Mon, 22 May 2017 17:15:26 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-175.pppoe.spdop.ru. [109.252.91.175]) by smtp.gmail.com with ESMTPSA id v30sm3440904ljd.9.2017.05.22.17.15.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 May 2017 17:15:26 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen Subject: [PATCH 12/22] gpu: host1x: Correct host1x_job_pin() error handling Date: Tue, 23 May 2017 03:14:27 +0300 Message-Id: X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Tue, 23 May 2017 00:59:38 +0000 Cc: linux-tegra@vger.kernel.org, DRI Development 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In case of relocations / waitchecks patching failure the jobs pins stay referenced till DRM file get closed, wasting memory. Add the missed unpinning. Signed-off-by: Dmitry Osipenko Reviewed-by: Mikko Perttunen --- drivers/gpu/host1x/job.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c index d9933828fe87..14f3f957ffab 100644 --- a/drivers/gpu/host1x/job.c +++ b/drivers/gpu/host1x/job.c @@ -592,22 +592,20 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev) err = do_relocs(job, g->bo); if (err) - break; + goto out; err = do_waitchks(job, host, g->bo); if (err) - break; + goto out; } - if (IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && !err) { - err = copy_gathers(job, dev); - if (err) { - host1x_job_unpin(job); - return err; - } - } + if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL)) + goto out; + err = copy_gathers(job, dev); out: + if (err) + host1x_job_unpin(job); wmb(); return err;