[PATCH 5/5] drm/amdgpu: immedially invalidate PTEs
Christian König
ckoenig.leichtzumerken at gmail.com
Thu Dec 5 17:15:39 UTC 2019
Am 05.12.19 um 17:45 schrieb Felix Kuehling:
> On 2019-12-05 8:39 a.m., Christian König wrote:
>> When a BO is evicted immedially invalidate the mapped PTEs.
>
> I think you mentioned that this is just a proof of concept.
I also need this for immediately getting rid of mappings in DMA-buf
based P2P.
> I wouldn't submit the patch like this because it's overkill for VMs
> that don't want to use recoverable page faults and probably has a
> performance impact. I would do something specific to compute VMs in
> our MMU notifier.
I still need to test this, but I hope that it doesn't have that much
impact on performance.
Regards,
Christian.
>
> Regards,
> Â Felix
>
>>
>> Signed-off-by: Christian König <christian.koenig at amd.com>
>> ---
>> Â drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 17 ++++++++++++++++-
>> Â 1 file changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> index 839d6df394fc..e578113bfd55 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> @@ -2565,6 +2565,7 @@ void amdgpu_vm_bo_invalidate(struct
>> amdgpu_device *adev,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â struct amdgpu_bo *bo, bool evicted)
>> Â {
>> Â Â Â Â Â struct amdgpu_vm_bo_base *bo_base;
>> +Â Â Â int r;
>> Â Â Â Â Â Â /* shadow bo doesn't have bo base, its validation needs its
>> parent */
>> Â Â Â Â Â if (bo->parent && bo->parent->shadow == bo)
>> @@ -2572,8 +2573,22 @@ void amdgpu_vm_bo_invalidate(struct
>> amdgpu_device *adev,
>> Â Â Â Â Â Â for (bo_base = bo->vm_bo; bo_base; bo_base = bo_base->next) {
>> Â Â Â Â Â Â Â Â Â struct amdgpu_vm *vm = bo_base->vm;
>> +Â Â Â Â Â Â Â struct dma_resv *resv = vm->root.base.bo->tbo.base.resv;
>> +
>> +Â Â Â Â Â Â Â if (bo->tbo.type != ttm_bo_type_kernel) {
>> +Â Â Â Â Â Â Â Â Â Â Â struct amdgpu_bo_va *bo_va;
>> +
>> +Â Â Â Â Â Â Â Â Â Â Â bo_va = container_of(bo_base, struct amdgpu_bo_va,
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â base);
>> +Â Â Â Â Â Â Â Â Â Â Â r = amdgpu_vm_bo_update(adev, bo_va,
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â bo->tbo.base.resv != resv);
>> +Â Â Â Â Â Â Â Â Â Â Â if (!r) {
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â amdgpu_vm_bo_idle(bo_base);
>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â continue;
>> +Â Â Â Â Â Â Â Â Â Â Â }
>> +Â Â Â Â Â Â Â }
>> Â -Â Â Â Â Â Â Â if (evicted && bo->tbo.base.resv ==
>> vm->root.base.bo->tbo.base.resv) {
>> +Â Â Â Â Â Â Â if (evicted && bo->tbo.base.resv == resv) {
>> Â Â Â Â Â Â Â Â Â Â Â Â Â amdgpu_vm_bo_evicted(bo_base);
>> Â Â Â Â Â Â Â Â Â Â Â Â Â continue;
>> Â Â Â Â Â Â Â Â Â }
More information about the amd-gfx
mailing list