From: Felix Kuehling <felix.kuehling@amd.com>
To: christian.koenig@amd.com, amd-gfx@lists.freedesktop.org
Cc: jay.cornwall@amd.com
Subject: Re: [PATCH 1/1] drm/amdgpu: Sync with VM root BO when switching VM to CPU update mode
Date: Thu, 21 May 2020 13:06:14 -0400 [thread overview]
Message-ID: <2cd1235f-9d2c-7f48-66ea-90e361d5178b@amd.com> (raw)
In-Reply-To: <14ac63e1-a212-7540-fe65-523451bf6a89@gmail.com>
Am 2020-05-21 um 9:50 a.m. schrieb Christian König:
> Am 21.05.20 um 00:51 schrieb Felix Kuehling:
>> This fixes an intermittent bug where a root PD clear operation still in
>> progress could overwrite a PDE update done by the CPU, resulting in a
>> VM fault.
>
> Mhm, maybe better add this to amdgpu_vm_cpu_prepare().
>
> This way we could (in theory) switch between CPU and SDMA based
> updates on the fly elsewhere as well.
That won't work. I want to wait for FENCE_OWNER_VM fences, so I need to
use FENCE_OWNER_UNDEFINED. But then I would also end up waiting for
FENCE_OWNER_KFD eviction fences, which would trigger unwanted evictions.
This works OK in amdgpu_vm_make_compute because it runs before the
eviction fence is attached to the VM.
Regards,
Felix
>
> Christian.
>
>>
>> Fixes: 108b4d928c03 ("drm/amd/amdgpu: Update VM function pointer")
>> Reported-by: Jay Cornwall <Jay.Cornwall@amd.com>
>> Tested-by: Jay Cornwall <Jay.Cornwall@amd.com>
>> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 11 +++++++++--
>> 1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> index 414a0b1c2e5a..7417754e9141 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> @@ -3000,10 +3000,17 @@ int amdgpu_vm_make_compute(struct
>> amdgpu_device *adev, struct amdgpu_vm *vm,
>> !amdgpu_gmc_vram_full_visible(&adev->gmc)),
>> "CPU update of VM recommended only for large BAR system\n");
>> - if (vm->use_cpu_for_update)
>> + if (vm->use_cpu_for_update) {
>> + /* Sync with last SDMA update/clear before switching to CPU */
>> + r = amdgpu_bo_sync_wait(vm->root.base.bo,
>> + AMDGPU_FENCE_OWNER_UNDEFINED, true);
>> + if (r)
>> + goto free_idr;
>> +
>> vm->update_funcs = &amdgpu_vm_cpu_funcs;
>> - else
>> + } else {
>> vm->update_funcs = &amdgpu_vm_sdma_funcs;
>> + }
>> dma_fence_put(vm->last_update);
>> vm->last_update = NULL;
>> vm->is_compute_context = true;
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2020-05-21 17:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 22:51 [PATCH 1/1] drm/amdgpu: Sync with VM root BO when switching VM to CPU update mode Felix Kuehling
2020-05-21 13:50 ` Christian König
2020-05-21 17:06 ` Felix Kuehling [this message]
2020-05-22 8:59 ` Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2cd1235f-9d2c-7f48-66ea-90e361d5178b@amd.com \
--to=felix.kuehling@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=jay.cornwall@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox