public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Iddamsetty, Aravind" <aravind.iddamsetty@intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	<Intel-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 2/5] drm/i915: Record which client owns a VM
Date: Tue, 11 Jul 2023 14:38:04 +0530	[thread overview]
Message-ID: <dde4749e-1ba5-21b1-fbeb-12086bfb7c30@intel.com> (raw)
In-Reply-To: <20230707130220.3966836-3-tvrtko.ursulin@linux.intel.com>



On 07-07-2023 18:32, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> To enable accounting of indirect client memory usage (such as page tables)
> in the following patch, lets start recording the creator of each PPGTT.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_context.c       | 11 ++++++++---
>  drivers/gpu/drm/i915/gem/i915_gem_context_types.h |  3 +++
>  drivers/gpu/drm/i915/gem/selftests/mock_context.c |  4 ++--
>  drivers/gpu/drm/i915/gt/intel_gtt.h               |  1 +
>  4 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> index 9a9ff84c90d7..35cf6608180e 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> @@ -279,7 +279,8 @@ static int proto_context_set_protected(struct drm_i915_private *i915,
>  }
>  
>  static struct i915_gem_proto_context *
> -proto_context_create(struct drm_i915_private *i915, unsigned int flags)
> +proto_context_create(struct drm_i915_file_private *fpriv,
> +		     struct drm_i915_private *i915, unsigned int flags)
>  {
>  	struct i915_gem_proto_context *pc, *err;
>  
> @@ -287,6 +288,7 @@ proto_context_create(struct drm_i915_private *i915, unsigned int flags)
>  	if (!pc)
>  		return ERR_PTR(-ENOMEM);
>  
> +	pc->fpriv = fpriv;
>  	pc->num_user_engines = -1;
>  	pc->user_engines = NULL;
>  	pc->user_flags = BIT(UCONTEXT_BANNABLE) |
> @@ -1621,6 +1623,7 @@ i915_gem_create_context(struct drm_i915_private *i915,
>  			err = PTR_ERR(ppgtt);
>  			goto err_ctx;
>  		}
> +		ppgtt->vm.fpriv = pc->fpriv;
>  		vm = &ppgtt->vm;
>  	}
>  	if (vm)
> @@ -1740,7 +1743,7 @@ int i915_gem_context_open(struct drm_i915_private *i915,
>  	/* 0 reserved for invalid/unassigned ppgtt */
>  	xa_init_flags(&file_priv->vm_xa, XA_FLAGS_ALLOC1);
>  
> -	pc = proto_context_create(i915, 0);
> +	pc = proto_context_create(file_priv, i915, 0);
>  	if (IS_ERR(pc)) {
>  		err = PTR_ERR(pc);
>  		goto err;
> @@ -1822,6 +1825,7 @@ int i915_gem_vm_create_ioctl(struct drm_device *dev, void *data,
>  
>  	GEM_BUG_ON(id == 0); /* reserved for invalid/unassigned ppgtt */
>  	args->vm_id = id;
> +	ppgtt->vm.fpriv = file_priv;
>  	return 0;
>  
>  err_put:
> @@ -2284,7 +2288,8 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
>  		return -EIO;
>  	}
>  
> -	ext_data.pc = proto_context_create(i915, args->flags);
> +	ext_data.pc = proto_context_create(file->driver_priv, i915,
> +					   args->flags);
>  	if (IS_ERR(ext_data.pc))
>  		return PTR_ERR(ext_data.pc);
>  
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context_types.h b/drivers/gpu/drm/i915/gem/i915_gem_context_types.h
> index cb78214a7dcd..c573c067779f 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_context_types.h
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context_types.h
> @@ -188,6 +188,9 @@ struct i915_gem_proto_engine {
>   * CONTEXT_CREATE_SET_PARAM during GEM_CONTEXT_CREATE.
>   */
>  struct i915_gem_proto_context {
> +	/** @fpriv: Client which creates the context */
> +	struct drm_i915_file_private *fpriv;
> +
>  	/** @vm: See &i915_gem_context.vm */
>  	struct i915_address_space *vm;
>  
> diff --git a/drivers/gpu/drm/i915/gem/selftests/mock_context.c b/drivers/gpu/drm/i915/gem/selftests/mock_context.c
> index 8ac6726ec16b..125584ada282 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/mock_context.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/mock_context.c
> @@ -83,7 +83,7 @@ live_context(struct drm_i915_private *i915, struct file *file)
>  	int err;
>  	u32 id;
>  
> -	pc = proto_context_create(i915, 0);
> +	pc = proto_context_create(fpriv, i915, 0);
>  	if (IS_ERR(pc))
>  		return ERR_CAST(pc);
>  
> @@ -152,7 +152,7 @@ kernel_context(struct drm_i915_private *i915,
>  	struct i915_gem_context *ctx;
>  	struct i915_gem_proto_context *pc;
>  
> -	pc = proto_context_create(i915, 0);
> +	pc = proto_context_create(NULL, i915, 0);
>  	if (IS_ERR(pc))
>  		return ERR_CAST(pc);
>  
> diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h b/drivers/gpu/drm/i915/gt/intel_gtt.h
> index 4d6296cdbcfd..7192a534a654 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gtt.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gtt.h
> @@ -248,6 +248,7 @@ struct i915_address_space {
>  	struct drm_mm mm;
>  	struct intel_gt *gt;
>  	struct drm_i915_private *i915;
> +	struct drm_i915_file_private *fpriv;
>  	struct device *dma;
>  	u64 total;		/* size addr space maps (ex. 2GB for ggtt) */
>  	u64 reserved;		/* size addr space reserved */

Looks good to me.
Reviewed-by: Aravind Iddamsetty <aravind.iddamsetty@intel.com>

Thanks,
Aravind.

  reply	other threads:[~2023-07-11  9:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07 13:02 [Intel-gfx] [PATCH v5 0/5] fdinfo memory stats Tvrtko Ursulin
2023-07-07 13:02 ` [Intel-gfx] [PATCH 1/5] drm/i915: Add ability for tracking buffer objects per client Tvrtko Ursulin
2023-07-10 10:44   ` Iddamsetty, Aravind
2023-07-10 13:20     ` Tvrtko Ursulin
2023-07-11  7:48       ` Iddamsetty, Aravind
2023-07-11  9:39         ` Tvrtko Ursulin
2023-07-07 13:02 ` [Intel-gfx] [PATCH 2/5] drm/i915: Record which client owns a VM Tvrtko Ursulin
2023-07-11  9:08   ` Iddamsetty, Aravind [this message]
2023-07-07 13:02 ` [Intel-gfx] [PATCH 3/5] drm/i915: Track page table backing store usage Tvrtko Ursulin
2023-07-11  9:08   ` Iddamsetty, Aravind
2023-07-07 13:02 ` [Intel-gfx] [PATCH 4/5] drm/i915: Account ring buffer and context state storage Tvrtko Ursulin
2023-07-11  9:29   ` Iddamsetty, Aravind
2023-07-11  9:44     ` Tvrtko Ursulin
2023-07-07 13:02 ` [Intel-gfx] [PATCH 5/5] drm/i915: Implement fdinfo memory stats printing Tvrtko Ursulin
2023-08-24 11:35   ` Upadhyay, Tejas
2023-09-20 14:22     ` Tvrtko Ursulin
2023-09-20 14:39       ` Rob Clark
2023-07-07 16:00 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for fdinfo memory stats (rev4) Patchwork
2023-07-07 16:00 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-07-07 16:10 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-07-07 20:57 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-09-21 11:48 [Intel-gfx] [PATCH v7 0/5] fdinfo memory stats Tvrtko Ursulin
2023-09-21 11:48 ` [Intel-gfx] [PATCH 2/5] drm/i915: Record which client owns a VM Tvrtko Ursulin
2023-07-27 10:13 [Intel-gfx] [PATCH v6 0/5] fdinfo memory stats Tvrtko Ursulin
2023-07-27 10:13 ` [Intel-gfx] [PATCH 2/5] drm/i915: Record which client owns a VM Tvrtko Ursulin
2023-06-12 10:46 [Intel-gfx] [PATCH v4 0/5] fdinfo memory stats Tvrtko Ursulin
2023-06-12 10:46 ` [Intel-gfx] [PATCH 2/5] drm/i915: Record which client owns a VM Tvrtko Ursulin

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=dde4749e-1ba5-21b1-fbeb-12086bfb7c30@intel.com \
    --to=aravind.iddamsetty@intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tvrtko.ursulin@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