• O
    drm/radeon: Impl. new gtt allocate/free functions · ceae881b
    Oded Gabbay 提交于
    This patch adds the implementation of the gtt interface functions.
    
    The allocate function will allocate a single bo, pin and map it to kernel
    memory. It will return the gpu address and cpu ptr as arguments.
    
    v2:
    
    The bulk of the allocations in the GART is for MQDs. MQDs represent active
    user-mode queues, which are on the current runlist. It is important to
    remember that active queues doesn't necessarily mean scheduled/running
    queues, especially if there is over-subscription of queues or more than a
    single HSA process.
    
    Because the scheduling of the user-mode queues is done by the CP firmware,
    amdkfd doesn't have any indication if the queue is scheduled or not. If the
    CP will try to schedule a queue, and its MQD is not present, this will
    probably stuck the CP permanently, as it will load garbage from the GART
    (the address of the MQD is given to the CP inside the runlist packet).
    
    In addition, there are a couple of small allocations which also should
    always be pinned - runlist packets (2 packets) and HPDs. runlist packets can
    be quite large, depending on number of processes and queues.
    
    This new allocate function represents the short/mid-term solution of limiting
    the total memory consumption to around 4MB by default.
    
    The long-term solution is to create a mechanism through which radeon/ttm can
    ask amdkfd to clear GART/VRAM memory due to memory pressure.
    Then, amdkfd will preempt the running queues and wait until the memory pressure
    is over. After that, amdkfd will reschedule the queues.
    Signed-off-by: NOded Gabbay <oded.gabbay@amd.com>
    Reviewed-by: NAlexey Skidanov <Alexey.skidanov@amd.com>
    Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
    ceae881b
radeon_kfd.c 20.8 KB