Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3718843pxb; Mon, 24 Jan 2022 16:14:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfSUDpdDz7XtOEXe+n7sL+E4AXoTINhF7+ROPCx8vUeqVgT7O5t+FKcBali/l/kGFjY8Wb X-Received: by 2002:a17:902:9006:b0:14a:930e:cc95 with SMTP id a6-20020a170902900600b0014a930ecc95mr16860173plp.9.1643069671332; Mon, 24 Jan 2022 16:14:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643069671; cv=none; d=google.com; s=arc-20160816; b=0FXy3M2S/7VzU41FYvVb8OqWv/w3f9J39XwMw3VznbQTssQmQqQSZmEkq1vIOArIGy 5JqzTkzxZZKjf9dS+Zm3tgUnsAGde74pjX2zqitr6F+va4XBSzOj9fE8iF915oVi5EFJ g3gpP3O8QmQDeBCs7tSQUHQC/f0qIsNJ0Ylc76kc4PpdeLtINFjb5BUv+0LyZQu3f2/U 6QGR+WilVJL/6Z+ty4hkE0QVpirpCLcA6IEM3xYhheFJD+ohPPvXY+CSCBWviuScxf6c +W9r/WlmlKHO314p6+4HY3sT5I5hCWLqG79LU9KFGVwdAnNYA09PAF/AoeS1wZWj5TlJ SPPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=USk8t6EBSUpZbPS9S6GTLNa3LU6uPPaiHafHk6Rh0CA=; b=CoG/NUUa+5vkmbKbUcldwoxc195lU7bZ70DQZGQ8Sw4iZMlahQrFzhB52aBVKwTGFr XuukFPM3FldQnPQJfDCQBH9sSjeCQnphiPC0yy9CgipEJ4mzKcJswY/nKyjNmSlSeDs8 lAMUhTpx8GMcK7SHY5b1H9yM6MWS2ORpPtkPUNngi4TyLUKSNdJHErEpn2y1568gmvv4 zzt9nn+S8G4oBDR/BysMLkawKhGGo5hyMQNynrM5jfgPUgn5ZBmsuqisE6v1owymRj04 rzp+W9cQLWnLFV2nbFjGC0Q0ZyQ7l6g2s5nIly2cVUWL+ReNGBF4Z5xW5y9H34ASc2hz 9pLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZSN6lnyJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v11si13591384plz.366.2022.01.24.16.14.15; Mon, 24 Jan 2022 16:14:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZSN6lnyJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2372216AbiAYAKv (ORCPT + 99 others); Mon, 24 Jan 2022 19:10:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1848903AbiAXXYP (ORCPT ); Mon, 24 Jan 2022 18:24:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AB02C0730A3; Mon, 24 Jan 2022 13:29:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2E6E1B81057; Mon, 24 Jan 2022 21:29:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62233C340E4; Mon, 24 Jan 2022 21:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059768; bh=F4q09PcjBgUukBysrwd15UYEG4A+dn6xaDs9qiOmli0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZSN6lnyJ1NF6lbDpwTyoTADAkdqDYoQd0AQWFTag0Yw7T6SkrSUX8mbrQyVTw/9w0 IhjONH+IajXpaRNVfliBs2Q4bDckUxwQHQEwJQ1sknWXKpEkZHXxMU3fFKBrJW92UF biSOPBlRy7OSKf1xVQRiaFbsIJxSUlpxi/iGtwEg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joerg Albert , Lucas Stach , Christian Gmeiner , Sasha Levin Subject: [PATCH 5.16 0694/1039] drm/etnaviv: consider completed fence seqno in hang check Date: Mon, 24 Jan 2022 19:41:23 +0100 Message-Id: <20220124184148.671759759@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lucas Stach [ Upstream commit cdd156955f946beaa5f3a00d8ccf90e5a197becc ] Some GPU heavy test programs manage to trigger the hangcheck quite often. If there are no other GPU users in the system and the test program exhibits a very regular structure in the commandstreams that are being submitted, we can end up with two distinct submits managing to trigger the hangcheck with the FE in a very similar address range. This leads the hangcheck to believe that the GPU is stuck, while in reality the GPU is already busy working on a different job. To avoid those spurious GPU resets, also remember and consider the last completed fence seqno in the hang check. Reported-by: Joerg Albert Signed-off-by: Lucas Stach Reviewed-by: Christian Gmeiner Signed-off-by: Sasha Levin --- drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 1 + drivers/gpu/drm/etnaviv/etnaviv_sched.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h index 1c75c8ed5bcea..85eddd492774d 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h @@ -130,6 +130,7 @@ struct etnaviv_gpu { /* hang detection */ u32 hangcheck_dma_addr; + u32 hangcheck_fence; void __iomem *mmio; int irq; diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c b/drivers/gpu/drm/etnaviv/etnaviv_sched.c index 180bb633d5c53..58f593b278c15 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c @@ -107,8 +107,10 @@ static enum drm_gpu_sched_stat etnaviv_sched_timedout_job(struct drm_sched_job */ dma_addr = gpu_read(gpu, VIVS_FE_DMA_ADDRESS); change = dma_addr - gpu->hangcheck_dma_addr; - if (change < 0 || change > 16) { + if (gpu->completed_fence != gpu->hangcheck_fence || + change < 0 || change > 16) { gpu->hangcheck_dma_addr = dma_addr; + gpu->hangcheck_fence = gpu->completed_fence; goto out_no_timeout; } -- 2.34.1