<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>My mean is you should add a condition in code to check if BO is kernel BO or not. I expect V3.<br>
<br>
Regards,<br>
David<br>
<br>
<p dir="ltr" style="display:inline"><span style="color:#888888"><span style="font-size:0.81em">发自坚果 Pro</span></span></p>
<style type="text/css">
<!--
* body
        {padding:0 16px 30px!important;
        margin:0!important;
        background-color:#ffffff;
        line-height:1.4;
        word-wrap:break-word;
        word-break:normal}
div
        {word-wrap:break-word;
        word-break:normal}
p
        {word-wrap:break-word;
        word-break:normal;
        text-indent:0pt!important}
span
        {word-wrap:break-word;
        word-break:normal}
a
        {word-wrap:break-word;
        word-break:normal}
td
        {word-wrap:break-word;
        word-break:break-all}
-->
</style>
<div class="x_quote">
<div style="margin:0 0px; font-size:105%"><font color="#629140" style="line-height:1.4"><span>He, Roger <Hongbo.He@amd.com> 于 2017年9月11日 下午6:57写道:</span></font></div>
<br type="attribution">
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Reviewed-by: Roger He <Hongbo.He@amd.com><br>
<br>
Thanks<br>
Roger(Hongbo.He)<br>
-----Original Message-----<br>
From: amd-gfx [<a href="mailto:amd-gfx-bounces@lists.freedesktop.org">mailto:amd-gfx-bounces@lists.freedesktop.org</a>] On Behalf Of Christian K?nig<br>
Sent: Monday, September 11, 2017 6:53 PM<br>
To: Zhou, David(ChunMing) <David1.Zhou@amd.com>; amd-gfx@lists.freedesktop.org<br>
Subject: Re: [PATCH] drm/amdgpu: fix VM sync with always valid BOs v2<br>
<br>
Am 11.09.2017 um 11:10 schrieb zhoucm1:<br>
><br>
><br>
> On 2017年09月11日 17:04, Christian König wrote:<br>
>>> NAK, as Roger pointed, the performance of Vulkan Dota2 drops from <br>
>>> 72fps to 24fps.<br>
>>><br>
>>> This patches will kill Per-vm-BO advantages, even drop to 1/3 of <br>
>>> previous non-per-vm-bo.<br>
>><br>
>> This is irrelevant and actually a foreseen consequence of per VM BOs.<br>
>><br>
>> If the performance drops is in-acceptable then the UMD shouldn't use <br>
>> this feature.<br>
> I got your mean, if UMD doesn't use this feature, then all BOs should <br>
> be kernel only, then this change should only be limited to kernel VM <br>
> BOs, not include UMD BOs.<br>
> With this limitation, I think the change also can fix your issue.<br>
<br>
Correct, yes. Can I get your rb or ab now? We need to get this fixed asap.<br>
<br>
Thanks,<br>
Christian.<br>
<br>
><br>
> Regards,<br>
> David Zhou<br>
>><br>
>>> all moved and relocated fence have already synced, we just need to <br>
>>> catch the va mapping but which is CS itself required, as my proposal <br>
>>> in another thread, we maybe need to expand va_ioctl to return <br>
>>> mapping fence to UMD, then UMD passes it to CS as dependency.<br>
>><br>
>> That can be an addition to the existing handling, but first of all <br>
>> the current state must be corrected.<br>
>><br>
>> There are at least two bug reports on the open driver fixed by this, <br>
>> so please review.<br>
>><br>
>> Thanks,<br>
>> Christian.<br>
>><br>
>> Am 11.09.2017 um 10:59 schrieb zhoucm1:<br>
>>> NAK, as Roger pointed, the performance of Vulkan Dota2 drops from <br>
>>> 72fps to 24fps.<br>
>>><br>
>>> This patches will kill Per-vm-BO advantages, even drop to 1/3 of <br>
>>> previous non-per-vm-bo.<br>
>>><br>
>>> all moved and relocated fence have already synced, we just need to <br>
>>> catch the va mapping but which is CS itself required, as my proposal <br>
>>> in another thread, we maybe need to expand va_ioctl to return <br>
>>> mapping fence to UMD, then UMD passes it to CS as dependency.<br>
>>><br>
>>><br>
>>> Regards,<br>
>>><br>
>>> David Zhou<br>
>>><br>
>>><br>
>>> On 2017年09月11日 15:53, Christian König wrote:<br>
>>>> From: Christian König <christian.koenig@amd.com><br>
>>>><br>
>>>> All users of a VM must always wait for updates with always valid <br>
>>>> BOs to be completed.<br>
>>>><br>
>>>> v2: remove debugging leftovers, rename struct member<br>
>>>><br>
>>>> Signed-off-by: Christian König <christian.koenig@amd.com><br>
>>>> ---<br>
>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 10 ++++++----<br>
>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15 ++++++++++-----<br>
>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h |  2 +-<br>
>>>>   3 files changed, 17 insertions(+), 10 deletions(-)<br>
>>>><br>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c<br>
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c<br>
>>>> index 8aa37e0..4681dcc 100644<br>
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c<br>
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c<br>
>>>> @@ -752,10 +752,6 @@ static int amdgpu_bo_vm_update_pte(struct <br>
>>>> amdgpu_cs_parser *p)<br>
>>>>       if (r)<br>
>>>>           return r;<br>
>>>>   -    r = amdgpu_sync_fence(adev, &p->job->sync, <br>
>>>> vm->last_dir_update);<br>
>>>> -    if (r)<br>
>>>> -        return r;<br>
>>>> -<br>
>>>>       r = amdgpu_vm_clear_freed(adev, vm, NULL);<br>
>>>>       if (r)<br>
>>>>           return r;<br>
>>>> @@ -810,6 +806,12 @@ static int amdgpu_bo_vm_update_pte(struct <br>
>>>> amdgpu_cs_parser *p)<br>
>>>>       }<br>
>>>>         r = amdgpu_vm_handle_moved(adev, vm, &p->job->sync);<br>
>>>> +    if (r)<br>
>>>> +        return r;<br>
>>>> +<br>
>>>> +    r = amdgpu_sync_fence(adev, &p->job->sync, vm->last_update);<br>
>>>> +    if (r)<br>
>>>> +        return r;<br>
>>>>         if (amdgpu_vm_debug && p->bo_list) {<br>
>>>>           /* Invalidate all BOs to test for userspace bugs */ diff <br>
>>>> --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
>>>> index 55f1ecb..5042f09 100644<br>
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
>>>> @@ -1140,9 +1140,8 @@ static int amdgpu_vm_update_level(struct <br>
>>>> amdgpu_device *adev,<br>
>>>>                   goto error_free;<br>
>>>>                 amdgpu_bo_fence(parent->base.bo, fence, true);<br>
>>>> -            dma_fence_put(vm->last_dir_update);<br>
>>>> -            vm->last_dir_update = dma_fence_get(fence);<br>
>>>> -            dma_fence_put(fence);<br>
>>>> +            dma_fence_put(vm->last_update);<br>
>>>> +            vm->last_update = fence;<br>
>>>>           }<br>
>>>>       }<br>
>>>>   @@ -1803,6 +1802,12 @@ int amdgpu_vm_bo_update(struct <br>
>>>> amdgpu_device *adev,<br>
>>>>               trace_amdgpu_vm_bo_mapping(mapping);<br>
>>>>       }<br>
>>>>   +    if (bo_va->base.bo &&<br>
>>>> +        bo_va->base.bo->tbo.resv == vm->root.base.bo->tbo.resv) {<br>
>>>> +        dma_fence_put(vm->last_update);<br>
>>>> +        vm->last_update = dma_fence_get(bo_va->last_pt_update);<br>
>>>> +    }<br>
>>>> +<br>
>>>>       return 0;<br>
>>>>   }<br>
>>>>   @@ -2586,7 +2591,7 @@ int amdgpu_vm_init(struct amdgpu_device <br>
>>>> *adev, struct amdgpu_vm *vm,<br>
>>>>                vm->use_cpu_for_update ? "CPU" : "SDMA");<br>
>>>>       WARN_ONCE((vm->use_cpu_for_update & <br>
>>>> !amdgpu_vm_is_large_bar(adev)),<br>
>>>>             "CPU update of VM recommended only for large BAR <br>
>>>> system\n");<br>
>>>> -    vm->last_dir_update = NULL;<br>
>>>> +    vm->last_update = NULL;<br>
>>>>         flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |<br>
>>>>               AMDGPU_GEM_CREATE_VRAM_CLEARED; @@ -2692,7 +2697,7 @@ <br>
>>>> void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm <br>
>>>> *vm)<br>
>>>>       }<br>
>>>>         amdgpu_vm_free_levels(&vm->root);<br>
>>>> -    dma_fence_put(vm->last_dir_update);<br>
>>>> +    dma_fence_put(vm->last_update);<br>
>>>>       for (i = 0; i < AMDGPU_MAX_VMHUBS; i++)<br>
>>>>           amdgpu_vm_free_reserved_vmid(adev, vm, i);<br>
>>>>   }<br>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
>>>> index c1accd1..cb6a622 100644<br>
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h<br>
>>>> @@ -140,7 +140,7 @@ struct amdgpu_vm {<br>
>>>>         /* contains the page directory */<br>
>>>>       struct amdgpu_vm_pt     root;<br>
>>>> -    struct dma_fence    *last_dir_update;<br>
>>>> +    struct dma_fence    *last_update;<br>
>>>>         /* protecting freed */<br>
>>>>       spinlock_t        freed_lock;<br>
>>><br>
>>> _______________________________________________<br>
>>> amd-gfx mailing list<br>
>>> amd-gfx@lists.freedesktop.org<br>
>>> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
>><br>
>><br>
><br>
> _______________________________________________<br>
> amd-gfx mailing list<br>
> amd-gfx@lists.freedesktop.org<br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font>
</body>
</html>