Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7919900imu; Thu, 15 Nov 2018 03:46:36 -0800 (PST) X-Google-Smtp-Source: AJdET5fhfp3+Gnxvup24J+9+ax1SKu3jYupng9Z6o5yx4AHCR6Gi0AtFynnE/cYMD0oB1SO5E8h8 X-Received: by 2002:a63:1444:: with SMTP id 4mr5580124pgu.430.1542282396728; Thu, 15 Nov 2018 03:46:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542282396; cv=none; d=google.com; s=arc-20160816; b=vxpnO4HR7uLneyGADsyYdIBFJvcBMLOCgWCl+3pDoN/ioWKWVJflgXiphugfcdpM6v Nl2udzdOeTsjx7qrLxlZ8OVteMVD72asSECx61NhNU5N+A4/JT/YUt1UXnDWRpaP+s+8 C+m89FDCQ7+K5C/iVSks2CUF6E2G9G7hwuiTCXK2LMkDzelmH2sH79NwzyHtbUCdiI7r Fbbrz3g3F9GBBiRoL9wuB2dr388oeUMBF4t57OMedFLUzCd54rsOzsqakxQXK2v6THnI X0aOzjzCTx07DXkvRpg1FN0CwRQQTSsWbEY9AZVXWeuq+kC38gPGByWbm6XcrG+a+tXo W4Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=HsXo3J5qVZ2QvnMPw/3rQj4E0wRI+FCRBaeFuwnRQ2M=; b=f1ABEA/k3EewCdNhNqLXk5mv7X7jafkwiLKxa3r+CGrNv21nYHBy0FxnJraH10ddyC ku3tF1qorvMcGED/mbOLajPp6nxN66+ptGB4OSKBImHjIE2B+8Kd/N4esn8rqWWY+VH7 /2iYNeb4+kgQhI/+40HyDdsfpWLLnSj967P6UoExRCIz8AjBuZuVeDU4IY51XI1BGC+Z fWO2LbfYelg29X//EhW2jvowy8EHVlvlmYqq5yBxSQ1JEoSz+8EJjtw/k5VoRcbC5NZQ VdsQq6l5JcOHIdY96BRi/xtpH47ThKL9rxigNNVtkL/Dp2bzPI/Krv7CtwzuZZx6eV/0 BqdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y15-v6si27050047pfl.255.2018.11.15.03.46.21; Thu, 15 Nov 2018 03:46:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387998AbeKOVxL (ORCPT + 99 others); Thu, 15 Nov 2018 16:53:11 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:44582 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728931AbeKOVxL (ORCPT ); Thu, 15 Nov 2018 16:53:11 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: robertfoss) with ESMTPSA id 79AC72607A4 Subject: Re: [PATCH v3] drm/msm: Move fence put to where failure occurs To: robdclark@gmail.com, airlied@linux.ie, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Chris Wilson Cc: Greg KH , stable@vger.kernel.org References: <20181105101312.24581-1-robert.foss@collabora.com> From: Robert Foss Message-ID: Date: Thu, 15 Nov 2018 12:45:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181105101312.24581-1-robert.foss@collabora.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey, I think this patch is ready for inclusion. Rob. On 2018-11-05 11:13, Robert Foss wrote: > If dma_fence_wait fails to wait for a supplied in-fence in > msm_ioctl_gem_submit, make sure we release that in-fence. > > Also remove this dma_fence_put() from the 'out' label. > > Signed-off-by: Robert Foss > Reviewed-by: Chris Wilson > Cc: stable@vger.kernel.org > --- > > Changes since v2: > - Chris Wilson: Added r-b and stable kernel tag > > Changes since v1: > - Chris Wilson: Make sure that dma_fence_put() is always executed > > > drivers/gpu/drm/msm/msm_gem_submit.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c > index a90aedd6883a..d5e6665a4c8f 100644 > --- a/drivers/gpu/drm/msm/msm_gem_submit.c > +++ b/drivers/gpu/drm/msm/msm_gem_submit.c > @@ -411,7 +411,6 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, > struct msm_file_private *ctx = file->driver_priv; > struct msm_gem_submit *submit; > struct msm_gpu *gpu = priv->gpu; > - struct dma_fence *in_fence = NULL; > struct sync_file *sync_file = NULL; > struct msm_gpu_submitqueue *queue; > struct msm_ringbuffer *ring; > @@ -444,6 +443,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, > ring = gpu->rb[queue->prio]; > > if (args->flags & MSM_SUBMIT_FENCE_FD_IN) { > + struct dma_fence *in_fence; > + > in_fence = sync_file_get_fence(args->fence_fd); > > if (!in_fence) > @@ -453,11 +454,13 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, > * Wait if the fence is from a foreign context, or if the fence > * array contains any fence from a foreign context. > */ > - if (!dma_fence_match_context(in_fence, ring->fctx->context)) { > + ret = 0; > + if (!dma_fence_match_context(in_fence, ring->fctx->context)) > ret = dma_fence_wait(in_fence, true); > - if (ret) > - return ret; > - } > + > + dma_fence_put(in_fence); > + if (ret) > + return ret; > } > > ret = mutex_lock_interruptible(&dev->struct_mutex); > @@ -583,8 +586,6 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, > } > > out: > - if (in_fence) > - dma_fence_put(in_fence); > submit_cleanup(submit); > if (ret) > msm_gem_submit_free(submit); >