From: Boris Brezillon <boris.brezillon@collabora.com>
To: Danilo Krummrich <dakr@redhat.com>
Cc: airlied@gmail.com, daniel@ffwll.ch, matthew.brost@intel.com,
thomas.hellstrom@linux.intel.com, sarah.walker@imgtec.com,
donald.robson@imgtec.com, christian.koenig@amd.com,
faith.ekstrand@collabora.com, dri-devel@lists.freedesktop.org,
nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH drm-misc-next v2 5/7] drm/gpuvm: add an abstraction for a VM / BO combination
Date: Thu, 7 Sep 2023 10:42:52 +0200 [thread overview]
Message-ID: <20230907104252.4e15acb9@collabora.com> (raw)
In-Reply-To: <20230906214723.4393-6-dakr@redhat.com>
On Wed, 6 Sep 2023 23:47:13 +0200
Danilo Krummrich <dakr@redhat.com> wrote:
> +void drm_gpuvm_bo_destroy(struct kref *kref);
I usually keep kref's release functions private so people are not
tempted to use them.
> +
> +/**
> + * drm_gpuvm_bo_get() - acquire a struct drm_gpuvm_bo reference
> + * @vm_bo: the &drm_gpuvm_bo to acquire the reference of
> + *
> + * This function acquires an additional reference to @vm_bo. It is illegal to
> + * call this without already holding a reference. No locks required.
> + */
> +static inline struct drm_gpuvm_bo *
> +drm_gpuvm_bo_get(struct drm_gpuvm_bo *vm_bo)
> +{
> + kref_get(&vm_bo->kref);
> + return vm_bo;
> +}
> +
> +/**
> + * drm_gpuvm_bo_put() - drop a struct drm_gpuvm_bo reference
> + * @vm_bo: the &drm_gpuvm_bo to release the reference of
> + *
> + * This releases a reference to @vm_bo.
> + */
> +static inline void
> +drm_gpuvm_bo_put(struct drm_gpuvm_bo *vm_bo)
> +{
> + kref_put(&vm_bo->kref, drm_gpuvm_bo_destroy);
nit: can we have
if (vm_bo)
kref_put(&vm_bo->kref, drm_gpuvm_bo_destroy);
so we don't have to bother testing the vm_bo value in the error/cleanup
paths?
> +}
> +
next prev parent reply other threads:[~2023-09-07 17:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-06 21:47 [PATCH drm-misc-next v2 0/7] [RFC] DRM GPUVA Manager GPU-VM features Danilo Krummrich
2023-09-06 21:47 ` [PATCH drm-misc-next v2 1/7] drm: gpuva_mgr: allow building as module Danilo Krummrich
2023-09-06 21:47 ` [PATCH drm-misc-next v2 2/7] drm/gpuvm: rename struct drm_gpuva_manager to struct drm_gpuvm Danilo Krummrich
2023-09-07 7:56 ` Boris Brezillon
2023-09-07 8:54 ` Danilo Krummrich
2023-09-07 8:51 ` kernel test robot
2023-09-06 21:47 ` [PATCH drm-misc-next v2 3/7] drm/nouveau: uvmm: rename 'umgr' to 'base' Danilo Krummrich
2023-09-06 21:47 ` [PATCH drm-misc-next v2 4/7] drm/gpuvm: common dma-resv per struct drm_gpuvm Danilo Krummrich
2023-09-06 21:47 ` [PATCH drm-misc-next v2 5/7] drm/gpuvm: add an abstraction for a VM / BO combination Danilo Krummrich
2023-09-07 8:16 ` Boris Brezillon
2023-09-07 9:11 ` Danilo Krummrich
2023-09-07 8:42 ` Boris Brezillon [this message]
2023-09-07 9:41 ` Danilo Krummrich
2023-09-07 11:05 ` Boris Brezillon
2023-09-06 21:47 ` [PATCH drm-misc-next v2 6/7] drm/gpuvm: generalize dma_resv/extobj handling and GEM validation Danilo Krummrich
2023-09-07 0:12 ` kernel test robot
2023-09-06 21:47 ` [PATCH drm-misc-next v2 7/7] drm/nouveau: GPUVM dma-resv/extobj handling, " Danilo Krummrich
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=20230907104252.4e15acb9@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=airlied@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dakr@redhat.com \
--cc=daniel@ffwll.ch \
--cc=donald.robson@imgtec.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=faith.ekstrand@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.brost@intel.com \
--cc=nouveau@lists.freedesktop.org \
--cc=sarah.walker@imgtec.com \
--cc=thomas.hellstrom@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox