public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alyssa Rosenzweig <alyssa@rosenzweig.io>
To: j@jannau.net
Cc: Sasha Finkelstein <fnkl.kernel@gmail.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Neal Gompa <neal@gompa.dev>, Dmitry Baryshkov <lumag@kernel.org>,
	dri-devel@lists.freedesktop.org, asahi@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] drm: adp: Handle drm_crtc_vblank_get() errors
Date: Wed, 16 Apr 2025 16:58:18 -0400	[thread overview]
Message-ID: <aAAZ6iIUtYcfpcdm@blossom> (raw)
In-Reply-To: <20250416-drm_adp_fixes-v1-2-772699f13293@jannau.net>

> -	spin_lock_irqsave(&crtc->dev->event_lock, flags);
>  	if (crtc->state->event) {
> -		drm_crtc_vblank_get(crtc);
> -		adp->event = crtc->state->event;
> +		spin_lock_irqsave(&crtc->dev->event_lock, flags);
> +
> +		if (drm_crtc_vblank_get(crtc) != 0)
> +			drm_crtc_send_vblank_event(crtc, crtc->state->event);
> +		else
> +			adp->event = crtc->state->event;
> +
> +		spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
>  	}
>  	crtc->state->event = NULL;
> -	spin_unlock_irqrestore(&crtc->dev->event_lock, flags);

Kind of confused about

>  	crtc->state->event = NULL;

now being out of the lock. Should we set to NULL in the if, since
if we don't take the if, we know event is already NULL? Or should we
hold the lock for the whole time, the way the code did before your
change? I'm not sure between the two, but the in-between here smells
wrong.

  reply	other threads:[~2025-04-16 20:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-16 20:25 [PATCH 0/4] Apple Display Pipe driver fixes Janne Grunau via B4 Relay
2025-04-16 20:25 ` [PATCH 1/4] drm: adp: Use spin_lock_irqsave for drm device event_lock Janne Grunau via B4 Relay
2025-04-16 20:56   ` Alyssa Rosenzweig
2025-04-16 20:25 ` [PATCH 2/4] drm: adp: Handle drm_crtc_vblank_get() errors Janne Grunau via B4 Relay
2025-04-16 20:58   ` Alyssa Rosenzweig [this message]
2025-04-16 22:39     ` Janne Grunau
2025-04-16 20:25 ` [PATCH 3/4] drm: adp: Enable vblank interrupts in crtc's .atomic_enable Janne Grunau via B4 Relay
2025-04-16 20:59   ` Alyssa Rosenzweig
2025-04-16 20:25 ` [PATCH 4/4] drm: adp: Remove pointless irq_lock spin lock Janne Grunau via B4 Relay
2025-04-16 20:59   ` Alyssa Rosenzweig
2025-04-16 20:54 ` [PATCH 0/4] Apple Display Pipe driver fixes Alyssa Rosenzweig
2025-04-16 22:04   ` Janne Grunau

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=aAAZ6iIUtYcfpcdm@blossom \
    --to=alyssa@rosenzweig.io \
    --cc=airlied@gmail.com \
    --cc=asahi@lists.linux.dev \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fnkl.kernel@gmail.com \
    --cc=j@jannau.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neal@gompa.dev \
    --cc=simona@ffwll.ch \
    --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