From: Eric Anholt <eric@anholt.net> To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>, Jordan Crouse <jcrouse@codeaurora.org> Cc: linux-kernel@vger.kernel.org, Eric Anholt <eric@anholt.net>, stable@vger.kernel.org Subject: [PATCH 2/3] drm/msm: Fix races managing the OOB state for timestamp vs timestamps. Date: Wed, 27 Jan 2021 15:39:45 -0800 [thread overview] Message-ID: <20210127233946.1286386-2-eric@anholt.net> (raw) In-Reply-To: <20210127233946.1286386-1-eric@anholt.net> Now that we're not racing with GPU setup, also fix races of timestamps against other timestamps. In CI, we were seeing this path trigger timeouts on setting the GMU bit, especially on the first set of tests right after boot (it's probably easier to lose the race than one might think, given that we start many tests in parallel, and waiting for NFS to page in code probably means that lots of tests hit the same point of screen init at the same time). Signed-off-by: Eric Anholt <eric@anholt.net> Cc: stable@vger.kernel.org # v5.9 --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 7424a70b9d35..e8f0b5325a7f 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -1175,6 +1175,9 @@ static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); + static DEFINE_MUTEX(perfcounter_oob); + + mutex_lock(&perfcounter_oob); /* Force the GPU power on so we can read this register */ a6xx_gmu_set_oob(&a6xx_gpu->gmu, GMU_OOB_PERFCOUNTER_SET); @@ -1183,6 +1186,7 @@ static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) REG_A6XX_RBBM_PERFCTR_CP_0_HI); a6xx_gmu_clear_oob(&a6xx_gpu->gmu, GMU_OOB_PERFCOUNTER_SET); + mutex_unlock(&perfcounter_oob); return 0; } -- 2.30.0
WARNING: multiple messages have this Message-ID (diff)
From: Eric Anholt <eric@anholt.net> To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>, Jordan Crouse <jcrouse@codeaurora.org> Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 2/3] drm/msm: Fix races managing the OOB state for timestamp vs timestamps. Date: Wed, 27 Jan 2021 15:39:45 -0800 [thread overview] Message-ID: <20210127233946.1286386-2-eric@anholt.net> (raw) In-Reply-To: <20210127233946.1286386-1-eric@anholt.net> Now that we're not racing with GPU setup, also fix races of timestamps against other timestamps. In CI, we were seeing this path trigger timeouts on setting the GMU bit, especially on the first set of tests right after boot (it's probably easier to lose the race than one might think, given that we start many tests in parallel, and waiting for NFS to page in code probably means that lots of tests hit the same point of screen init at the same time). Signed-off-by: Eric Anholt <eric@anholt.net> Cc: stable@vger.kernel.org # v5.9 --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 7424a70b9d35..e8f0b5325a7f 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -1175,6 +1175,9 @@ static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); + static DEFINE_MUTEX(perfcounter_oob); + + mutex_lock(&perfcounter_oob); /* Force the GPU power on so we can read this register */ a6xx_gmu_set_oob(&a6xx_gpu->gmu, GMU_OOB_PERFCOUNTER_SET); @@ -1183,6 +1186,7 @@ static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) REG_A6XX_RBBM_PERFCTR_CP_0_HI); a6xx_gmu_clear_oob(&a6xx_gpu->gmu, GMU_OOB_PERFCOUNTER_SET); + mutex_unlock(&perfcounter_oob); return 0; } -- 2.30.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2021-01-27 23:42 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-27 23:39 [PATCH 1/3] drm/msm: Fix race of GPU init vs timestamp power management Eric Anholt 2021-01-27 23:39 ` Eric Anholt 2021-01-27 23:39 ` Eric Anholt [this message] 2021-01-27 23:39 ` [PATCH 2/3] drm/msm: Fix races managing the OOB state for timestamp vs timestamps Eric Anholt 2021-01-28 18:47 ` Jordan Crouse 2021-01-28 18:47 ` Jordan Crouse 2021-01-28 20:40 ` Rob Clark 2021-01-28 20:40 ` Rob Clark 2021-01-27 23:39 ` [PATCH 3/3] drm/msm: Clean up GMU OOB set/clear handling Eric Anholt 2021-01-27 23:39 ` Eric Anholt 2021-01-28 1:05 ` [PATCH 3/3 v2] " Eric Anholt 2021-01-28 1:05 ` Eric Anholt 2021-01-28 18:48 ` [PATCH 3/3] " Jordan Crouse 2021-01-28 18:47 ` [PATCH 1/3] drm/msm: Fix race of GPU init vs timestamp power management Jordan Crouse 2021-01-28 19:17 ` Eric Anholt 2021-01-29 23:48 ` Jordan Crouse 2021-01-29 23:48 ` Jordan Crouse
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210127233946.1286386-2-eric@anholt.net \ --to=eric@anholt.net \ --cc=dri-devel@lists.freedesktop.org \ --cc=freedreno@lists.freedesktop.org \ --cc=jcrouse@codeaurora.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=robdclark@gmail.com \ --cc=sean@poorly.run \ --cc=stable@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.