• Jonathan Kim's avatar
    drm/amdkfd: prepare per-process debug enable and disable · 0ab2d753
    Jonathan Kim authored
    The ROCm debugger will attach to a process to debug by PTRACE and will
    expect the KFD to prepare a process for the target PID, whether the
    target PID has opened the KFD device or not.
    
    This patch is to explicity handle this requirement.  Further HW mode
    setting and runtime coordination requirements will be handled in
    following patches.
    
    In the case where the target process has not opened the KFD device,
    a new KFD process must be created for the target PID.
    The debugger as well as the target process for this case will have not
    acquired any VMs so handle process restoration to correctly account for
    this.
    
    To coordinate with HSA runtime, the debugger must be aware of the target
    process' runtime enablement status and will copy the runtime status
    information into the debugged KFD process for later query.
    
    On enablement, the debugger will subscribe to a set of exceptions where
    each exception events will notify the debugger through a pollable FIFO
    file descriptor that the debugger provides to the KFD to manage.
    
    Finally on process termination of either the debugger or the target,
    debugging must be disabled if it has not been done so.
    Signed-off-by: default avatarJonathan Kim <jonathan.kim@amd.com>
    Reviewed-by: default avatarFelix Kuehling <felix.kuehling@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    0ab2d753
kfd_debug.c 2.33 KB