From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>,
Matthew Brost <matthew.brost@intel.com>
Subject: [PATCH 16/18] drm/xe/eudebug: Implement vm_bind_op discovery
Date: Tue, 1 Oct 2024 17:43:04 +0300 [thread overview]
Message-ID: <20241001144306.1991001-17-mika.kuoppala@linux.intel.com> (raw)
In-Reply-To: <20241001144306.1991001-1-mika.kuoppala@linux.intel.com>
Follow the vm bind, vm_bind op sequence for
discovery process of a vm with the vmas it has.
Send events for ops and attach metadata if available.
v2: - Fix bad op ref seqno (Christoph)
- with discovery semaphore, we dont need vm lock (Matthew)
Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
drivers/gpu/drm/xe/xe_eudebug.c | 45 +++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_eudebug.c b/drivers/gpu/drm/xe/xe_eudebug.c
index 368e1a987f7a..faa49ba55b78 100644
--- a/drivers/gpu/drm/xe/xe_eudebug.c
+++ b/drivers/gpu/drm/xe/xe_eudebug.c
@@ -3153,6 +3153,47 @@ void xe_eudebug_debug_metadata_destroy(struct xe_file *xef, struct xe_debug_meta
xe_eudebug_event_put(d, debug_metadata_destroy_event(d, xef, m));
}
+static int vm_discover_binds(struct xe_eudebug *d, struct xe_vm *vm)
+{
+ struct drm_gpuva *va;
+ unsigned int num_ops = 0, send_ops = 0;
+ u64 ref_seqno = 0;
+ int err;
+
+ /*
+ * Currently only vm_bind_ioctl inserts vma's
+ * and with discovery lock, we have exclusivity.
+ */
+ lockdep_assert_held_write(&d->xe->eudebug.discovery_lock);
+
+ drm_gpuvm_for_each_va(va, &vm->gpuvm)
+ num_ops++;
+
+ if (!num_ops)
+ return 0;
+
+ err = vm_bind_event(d, vm, num_ops, &ref_seqno);
+ if (err)
+ return err;
+
+ drm_gpuvm_for_each_va(va, &vm->gpuvm) {
+ struct xe_vma *vma = container_of(va, struct xe_vma, gpuva);
+
+ if (send_ops >= num_ops)
+ break;
+
+ err = vm_bind_op(d, vm, DRM_XE_EUDEBUG_EVENT_CREATE, ref_seqno,
+ xe_vma_start(vma), xe_vma_size(vma),
+ &vma->eudebug.metadata.list);
+ if (err)
+ return err;
+
+ send_ops++;
+ }
+
+ return num_ops == send_ops ? 0 : -EINVAL;
+}
+
static int discover_client(struct xe_eudebug *d, struct xe_file *xef)
{
struct xe_debug_metadata *m;
@@ -3175,6 +3216,10 @@ static int discover_client(struct xe_eudebug *d, struct xe_file *xef)
err = vm_create_event(d, xef, vm);
if (err)
break;
+
+ err = vm_discover_binds(d, vm);
+ if (err)
+ break;
}
xa_for_each(&xef->exec_queue.xa, i, q) {
--
2.34.1
next prev parent reply other threads:[~2024-10-01 14:53 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-01 14:42 [PATCH 00/18] GPU debug support (eudebug) v2 Mika Kuoppala
2024-10-01 14:42 ` [PATCH 01/18] ptrace: export ptrace_may_access Mika Kuoppala
2024-10-01 14:42 ` [PATCH 02/18] drm/xe/eudebug: Introduce eudebug support Mika Kuoppala
2024-10-01 14:42 ` [PATCH 03/18] drm/xe/eudebug: Introduce discovery for resources Mika Kuoppala
2024-10-03 0:41 ` Matthew Brost
2024-10-03 7:27 ` Mika Kuoppala
2024-10-03 16:32 ` Matthew Brost
2024-10-01 14:42 ` [PATCH 04/18] drm/xe/eudebug: Introduce exec_queue events Mika Kuoppala
2024-10-01 14:42 ` [PATCH 05/18] drm/xe/eudebug: hw enablement for eudebug Mika Kuoppala
2024-10-01 14:42 ` [PATCH 06/18] drm/xe: Add EUDEBUG_ENABLE exec queue property Mika Kuoppala
2024-10-01 14:42 ` [PATCH 07/18] drm/xe/eudebug: Introduce per device attention scan worker Mika Kuoppala
2024-10-01 14:42 ` [PATCH 08/18] drm/xe/eudebug: Introduce EU control interface Mika Kuoppala
2024-10-01 14:42 ` [PATCH 09/18] drm/xe/eudebug: Add vm bind and vm bind ops Mika Kuoppala
2024-10-01 14:42 ` [PATCH 10/18] drm/xe/eudebug: Add UFENCE events with acks Mika Kuoppala
2024-10-01 14:42 ` [PATCH 11/18] drm/xe/eudebug: vm open/pread/pwrite Mika Kuoppala
2024-10-01 14:43 ` [PATCH 12/18] drm/xe/eudebug: implement userptr_vma access Mika Kuoppala
2024-10-05 3:48 ` Matthew Brost
2024-10-12 2:39 ` Matthew Brost
2024-10-12 2:55 ` Matthew Brost
2024-10-20 18:16 ` Matthew Brost
2024-10-21 9:54 ` Hajda, Andrzej
2024-10-21 22:34 ` Matthew Brost
2024-10-23 11:32 ` Hajda, Andrzej
2024-10-24 16:06 ` Matthew Brost
2024-10-25 13:20 ` Hajda, Andrzej
2024-10-25 18:23 ` Matthew Brost
2024-10-28 16:19 ` [PATCH 1/2] drm/xe: keep list of system pages in xe_userptr Andrzej Hajda
2024-10-28 16:19 ` [PATCH 2/2] drm/xe/eudebug: implement userptr_vma access Andrzej Hajda
2024-10-28 16:55 ` Hajda, Andrzej
2024-10-01 14:43 ` [PATCH 13/18] drm/xe: Debug metadata create/destroy ioctls Mika Kuoppala
2024-10-01 16:25 ` Matthew Auld
2024-10-02 13:59 ` Grzegorzek, Dominik
2024-10-01 14:43 ` [PATCH 14/18] drm/xe: Attach debug metadata to vma Mika Kuoppala
2024-10-01 14:43 ` [PATCH 15/18] drm/xe/eudebug: Add debug metadata support for xe_eudebug Mika Kuoppala
2024-10-01 14:43 ` Mika Kuoppala [this message]
2024-10-01 14:43 ` [PATCH 17/18] drm/xe/eudebug: Dynamically toggle debugger functionality Mika Kuoppala
2024-10-01 14:43 ` [PATCH 18/18] drm/xe/eudebug_test: Introduce xe_eudebug wa kunit test Mika Kuoppala
2024-10-01 15:02 ` ✓ CI.Patch_applied: success for GPU debug support (eudebug) (rev2) Patchwork
2024-10-01 15:03 ` ✗ CI.checkpatch: warning " Patchwork
2024-10-01 15:03 ` ✗ CI.KUnit: failure " 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=20241001144306.1991001-17-mika.kuoppala@linux.intel.com \
--to=mika.kuoppala@linux.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