From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
To: "Philipp Stanner" <phasta@kernel.org>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Matthew Brost" <matthew.brost@intel.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Mario Limonciello (AMD)" <superm1@kernel.org>,
"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
"Pierre-Eric Pelloux-Prayer" <pierre-eric.pelloux-prayer@amd.com>,
"Gustavo Padovan" <gustavo.padovan@collabora.com>,
"Chris Wilson" <chris@chris-wilson.co.uk>,
"Luben Tuikov" <ltuikov89@gmail.com>,
"Shashank Sharma" <shashank.sharma@amd.com>,
"Paul E . McKenney" <paulmck@kernel.org>,
"Gary Guo" <gary@garyguo.net>
Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
stable@vger.kernel.org
Subject: Re: [PATCH 3/3] drm/amdgpu: Hot-fix timestamp misordering
Date: Fri, 27 Nov 2026 09:57:47 +0000 [thread overview]
Message-ID: <71b2506f-8534-468e-881d-1abf8f8224d9@igalia.com> (raw)
In-Reply-To: <20261126172046.2473303-5-phasta@kernel.org>
On 26/11/2026 17:20, Philipp Stanner wrote:
> dma_fence timestamps could so far be written and read without any memory
> ordering, a bug that presumably got overlooked because x86 is strongly
> ordered.
>
> Hot-fix amdgpu's manual timestamp evaluation until we found a more
> suitable solution for mainline linux.
>
> Cc: stable@vger.kernel.org
> Fixes: af0b54167009 ("drm/amdgpu: Convert to common fdinfo format v5")
Not sure the fixes target is strictly correct since timestamp access
goes even further back, but I guess it is good enough for GPU stats.
Please just add some sort of an impact assessment and bug description to
the commit text. With that:
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Regards,
Tvrtko
> Signed-off-by: Philipp Stanner <phasta@kernel.org>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index 2f0349233695..415f23aa08a0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -177,11 +177,11 @@ static ktime_t amdgpu_ctx_fence_time(struct dma_fence *fence)
>
> /* When the fence is not even scheduled it can't have spend time */
> s_fence = to_drm_sched_fence(fence);
> - if (!test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &s_fence->scheduled.flags))
> + if (!test_bit_acquire(DMA_FENCE_FLAG_TIMESTAMP_BIT, &s_fence->scheduled.flags))
> return ns_to_ktime(0);
>
> /* When it is still running account how much already spend */
> - if (!test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &s_fence->finished.flags))
> + if (!test_bit_acquire(DMA_FENCE_FLAG_TIMESTAMP_BIT, &s_fence->finished.flags))
> return ktime_sub(ktime_get(), s_fence->scheduled.timestamp);
>
> return ktime_sub(s_fence->finished.timestamp,
next prev parent reply other threads:[~2026-11-27 9:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 17:20 [PATCH 0/3] dma-fence: Properly order timestamps Philipp Stanner
2026-11-26 17:20 ` [PATCH 1/3] dma-buf: dma-fence: Hot-fix timestamp misordering Philipp Stanner
2026-11-27 9:43 ` Tvrtko Ursulin
2026-11-26 17:20 ` [PATCH 2/3] drm/sched: " Philipp Stanner
2026-11-27 9:55 ` Tvrtko Ursulin
2026-11-26 17:20 ` [PATCH 3/3] drm/amdgpu: " Philipp Stanner
2026-11-27 9:57 ` Tvrtko Ursulin [this message]
2026-11-27 10:30 ` Philipp Stanner
2026-11-27 11:45 ` Danilo Krummrich
2026-11-27 11:34 ` [PATCH 0/3] dma-fence: Properly order timestamps Danilo Krummrich
2026-11-27 11:43 ` Philipp Stanner
2026-11-27 11:53 ` Danilo Krummrich
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=71b2506f-8534-468e-881d-1abf8f8224d9@igalia.com \
--to=tvrtko.ursulin@igalia.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=chris@chris-wilson.co.uk \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=gustavo.padovan@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=ltuikov89@gmail.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=mripard@kernel.org \
--cc=paulmck@kernel.org \
--cc=phasta@kernel.org \
--cc=pierre-eric.pelloux-prayer@amd.com \
--cc=shashank.sharma@amd.com \
--cc=simona@ffwll.ch \
--cc=stable@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=superm1@kernel.org \
--cc=tzimmermann@suse.de \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®