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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z3vQt9J2coVae7EO@louis-chauvet-laptop>
Date: Mon, 6 Jan 2025 13:46:47 +0100
From: Louis Chauvet <louis.chauvet@...tlin.com>
To: Maxime Ripard <mripard@...nel.org>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@...il.com>,
	Melissa Wen <melissa.srw@...il.com>,
	MaĆ­ra Canal <mairacanal@...eup.net>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
	Thomas Zimmermann <tzimmermann@...e.de>,
	David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
	Simona Vetter <simona.vetter@...ll.ch>,
	dri-devel@...ts.freedesktop.org, arthurgrillo@...eup.net,
	linux-kernel@...r.kernel.org, jeremie.dautheribes@...tlin.com,
	miquel.raynal@...tlin.com, thomas.petazzoni@...tlin.com,
	seanpaul@...gle.com, nicolejadeyee@...gle.com
Subject: Re: [PATCH v6 4/8] drm: writeback: Introduce cleanup function

On 06/01/25 - 10:43, Maxime Ripard wrote:
> On Mon, Dec 30, 2024 at 07:37:34PM +0100, Louis Chauvet wrote:
> > Currently there is no cleanup function for writeback connectors. To allows
> > implementation of drmm variant of writeback connector, create a cleanup
> > function that can be used to properly remove all the writeback-specific
> > properties and allocations.
> > 
> > This also introduce an helper to cleanup only the drm_writeback_connector
> > properties, so it can be used during initialization to cleanup in case of
> > failure.
> > 
> > Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>
> > ---
> >  drivers/gpu/drm/drm_writeback.c | 43 +++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 43 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c
> > index 33a3c98a962d1ec49ac4b353902036cf74290ae6..c274cba257cde5f4b446df3854974e690c60bf7b 100644
> > --- a/drivers/gpu/drm/drm_writeback.c
> > +++ b/drivers/gpu/drm/drm_writeback.c
> > @@ -15,6 +15,7 @@
> >  #include <drm/drm_device.h>
> >  #include <drm/drm_drv.h>
> >  #include <drm/drm_framebuffer.h>
> > +#include <drm/drm_managed.h>
> >  #include <drm/drm_modeset_helper_vtables.h>
> >  #include <drm/drm_property.h>
> >  #include <drm/drm_writeback.h>
> > @@ -140,6 +141,22 @@ static int create_writeback_properties(struct drm_device *dev)
> >  	return 0;
> >  }
> >  
> > +static void delete_writeback_properties(struct drm_device *dev)
> > +{
> > +	if (dev->mode_config.writeback_pixel_formats_property) {
> > +		drm_property_destroy(dev, dev->mode_config.writeback_pixel_formats_property);
> > +		dev->mode_config.writeback_pixel_formats_property = NULL;
> > +	}
> > +	if (dev->mode_config.writeback_out_fence_ptr_property) {
> > +		drm_property_destroy(dev, dev->mode_config.writeback_out_fence_ptr_property);
> > +		dev->mode_config.writeback_out_fence_ptr_property = NULL;
> > +	}
> > +	if (dev->mode_config.writeback_fb_id_property) {
> > +		drm_property_destroy(dev, dev->mode_config.writeback_fb_id_property);
> > +		dev->mode_config.writeback_fb_id_property = NULL;
> > +	}
> > +}
> > +
> >  static const struct drm_encoder_funcs drm_writeback_encoder_funcs = {
> >  	.destroy = drm_encoder_cleanup,
> >  };
> > @@ -284,6 +301,32 @@ int drm_writeback_connector_init_with_encoder(struct drm_device *dev,
> >  }
> >  EXPORT_SYMBOL(drm_writeback_connector_init_with_encoder);
> >  
> > +/**
> > + * drm_writeback_connector_cleanup - Cleanup the writeback connector
> > + * @dev: DRM device
> > + * @wb_connector: Pointer to the writeback connector to clean up
> > + *
> > + * This will decrement the reference counter of blobs and destroy properties. It
> > + * will also clean the remaining jobs in this writeback connector. Caution: This helper will not
> > + * clean up the attached encoder and the drm_connector.
> > + */
> > +static void drm_writeback_connector_cleanup(struct drm_device *dev,
> > +					    struct drm_writeback_connector *wb_connector)
> > +{
> > +	unsigned long flags;
> > +	struct drm_writeback_job *pos, *n;
> > +
> > +	delete_writeback_properties(dev);
> > +	drm_property_blob_put(wb_connector->pixel_formats_blob_ptr);
> > +
> > +	spin_lock_irqsave(&wb_connector->job_lock, flags);
> > +	list_for_each_entry_safe(pos, n, &wb_connector->job_queue, list_entry) {
> > +		drm_writeback_cleanup_job(pos);
> > +		list_del(&pos->list_entry);
> > +	}
> > +	spin_unlock_irqrestore(&wb_connector->job_lock, flags);
> > +}
> > +
> 
> Given that this function is static now, it should be merged with the
> patch using it.
> 
> Maxime

Hi Maxime,

Thanks for your review. I appreciate your feedback and will take it into 
account for the next iteration.

Besides this comment, is there anything else you noticed that might need 
attention before adding your Acked-by/Reviewed-by to the rest of the 
series?

Thanks a lot,
Louis Chauvet

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ