Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp500588rdd; Tue, 9 Jan 2024 10:22:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgzu6OzcFoCkynqc5nZuW00n12wyngC8u+o/0R/u29soJg39W2M8BYCdoQkaYjloqliWt3 X-Received: by 2002:a05:6a00:2e9e:b0:6da:c208:7044 with SMTP id fd30-20020a056a002e9e00b006dac2087044mr3323199pfb.40.1704824572379; Tue, 09 Jan 2024 10:22:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704824572; cv=none; d=google.com; s=arc-20160816; b=nyTmbqccXE7kQSmxe1pPpU3cXood+kfnf96icWw0cK6oet/qkgvlgeGejqV08yefh5 JV/J0lz7wuCqKsTdt4RQkyQs9++cd1rMgfQv+UGPIHLyraQH2DSL5jx8eheCMWQPqUKf WmJxDquDnPwLM/Rq7N3z1IgRT/uLq1dv4tmEMiAhR5gI9fCUdaUENcPJibPTSRpjiCxF fAmE9Cfs7PUBdSfyw/FttjuWNoV/2+Kf4SmaDaUQbM5oHS/qN9LCMkDwmDGSNgL72VEa pEG+YG9mXoFfCU4zeVqnb9zguNeb52w+nyTj4/08rA51tC3GOUs6etGub1GikPJf4BqX s1JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=k4A842bIbNaLxIo03lzXt0/VhyZzfulbNd4Jc/GgvJg=; fh=9atKuf829lAg0tkIKo07XINzPVtuPagGNz81nd3QBps=; b=ODl/Xv3HF23bgeWq5lW8ARqHcGotod+Neumi8srLOEbUoxTWbhoSoYEGcfi0itK8v9 4Brn3AzVvENL7vFW4odHK4MKIME6lKln9+Z63NHrSfkng3yjnoxsVQH9BOufw3JUCueB C7wFkcMBiPnCjilI4cHKaR4jvFVT1zdxMkAI1G1DQE3sYSPbQ6SOsjHP04NSeRdJgFvW IUAf5vjFYR/LfmP1hejB8cRi1fTDifSoxCiEpmsZVZSYAfRa6HlKTUOhagE0p/bLpNl9 As/twb0ITtnAHnxv54StoOtKIVWWTNXgI73sZDnANtNYY7Rnmq+iVdLgXXZG9d0NmRXV D5XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="eZkbIMM/"; spf=pass (google.com: domain of linux-kernel+bounces-21248-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21248-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u22-20020a63f656000000b005cdf9c8000asi1878627pgj.147.2024.01.09.10.22.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 10:22:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21248-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="eZkbIMM/"; spf=pass (google.com: domain of linux-kernel+bounces-21248-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21248-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 539E628EC7E for ; Tue, 9 Jan 2024 18:22:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EAAE23C6BF; Tue, 9 Jan 2024 18:22:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eZkbIMM/" Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3C313C68E; Tue, 9 Jan 2024 18:22:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1d41bb4da91so15600515ad.0; Tue, 09 Jan 2024 10:22:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704824541; x=1705429341; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=k4A842bIbNaLxIo03lzXt0/VhyZzfulbNd4Jc/GgvJg=; b=eZkbIMM/OXBLA834+i0Re8gizkmALs8+6ruF88bZhAQpYPMp9/vTXz6FM+I21RkJj/ GKPVFdsicx3ICpWcjVmQnAq5f8IbTxNK6wh9q/kjUoE2vyrWBBxVWBICLuvBMa1DcwXc Kbw7CSu0nf43geyJMBvRAO9tshY7KVDCYvT/zHTAvKuFg7DM8jHaE/ufUjl5Fk+N+4qF Z1Z+Cz6RHp5Utb1mGkPJMIjixxW3+5CoOeFyofF1NeFW8onuyjf6Qxwz3mOVExCDRAcS HlvwgWW8EZ/PkyQu8ufu0+Yf75zHO+XZsYbG94LlStQbJ36TGTZrq0yfVvoFtpkf3fZ2 GGkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704824541; x=1705429341; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=k4A842bIbNaLxIo03lzXt0/VhyZzfulbNd4Jc/GgvJg=; b=YsIreEoRPYQGT466m2hJ3yEgVO8u05WY/t7oqSLxYTTL3dkyWBuNUceTWhSogE7TTs WOQm0LPJH80HUEJYf8PvWQb+u76A8Q5QZwKKzYgTZ8ctQb7dFYo4RHZlXEeFkZ4/xeRX NnCE2MD0VoDMvP9atl+EE8iuX0eP1LgnDEaNVTQYolU/E72FG1UMtiztUwfEiHHFBsbO N2cd0UPHZc8+DUAiFie/zcTJXOIy2zNRpdfsvo3tswVRETW/4ttVbRX0exoBDP5io0+v eOjIxz7LYvw1Dau2tuVJp4JPKvBxHt0v2cPnQBmJEksNZP4bd46lI8tx1cTiRTIAox0u JPLQ== X-Gm-Message-State: AOJu0YyCVJa8/FN94GYWEWL3SWE7GzpWYw+bvm+aaEOSMGqvKLjGrQQz qx8fCr4snoPPRvXX0lYz1+k= X-Received: by 2002:a17:903:32c3:b0:1d4:1a55:6e70 with SMTP id i3-20020a17090332c300b001d41a556e70mr3390318plr.113.1704824540985; Tue, 09 Jan 2024 10:22:20 -0800 (PST) Received: from localhost ([2a00:79e1:2e00:1301:e1c5:6354:b45d:8ffc]) by smtp.gmail.com with ESMTPSA id jf15-20020a170903268f00b001d3e6f58e5esm2104217plb.6.2024.01.09.10.22.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 10:22:20 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Rob Clark , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org (open list) Subject: [PATCH] Revert "drm/msm/gpu: Push gpu lock down past runpm" Date: Tue, 9 Jan 2024 10:22:17 -0800 Message-ID: <20240109182218.193804-1-robdclark@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Rob Clark This reverts commit abe2023b4cea192ab266b351fd38dc9dbd846df0. Changing the locking order means that scheduler/msm_job_run() can race with the recovery kthread worker, with the result that the GPU gets an extra runpm get when we are trying to power it off. Leaving the GPU in an unrecovered state. I'll need to come up with a different scheme for appeasing lockdep. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_gpu.c | 11 +++++------ drivers/gpu/drm/msm/msm_ringbuffer.c | 7 +++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 095390774f22..655002b21b0d 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -751,12 +751,14 @@ void msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) struct msm_ringbuffer *ring = submit->ring; unsigned long flags; - pm_runtime_get_sync(&gpu->pdev->dev); + WARN_ON(!mutex_is_locked(&gpu->lock)); - mutex_lock(&gpu->lock); + pm_runtime_get_sync(&gpu->pdev->dev); msm_gpu_hw_init(gpu); + submit->seqno = submit->hw_fence->seqno; + update_sw_cntrs(gpu); /* @@ -781,11 +783,8 @@ void msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) gpu->funcs->submit(gpu, submit); gpu->cur_ctx_seqno = submit->queue->ctx->seqno; - hangcheck_timer_reset(gpu); - - mutex_unlock(&gpu->lock); - pm_runtime_put(&gpu->pdev->dev); + hangcheck_timer_reset(gpu); } /* diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c b/drivers/gpu/drm/msm/msm_ringbuffer.c index e0ed27739449..548f5266a7d3 100644 --- a/drivers/gpu/drm/msm/msm_ringbuffer.c +++ b/drivers/gpu/drm/msm/msm_ringbuffer.c @@ -21,8 +21,6 @@ static struct dma_fence *msm_job_run(struct drm_sched_job *job) msm_fence_init(submit->hw_fence, fctx); - submit->seqno = submit->hw_fence->seqno; - mutex_lock(&priv->lru.lock); for (i = 0; i < submit->nr_bos; i++) { @@ -35,8 +33,13 @@ static struct dma_fence *msm_job_run(struct drm_sched_job *job) mutex_unlock(&priv->lru.lock); + /* TODO move submit path over to using a per-ring lock.. */ + mutex_lock(&gpu->lock); + msm_gpu_submit(gpu, submit); + mutex_unlock(&gpu->lock); + return dma_fence_get(submit->hw_fence); } -- 2.43.0