drm/amdkfd: Fix svm_range_is_same_attrs
authorFelix Kuehling <Felix.Kuehling@amd.com>
Wed, 8 Dec 2021 02:02:42 +0000 (21:02 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 13 Dec 2021 21:32:35 +0000 (16:32 -0500)
commitf864df76ff1021b21776a7df029c0da884794c28
tree357228bbfde66d0a61ecfb829037936de95bfa07
parent726be40607264b180a2b336c81e1dcff941de618
drm/amdkfd: Fix svm_range_is_same_attrs

The existing function doesn't compare the access bitmaps and flags.
This can result in failure to update those attributes in existing
ranges when all other attributes remained unchanged.

Because the access and flags attributes modify only some bits in the
respective bitmaps, we cannot compare them directly. Instead we need to
check whether applying the attributes to a particular range would
change the bitmaps.

A PREFETCH_LOC attribute must always trigger a migration, even if the
attribute value remains unchanged. E.g. if some pages were migrated due
to a CPU page fault, a prefetch must still be executed to migrate pages
back to VRAM.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_svm.c