From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Luca Coelho <luciano.coelho@intel.com>
Cc: <intel-gfx@lists.freedesktop.org>, <ville.syrjala@intel.com>
Subject: Re: [PATCH 2/2] drm/i915: move uapi.event outside spinlock in intel_crtc_vblank_work
Date: Tue, 28 May 2024 12:58:11 -0400 [thread overview]
Message-ID: <ZlYNIwxyv-6eA2bc@intel.com> (raw)
In-Reply-To: <20240528112901.476068-3-luciano.coelho@intel.com>
On Tue, May 28, 2024 at 02:29:01PM +0300, Luca Coelho wrote:
> In intel_crtc_vblank_work(), we access uapi.event before grabbing the
> event_lock spinlock, but modify it inside the spinlock block. This
> causes some static analyzers to get confused and issue a warning.
>
> The uapi.event value is not protected by the event_lock, so we can
> safely move it out of the protected block to prevent false positives.
My first reaction was to think about moving the lock before the if,
but then I went down to see the event_lock definition and usage in drm
and see some other precedences on this and agree this is safe and
better.
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_crtc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
> index ca6dc1dc56c8..bf6e74e99f5c 100644
> --- a/drivers/gpu/drm/i915/display/intel_crtc.c
> +++ b/drivers/gpu/drm/i915/display/intel_crtc.c
> @@ -411,8 +411,8 @@ static void intel_crtc_vblank_work(struct kthread_work *base)
> if (crtc_state->uapi.event) {
> spin_lock_irq(&crtc->base.dev->event_lock);
> drm_crtc_send_vblank_event(&crtc->base, crtc_state->uapi.event);
> - crtc_state->uapi.event = NULL;
> spin_unlock_irq(&crtc->base.dev->event_lock);
> + crtc_state->uapi.event = NULL;
> }
>
> trace_intel_crtc_vblank_work_end(crtc);
> --
> 2.39.2
>
next prev parent reply other threads:[~2024-05-28 16:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 11:28 [PATCH 0/2] drm/i915: prevent some static analyzer warnings Luca Coelho
2024-05-28 11:29 ` [PATCH 1/2] drm/i915/bios: double check array-boundary in parse_sdvo_lvds_data Luca Coelho
2024-05-28 17:01 ` Rodrigo Vivi
2024-05-28 11:29 ` [PATCH 2/2] drm/i915: move uapi.event outside spinlock in intel_crtc_vblank_work Luca Coelho
2024-05-28 16:58 ` Rodrigo Vivi [this message]
2024-05-28 12:46 ` ✗ Fi.CI.SPARSE: warning for drm/i915: prevent some static analyzer warnings Patchwork
2024-05-28 12:54 ` ✓ Fi.CI.BAT: success " Patchwork
2024-05-29 3:28 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-05-29 11:47 ` Luca Coelho
2024-05-30 8:56 ` Illipilli, TejasreeX
2024-05-30 5:53 ` ✓ Fi.CI.IGT: success " Patchwork
2024-05-30 10:48 ` [PATCH 0/2] " Kandpal, Suraj
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=ZlYNIwxyv-6eA2bc@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=luciano.coelho@intel.com \
--cc=ville.syrjala@intel.com \
/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