mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Harrison <John.Harrison@Igalia.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: "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>,
	"Harry Wentland" <harry.wentland@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>,
	"Rodrigo Siqueira" <siqueira@igalia.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Laurent Pinchart" <laurent.pinchart+renesas@ideasonboard.com>,
	"Tomi Valkeinen" <tomi.valkeinen+renesas@ideasonboard.com>,
	"Kieran Bingham" <kieran.bingham+renesas@ideasonboard.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
	"Maíra Canal" <mcanal@igalia.com>,
	"Raspberry Pi Kernel Maintenance" <kernel-list@raspberrypi.com>,
	"Louis Chauvet" <louis.chauvet@bootlin.com>,
	"Mihail Atanassov" <mihail.atanassov@arm.com>,
	"Eric Anholt" <eric@anholt.net>,
	"Rob Clark" <robin.clark@oss.qualcomm.com>,
	"Brian Starkey" <brian.starkey@arm.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	amd-gfx@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v7 8/9] drm: writeback: clean up writeback connectors in drm_connector_cleanup()
Date: Thu, 22 Oct 2026 08:52:34 -0700	[thread overview]
Message-ID: <b93caf6d-1277-4e86-98a6-139f9cf8fb4c@Igalia.com> (raw)
In-Reply-To: <gjeqgaewd5omwhdmepqcsrjq3pph722j6rjtoedot5rqsjsaht@h55ako6z42dt>

On 10/22/26 04:59, Dmitry Baryshkov wrote:
> On Wed, Oct 21, 2026 at 11:22:48AM -0700, John Harrison wrote:
>> On 10/19/26 06:12, Dmitry Baryshkov wrote:
>>> Only drmm_writeback_connector_init() registers
>>> drm_writeback_connector_cleanup(). Connectors set up with
>>> drm_writeback_connector_init() (amdgpu, komeda, malidp, rcar-du, vc4)
>>> never drop the formats blob or free the jobs still on the queue, leaking
>>> them together with their framebuffer and fence references.
>>>
>>> Call drm_writeback_connector_cleanup() from drm_connector_cleanup() for
>>> writeback connectors, the same way the HDMI audio and SCDC state is torn
>>> down there, so it runs for both kinds of initialization. The drmm action
>>> now just wraps it. Clearing the blob pointer makes the second invocation
>>> a no-op and also covers drm_connector_cleanup() being called after a
>>> failed __drm_writeback_connector_init().
>>>
>>> Fixes: 935774cd71fe ("drm: Add writeback connector type")
>>> Assisted-by: LLM
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>>> ---
>>>    drivers/gpu/drm/drm_connector.c     |  3 +++
>>>    drivers/gpu/drm/drm_crtc_internal.h |  3 +++
>>>    drivers/gpu/drm/drm_writeback.c     | 30 +++++++++++++++++++++++-------
>>>    3 files changed, 29 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
>>> index 893716a9e489..1c2bef5e0636 100644
>>> --- a/drivers/gpu/drm/drm_connector.c
>>> +++ b/drivers/gpu/drm/drm_connector.c
>>> @@ -929,6 +929,9 @@ void drm_connector_cleanup(struct drm_connector *connector)
>>>    	if (connector->hdmi.scdc_work_initialized)
>>>    		cancel_delayed_work_sync(&connector->hdmi.scdc_work);
>>> +	if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
>>> +		drm_writeback_connector_cleanup(connector);
>>> +
>> Could this be done via a new connector->funcs->cleanup() vfunc or something?
>> Set that inside the writeback init path and it is guaranteed to then only be
>> called for objects that explicitly requested it. That would be more robust
>> and would keep sashiko happy. It would also keep a writeback connector
>> specific declaration out of the crtc_internal header.
> I'd rather not do it. These are the generic properties of every
> writeback connector. The answer to Sahiko would be that yes, currently
> all DRM_MODE_CONNECTOR_WRITEBACK use drm_writeback_connector. Once that
> is changed for the Intel driver, the condition might/would change here.
Except for the KUNIT selftests at least. I'm not sure about the HDMI 
issues but Sashiko is correct that some of the tests hack up partial 
structures and I can reproduce a bunch of the AMD ones hitting 
out-of-bounds accesses with the 'connector_type' based clean up. Locally 
hacking it to just add an extra bool that is only set in the full init 
path fixes the issue. Using a vfunc cleanup member would be nicer than 
having a specific writeback flag ontop of the connector type. The other 
option is to re-work all the selftests to allocate full writeback 
connector objects in the first place. Again, having an explicitly set 
vfunc would fix all those and just be more robust in general.

Note, it's not just the audio selftests that go boom. E.g. 
dm_test_crtc_set_crc_source_dprx_no_connector, 
dm_test_dmub_hpd_callback_unknown_type_match and 
dm_test_register_hpd_handlers_valid all fail. I've only tried the AMD 
ones at the moment, I'm not able to run the VC4 tests.

Note further, there are a lot of unrelated failures in the AMD selftests 
at the moment :(. I had to fix a bunch of other issues to get a clean 
run! Will post some patches shortly.

Regarding i915/Xe, I have updated those patch sets to run on your new 
baseline and I have the IGTs passing. At least, as well as they did with 
the prior versions. So no particular concerns from there.

John.


  reply	other threads:[~2026-10-22 15:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 13:12 [PATCH v7 0/9] drm: writeback: clean up writeback connector initialization Dmitry Baryshkov
2026-10-19 13:12 ` [PATCH v7 1/9] drm/amd/display: embed the writeback encoder in amdgpu_dm_wb_connector Dmitry Baryshkov
2026-10-20 19:14   ` Harry Wentland
2026-10-19 13:12 ` [PATCH v7 2/9] drm/komeda: embed the writeback encoder in komeda_wb_connector Dmitry Baryshkov
2026-10-19 13:12 ` [PATCH v7 3/9] drm/mali: embed the writeback encoder in malidp_drm Dmitry Baryshkov
2026-10-19 13:12 ` [PATCH v7 4/9] drm: renesas: rcar-du: embed the writeback encoder in rcar_du_crtc Dmitry Baryshkov
2026-10-19 13:12 ` [PATCH v7 5/9] drm: writeback: drop excess connector initialization functions Dmitry Baryshkov
2026-10-19 13:12 ` [PATCH v7 6/9] drm: writeback: rename drm_writeback_connector_init_with_encoder() Dmitry Baryshkov
2026-10-20  1:22   ` Chaoyi Chen
2026-10-19 13:12 ` [PATCH v7 7/9] drm: writeback: don't destroy the shared writeback properties Dmitry Baryshkov
2026-10-20  1:28   ` Chaoyi Chen
2026-10-19 13:12 ` [PATCH v7 8/9] drm: writeback: clean up writeback connectors in drm_connector_cleanup() Dmitry Baryshkov
2026-10-21 18:22   ` John Harrison
2026-10-22 11:59     ` Dmitry Baryshkov
2026-10-22 15:52       ` John Harrison [this message]
2026-10-19 13:12 ` [PATCH v7 9/9] drm: writeback: drop the drmm writeback cleanup action Dmitry Baryshkov
2026-10-21 18:32   ` John Harrison
2026-10-19 19:40 ` [PATCH v7 0/9] drm: writeback: clean up writeback connector initialization John Harrison
2026-10-22 12:01   ` Dmitry Baryshkov
2026-10-23 10:21 ` Liviu Dudau

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=b93caf6d-1277-4e86-98a6-139f9cf8fb4c@Igalia.com \
    --to=john.harrison@igalia.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=brian.starkey@arm.com \
    --cc=christian.koenig@amd.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    --cc=geert+renesas@glider.be \
    --cc=harry.wentland@amd.com \
    --cc=kernel-list@raspberrypi.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=louis.chauvet@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=magnus.damm@gmail.com \
    --cc=mcanal@igalia.com \
    --cc=mihail.atanassov@arm.com \
    --cc=mripard@kernel.org \
    --cc=robin.clark@oss.qualcomm.com \
    --cc=simona@ffwll.ch \
    --cc=siqueira@igalia.com \
    --cc=sunpeng.li@amd.com \
    --cc=tomi.valkeinen+renesas@ideasonboard.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

all inboxes | Powered by JetHome®