• Philip Yang's avatar
    drm/amdkfd: Track unified memory when switching xnack mode · 8a7c3ce1
    Philip Yang authored
    Unified memory usage with xnack off is tracked to avoid oversubscribe
    system memory, with xnack on, we don't track unified memory usage to
    allow memory oversubscribe. When switching xnack mode from off to on,
    subsequent free ranges allocated with xnack off will not unreserve
    memory. When switching xnack mode from on to off, subsequent free ranges
    allocated with xnack on will unreserve memory. Both cases cause memory
    accounting unbalanced.
    
    When switching xnack mode from on to off, need reserve already allocated
    svm range memory. When switching xnack mode from off to on, need
    unreserve already allocated svm range memory.
    
    v6: Take prange lock to access range child list
    v5: Handle prange child ranges
    v4: Handle reservation memory failure
    v3: Handle switching xnack mode race with svm_range_deferred_list_work
    v2: Handle both switching xnack from on to off and from off to on cases
    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>
    8a7c3ce1
kfd_chardev.c 73.9 KB