From: "Christian König" <christian.koenig@amd.com>
To: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Mika Kuoppala <mika.kuoppala@linux.intel.com>,
intel-xe@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org,
"Matthew Brost" <matthew.brost@intel.com>,
"Andrzej Hajda" <andrzej.hajda@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Dominik Grzegorzek" <dominik.grzegorzek@intel.com>,
"Simona Vetter" <simona@ffwll.ch>
Subject: Re: [PATCH 13/26] RFC drm/xe/eudebug: userptr vm pread/pwrite
Date: Thu, 30 Jan 2025 13:09:01 +0100 [thread overview]
Message-ID: <f2f8bdc4-d803-41f1-931d-d9a68273fa70@amd.com> (raw)
In-Reply-To: <173817470871.73308.11950290138742433654@jlahtine-mobl.ger.corp.intel.com>
[-- Attachment #1: Type: text/plain, Size: 4514 bytes --]
Am 29.01.25 um 19:18 schrieb Joonas Lahtinen:
>>> Would be great to reach a consensus on the high level details before
>>> spinning off further series addressing the smaller items.
>> I would say that attaching debug metadata to the GPU VMA doesn't look
>> like the best design, but if you just do that inside XE it won't affect
>> any other part of the kernel.
> It just grew out of convenience of implementation on the side of VM_BIND.
>
> The other alternative would be to maintain a secondary load map in the
> kernel in a separate data structure from GPU VMA.
>
> I was actually going to suggest such thing as a common DRM thing: GPU VMA
> metadata interface or parallel "GPU loadmap" interface. It'd allow for
> userspace tooling to more easier go from GPU EU IP to a module that
> was loaded at that address. Kind of a step 0 towards backtrace for GPU.
>
> Can you elaborate on what your concern is with the VMA metadata
> attachment?
In general we should try to avoid putting data into the kernel the
kernel doesn't need.
In other words we don't put the debug metadata for the CPU process on
the CPU VMA either.
You could reduce the amount of data massively if you just attach the
source of the debug metadata to the GPU VMA.
E.g. instead of the symbol table just where to find it. A VA of the CPU
process, a file system location or something like that.
>> My other concern I have is using ptrace_may_access, I would still try to
>> avoid that.
>>
>> What if you first grab the DRM render node file descriptor which
>> represents the GPU address space you want to debug with pidfd_getfd()
>> and then either create the eudebug file descriptor from an IOCTL or
>> implement the necessary IOCTLs on the DRM render node directly?
>>
>> That would make it unnecessary to export ptrace_may_access.
> We're prototyping this. At this point there are some caveats recognized:
>
> 1. There is a limitation that you don't get a notification when your
> target PID opens a DRM client, but GDB or other application would have
> to keep polling for the FDs. I'll have to check with the team how that
> would fit to GDB side.
Well there is the dnotify/inotify API which allows a process to be
notified of certain filesystem events.
I never used it, but it potentially provides an event when a specific
file is open.
On the other hand I have no idea what permissions are necessary to use
it, potentially root.
> 2. Debugging multiple DRM clients (to same GPU) under one PID now
> requires separate debugger connections. This may break the way the debugger
> locking is currently implemented for the discovery phase to prevent parallel
> IOCTL from running. Will have to look into it once we have a working
> prototype.
Well multiple DRM clients would also have multiple GPU VM address
spaces, wouldn't they?
So you would need multiple connections, one for each DRM client as well.
> 3. Last but not the least, we'll have to compare which LSM security
> modules and other conditions checked on the pidfd_getfd() paths for
> access restrictions.
>
> Reason for using ptrace_may_access() was to have a clear 1:1 mapping
> between user being allowed to ptrace() a PID to control CPU threads and
> do debugger IOCTL to control GPU threads. So if user can attach to a PID
> with GDB, they would certainly also be able to debug the GPU portion.
>
> If there is divergence, I don't see a big benefit in going to
> pidfd_getfd(). We're all the same not even exporting ptrace_may_access()
> and YOLO'ing the access check by comparing euid and such which is close
> to what ptrace does, but not exactly the same (just like pidfd_getfd()
> access checks).
Well that argumentation is exactly backward to why I suggested not using
ptrace_may_access().
When an administrator used LSM to block pidfd_getfd() then a driver
which uses a driver specific IOCTL to bypass that is actually a really
bad idea.
> However I believe this would not be a fundamental blocker for the
> series? If this would be the only remaining disagreement, I guess we
> could just do CAP_ADMIN check initially before we can find something
> agreeable.
Well as soon as anything is merged upstream it becomes UAPI, which in
turn means that changing it fundamentally becomes really hard to do.
What you could do is to expose the interface through debugfs and
explicitly state that it isn't stable in any way.
Regards,
Christian.
>
> Regards, Joonas
>
>> Regards,
>> Christian.
>>
>>> Regards, Joonas
>>>
>>>> Regards,
>>>> Christian.
[-- Attachment #2: Type: text/html, Size: 6750 bytes --]
next prev parent reply other threads:[~2025-01-30 12:09 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 13:32 [PATCH 00/26] Intel Xe GPU debug support (eudebug) v3 Mika Kuoppala
2024-12-09 13:32 ` [PATCH 01/26] ptrace: export ptrace_may_access Mika Kuoppala
2024-12-10 4:29 ` Christoph Hellwig
2024-12-12 9:16 ` Joonas Lahtinen
2024-12-09 13:32 ` [PATCH 02/26] drm/xe/eudebug: Introduce eudebug support Mika Kuoppala
2024-12-09 13:32 ` [PATCH 03/26] drm/xe/eudebug: Introduce discovery for resources Mika Kuoppala
2024-12-09 13:32 ` [PATCH 04/26] drm/xe/eudebug: Introduce exec_queue events Mika Kuoppala
2024-12-09 13:32 ` [PATCH 05/26] drm/xe/eudebug: Introduce exec queue placements event Mika Kuoppala
2024-12-09 13:32 ` [PATCH 06/26] drm/xe/eudebug: hw enablement for eudebug Mika Kuoppala
2024-12-09 13:32 ` [PATCH 07/26] drm/xe: Add EUDEBUG_ENABLE exec queue property Mika Kuoppala
2024-12-09 13:32 ` [PATCH 08/26] drm/xe/eudebug: Introduce per device attention scan worker Mika Kuoppala
2024-12-09 13:33 ` [PATCH 09/26] drm/xe/eudebug: Introduce EU control interface Mika Kuoppala
2024-12-09 13:33 ` [PATCH 10/26] drm/xe/eudebug: Add vm bind and vm bind ops Mika Kuoppala
2024-12-09 13:33 ` [PATCH 11/26] drm/xe/eudebug: Add UFENCE events with acks Mika Kuoppala
2024-12-09 13:33 ` [PATCH 12/26] drm/xe/eudebug: vm open/pread/pwrite Mika Kuoppala
2024-12-09 13:33 ` [PATCH 13/26] drm/xe: add system memory page iterator support to xe_res_cursor Mika Kuoppala
2024-12-09 13:33 ` [PATCH 14/26] drm/xe/eudebug: implement userptr_vma access Mika Kuoppala
2024-12-09 14:03 ` Christian König
2024-12-09 14:56 ` Joonas Lahtinen
2024-12-09 15:31 ` Simona Vetter
2024-12-09 15:42 ` Christian König
2024-12-09 15:45 ` Christian König
2024-12-10 9:33 ` Joonas Lahtinen
2024-12-10 10:00 ` Christian König
2024-12-10 11:57 ` Joonas Lahtinen
2024-12-10 14:03 ` Christian König
2024-12-11 12:59 ` Joonas Lahtinen
2024-12-17 14:12 ` Joonas Lahtinen
2024-12-20 12:47 ` Mika Kuoppala
2024-12-10 11:17 ` Simona Vetter
2024-12-12 8:49 ` Thomas Hellström
2024-12-12 10:12 ` Simona Vetter
2024-12-13 19:39 ` Matthew Brost
2024-12-16 14:17 ` [PATCH 13/26] RFC drm/xe/eudebug: userptr vm pread/pwrite Mika Kuoppala
2024-12-20 11:31 ` Mika Kuoppala
2024-12-20 12:56 ` Christian König
2025-01-29 8:03 ` Joonas Lahtinen
2025-01-29 10:33 ` Christian König
2025-01-29 18:18 ` Joonas Lahtinen
2025-01-30 12:09 ` Christian König [this message]
2024-12-23 10:31 ` Thomas Hellström
2025-01-13 13:22 ` Mika Kuoppala
2025-01-13 13:32 ` [PATCH 13/27] mm: export access_remote_vm symbol for debugger use Mika Kuoppala
2025-01-13 13:32 ` [PATCH 14/27] drm/xe/eudebug: userptr vm access pread/pwrite Mika Kuoppala
2024-12-09 13:33 ` [PATCH 15/26] drm/xe: Debug metadata create/destroy ioctls Mika Kuoppala
2024-12-09 13:33 ` [PATCH 16/26] drm/xe: Attach debug metadata to vma Mika Kuoppala
2024-12-09 13:33 ` [PATCH 17/26] drm/xe/eudebug: Add debug metadata support for xe_eudebug Mika Kuoppala
2024-12-09 13:33 ` [PATCH 18/26] drm/xe/eudebug: Implement vm_bind_op discovery Mika Kuoppala
2024-12-09 13:33 ` [PATCH 19/26] drm/xe/eudebug: Dynamically toggle debugger functionality Mika Kuoppala
2024-12-09 13:33 ` [PATCH 20/26] drm/xe/eudebug_test: Introduce xe_eudebug wa kunit test Mika Kuoppala
2024-12-09 13:33 ` [PATCH 21/26] drm/xe/eudebug/ptl: Add support for extra attention register Mika Kuoppala
2024-12-09 13:33 ` [PATCH 22/26] drm/xe/eudebug/ptl: Add RCU_DEBUG_1 register support for xe3 Mika Kuoppala
2024-12-09 13:33 ` [PATCH 23/26] drm/xe/eudebug: Add read/count/compare helper for eu attention Mika Kuoppala
2024-12-09 13:33 ` [PATCH 24/26] drm/xe/eudebug: Introduce EU pagefault handling interface Mika Kuoppala
2024-12-09 13:33 ` [PATCH 25/26] drm/xe/vm: Support for adding null page VMA to VM on request Mika Kuoppala
2024-12-09 13:33 ` [PATCH 26/26] drm/xe/eudebug: Enable EU pagefault handling Mika Kuoppala
2024-12-09 14:37 ` ✓ CI.Patch_applied: success for Intel Xe GPU debug support (eudebug) v3 Patchwork
2024-12-09 14:38 ` ✗ CI.checkpatch: warning " Patchwork
2024-12-09 14:39 ` ✗ CI.KUnit: failure " Patchwork
2024-12-16 14:22 ` ✗ CI.Patch_applied: failure for Intel Xe GPU debug support (eudebug) v3 (rev2) Patchwork
2024-12-20 14:36 ` ✗ CI.Patch_applied: failure for Intel Xe GPU debug support (eudebug) v3 (rev3) Patchwork
2025-01-13 16:15 ` ✗ CI.Patch_applied: failure for Intel Xe GPU debug support (eudebug) v3 (rev4) 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=f2f8bdc4-d803-41f1-931d-d9a68273fa70@amd.com \
--to=christian.koenig@amd.com \
--cc=andrzej.hajda@intel.com \
--cc=dominik.grzegorzek@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=mika.kuoppala@linux.intel.com \
--cc=simona@ffwll.ch \
--cc=thomas.hellstrom@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