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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A1CDC25B06 for ; Thu, 4 Aug 2022 07:53:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236920AbiHDHxS (ORCPT ); Thu, 4 Aug 2022 03:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239292AbiHDHxN (ORCPT ); Thu, 4 Aug 2022 03:53:13 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBFE965547; Thu, 4 Aug 2022 00:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1659599588; x=1691135588; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=I7OayC0sFap2AlYvZdR6JVxb0RZ2MlfjjD1PjQxCMdY=; b=XjB1PrAdZHg2xDW9BssBu/9O1PdfeVyWyNKsJ+fpS/jDNr/RpftSC31D T8eMtPYyTbOzsF45YiklsbR5Yf8CLqgvd5vY5YbMwm9FpImA7dNO4hdfe cFpGr/DTzU+qOogyktzW2BhwVrU9RXIiBJiaaUvnlRZcLST69VdnzMr7g k=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-01.qualcomm.com with ESMTP; 04 Aug 2022 00:53:08 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2022 00:53:07 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 4 Aug 2022 00:53:07 -0700 Received: from [10.216.4.234] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 4 Aug 2022 00:53:03 -0700 Message-ID: <7f7bd85a-2444-1939-4ac8-dbf2685eaf24@quicinc.com> Date: Thu, 4 Aug 2022 13:23:00 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH 1/2] drm/msm: Move hangcheck timer restart Content-Language: en-US To: Rob Clark CC: , , , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , open list References: <20220803172302.1976981-1-robdclark@gmail.com> From: Akhil P Oommen In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/4/2022 1:59 AM, Rob Clark wrote: > On Wed, Aug 3, 2022 at 12:52 PM Akhil P Oommen wrote: >> On 8/3/2022 10:53 PM, Rob Clark wrote: >>> From: Rob Clark >>> >>> Don't directly restart the hangcheck timer from the timer handler, but >>> instead start it after the recover_worker replays remaining jobs. >>> >>> If the kthread is blocked for other reasons, there is no point to >>> immediately restart the timer. Fixes a random symptom of the problem >>> fixed in the next patch. >>> >>> Signed-off-by: Rob Clark >>> --- >>> drivers/gpu/drm/msm/msm_gpu.c | 14 +++++++++----- >>> 1 file changed, 9 insertions(+), 5 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c >>> index fba85f894314..8f9c48eabf7d 100644 >>> --- a/drivers/gpu/drm/msm/msm_gpu.c >>> +++ b/drivers/gpu/drm/msm/msm_gpu.c >>> @@ -328,6 +328,7 @@ find_submit(struct msm_ringbuffer *ring, uint32_t fence) >>> } >>> >>> static void retire_submits(struct msm_gpu *gpu); >>> +static void hangcheck_timer_reset(struct msm_gpu *gpu); >>> >>> static void get_comm_cmdline(struct msm_gem_submit *submit, char **comm, char **cmd) >>> { >>> @@ -420,6 +421,8 @@ static void recover_worker(struct kthread_work *work) >>> } >>> >>> if (msm_gpu_active(gpu)) { >>> + bool restart_hangcheck = false; >>> + >>> /* retire completed submits, plus the one that hung: */ >>> retire_submits(gpu); >>> >>> @@ -436,10 +439,15 @@ static void recover_worker(struct kthread_work *work) >>> unsigned long flags; >>> >>> spin_lock_irqsave(&ring->submit_lock, flags); >>> - list_for_each_entry(submit, &ring->submits, node) >>> + list_for_each_entry(submit, &ring->submits, node) { >>> gpu->funcs->submit(gpu, submit); >>> + restart_hangcheck = true; >>> + } >>> spin_unlock_irqrestore(&ring->submit_lock, flags); >>> } >>> + >>> + if (restart_hangcheck) >>> + hangcheck_timer_reset(gpu); >>> } >>> >>> mutex_unlock(&gpu->lock); >>> @@ -515,10 +523,6 @@ static void hangcheck_handler(struct timer_list *t) >>> kthread_queue_work(gpu->worker, &gpu->recover_work); >>> } >>> >>> - /* if still more pending work, reset the hangcheck timer: */ >> In the scenario mentioned here, shouldn't we restart the timer? > yeah, actually the case where we don't want to restart the timer is > *only* when we schedule recover_work.. > > BR, > -R Not sure if your codebase is different but based on msm-next branch, when "if (fence != ring->hangcheck_fence)" is true, we now skip rescheduling the timer. I don't think that is what we want. There should be a hangcheck timer running as long as there is an active submit, unless we have scheduled a recover_work here. -Akhil. > >> -Akhil. >>> - if (fence_after(ring->fctx->last_fence, ring->hangcheck_fence)) >>> - hangcheck_timer_reset(gpu); >>> - >>> /* workaround for missing irq: */ >>> msm_gpu_retire(gpu); >>> } >>>