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: <bd44b702-34b5-816f-9ef9-00205a4375d0@suse.de>
Date:   Fri, 17 Feb 2023 13:23:49 +0100
From:   Thomas Zimmermann <tzimmermann@...e.de>
To:     Dmitry Osipenko <dmitry.osipenko@...labora.com>,
        David Airlie <airlied@...il.com>,
        Gerd Hoffmann <kraxel@...hat.com>,
        Gurchetan Singh <gurchetansingh@...omium.org>,
        Chia-I Wu <olvaffe@...il.com>, Daniel Vetter <daniel@...ll.ch>,
        Daniel Almeida <daniel.almeida@...labora.com>,
        Gustavo Padovan <gustavo.padovan@...labora.com>,
        Daniel Stone <daniel@...ishbar.org>,
        Tomeu Vizoso <tomeu.vizoso@...labora.com>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <mripard@...nel.org>,
        Rob Clark <robdclark@...il.com>,
        Sumit Semwal <sumit.semwal@...aro.org>,
        Christian König <christian.koenig@....com>,
        Qiang Yu <yuq825@...il.com>,
        Steven Price <steven.price@....com>,
        Alyssa Rosenzweig <alyssa.rosenzweig@...labora.com>,
        Rob Herring <robh@...nel.org>, Sean Paul <sean@...rly.run>,
        Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
        Abhinav Kumar <quic_abhinavk@...cinc.com>
Cc:     kernel@...labora.com, linux-kernel@...r.kernel.org,
        dri-devel@...ts.freedesktop.org,
        virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH v10 03/11] drm/gem: Add evict() callback to
 drm_gem_object_funcs

Hi

Am 08.01.23 um 22:04 schrieb Dmitry Osipenko:
> Add new common evict() callback to drm_gem_object_funcs and corresponding
> drm_gem_object_evict() helper. This is a first step on a way to providing
> common GEM-shrinker API for DRM drivers.
> 
> Suggested-by: Thomas Zimmermann <tzimmermann@...e.de>
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@...labora.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@...e.de>

with my comments below addressed.

> ---
>   drivers/gpu/drm/drm_gem.c | 16 ++++++++++++++++
>   include/drm/drm_gem.h     | 12 ++++++++++++
>   2 files changed, 28 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index c6bca5ac6e0f..dbb48fc9dff3 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -1471,3 +1471,19 @@ drm_gem_lru_scan(struct drm_gem_lru *lru,
>   	return freed;
>   }
>   EXPORT_SYMBOL(drm_gem_lru_scan);
> +
> +/**
> + * drm_gem_object_evict - helper to evict backing pages for a GEM object
> + * @obj: obj in question
> + */
> +bool

Please use int and return an errno code.

No newline here, please.

> +drm_gem_object_evict(struct drm_gem_object *obj)
> +{
> +	dma_resv_assert_held(obj->resv);
> +
> +	if (obj->funcs->evict)
> +		return obj->funcs->evict(obj);
> +
> +	return false;
> +}
> +EXPORT_SYMBOL(drm_gem_object_evict);
> diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
> index f1f00fc2dba6..8e5c22f25691 100644
> --- a/include/drm/drm_gem.h
> +++ b/include/drm/drm_gem.h
> @@ -172,6 +172,16 @@ struct drm_gem_object_funcs {
>   	 * This is optional but necessary for mmap support.
>   	 */
>   	const struct vm_operations_struct *vm_ops;
> +
> +	/**
> +	 * @evict:
> +	 *
> +	 * Evicts gem object out from memory. Used by the drm_gem_object_evict()
> +	 * helper. Returns true on success, false otherwise.
> +	 *
> +	 * This callback is optional.
> +	 */
> +	bool (*evict)(struct drm_gem_object *obj);

This should be declared between mmap and evict.

Again, please use int and return an errno code.

>   };
>   
>   /**
> @@ -481,4 +491,6 @@ unsigned long drm_gem_lru_scan(struct drm_gem_lru *lru,
>   			       unsigned long *remaining,
>   			       bool (*shrink)(struct drm_gem_object *obj));
>   
> +bool drm_gem_object_evict(struct drm_gem_object *obj);

drm_gem_evict() should be the correct name; like drm_gem_vmap() and 
drm_gem_pin(), etc.

Best regards
Thomas

> +
>   #endif /* __DRM_GEM_H__ */

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ