linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Danilo Krummrich <dakr@redhat.com>
Cc: airlied@gmail.com, daniel@ffwll.ch, tzimmermann@suse.de,
	mripard@kernel.org, corbet@lwn.net, christian.koenig@amd.com,
	bskeggs@redhat.com, Liam.Howlett@oracle.com,
	matthew.brost@intel.com, alexdeucher@gmail.com,
	ogabbay@kernel.org, bagasdotme@gmail.com, willy@infradead.org,
	jason@jlekstrand.net, dri-devel@lists.freedesktop.org,
	nouveau@lists.freedesktop.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Donald Robson <donald.robson@imgtec.com>,
	Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH drm-next v6 02/13] drm: manager to keep track of GPUs VA mappings
Date: Thu, 6 Jul 2023 20:26:42 +0200	[thread overview]
Message-ID: <20230706202642.4cbc7227@collabora.com> (raw)
In-Reply-To: <20230629222651.3196-3-dakr@redhat.com>

On Fri, 30 Jun 2023 00:25:18 +0200
Danilo Krummrich <dakr@redhat.com> wrote:

> +#ifdef CONFIG_LOCKDEP
> +typedef struct lockdep_map *lockdep_map_p;
> +#define drm_gpuva_manager_ext_assert_held(mgr)		\
> +	lockdep_assert(lock_is_held((mgr)->ext_lock) != LOCK_STATE_NOT_HELD)
> +/**
> + * drm_gpuva_manager_set_ext_lock - set the external lock according to
> + * @DRM_GPUVA_MANAGER_LOCK_EXTERN
> + * @mgr: the &drm_gpuva_manager to set the lock for
> + * @lock: the lock to set
> + *
> + * If @DRM_GPUVA_MANAGER_LOCK_EXTERN is set, drivers need to call this function
> + * to provide the lock used to lock linking and unlinking of &drm_gpuvas to the
> + * &drm_gem_objects GPUVA list.
> + */
> +#define drm_gpuva_manager_set_ext_lock(mgr, lock)	\
> +	(mgr)->ext_lock = &(lock)->dep_map

Okay, so, IIUC, this is the lock protecting the GEM's active mappings
list, meaning the lock is likely to be attached to the GEM object. Are
we expected to call drm_gpuva_manager_set_ext_lock() every time we call
drm_gpuva_[un]link(), or are we supposed to have some lock at the
device level serializing all drm_gpuva_[un]link() calls across VMs? The
later doesn't sound like a good option to me, and the former feels a bit
weird. I'm wondering if we shouldn't just drop this assert_held() check
when DRM_GPUVA_MANAGER_LOCK_EXTERN is set. Alternatively, we could say
that any driver wanting to use a custom lock (which is basically all
drivers modifying the VA space asynchronously in the ::run_job() path)
has to provide its own variant of drm_gpuva_[un]link() (maybe with its
own VA list too), which doesn't sound like a good idea either.

> +#else
> +typedef struct { /* nothing */ } lockdep_map_p;
> +#define drm_gpuva_manager_ext_assert_held(mgr)		do { (void)(mgr); } while (0)
> +#define drm_gpuva_manager_set_ext_lock(mgr, lock)	do { } while (0)
> +#endif

  parent reply	other threads:[~2023-07-06 18:26 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29 22:25 [PATCH drm-next v6 00/13] [RFC] DRM GPUVA Manager & Nouveau VM_BIND UAPI Danilo Krummrich
2023-06-29 22:25 ` [PATCH drm-next v6 01/13] drm: execution context for GEM buffers v5 Danilo Krummrich
2023-06-29 22:25 ` [PATCH drm-next v6 02/13] drm: manager to keep track of GPUs VA mappings Danilo Krummrich
2023-06-30  8:02   ` Boris Brezillon
2023-06-30  8:09     ` Boris Brezillon
2023-06-30  9:40     ` Boris Brezillon
2023-07-06 15:06     ` Danilo Krummrich
2023-07-06 16:17       ` Boris Brezillon
2023-07-06  8:49   ` Thomas Hellström (Intel)
2023-07-06 15:45   ` Donald Robson
2023-07-06 15:52     ` Danilo Krummrich
2023-07-06 18:26   ` Boris Brezillon [this message]
2023-07-07  7:57     ` Boris Brezillon
2023-07-07 12:32       ` Danilo Krummrich
2023-07-07 11:00   ` Boris Brezillon
2023-07-07 12:41     ` Danilo Krummrich
2023-07-07 12:52       ` Boris Brezillon
2023-07-08  6:39         ` Matthew Brost
2023-06-29 22:25 ` [PATCH drm-next v6 03/13] drm: debugfs: provide infrastructure to dump a DRM GPU VA space Danilo Krummrich
2023-06-29 22:25 ` [PATCH drm-next v6 04/13] drm/nouveau: new VM_BIND uapi interfaces Danilo Krummrich
2023-06-29 22:25 ` [PATCH drm-next v6 05/13] drm/nouveau: get vmm via nouveau_cli_vmm() Danilo Krummrich
2023-06-29 22:25 ` [PATCH drm-next v6 06/13] drm/nouveau: bo: initialize GEM GPU VA interface Danilo Krummrich
2023-06-29 22:25 ` [PATCH drm-next v6 07/13] drm/nouveau: move usercopy helpers to nouveau_drv.h Danilo Krummrich
2023-06-29 22:25 ` [PATCH drm-next v6 08/13] drm/nouveau: fence: separate fence alloc and emit Danilo Krummrich
2023-06-29 22:25 ` [PATCH drm-next v6 09/13] drm/nouveau: fence: fail to emit when fence context is killed Danilo Krummrich
2023-06-29 22:25 ` [PATCH drm-next v6 10/13] drm/nouveau: chan: provide nouveau_channel_kill() Danilo Krummrich
2023-06-29 22:25 ` [PATCH drm-next v6 11/13] drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm Danilo Krummrich
2023-06-29 22:25 ` [PATCH drm-next v6 12/13] drm/nouveau: implement new VM_BIND uAPI Danilo Krummrich
2023-06-29 22:25 ` [PATCH drm-next v6 13/13] drm/nouveau: debugfs: implement DRM GPU VA debugfs 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=20230706202642.4cbc7227@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=alexdeucher@gmail.com \
    --cc=bagasdotme@gmail.com \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=corbet@lwn.net \
    --cc=dakr@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=donald.robson@imgtec.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jason@jlekstrand.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=ogabbay@kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=willy@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).