Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Maxime Ripard <mripard@kernel.org>
Cc: intel-gfx@lists.freedesktop.org,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Dave Airlie <airlied@redhat.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	dri-devel@lists.freedesktop.org,
	Jani Nikula <jani.nikula@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH v2 1/4] drm/dp: Add a way to init/add a connector in separate steps
Date: Fri, 29 Nov 2024 18:12:01 +0200	[thread overview]
Message-ID: <Z0nn0VzawSCdOCKY@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <20241129-wild-cobra-of-thunder-829d1f@houat>

On Fri, Nov 29, 2024 at 03:46:28PM +0100, Maxime Ripard wrote:
> On Fri, Nov 29, 2024 at 04:26:01PM +0200, Imre Deak wrote:
> > Adding more people from DRM core domain. Any comment, objection to this
> > change?
> > 
> > On Tue, Nov 26, 2024 at 06:18:56PM +0200, Imre Deak wrote:
> > > Atm when the connector is added to the drm_mode_config::connector_list,
> > > the connector may not be fully initialized yet. This is not a problem
> > > for user space, which will see the connector only after it's registered
> > > later, it could be a problem for in-kernel users looking up connectors
> > > via the above list.
> 
> It could be, or it actually is a problem? If so, in what situation?

An actual problem is that after an MST connector is created and added to
the connector list, the connector could be probed without the connector
being fully initialized during a hotplug event handling along with all
the other connectors on the list. The connector's helper functions could
be still unset leading to a NULL deref while trying to call the
connector's detect/detect_ctx callbacks, or if these callbacks are set
already, the detect handler could see a connector which is not yet
initialized fully.

> > > To resolve the above issue, add a way to separately initialize the DRM
> > > core specific parts of the connector and add it to the above list. This
> > > will move adding the connector to the list after the properties on the
> > > connector have been added, this is ok since these steps don't have a
> > > dependency.
> > >
> > > v2: (Jani)
> > > - Let initing DDC as well via drm_connector_init_core().
> > > - Rename __drm_connector_init to drm_connector_init_core_and_add().
> > > 
> > > Cc: Jani Nikula <jani.nikula@intel.com>
> > > Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> (v1)
> > > Signed-off-by: Imre Deak <imre.deak@intel.com>
> 
> If we do have an actual problem to solve, we'll need kunit tests too.

I don't have a good idea for this. The problem is not in a parituclar
function, rather in the order a connector is initialized and added to
the connector list. The above is an actual problem though, so I don't
think fixing that should be blocked by this.

> 
> Maxime

  parent reply	other threads:[~2024-11-29 16:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 16:18 [PATCH v2 0/4] drm/dp: Expose only a properly inited connector Imre Deak
2024-11-26 16:18 ` [PATCH v2 1/4] drm/dp: Add a way to init/add a connector in separate steps Imre Deak
2024-11-29 14:26   ` Imre Deak
2024-11-29 14:46     ` Maxime Ripard
2024-11-29 15:58       ` Jani Nikula
2024-12-02 10:45         ` Maxime Ripard
2024-11-29 16:12       ` Imre Deak [this message]
2024-12-02 10:48         ` Maxime Ripard
2024-12-02 12:07           ` Jani Nikula
2024-12-02 13:24             ` Imre Deak
2024-12-02 15:07               ` Maxime Ripard
2024-12-02 15:31                 ` Imre Deak
2024-12-02 15:06             ` Maxime Ripard
2024-12-02 15:44               ` Jani Nikula
2024-12-03  9:36                 ` Maxime Ripard
2024-12-03 11:17                   ` Jani Nikula
2024-12-02 16:35   ` Simona Vetter
2024-12-02 20:07     ` Imre Deak
2024-12-06 20:48       ` Simona Vetter
2024-11-26 16:18 ` [PATCH v2 2/4] drm/i915/dp_mst: Expose a connector to kernel users after it's properly initialized Imre Deak
2024-11-26 16:18 ` [PATCH v2 3/4] drm/i915/dp_mst: Fix error handling while adding a connector Imre Deak
2024-11-26 16:18 ` [PATCH v2 4/4] drm/i915/dp_mst: Use intel_connector vs. drm_connector pointer in intel_dp_mst.c Imre Deak
2024-11-26 16:51 ` ✗ Fi.CI.SPARSE: warning for drm/dp: Expose only a properly inited connector Patchwork
2024-11-26 17:05 ` ✓ i915.CI.BAT: success " Patchwork
2024-11-26 18:30 ` ✗ i915.CI.Full: failure " Patchwork

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=Z0nn0VzawSCdOCKY@ideak-desk.fi.intel.com \
    --to=imre.deak@intel.com \
    --cc=airlied@redhat.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --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