[PATCH 01/11] drm/amdkfd: device pgmap owner at the svm migrate init

Felix Kuehling felix.kuehling at amd.com
Wed Jun 30 04:06:47 UTC 2021


Other than the updated patch description for patch 1, the series
(patches 1-10) is

Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>

Patch 11 was already reviewed and revised separately.

Thanks,
  Felix


Am 2021-06-30 um 12:00 a.m. schrieb Felix Kuehling:
> Am 2021-06-29 um 2:01 p.m. schrieb Alex Sierra:
>> pgmap owner member at the svm migrate init could be referenced
>> to either adev or hive, depending on device topology.
> Please update the commit description before submitting the change:
>
> GPUs in the same XGMI hive have direct access to all members' VRAM. When
> mapping memory to a GPU, we don't need hmm_range_fault to fault
> device-private pages in the same hive back to the host. Identifying the
> page owner as the hive, rather than the individual GPU, accomplishes this.
>
>
>> Signed-off-by: Alex Sierra <alex.sierra at amd.com>
>> Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>
>> ---
>>  drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 6 +++---
>>  drivers/gpu/drm/amd/amdkfd/kfd_svm.h     | 3 +++
>>  2 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
>> index 45b5349283af..8ce71c8142aa 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
>> @@ -427,7 +427,7 @@ svm_migrate_vma_to_vram(struct amdgpu_device *adev, struct svm_range *prange,
>>  	migrate.start = start;
>>  	migrate.end = end;
>>  	migrate.flags = MIGRATE_VMA_SELECT_SYSTEM;
>> -	migrate.pgmap_owner = adev;
>> +	migrate.pgmap_owner = SVM_ADEV_PGMAP_OWNER(adev);
>>  
>>  	size = 2 * sizeof(*migrate.src) + sizeof(uint64_t) + sizeof(dma_addr_t);
>>  	size *= npages;
>> @@ -649,7 +649,7 @@ svm_migrate_vma_to_ram(struct amdgpu_device *adev, struct svm_range *prange,
>>  	migrate.start = start;
>>  	migrate.end = end;
>>  	migrate.flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE;
>> -	migrate.pgmap_owner = adev;
>> +	migrate.pgmap_owner = SVM_ADEV_PGMAP_OWNER(adev);
>>  
>>  	size = 2 * sizeof(*migrate.src) + sizeof(uint64_t) + sizeof(dma_addr_t);
>>  	size *= npages;
>> @@ -921,7 +921,7 @@ int svm_migrate_init(struct amdgpu_device *adev)
>>  	pgmap->range.start = res->start;
>>  	pgmap->range.end = res->end;
>>  	pgmap->ops = &svm_migrate_pgmap_ops;
>> -	pgmap->owner = adev;
>> +	pgmap->owner = SVM_ADEV_PGMAP_OWNER(adev);
>>  	pgmap->flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE;
>>  	r = devm_memremap_pages(adev->dev, pgmap);
>>  	if (IS_ERR(r)) {
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.h b/drivers/gpu/drm/amd/amdkfd/kfd_svm.h
>> index a9af03994d1a..1f88bdfdbcc2 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.h
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.h
>> @@ -35,6 +35,9 @@
>>  #include "amdgpu.h"
>>  #include "kfd_priv.h"
>>  
>> +#define SVM_ADEV_PGMAP_OWNER(adev)\
>> +			((adev)->hive ? (void *)(adev)->hive : (void *)(adev))
>> +
>>  struct svm_range_bo {
>>  	struct amdgpu_bo		*bo;
>>  	struct kref			kref;
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list