Quoting Christian König (2026-11-16 15:17:02)
> On 11/9/26 14:55, Mika Kuoppala wrote:
> > Implement debugger vm access for userptrs.
> > 
> > When bind is done, take a ref to the current task so that
> > we know from which vm the address was bound. Then during
> > debugger pread/pwrite we use this target task as
> > parameter to access the debuggee vm with access_process_vm().
> > 
> > This is based on suggestions from Simona, Thomas and Joonas.
> 
> At AMD we had a legthly discussion if such an interface would be necessary 
> for AMDs debugger interface and came to the conclusion that it is *NOT* a 
> good idea to have this.

I'd like to refer to our 2024 December discussion on review of v3 of
this series[1].

Quoting myself from the end:

        "It seems like the peek/poke access to userptr is the big remaining open
        where opinions differ, so maybe we should first focus on aligning on it.
        It impacts both core dumping and interactive debugging."

Then from same series review, we took Sima's suggestions[2] to be
implemented. About one year later in 2025 December we got your
review comments[3] for series v6:

        "But from a ten mile high view it looks sane to me now."

And quoting myself:

        "Understandable and thanks for the high level check, we'll continue 
with the
        current direction then."

So given v4 (which you gave above "looks sane to me" included pretty much
exactly this patch [4], I'm bit surprised to be starting to reiterate what
feels like our discussion from [1].

I'm hoping we can agree to a disagree here. ROCm maybe doesn't need
interface like this due to requirement of ptrace_attach(), GPU address
== CPU address and no kernel initiated core dumps. We want to avoid
those limitations in our architecture as discussed in [1].

After you very much seemed to agree in the direction on [3], we've
spent 2 years incrementally addressing all the other comments in 7 new
series versions. Thus I'm not really a big fan of reiterating the original
discussion, so excuse me for being bit irritated here.

> process_vm_readv() and process_vm_writev() interfaces already allow a 
> debugger to access userptr resources completely without the need of 
> PTRACE_ATTACH.

That is correct. However as discussed earlier the access implemented
here is for reading memory from ppGTT, not the CPU address space. For
readv/writev userspace driver would have to maintain all ppGTT layouts
in CPU address space and that'll simply not fit as discussed in [1]
amongst the other reasons.

This exact same access will be needed when doing core dumps and capturing
the ppGTT contents during crash by kernel, when there is no GDB involved.
I don't see any value in diverging the memory access path for interactive
debug and core dumps.

I don't know if ROCm has plans for supporting core dumps without GDB
involved, but we definitely want to have that ability. And in [1] we
seemed to agree on the usefulness.

> Especially since this interface here allows to bypass all the extra security 
> checks otherwise applied to such an action it should probably not be 
> something allowed upstream.

To recap. No security is bypassed, access happens as if GPU did the
access. If the address is not in ppGTT, there's no access to it. So
access given here is equal to access gained submitting a blitter copy
command to copy the data using a context with the same ppGTT. Code
comments were added to explain to eliminate Sashiko false positives.

Unfortunately, we can't actually rely on the RCS/CCS/BCS engines
making forward progress on current gen hardware as hardware may be
stalled due to numerous pending page-faults. Especially when doing
core dumps.

Regards, Joonas

[1] 
https://lore.kernel.org/intel-xe/173392197322.40386.12252741494998606...@jlahtine-mobl.ger.corp.intel.com/
[2] https://lore.kernel.org/intel-xe/[email protected]/
[3] 
https://lore.kernel.org/intel-xe/176520185138.24350.8954844301177099832@jlahtine-mobl/
[4] 
https://lore.kernel.org/intel-xe/[email protected]/

Reply via email to