From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: Daniel Stone <daniel@fooishbar.org>, Simona Vetter <simona@ffwll.ch>
Cc: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Stanislav Lisovskiy" <stanislav.lisovskiy@intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Louis Chauvet" <louis.chauvet@bootlin.com>,
"Haneen Mohammed" <hamohammed.sa@gmail.com>,
"Melissa Wen" <melissa.srw@gmail.com>,
"Daniel Stone" <daniel.stone@collabora.com>,
"Ian Forbes" <ian.forbes@broadcom.com>,
"Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
kernel@collabora.com, wayland-devel@lists.freedesktop.org,
"Marius Vlad" <marius.vlad@collabora.com>
Subject: Re: [PATCH v9 2/2] drm: Send per-connector hotplug events
Date: Fri, 22 May 2026 15:05:42 +0200 [thread overview]
Message-ID: <ZSuf-ENwSXWZM2puVBDxGQ@collabora.com> (raw)
In-Reply-To: <CAPj87rNHsa2TKMcSMHeq3M7ZfyZp0P_i3FtjxQp8Qk53UwXGLQ@mail.gmail.com>
+To: Simona Vetter, who wrote two of the commits relevant to this question.
On Thursday, 21 May 2026 17:00:17 Central European Summer Time Daniel Stone wrote:
> Hi,
>
> On Wed, 22 Apr 2026 at 19:24, Nicolas Frattaroli
> <nicolas.frattaroli@collabora.com> wrote:
> > @@ -760,16 +760,12 @@ static void output_poll_execute(struct work_struct *work)
> > struct drm_connector *connector;
> > struct drm_connector_list_iter conn_iter;
> > enum drm_connector_status old_status;
> > - bool repoll = false, changed;
> > + bool repoll = false, changed = false;
> > u64 old_epoch_counter;
> >
> > if (!dev->mode_config.poll_enabled)
> > return;
> >
> > - /* Pick up any changes detected by the probe functions. */
> > - changed = dev->mode_config.delayed_event;
> > - dev->mode_config.delayed_event = false;
> > -
> > if (!drm_kms_helper_poll) {
> > if (dev->mode_config.poll_running) {
> > drm_kms_helper_disable_hpd(dev);
> > @@ -844,8 +841,15 @@ static void output_poll_execute(struct work_struct *work)
> > mutex_unlock(&dev->mode_config.mutex);
> >
> > out:
> > + /* Pick up any changes detected by the probe functions. */
> > + if (dev->mode_config.delayed_event) {
>
> Not your doing, as it was just the same before, but doesn't this read
> need to be protected by the mode_config mutex?
It looks like the fuzzy meaning of the mode_config.mutex came to
bite here. It is set to true with the lock held in
drm_helper_probe_single_connector_modes(), but set to false in this
function without the lock, and always read without the lock
(drm_kms_helper_poll_enable(), reschedule_output_poll_work()). Some
of these calls happen in paths where it might be inconvenient to take
a lock this coarse.
Specifically, drm_helper_probe_single_connector_modes() has this
comment right before setting delayed_event to true:
/*
* The hotplug event code might call into the fb
* helpers, and so expects that we do not hold any
* locks. Fire up the poll struct instead, it will
* disable itself again.
*/
So there was a problem with accessing parts under a lock before,
so if we're reintroducing the coarse lock wherever the boolean is
accessed we might be going backwards here.
The relevant commits are:
Commit 162b6a57ac50 (drm/probe-helper: don't lose hotplug event, 2015-01-21)
Commit ed293f775493 (drm/sysfs: Send out uevent when connector->force changes, 2015-11-19)
One obvious move would be to change it to an atomic so at least we
punch through any caches, but that doesn't help if the intended
design was that it's in a consistent state with the rest of
mode_config. Though I don't think that's the case?
Kind regards,
Nicolas Frattaroli
>
> The series is very satisfying otherwise; both patches are:
> Reviewed-by: Daniel Stone <daniels@collabora.com>
>
> Cheers,
> Daniel
>
next prev parent reply other threads:[~2026-05-22 13:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-22 18:24 [PATCH v9 0/2] Pass down hot-plug CONNECTOR ID to user-space Nicolas Frattaroli
2026-04-22 18:24 ` [PATCH v9 1/2] drm/connector: Fix epoch_counter docs to reflect reality Nicolas Frattaroli
2026-04-22 18:24 ` [PATCH v9 2/2] drm: Send per-connector hotplug events Nicolas Frattaroli
2026-05-21 15:00 ` Daniel Stone
2026-05-22 13:05 ` Nicolas Frattaroli [this message]
2026-05-22 17:58 ` Daniel Stone
2026-05-22 18:10 ` Ville Syrjälä
2026-05-22 19:28 ` Nicolas Frattaroli
2026-05-22 19:47 ` Daniel Stone
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=ZSuf-ENwSXWZM2puVBDxGQ@collabora.com \
--to=nicolas.frattaroli@collabora.com \
--cc=airlied@gmail.com \
--cc=daniel.stone@collabora.com \
--cc=daniel@fooishbar.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=ian.forbes@broadcom.com \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=louis.chauvet@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marius.vlad@collabora.com \
--cc=melissa.srw@gmail.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=stanislav.lisovskiy@intel.com \
--cc=tzimmermann@suse.de \
--cc=ville.syrjala@linux.intel.com \
--cc=wayland-devel@lists.freedesktop.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: 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®