• Philip Yang's avatar
    drm/amdkfd: Fix partial migration bugs · 88467db6
    Philip Yang authored
    Migration range from system memory to VRAM, if system page can not be
    locked or unmapped, we do partial migration and leave some pages in
    system memory. Several bugs found to copy pages and update GPU mapping
    for this situation:
    
    1. copy to vram should use migrate->npage which is total pages of range
    as npages, not migrate->cpages which is number of pages can be migrated.
    
    2. After partial copy, set VRAM res cursor as j + 1, j is number of
    system pages copied plus 1 page to skip copy.
    
    3. copy to ram, should collect all continuous VRAM pages and copy
    together.
    
    4. Call amdgpu_vm_update_range, should pass in offset as bytes, not
    as number of pages.
    Signed-off-by: default avatarPhilip Yang <Philip.Yang@amd.com>
    Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    88467db6
kfd_svm.c 105 KB