lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5sufhgtqempg56b57ocg45ah4ip5ykhaz6thphctcupk5lortz@fmkxzzzdwd3i>
Date: Mon, 23 Sep 2024 15:16:27 +0300
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, 
	Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>, 
	David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>, jani.nikula@...ux.intel.com, 
	thomas.petazzoni@...tlin.com, dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm: writeback: Introduce drm managed helpers

On Mon, Sep 23, 2024 at 11:54:57AM GMT, Louis Chauvet wrote:
> Le 22/09/24 - 18:31, Dmitry Baryshkov a écrit :
> > On Fri, Sep 06, 2024 at 07:28:17PM GMT, Louis Chauvet wrote:
> > > Currently drm_writeback_connector are created by
> > > drm_writeback_connector_init or drm_writeback_connector_init_with_encoder.
> > > Both of the function uses drm_connector_init and drm_encoder_init, but
> > > there is no way to properly clean those structure from outside. By using
> > > drm managed variants, we can ensure that the writeback connector is
> > > properly cleaned.
> > > 
> > > This patch introduce drmm_writeback_connector_init, an helper to initialize
> > > a writeback connector using drm managed helpers. This function allows the
> > > caller to use its own encoder.
> > 
> > Also it introduces drm_writeback_connector_cleanup(). Ideally that
> > should be a separate commit with a proper description.
> 
> Will do for the v2.
> 
> > You should also
> > document that existing users should call that function (and maybe add a
> > WARN_ON that can check if the function wasn't called).
> 
> It was my initial implementation [2] (usage in [3]), but Maxime suggested 
> switching to drmm. If I make it non-static, this will be a new API with no 
> user.
> 
> I don't know how to add a warning if this function is not called. Do you 
> have an example somewhere where a warning is emitted after everything has 
> been cleaned up?

Add boolean wariable to drm_connector, make
drm_writeback_connector_cleanup set it, WARN_ON(!set &&
connector->connctor_type == DRM_MODE_CONNECTOR_WRITEBACK).

Or maybe even better, make this function being called from
drm_connector_cleanup() if it is a writeback connector.

> 
> > Last, but not least, please don't add API without a user. Please switch
> > at least one driver into using this API.
> 
> The user will be VKMS, see [1].

Usage should come with the API in the same patchset. Otherwise it's
impossible to judge whether the pieces fit together or not.

> 
> [1]:https://lore.kernel.org/all/20240912-google-vkms-managed-v3-4-7708d6ad262d@bootlin.com/
> [2]:https://lore.kernel.org/all/20240814-google-remove-crtc-index-from-parameter-v1-11-6e179abf9fd4@bootlin.com/
> [3]:https://lore.kernel.org/all/20240814-google-remove-crtc-index-from-parameter-v1-12-6e179abf9fd4@bootlin.com/
> 
> Thanks,
> Louis Chauvet
> 
> > > 
> > > Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>
> > > ---
> > > Hi Maxime, Jani,
> > > 
> > > I tried with this commit to implement the drm-managed version of writeback 
> > > connector initialization. I tested with the current vkms driver, and it 
> > > seems to works (at least no crash/warns).
> > > 
> > > As suggested by Jani, I only created one function, which takes a 
> > > NULL-able pointer for encoder/encoder functions/possible_crtc. What do you 
> > > think about it?
> > > 
> > > Regarding the documentation, I think I repeated too much, can I simply add 
> > > comments like "see documentation of @... for the details / requirements"?
> > > 
> > > Good weekend,
> > > Louis Chauvet
> > > ---
> > >  drivers/gpu/drm/drm_writeback.c | 224 ++++++++++++++++++++++++++++++++++------
> > >  include/drm/drm_writeback.h     |   7 ++
> > >  2 files changed, 201 insertions(+), 30 deletions(-)
> > > 
> > 
> > -- 
> > With best wishes
> > Dmitry

-- 
With best wishes
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ