From: Matthew Wilcox <willy@infradead.org>
To: Danilo Krummrich <dakr@redhat.com>
Cc: matthew.brost@intel.com, dri-devel@lists.freedesktop.org,
corbet@lwn.net, nouveau@lists.freedesktop.org,
ogabbay@kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
boris.brezillon@collabora.com, bskeggs@redhat.com,
tzimmermann@suse.de, Liam.Howlett@oracle.com,
bagasdotme@gmail.com, christian.koenig@amd.com,
jason@jlekstrand.net
Subject: Re: [PATCH drm-next v2 04/16] maple_tree: add flag MT_FLAGS_LOCK_NONE
Date: Wed, 22 Feb 2023 16:32:12 +0000 [thread overview]
Message-ID: <Y/ZDjJmc4aGRGyVn@casper.infradead.org> (raw)
In-Reply-To: <91d34e47-10f6-8278-ef4c-72cdfa24e038@redhat.com>
On Wed, Feb 22, 2023 at 05:11:34PM +0100, Danilo Krummrich wrote:
> On 2/21/23 19:31, Matthew Wilcox wrote:
> > on tue, feb 21, 2023 at 03:37:49pm +0100, danilo krummrich wrote:
> > > It feels a bit weird that I, as a user of the API, would need to lock certain
> > > (or all?) mas_*() functions with the internal spinlock in order to protect
> > > (future) internal features of the tree, such as the slab cache defragmentation
> > > you mentioned. Because from my perspective, as the generic component that tells
> > > it's users (the drivers) to take care of locking VA space operations (and hence
> > > tree operations) I don't have an own purpose of this internal spinlock, right?
> >
> > You don't ... but we can't know that.
>
> Thanks for the clarification. I think I should now know what to for the
> GPUVA manager in terms of locking the maple tree in general.
>
> Though I still have very limited insights on the maple tree I want to share
> some further thoughts.
>
> From what I got so far it really seems to me that it would be better to just
> take the internal spinlock for both APIs (normal and advanced) whenever you
> need to internally.
No. Really, no. The point of the advanced API is that it's a toolbox
for doing the operation you want, but isn't a generic enough operation
to be part of the normal API. To take an example from the radix
tree days, in the page cache, we need to walk a range of the tree,
looking for any entries that are marked as DIRTY, clear the DIRTY
mark and set the TOWRITE mark. There was a horrendous function called
radix_tree_range_tag_if_tagged() which did exactly this. Now look at
the implementation of tag_pages_for_writeback(); it's a simple loop over
a range with an occasional pause to check whether we need to reschedule.
But that means you need to know how to use the toolbox. Some of the
tools are dangerous and you can cut yourself on them.
> Another plus would probably be maintainability. Once you got quite a few
> maple tree users using external locks (either in the sense of calling
I don't want maple tree users using external locks. That exists
because it was the only reasonable way of converting the VMA tree
from the rbtree to the maple tree. I intend to get rid of
mt_set_external_lock(). The VMAs are eventually going to be protected
by the internal spinlock.
next prev parent reply other threads:[~2023-02-22 16:32 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 13:44 [PATCH drm-next v2 00/16] [RFC] DRM GPUVA Manager & Nouveau VM_BIND UAPI Danilo Krummrich
2023-02-17 13:44 ` [PATCH drm-next v2 01/16] drm: execution context for GEM buffers Danilo Krummrich
2023-02-17 16:00 ` Christian König
2023-02-21 14:56 ` Danilo Krummrich
2023-02-17 13:44 ` [PATCH drm-next v2 02/16] drm/exec: fix memory leak in drm_exec_prepare_obj() Danilo Krummrich
2023-02-17 13:44 ` [PATCH drm-next v2 03/16] maple_tree: split up MA_STATE() macro Danilo Krummrich
2023-02-17 18:34 ` Liam R. Howlett
2023-02-20 13:48 ` Danilo Krummrich
2023-02-21 16:52 ` Liam R. Howlett
2023-02-17 19:45 ` Matthew Wilcox
2023-02-20 13:48 ` Danilo Krummrich
2023-02-17 13:44 ` [PATCH drm-next v2 04/16] maple_tree: add flag MT_FLAGS_LOCK_NONE Danilo Krummrich
2023-02-17 18:18 ` Liam R. Howlett
2023-02-17 19:38 ` Matthew Wilcox
2023-02-20 14:00 ` Danilo Krummrich
2023-02-20 15:10 ` Matthew Wilcox
2023-02-20 17:06 ` Danilo Krummrich
2023-02-20 20:33 ` Matthew Wilcox
2023-02-21 14:37 ` Danilo Krummrich
2023-02-21 18:31 ` Matthew Wilcox
2023-02-22 16:11 ` Danilo Krummrich
2023-02-22 16:32 ` Matthew Wilcox [this message]
2023-02-22 17:28 ` Danilo Krummrich
2023-02-27 17:39 ` Danilo Krummrich
2023-02-27 18:36 ` Matthew Wilcox
2023-02-27 18:59 ` Danilo Krummrich
2023-02-17 13:44 ` [PATCH drm-next v2 05/16] drm: manager to keep track of GPUs VA mappings Danilo Krummrich
2023-02-18 1:05 ` kernel test robot
2023-02-21 18:20 ` Liam R. Howlett
2023-02-22 18:13 ` Danilo Krummrich
2023-02-23 19:09 ` Liam R. Howlett
2023-02-27 12:23 ` Danilo Krummrich
2023-03-02 2:38 ` Liam R. Howlett
2023-03-06 15:46 ` Danilo Krummrich
2023-03-07 22:43 ` Liam R. Howlett
2023-03-13 23:46 ` Danilo Krummrich
2023-03-20 19:16 ` Liam R. Howlett
2023-02-28 2:17 ` Danilo Krummrich
2023-02-28 16:24 ` Liam R. Howlett
2023-03-06 13:39 ` Danilo Krummrich
2023-02-22 10:25 ` Christian König
2023-02-22 15:07 ` Danilo Krummrich
2023-02-22 15:14 ` Christian König
2023-02-22 16:40 ` Danilo Krummrich
2023-02-23 7:06 ` Christian König
2023-02-23 14:12 ` Danilo Krummrich
2023-02-17 13:48 ` [PATCH drm-next v2 06/16] drm: debugfs: provide infrastructure to dump a DRM GPU VA space Danilo Krummrich
2023-02-18 2:47 ` kernel test robot
2023-02-17 13:48 ` [PATCH drm-next v2 07/16] drm/nouveau: new VM_BIND uapi interfaces Danilo Krummrich
2023-02-17 13:48 ` [PATCH drm-next v2 08/16] drm/nouveau: get vmm via nouveau_cli_vmm() Danilo Krummrich
2023-02-17 13:48 ` [PATCH drm-next v2 09/16] drm/nouveau: bo: initialize GEM GPU VA interface Danilo Krummrich
2023-02-17 13:48 ` [PATCH drm-next v2 10/16] drm/nouveau: move usercopy helpers to nouveau_drv.h Danilo Krummrich
2023-02-17 13:48 ` [PATCH drm-next v2 11/16] drm/nouveau: fence: fail to emit when fence context is killed Danilo Krummrich
2023-02-17 13:48 ` [PATCH drm-next v2 12/16] drm/nouveau: chan: provide nouveau_channel_kill() Danilo Krummrich
2023-02-17 13:48 ` [PATCH drm-next v2 13/16] drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm Danilo Krummrich
2023-02-18 1:16 ` kernel test robot
2023-02-17 13:48 ` [PATCH drm-next v2 14/16] drm/nouveau: implement uvmm for user mode bindings Danilo Krummrich
2023-02-17 13:48 ` [PATCH drm-next v2 15/16] drm/nouveau: implement new VM_BIND UAPI Danilo Krummrich
2023-02-17 13:48 ` [PATCH drm-next v2 16/16] drm/nouveau: debugfs: implement DRM GPU VA debugfs Danilo Krummrich
2023-03-09 9:12 ` [PATCH drm-next v2 00/16] [RFC] DRM GPUVA Manager & Nouveau VM_BIND UAPI Boris Brezillon
2023-03-09 9:48 ` Boris Brezillon
2023-03-10 16:45 ` Danilo Krummrich
2023-03-10 17:25 ` Boris Brezillon
2023-03-10 20:06 ` 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=Y/ZDjJmc4aGRGyVn@casper.infradead.org \
--to=willy@infradead.org \
--cc=Liam.Howlett@oracle.com \
--cc=bagasdotme@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=bskeggs@redhat.com \
--cc=christian.koenig@amd.com \
--cc=corbet@lwn.net \
--cc=dakr@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jason@jlekstrand.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=matthew.brost@intel.com \
--cc=nouveau@lists.freedesktop.org \
--cc=ogabbay@kernel.org \
--cc=tzimmermann@suse.de \
/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