From: sashiko-bot@kernel.org
To: "Maarten Lankhorst" <dev@lankhorst.se>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 02/10] drm/vblank: Add a 2-stage version of drm_crtc_arm_vblank_event
Date: Thu, 02 Jul 2026 07:35:35 +0000 [thread overview]
Message-ID: <20260702073536.054121F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260702072154.171324-3-dev@lankhorst.se>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Insufficient memory barrier for ordering MMIO hardware programming against vblank event arming
--
commit e7abec27222d12389651c409a1f108b4e73b0d3e
Author: Maarten Lankhorst <dev@lankhorst.se>
drm/vblank: Add a 2-stage version of drm_crtc_arm_vblank_event
This patch introduces drm_crtc_prepare_arm_vblank_event() and
drm_crtc_arm_prepared_vblank_event() to allow arming vblank events in two
stages. This avoids taking vblank-related spinlocks with interrupts disabled
during hardware programming, which is useful for PREEMPT_RT kernels.
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index f90fb2d13e423..b52e0215312f8 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
[ ... ]
> +void drm_crtc_arm_prepared_vblank_event(struct drm_pending_vblank_event *e)
> +{
> + WARN_ON(!e->postponed);
> +
> + /* Ensure previous writes are visible */
> + smp_wmb();
> +
> + /* remove the flag to be processed as a normal event */
> + WRITE_ONCE(e->postponed, false);
> +}
[Severity: Medium]
Is smp_wmb() sufficient to order prior MMIO hardware programming against this
memory write to e->postponed?
If the intent is to order the prior hardware programming (MMIO writes) against
setting e->postponed to false, smp_wmb() is strictly a CPU-to-CPU barrier for
normal memory. On weakly-ordered architectures (like ARM64), the CPU can
reorder the normal memory write (postponed = false) before the MMIO writes are
issued to the bus, potentially causing the vblank interrupt handler to process
the event before the hardware programming is complete.
Does this need a full wmb() to correctly order I/O against memory?
Conversely, if it were intended for CPU memory ordering, the reader in
drm_handle_vblank_events() lacks a matching smp_rmb(). Since all other CPU
memory fields are protected by event_lock, there shouldn't be lockless CPU
memory writes to order here.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260702072154.171324-1-dev@lankhorst.se?part=2
next prev parent reply other threads:[~2026-07-02 7:35 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 7:21 [PATCH 00/10] drm/intel/display: Changes required to make vblank evasion PREEMPT_RT safe Maarten Lankhorst
2026-07-02 7:21 ` [PATCH 01/10] drm/vblank_work: Add methods to schedule vblank_work in 2 stages Maarten Lankhorst
2026-07-02 7:32 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 02/10] drm/vblank: Add a 2-stage version of drm_crtc_arm_vblank_event Maarten Lankhorst
2026-07-02 7:35 ` sashiko-bot [this message]
2026-07-02 7:21 ` [PATCH 03/10] drm/intel/display: Make intel_crtc_arm_vblank_event static Maarten Lankhorst
2026-07-10 14:20 ` Ville Syrjälä
2026-07-02 7:21 ` [PATCH 04/10] drm/intel/display: Convert vblank event handling to 2-stage arming Maarten Lankhorst
2026-07-02 7:37 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 05/10] drm/i915/display: Move vblank put until after critical section Maarten Lankhorst
2026-07-02 7:34 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 06/10] drm/i915/display: Remove locking from intel_vblank_evade " Maarten Lankhorst
2026-07-02 7:36 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 07/10] drm/i915/display: Handle vlv dsi workaround in scanline_in_safe_range too Maarten Lankhorst
2026-07-02 7:30 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 08/10] drm/i915: Use preempt_disable/enable_rt() where recommended Maarten Lankhorst
2026-07-02 7:36 ` sashiko-bot
2026-07-02 7:21 ` [PATCH 09/10] drm/i915/display: Make get_vblank_counter use intel_de_read_fw() Maarten Lankhorst
2026-07-02 7:43 ` sashiko-bot
2026-07-10 14:34 ` Ville Syrjälä
2026-07-02 7:21 ` [PATCH 10/10] drm/i915/display: Do not take uncore lock in i915_get_vblank_counter Maarten Lankhorst
2026-07-10 14:19 ` Ville Syrjälä
2026-07-02 7:56 ` ✗ CI.checkpatch: warning for drm/intel/display: Changes required to make vblank evasion PREEMPT_RT safe Patchwork
2026-07-02 7:58 ` ✓ CI.KUnit: success " Patchwork
2026-07-02 8:33 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-02 10:04 ` ✓ i915.CI.BAT: " Patchwork
2026-07-03 2:09 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-07-03 2:17 ` ✗ i915.CI.Full: " Patchwork
2026-07-10 14:43 ` [PATCH 00/10] " Ville Syrjälä
2026-07-13 10:59 ` Maarten Lankhorst
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=20260702073536.054121F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dev@lankhorst.se \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 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.