<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div dir="auto">
<div><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">Am 09.06.2020 18:37 schrieb "Grodzovsky, Andrey" <Andrey.Grodzovsky@amd.com>:<br type="attribution">
<blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><font size="2"><span style="font-size:11pt">
<div><br>
On 6/5/20 2:40 PM, Christian König wrote:<br>
> Am 05.06.20 um 16:29 schrieb Andrey Grodzovsky:<br>
>><br>
>> On 5/11/20 2:45 AM, Christian König wrote:<br>
>>> Am 09.05.20 um 20:51 schrieb Andrey Grodzovsky:<br>
>>>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com><br>
>>>> ---<br>
>>>>   drivers/gpu/drm/ttm/ttm_bo.c    | 22 +++++++++++++++++++++-<br>
>>>>   include/drm/ttm/ttm_bo_driver.h |  2 ++<br>
>>>>   2 files changed, 23 insertions(+), 1 deletion(-)<br>
>>>><br>
>>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c <br>
>>>> b/drivers/gpu/drm/ttm/ttm_bo.c<br>
>>>> index c5b516f..eae61cc 100644<br>
>>>> --- a/drivers/gpu/drm/ttm/ttm_bo.c<br>
>>>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c<br>
>>>> @@ -1750,9 +1750,29 @@ void ttm_bo_unmap_virtual(struct <br>
>>>> ttm_buffer_object *bo)<br>
>>>>       ttm_bo_unmap_virtual_locked(bo);<br>
>>>>       ttm_mem_io_unlock(man);<br>
>>>>   }<br>
>>>> +EXPORT_SYMBOL(ttm_bo_unmap_virtual);<br>
>>>>   +void ttm_bo_unmap_virtual_address_space(struct ttm_bo_device *bdev)<br>
>>>> +{<!-- --><br>
>>>> +    struct ttm_mem_type_manager *man;<br>
>>>> +    int i;<br>
>>>>   -EXPORT_SYMBOL(ttm_bo_unmap_virtual);<br>
>>><br>
>>>> +    for (i = 0; i < TTM_NUM_MEM_TYPES; i++) {<!-- --><br>
>>>> +        man = &bdev->man[i];<br>
>>>> +        if (man->has_type && man->use_type)<br>
>>>> +            ttm_mem_io_lock(man, false);<br>
>>>> +    }<br>
>>><br>
>>> You should drop that it will just result in a deadlock warning for <br>
>>> Nouveau and has no effect at all.<br>
>>><br>
>>> Apart from that looks good to me,<br>
>>> Christian.<br>
>><br>
>><br>
>> As I am considering to re-include this in V2 of the patchsets, can <br>
>> you clarify please why this will have no effect at all ?<br>
><br>
> The locks are exclusive for Nouveau to allocate/free the io address <br>
> space.<br>
><br>
> Since we don't do this here we don't need the locks.<br>
><br>
> Christian.<br>
<br>
<br>
So basically calling unmap_mapping_range doesn't require any extra <br>
locking around it and whatever locks are taken within the function <br>
should be enough ?<br>
</div>
</span></font></div>
</blockquote>
</div>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><font size="2"><span style="font-size:11pt">
<div></div>
</span></font></div>
</blockquote>
</div>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">I think so, yes.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Christian.</div>
<div dir="auto"><br>
</div>
<div dir="auto">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><font size="2"><span style="font-size:11pt">
<div><br>
Andrey<br>
<br>
<br>
><br>
>><br>
>> Andrey<br>
>><br>
>><br>
>>><br>
>>>> +<br>
>>>> +    unmap_mapping_range(bdev->dev_mapping, 0, 0 , 1);<br>
>>>> +    /*TODO What about ttm_mem_io_free_vm(bo) ? */<br>
>>>> +<br>
>>>> +    for (i = TTM_NUM_MEM_TYPES - 1; i >= 0; i--) {<!-- --><br>
>>>> +        man = &bdev->man[i];<br>
>>>> +        if (man->has_type && man->use_type)<br>
>>>> +            ttm_mem_io_unlock(man);<br>
>>>> +    }<br>
>>>> +}<br>
>>>> +EXPORT_SYMBOL(ttm_bo_unmap_virtual_address_space);<br>
>>>>     int ttm_bo_wait(struct ttm_buffer_object *bo,<br>
>>>>           bool interruptible, bool no_wait)<br>
>>>> diff --git a/include/drm/ttm/ttm_bo_driver.h <br>
>>>> b/include/drm/ttm/ttm_bo_driver.h<br>
>>>> index c9e0fd0..3133463 100644<br>
>>>> --- a/include/drm/ttm/ttm_bo_driver.h<br>
>>>> +++ b/include/drm/ttm/ttm_bo_driver.h<br>
>>>> @@ -600,6 +600,8 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,<br>
>>>>    */<br>
>>>>   void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo);<br>
>>>>   +void ttm_bo_unmap_virtual_address_space(struct ttm_bo_device <br>
>>>> *bdev);<br>
>>>> +<br>
>>>>   /**<br>
>>>>    * ttm_bo_unmap_virtual<br>
>>>>    *<br>
>>><br>
><br>
</div>
</span></font></div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</body>
</html>