From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Oak Zeng <oak.zeng@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe: Add more document to xe_vm::lock
Date: Tue, 28 May 2024 09:22:13 +0200 [thread overview]
Message-ID: <6c5cc6d2c79cd1c98d879b73f1bdc4790d9603e3.camel@linux.intel.com> (raw)
In-Reply-To: <20240527230731.1888261-1-oak.zeng@intel.com>
Hi, Oak.
On Mon, 2024-05-27 at 16:07 -0700, Oak Zeng wrote:
> More document is added to xe_vm::lock to describe what is protected
> by this lock.
>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Signed-off-by: Oak Zeng <oak.zeng@intel.com>
I don't think we should be documenting the locks in this detailed
manner, but rather take care when we document the structures / fields
that are protected by a lock.
If we double-document then there's a big chance that someone forgets to
update one of the documentation sites.
Also some members below have more complicated protection than just a
single lock, for example vm::rebind list.
Also (even if it's a copy-paste) it's not possible to protect a single
bit with a lock (thinking of vm::flags field), unless there are other
conditions as well, since:
A: B:
read_flags vm_lock
update_bit_0 read_flags
update_bit_1
write_flags
vm_unlock
write_flags
Here process a resets bit 1 to its original value.
Meaning all mutable bits must be protected by the same lock.
/Thomas
> ---
> drivers/gpu/drm/xe/xe_vm_types.h | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_vm_types.h
> b/drivers/gpu/drm/xe/xe_vm_types.h
> index ce1a63a5e3e7..5597d8072046 100644
> --- a/drivers/gpu/drm/xe/xe_vm_types.h
> +++ b/drivers/gpu/drm/xe/xe_vm_types.h
> @@ -161,7 +161,18 @@ struct xe_vm {
>
> /**
> * @lock: outer most lock, protects objects of anything
> attached to this
> - * VM
> + * VM, more specifically:
> + * 1) vm::rebind_list
> + * 2) vm::flags, only XE_VM_FLA_BANNED bit
> + * 3) vma::tile_present
> + * 4) userptr::repin_list
> + * 5) userptr::invalidated list
> + * 6) vm::preempt::exec_queue
> + * 7) drm_gpuvm::rb list and tree
> + * 8) vm::size
> + * 9) vm::q[]->last_fence, only if q->flags'
> EXEC_QUEUE_FLAG_VM is set,
> + * see xe_exec_queue_last_fence_lockdep_assert
> + * 10) a contested list during vm close. see
> xe_vm_close_and_put
> */
> struct rw_semaphore lock;
> /**
next prev parent reply other threads:[~2024-05-28 7:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 23:07 [PATCH] drm/xe: Add more document to xe_vm::lock Oak Zeng
2024-05-27 22:14 ` ✓ CI.Patch_applied: success for " Patchwork
2024-05-27 22:15 ` ✓ CI.KUnit: " Patchwork
2024-05-27 22:27 ` ✓ CI.Build: " Patchwork
2024-05-27 22:28 ` ✗ CI.Hooks: failure " Patchwork
2024-05-27 22:30 ` ✓ CI.checksparse: success " Patchwork
2024-05-27 22:53 ` ✗ CI.BAT: failure " Patchwork
2024-05-27 23:45 ` ✗ CI.FULL: " Patchwork
2024-05-28 7:22 ` Thomas Hellström [this message]
2024-05-28 13:22 ` [PATCH] " Zeng, Oak
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=6c5cc6d2c79cd1c98d879b73f1bdc4790d9603e3.camel@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=oak.zeng@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