<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 12-09-2023 17:22, Tejas Upadhyay
wrote:<br>
</div>
<blockquote type="cite" cite="mid:20230912115239.3554341-6-tejas.upadhyay@intel.com">
<pre class="moz-quote-pre" wrap="">Account page table memory usage in the owning client
memory usage stats.
V2:
- Minor tweak to if (vm->pt_root[id]) check - Himal
Signed-off-by: Tejas Upadhyay <a class="moz-txt-link-rfc2396E" href="mailto:tejas.upadhyay@intel.com"><tejas.upadhyay@intel.com></a>
---
drivers/gpu/drm/xe/xe_pt.c | 4 +++-
drivers/gpu/drm/xe/xe_vm.c | 7 ++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
index 5709518e314b..8df83241c5fe 100644
--- a/drivers/gpu/drm/xe/xe_pt.c
+++ b/drivers/gpu/drm/xe/xe_pt.c
@@ -7,6 +7,7 @@
#include "xe_bo.h"
#include "xe_device.h"
+#include "xe_drm_client.h"
#include "xe_gt.h"
#include "xe_gt_tlb_invalidation.h"
#include "xe_migrate.h"
@@ -195,7 +196,8 @@ struct xe_pt *xe_pt_create(struct xe_vm *vm, struct xe_tile *tile,
pt->bo = bo;
pt->level = level;
pt->base.dir = level ? &as_xe_pt_dir(pt)->dir : NULL;
-
+ if (vm->xef)
+ xe_drm_client_add_bo(vm->xef->client, pt->bo);
XE_WARN_ON(level > XE_VM_MAX_LEVEL);
return pt;
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 92d8c78c9284..4eae641fc79f 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -19,6 +19,7 @@
#include "xe_bo.h"
#include "xe_device.h"
+#include "xe_drm_client.h"
#include "xe_exec_queue.h"
#include "xe_gt.h"
#include "xe_gt_pagefault.h"
@@ -1974,6 +1975,7 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
struct xe_device *xe = to_xe_device(dev);
struct xe_file *xef = to_xe_file(file);
struct drm_xe_vm_create *args = data;
+ struct xe_tile *tile;
struct xe_vm *vm;
u32 id, asid;
int err;
@@ -2052,7 +2054,10 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
args->vm_id = id;
vm->xef = xef;
-
+ /* Record BO memory for VM pagetable create against client */
+ for_each_tile(tile, xe, id)
+ if (vm->pt_root[id])
+ xe_drm_client_add_bo(vm->xef->client, vm->pt_root[id]->bo);</pre>
</blockquote>
LGTM. <span class="reviewed-by" style="box-sizing: border-box;">Reviewed-by:
Himal Prasad Ghimiray <a class="moz-txt-link-rfc2396E" href="mailto:himal.prasad.ghimiray@intel.com"><himal.prasad.ghimiray@intel.com></a></span>
<blockquote type="cite" cite="mid:20230912115239.3554341-6-tejas.upadhyay@intel.com">
<pre class="moz-quote-pre" wrap="">
#if IS_ENABLED(CONFIG_DRM_XE_DEBUG_MEM)
/* Warning: Security issue - never enable by default */
args->reserved[0] = xe_bo_main_addr(vm->pt_root[0]->bo, XE_PAGE_SIZE);
</pre>
</blockquote>
</body>
</html>