Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2261963rwb; Thu, 29 Sep 2022 08:06:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4S3CKNIsX6coS1gNW/WqWoxI3vUcRbFMTN832M1yAVLaUeCuM7zjqPRi+e6I4LYCESHkDg X-Received: by 2002:a17:906:9749:b0:782:287f:d217 with SMTP id o9-20020a170906974900b00782287fd217mr2996841ejy.259.1664463973003; Thu, 29 Sep 2022 08:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664463972; cv=none; d=google.com; s=arc-20160816; b=dyRt7oS+E83ijeqMkkxFDcSlP/mlu3rkxiCMlGO1t2CXZgu9bWW83xfU5aciihy8Bb Bv3OsI/uqLpx+zz0peZeMXrsQj1jYSaS7b7QZXIdFKTvkVSt9SvXRepK3fY9c04bTS9E PK9x6Na2yiPoS0OBlb/3RuAjPJd3HZOT1R3YCqPqzD2wnrm33LrZnu9waUxwfVUTjG0b B02FBXGkxXV2diqxaNKfxpc6vp/jeBOKkW3VNAyYOMNT4SojLCgULlWLjBUU6fFMfgr9 i8eQHfMKY9URAqNCQGP4TeUn9Szf+cM1wJ0XyZGYfqDC2ozSG/2ofEcxE1mrUQ0Ck5r4 BW/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=Fxfgem/VeMLQHz8aPfPDTvG5hhohP+wp6zLIXa1SUtg=; b=TMvF/0BpIUzpaiZwB/6fNaZSpfHXh2Mtef6dk1WGwnh6Undm/O8Nven+CUIm0sKSZh uL5T56a1PpujC/IVKjtSJI0PdaOccRyF7bmni2kgCBkgd51kkDaHYoXTF+ME+pirck1/ NOfjxxPrD9qJJB7k9rKcQypO66dk25Ws926W18Mf1x07OpsO8k/U4C0IDCrw/I0/LS/+ IXw4zUdpWgCSHI3mGUhMUlKBV1tWI0hZu2EYAMlYpCvl72Lfq6R78cqSUVs0HHKjBaq8 xPYhA9+ZrkJ3Q5dC8951gwP0HOZAb8vPWrMIEAZJTuB1RdRQUIYXM2fZRS5QRWr70gvo p8kQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h12-20020a05640250cc00b004548c49ef4csi8037356edb.504.2022.09.29.08.05.46; Thu, 29 Sep 2022 08:06:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235738AbiI2Oxj (ORCPT + 99 others); Thu, 29 Sep 2022 10:53:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235724AbiI2Oxe (ORCPT ); Thu, 29 Sep 2022 10:53:34 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6387D13F2BB; Thu, 29 Sep 2022 07:53:33 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CEC591650; Thu, 29 Sep 2022 07:53:39 -0700 (PDT) Received: from [10.1.38.20] (e122027.cambridge.arm.com [10.1.38.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 693D83F792; Thu, 29 Sep 2022 07:53:30 -0700 (PDT) Message-ID: Date: Thu, 29 Sep 2022 15:53:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v4 5/6] drm/sched: Use parent fence instead of finished Content-Language: en-GB To: Arvind Yadav , Christian.Koenig@amd.com, andrey.grodzovsky@amd.com, shashank.sharma@amd.com, amaranath.somalapuram@amd.com, Arunpravin.PaneerSelvam@amd.com, sumit.semwal@linaro.org, gustavo@padovan.org, airlied@linux.ie, daniel@ffwll.ch, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org References: <20220914164321.2156-1-Arvind.Yadav@amd.com> <20220914164321.2156-6-Arvind.Yadav@amd.com> From: Steven Price In-Reply-To: <20220914164321.2156-6-Arvind.Yadav@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/09/2022 17:43, Arvind Yadav wrote: > Using the parent fence instead of the finished fence > to get the job status. This change is to avoid GPU > scheduler timeout error which can cause GPU reset. I'm able to reproduce crashes on Panfrost and I believe this commit is the cause. Specifically it's possible for job->s_fence->parent to be NULL. The underlying issue seems to involve drm_sched_resubmit_jobs_ext() - if the run_jobs() callback returns an error it will set s_fence->parent to NULL after signalling s_fence->finished: > fence = sched->ops->run_job(s_job); > i++; > > if (IS_ERR_OR_NULL(fence)) { > if (IS_ERR(fence)) > dma_fence_set_error(&s_fence->finished, PTR_ERR(fence)); > > s_job->s_fence->parent = NULL; I don't understand the reasoning behind this change, but it doesn't seem right to be using the parent fence when we have code which can be setting that pointer to NULL. Since I don't understand the reasoning my only suggestion is to revert this patch (and potentially the dependent patch "dma-buf: Check status of enable-signaling bit on debug"?). Can anyone suggest a better fix? Thanks, Steve > Signed-off-by: Arvind Yadav > Reviewed-by: Andrey Grodzovsky > --- > > changes in v1,v2 - Enable signaling for finished fence in sche_main() > is removed > > --- > drivers/gpu/drm/scheduler/sched_main.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c > index e0ab14e0fb6b..2ac28ad11432 100644 > --- a/drivers/gpu/drm/scheduler/sched_main.c > +++ b/drivers/gpu/drm/scheduler/sched_main.c > @@ -829,7 +829,7 @@ drm_sched_get_cleanup_job(struct drm_gpu_scheduler *sched) > job = list_first_entry_or_null(&sched->pending_list, > struct drm_sched_job, list); > > - if (job && dma_fence_is_signaled(&job->s_fence->finished)) { > + if (job && dma_fence_is_signaled(job->s_fence->parent)) { > /* remove job from pending_list */ > list_del_init(&job->list); > > @@ -841,7 +841,7 @@ drm_sched_get_cleanup_job(struct drm_gpu_scheduler *sched) > > if (next) { > next->s_fence->scheduled.timestamp = > - job->s_fence->finished.timestamp; > + job->s_fence->parent->timestamp; > /* start TO timer for next job */ > drm_sched_start_timeout(sched); > }