From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH 5/5] drm/xe: Only alloc userptr part of xe_vma for userptrs
Date: Thu, 13 Jul 2023 16:26:27 -0400 [thread overview]
Message-ID: <ZLBd88JCZQ1rXD3k@intel.com> (raw)
In-Reply-To: <20230711212748.2029455-6-matthew.brost@intel.com>
On Tue, Jul 11, 2023 at 02:27:48PM -0700, Matthew Brost wrote:
probably worth to repeat the commit subject here in the commit
msg.
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> This will save on space in common BO case.
>
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_vm.c | 6 +++-
> drivers/gpu/drm/xe/xe_vm_types.h | 56 ++++++++++++++++++--------------
> 2 files changed, 36 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 762aefa75ed4..d1fdc9974f3c 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -880,7 +880,11 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm,
> XE_BUG_ON(start >= end);
> XE_BUG_ON(end >= vm->size);
>
> - vma = kzalloc(sizeof(*vma), GFP_KERNEL);
> + if (!bo && !is_null) /* userptr */
> + vma = kzalloc(sizeof(*vma), GFP_KERNEL);
> + else
> + vma = kzalloc(sizeof(*vma) - sizeof(struct xe_userptr),
> + GFP_KERNEL);
> if (!vma) {
> vma = ERR_PTR(-ENOMEM);
> return vma;
> diff --git a/drivers/gpu/drm/xe/xe_vm_types.h b/drivers/gpu/drm/xe/xe_vm_types.h
> index 30beae541aca..80fb0b22bf0e 100644
> --- a/drivers/gpu/drm/xe/xe_vm_types.h
> +++ b/drivers/gpu/drm/xe/xe_vm_types.h
> @@ -33,6 +33,31 @@ struct xe_vm;
> #define XE_VMA_PTE_2M (DRM_GPUVA_USERBITS << 6)
> #define XE_VMA_PTE_1G (DRM_GPUVA_USERBITS << 7)
>
> +/** struct xe_userptr - User pointer */
> +struct xe_userptr {
> + /** @invalidate_link: Link for the vm::userptr.invalidated list */
> + struct list_head invalidate_link;
> + /**
> + * @notifier: MMU notifier for user pointer (invalidation call back)
> + */
> + struct mmu_interval_notifier notifier;
> + /** @sgt: storage for a scatter gather table */
> + struct sg_table sgt;
> + /** @sg: allocated scatter gather table */
> + struct sg_table *sg;
> + /** @notifier_seq: notifier sequence number */
> + unsigned long notifier_seq;
> + /**
> + * @initial_bind: user pointer has been bound at least once.
> + * write: vm->userptr.notifier_lock in read mode and vm->resv held.
> + * read: vm->userptr.notifier_lock in write mode or vm->resv held.
> + */
> + bool initial_bind;
> +#if IS_ENABLED(CONFIG_DRM_XE_USERPTR_INVAL_INJECT)
> + u32 divisor;
> +#endif
> +};
> +
> struct xe_vma {
> /** @gpuva: Base GPUVA object */
> struct drm_gpuva gpuva;
> @@ -58,31 +83,6 @@ struct xe_vma {
> struct work_struct destroy_work;
> };
>
> - /** @userptr: user pointer state */
> - struct {
> - /** @invalidate_link: Link for the vm::userptr.invalidated list */
> - struct list_head invalidate_link;
> - /**
> - * @notifier: MMU notifier for user pointer (invalidation call back)
> - */
> - struct mmu_interval_notifier notifier;
> - /** @sgt: storage for a scatter gather table */
> - struct sg_table sgt;
> - /** @sg: allocated scatter gather table */
> - struct sg_table *sg;
> - /** @notifier_seq: notifier sequence number */
> - unsigned long notifier_seq;
> - /**
> - * @initial_bind: user pointer has been bound at least once.
> - * write: vm->userptr.notifier_lock in read mode and vm->resv held.
> - * read: vm->userptr.notifier_lock in write mode or vm->resv held.
> - */
> - bool initial_bind;
> -#if IS_ENABLED(CONFIG_DRM_XE_USERPTR_INVAL_INJECT)
> - u32 divisor;
> -#endif
> - } userptr;
> -
> /** @usm: unified shared memory state */
> struct {
> /** @tile_invalidated: VMA has been invalidated */
> @@ -112,6 +112,12 @@ struct xe_vma {
> */
> struct list_head link;
> } extobj;
> +
> + /**
> + * @userptr: user pointer state, only allocated for VMAs that are
> + * user pointers
> + */
> + struct xe_userptr userptr;
> };
>
> struct xe_device;
> --
> 2.34.1
>
next prev parent reply other threads:[~2023-07-13 20:26 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 21:27 [Intel-xe] [PATCH 0/5] More VM cleanups Matthew Brost
2023-07-11 21:27 ` [Intel-xe] [PATCH 1/5] drm/xe: Avoid doing rebinds Matthew Brost
2023-07-13 20:10 ` Rodrigo Vivi
2023-07-13 20:11 ` Rodrigo Vivi
2023-07-11 21:27 ` [Intel-xe] [PATCH 2/5] drm/xe: Reduce the number list links in xe_vma Matthew Brost
2023-07-13 20:18 ` Rodrigo Vivi
2023-07-14 3:56 ` Matthew Brost
2023-07-14 13:42 ` Rodrigo Vivi
2023-07-15 13:11 ` Thomas Hellström
2023-07-19 22:19 ` Matthew Brost
2023-07-11 21:27 ` [Intel-xe] [PATCH 3/5] drm/xe: Change tile masks from u64 to u8 Matthew Brost
2023-07-13 20:21 ` Rodrigo Vivi
2023-07-14 3:46 ` Matthew Brost
2023-07-11 21:27 ` [Intel-xe] [PATCH 4/5] drm/xe: Combine destroy_cb and destroy_work in xe_vma into union Matthew Brost
2023-07-13 20:23 ` Rodrigo Vivi
2023-07-14 3:53 ` Matthew Brost
2023-07-14 14:28 ` Rodrigo Vivi
2023-07-11 21:27 ` [Intel-xe] [PATCH 5/5] drm/xe: Only alloc userptr part of xe_vma for userptrs Matthew Brost
2023-07-13 20:26 ` Rodrigo Vivi [this message]
2023-07-11 21:29 ` [Intel-xe] ✓ CI.Patch_applied: success for More VM cleanups Patchwork
2023-07-11 21:29 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-07-11 21:30 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-07-11 21:34 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-07-11 21:35 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-07-11 21:36 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-07-11 22:10 ` [Intel-xe] ○ CI.BAT: info " Patchwork
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=ZLBd88JCZQ1rXD3k@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@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