Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp531875lqb; Thu, 29 Feb 2024 07:51:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV+qaSQF5lV1XdmtLKK9Npp940NGHk6eZE08ereAMBy9szrob/LXXZ1h1HKNaf5tXnDLU8pCUamb7nUNGjHTCGfO3VnRCODeDHzUKXzrQ== X-Google-Smtp-Source: AGHT+IFNJrGhcQe+vGXeefBROHSQx/YBKl+Lib8A5LEj16fhK+64sr0jgEcekyvND+LAnC2FjoDY X-Received: by 2002:a05:6808:1404:b0:3c1:4979:888a with SMTP id w4-20020a056808140400b003c14979888amr3168111oiv.12.1709221901880; Thu, 29 Feb 2024 07:51:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709221901; cv=pass; d=google.com; s=arc-20160816; b=c4zQ+FLMP2aYD2nzKeCyYlIFgwbvql7scgD0Yn0vt5qmFieb9NgTAdaPd1TjCcr68n 1tNBwYXNH1llAG07tBmskXfLL2XVvT3s1zp4UBrcfs+WwT6hGG/0LsRJHbI10DwtN65R QJK0lNcddTE66Gy3HZjtZCE5ADmYcgfnGGtWubSM66bKRg4vXY651v6oYAlWTM8+lHH1 SdAp0+/si43ax0I7X/LKPvl4Ljs82C3dSe9GWo479IPt4MIm3HgoOwbauLIYciJzlWWu Fi3fkC7zhDmwsKgN62IDKnSKviOk7hst0tFzO/vlWTOxY8eBUqSF5HQETn4npHhd000K e+ew== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Z/4EPyLxJRArHWAUYLIq1WYCYmuru4D+pmtqY5/Gw3w=; fh=xfStJA2iJ2SutvO+NSPlwrw45TlIXVSmk2bEhFGnH5I=; b=QDUenAMaOiqylCfstqeR5QcMgiwGKjaNg762FhInU3xiDpM22HsE7t3Df7jpJYQ/c9 XQ1ScKAMIv8ZkCm8gTLyse9e2YsKxFU1xwzw4LikMLxEroQFzJhRVH9Qzj0gXHxHLZQj si98+2xlGa4wYv2BaAmlHxh5WB4LNtRQFnSPUcoUyKeoE9nzR08nIEmQHS+0RoiWyQVP 2QE3L9FmuY/08yT9kdoNrzS9/+yM6V26puf4YH3AqtV4iZ4AlIViOGSS+QhrkSsdOAXN mwka66J4rbJcdLIM2TyhoLGHYePwxI1Yk5meGa/ZudqmpZ98dx/WI0BbWSJwSRzAQpMv kBig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m3E1Be57; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86950-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86950-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id cj5-20020a056a00298500b006e52d4ed84fsi1550626pfb.222.2024.02.29.07.51.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 07:51:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86950-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m3E1Be57; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86950-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86950-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E7EA7B2127B for ; Thu, 29 Feb 2024 15:49:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 887AF14F9EB; Thu, 29 Feb 2024 15:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m3E1Be57" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB59014E2D5; Thu, 29 Feb 2024 15:48:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709221737; cv=none; b=Xee2+uQb712IF9sddQ8k2Rz6ntFur0+6TP5GQ3o+AdZmyNUO9CaRLwSu26W0fLgnnwxJmXf1ARmmIPwpMQuyDZdDzbBnIxy/mu12f58VLHdzIvWCi32ks/dmKCx/VrU/UK7XORKiPSPNbp1ke08z9i1UCjtD2FWPYrFAyRX+XzY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709221737; c=relaxed/simple; bh=+fv1LPuaO3JTr5Lszuh69m3jbmo7lu1K9f9DlffKTl0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DRVBbGl9FyvV5+LLzZrBwWbiEI7wYovreIYh76cdKiGhurA78q/Tj005Bky/4wfhWvABh6lVz/R4PoYokLLKUZMIncggpASW50UgHvXC8uYdHeqXr/VtBzCMUMgG3Y1fyvjgx+QadyR0piAj4eOURg1tTukNOE5tBU8euTT2t7o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m3E1Be57; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8368C433C7; Thu, 29 Feb 2024 15:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709221737; bh=+fv1LPuaO3JTr5Lszuh69m3jbmo7lu1K9f9DlffKTl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m3E1Be57eLLRArCxNRg61A/O//oceVyBUTHRtMBl63v4OnH/U3v8HO0duTaaOyofh rWyoombPTuixp8pYtLgk0WFvYBCNkX5oPDCl7UdCXzLwpBItvNg2ejg66lPwlcoFhE N56rs45yWd+E5RJ57GRoYkl4ny534R928bggwV+eIefzq4MUegzuGsyHHxBDpkQJnb 8qXKcd60pQDTen0cVhvWdRI2LnkwpbsX3c8IypEUCk88U0bkEkvytpfLJ7kvXH1x1f bj/58TugtMOV2kAflpybcQx5cIES8Gfed9+zXKt2yrEqk3/XIoK7zrkjGoOzb7p+4F 18A02WvHIa6hQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Rob Clark , Sasha Levin , robdclark@gmail.com, quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org, airlied@gmail.com, daniel@ffwll.ch, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.7 03/26] Revert "drm/msm/gpu: Push gpu lock down past runpm" Date: Thu, 29 Feb 2024 10:48:22 -0500 Message-ID: <20240229154851.2849367-3-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240229154851.2849367-1-sashal@kernel.org> References: <20240229154851.2849367-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7.6 Content-Transfer-Encoding: 8bit From: Rob Clark [ Upstream commit 917e9b7c2350e3e53162fcf5035e5f2d68e2cbed ] 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 Patchwork: https://patchwork.freedesktop.org/patch/573835/ Signed-off-by: Sasha Levin --- 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 7f64c66673002..5c10b559a5957 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -749,12 +749,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); /* @@ -779,11 +781,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 95257ab0185dc..a7e152f659a2c 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++) { @@ -34,8 +32,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