All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: felix.kuehling@amd.com, matthew.william.auld@gmail.com,
	dri-devel@lists.freedesktop.org,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH 4/6] drm/ttm: de-inline ttm_bo_pin/unpin
Date: Wed, 23 Mar 2022 11:37:37 +0100	[thread overview]
Message-ID: <Yjr4cUdHvqJhOy7G@phenom.ffwll.local> (raw)
In-Reply-To: <20220321132601.2161-4-christian.koenig@amd.com>

On Mon, Mar 21, 2022 at 02:25:59PM +0100, Christian König wrote:
> Those functions are going to become more complex, don't inline them any
> more.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/ttm/ttm_bo.c | 31 +++++++++++++++++++++++++++++++
>  include/drm/ttm/ttm_bo_api.h | 30 ++----------------------------
>  2 files changed, 33 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index b119af33e7d7..502617ee9303 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -633,6 +633,37 @@ int ttm_mem_evict_first(struct ttm_device *bdev,
>  	return ret;
>  }
>  
> +/**
> + * ttm_bo_pin - Pin the buffer object.
> + * @bo: The buffer object to pin
> + *
> + * Make sure the buffer is not evicted any more during memory pressure.

Maybe add kerneldoc cross links here while at it.

"@bo must be unpinned again by calling ttm_bo_unpin()."

or whatever you prefer.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> + */
> +void ttm_bo_pin(struct ttm_buffer_object *bo)
> +{
> +	dma_resv_assert_held(bo->base.resv);
> +	WARN_ON_ONCE(!kref_read(&bo->kref));
> +	++bo->pin_count;
> +}
> +EXPORT_SYMBOL(ttm_bo_pin);
> +
> +/**
> + * ttm_bo_unpin - Unpin the buffer object.
> + * @bo: The buffer object to unpin
> + *
> + * Allows the buffer object to be evicted again during memory pressure.
> + */
> +void ttm_bo_unpin(struct ttm_buffer_object *bo)
> +{
> +	dma_resv_assert_held(bo->base.resv);
> +	WARN_ON_ONCE(!kref_read(&bo->kref));
> +	if (bo->pin_count)
> +		--bo->pin_count;
> +	else
> +		WARN_ON_ONCE(true);
> +}
> +EXPORT_SYMBOL(ttm_bo_unpin);
> +
>  /*
>   * Add the last move fence to the BO and reserve a new shared slot. We only use
>   * a shared slot to avoid unecessary sync and rely on the subsequent bo move to
> diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
> index 3da77fc54552..885b7698fd65 100644
> --- a/include/drm/ttm/ttm_bo_api.h
> +++ b/include/drm/ttm/ttm_bo_api.h
> @@ -524,34 +524,8 @@ ssize_t ttm_bo_io(struct ttm_device *bdev, struct file *filp,
>  int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
>  		   gfp_t gfp_flags);
>  
> -/**
> - * ttm_bo_pin - Pin the buffer object.
> - * @bo: The buffer object to pin
> - *
> - * Make sure the buffer is not evicted any more during memory pressure.
> - */
> -static inline void ttm_bo_pin(struct ttm_buffer_object *bo)
> -{
> -	dma_resv_assert_held(bo->base.resv);
> -	WARN_ON_ONCE(!kref_read(&bo->kref));
> -	++bo->pin_count;
> -}
> -
> -/**
> - * ttm_bo_unpin - Unpin the buffer object.
> - * @bo: The buffer object to unpin
> - *
> - * Allows the buffer object to be evicted again during memory pressure.
> - */
> -static inline void ttm_bo_unpin(struct ttm_buffer_object *bo)
> -{
> -	dma_resv_assert_held(bo->base.resv);
> -	WARN_ON_ONCE(!kref_read(&bo->kref));
> -	if (bo->pin_count)
> -		--bo->pin_count;
> -	else
> -		WARN_ON_ONCE(true);
> -}
> +void ttm_bo_pin(struct ttm_buffer_object *bo);
> +void ttm_bo_unpin(struct ttm_buffer_object *bo);
>  
>  int ttm_mem_evict_first(struct ttm_device *bdev,
>  			struct ttm_resource_manager *man,
> -- 
> 2.25.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2022-03-23 10:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-21 13:25 [PATCH 1/6] drm/ttm: move the LRU into resource handling v4 Christian König
2022-03-21 13:25 ` [PATCH 2/6] drm/ttm: add resource iterator v4 Christian König
2022-03-21 13:25 ` [PATCH 3/6] drm/ttm: allow bulk moves for all domains Christian König
2022-03-21 13:25 ` [PATCH 4/6] drm/ttm: de-inline ttm_bo_pin/unpin Christian König
2022-03-23 10:37   ` Daniel Vetter [this message]
2022-03-21 13:26 ` [PATCH 5/6] drm/ttm: rework bulk move handling v4 Christian König
2022-03-23 10:49   ` Daniel Vetter
2022-03-21 13:26 ` [PATCH 6/6] drm/amdgpu: drop amdgpu_gtt_node Christian König
2022-03-23 10:35 ` [PATCH 1/6] drm/ttm: move the LRU into resource handling v4 Daniel Vetter
2022-03-23 10:39   ` Daniel Vetter
2022-03-24 14:25   ` Christian König
2022-03-24 17:27     ` Daniel Vetter
2022-03-23 11:59 ` Daniel Vetter
2022-03-23 12:20   ` Christian König
2022-03-23 13:36     ` Daniel Vetter
2022-03-23 13:44       ` Christian König
2022-03-23 15:22         ` Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2022-02-15 17:22 Reworking TTMs LRU handling Christian König
2022-02-15 17:22 ` [PATCH 4/6] drm/ttm: de-inline ttm_bo_pin/unpin Christian König

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=Yjr4cUdHvqJhOy7G@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=christian.koenig@amd.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=felix.kuehling@amd.com \
    --cc=matthew.william.auld@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.