From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Simon Ser <contact@emersion.fr>
Cc: dri-devel@lists.freedesktop.org,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Jonas Ådahl" <jadahl@redhat.com>,
stable@vger.kernel.org
Subject: Re: [PATCH 2/2] drm/connector: send hotplug uevent on connector cleanup
Date: Tue, 18 Oct 2022 12:24:53 +0300 [thread overview]
Message-ID: <Y05w5U0CAbrdA10S@intel.com> (raw)
In-Reply-To: <20221017153150.60675-2-contact@emersion.fr>
On Mon, Oct 17, 2022 at 03:32:01PM +0000, Simon Ser wrote:
> A typical DP-MST unplug removes a KMS connector. However care must
> be taken to properly synchronize with user-space. The expected
> sequence of events is the following:
>
> 1. The kernel notices that the DP-MST port is gone.
> 2. The kernel marks the connector as disconnected, then sends a
> uevent to make user-space re-scan the connector list.
> 3. User-space notices the connector goes from connected to disconnected,
> disables it.
> 4. Kernel handles the the IOCTL disabling the connector. On success,
> the very last reference to the struct drm_connector is dropped and
> drm_connector_cleanup() is called.
> 5. The connector is removed from the list, and a uevent is sent to tell
> user-space that the connector disappeared.
>
> The very last step was missing. As a result, user-space thought the
> connector still existed and could try to disable it again. Since the
> kernel no longer knows about the connector, that would end up with
> EINVAL and confused user-space.
So is the uevent sent by the mst delayed destroy work
useless now, or what is going on there?
>
> Fix this by sending a hotplug uevent from drm_connector_cleanup().
>
> Signed-off-by: Simon Ser <contact@emersion.fr>
> Cc: stable@vger.kernel.org
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: Jonas Ådahl <jadahl@redhat.com>
> ---
> drivers/gpu/drm/drm_connector.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index e3142c8142b3..90dad87e9ad0 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -582,6 +582,9 @@ void drm_connector_cleanup(struct drm_connector *connector)
> mutex_destroy(&connector->mutex);
>
> memset(connector, 0, sizeof(*connector));
> +
> + if (dev->registered)
> + drm_sysfs_hotplug_event(dev);
> }
> EXPORT_SYMBOL(drm_connector_cleanup);
>
> --
> 2.38.0
>
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2022-10-18 9:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221017153150.60675-1-contact@emersion.fr>
2022-10-17 15:32 ` [PATCH 2/2] drm/connector: send hotplug uevent on connector cleanup Simon Ser
2022-10-17 15:34 ` Jonas Ådahl
2022-10-17 19:08 ` Lyude Paul
2022-10-18 9:24 ` Ville Syrjälä [this message]
2022-10-18 9:26 ` Simon Ser
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=Y05w5U0CAbrdA10S@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=contact@emersion.fr \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jadahl@redhat.com \
--cc=stable@vger.kernel.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