From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A549C433F5 for ; Tue, 16 Nov 2021 16:38:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E8B7B61A64 for ; Tue, 16 Nov 2021 16:38:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E8B7B61A64 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DEDCC6E03E; Tue, 16 Nov 2021 16:37:56 +0000 (UTC) Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by gabe.freedesktop.org (Postfix) with ESMTPS id B839C6E03E for ; Tue, 16 Nov 2021 16:37:55 +0000 (UTC) Received: by mail-wm1-x333.google.com with SMTP id i12so16723913wmq.4 for ; Tue, 16 Nov 2021 08:37:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=tbVG0zLxx2OdRmBXqol7QL1Z8vbtq3aqMsSZsCQ6MTs=; b=WtY8nYi0J7zToYD8+SNvXhgatbQRO0AAGntCt6ejismlW88t4D0hqJRglXK0GjRH5v oJymQrTZWrtJFJM5k5HNN954fm/vzQhyqN+l06/EduvDWGiWTpx9dlFGiQzLN0MBPiul hx0ecoXWKbAvt+z4w52x6tB5YMvMayQKLHyu8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=tbVG0zLxx2OdRmBXqol7QL1Z8vbtq3aqMsSZsCQ6MTs=; b=n1j3qrjDjFfmSa07rcSkA4J+5YrMuNuXbo/jD+MmFZhsfyMXBlKjFFUsd9XC0AJHTn EBA30CX3kKDpeLbPhPXv6Qs2vaX3E6BCq6NWp2YZ5qSCTYSn2PrY/KVJO91Ifl220MUF 0n9hR8RiA1kku0VwCJ370K7OgrpYSakhemxKZl4MUE6vFSdSK4okY8cX8lzhFuDuWFPc 40hU0lEiL/9NvYCkaw6DFcVDxKGiWQ3IjaI6uK0fmjw73UqgKLH60P+hC1V1SwoNXYj4 Xxv9+z+MSDgdIL/LEhf8Vt3uw0I6o2jENGaaTY7UIpf0rIWRjkCUEd8PX42FX+bPBJez YNCw== X-Gm-Message-State: AOAM533NIKHtrb5LmtUrGzZytXL3OAZZ9JlFcG4Bhfr3++NmLqDKkawX 1h6tASlmB5iN88PB0hv9wUUFXPlorvYwwQ== X-Google-Smtp-Source: ABdhPJyZioQBeTc+kRqNwQwrqt6gaC+obTm61vpKOM3yHqWhs5KTYCZAO8Je4oJnknVZcYOst1zk4A== X-Received: by 2002:a1c:9842:: with SMTP id a63mr70912757wme.102.1637080674082; Tue, 16 Nov 2021 08:37:54 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id c11sm4335223wmq.27.2021.11.16.08.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Nov 2021 08:37:53 -0800 (PST) Date: Tue, 16 Nov 2021 17:37:51 +0100 From: Daniel Vetter To: Christian =?iso-8859-1?Q?K=F6nig?= Subject: Re: [PATCH 2/2] drm/sched: fix dropping the last fence ref Message-ID: References: <20211116092519.99206-1-christian.koenig@amd.com> <20211116092519.99206-2-christian.koenig@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211116092519.99206-2-christian.koenig@amd.com> X-Operating-System: Linux phenom 5.10.0-8-amd64 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: frattaroli.nicolas@gmail.com, dri-devel@lists.freedesktop.org, y.oudjana@protonmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Nov 16, 2021 at 10:25:19AM +0100, Christian König wrote: > We need to grab another ref before trying to add the fence to the sched > job and not after. > > Signed-off-by: Christian König Reviewed-by: Daniel Vetter I wondered first why this goes boom, but then I realized that in some cases add_dependency() drops the reference of the passed-in fence. Please also add the Fixes: line like in the previous patch. Cheers, Daniel > --- > drivers/gpu/drm/scheduler/sched_main.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c > index 94fe51b3caa2..400d201c3c28 100644 > --- a/drivers/gpu/drm/scheduler/sched_main.c > +++ b/drivers/gpu/drm/scheduler/sched_main.c > @@ -704,12 +704,14 @@ int drm_sched_job_add_implicit_dependencies(struct drm_sched_job *job, > int ret; > > dma_resv_for_each_fence(&cursor, obj->resv, write, fence) { > - ret = drm_sched_job_add_dependency(job, fence); > - if (ret) > - return ret; > - > /* Make sure to grab an additional ref on the added fence */ > dma_fence_get(fence); > + > + ret = drm_sched_job_add_dependency(job, fence); > + if (ret) { > + dma_fence_put(fence); > + return ret; > + } > } > return 0; > } > -- > 2.25.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch