RE: [PATCH 2/3] drm/amdgpu/pm_runtime: update usage count in fence handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[AMD Official Use Only - Internal Distribution Only]



Regards,
Oak

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Christian König
Sent: Monday, December 16, 2019 3:25 PM
To: Alex Deucher <alexdeucher@xxxxxxxxx>; Koenig, Christian <Christian.Koenig@xxxxxxx>
Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx>; amd-gfx list <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [PATCH 2/3] drm/amdgpu/pm_runtime: update usage count in fence handling

Am 16.12.19 um 21:22 schrieb Alex Deucher:
> On Mon, Dec 16, 2019 at 3:19 PM Christian König 
> <ckoenig.leichtzumerken@xxxxxxxxx> wrote:
>> Am 16.12.19 um 18:18 schrieb Alex Deucher:
>>> Increment the usage count in emit fence, and decrement in process 
>>> fence to make sure the GPU is always considered in use while there 
>>> are fences outstanding.  We always wait for the engines to drain in 
>>> runtime suspend, but in practice that only covers short lived jobs 
>>> for gfx.  This should cover us for longer lived fences.
>>>
>>> Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
>>> ---
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 6 +++++-
>>>    1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c 
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>>> index 377fe20bce23..e9efee04ca23 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
>>> @@ -34,6 +34,7 @@
>>>    #include <linux/kref.h>
>>>    #include <linux/slab.h>
>>>    #include <linux/firmware.h>
>>> +#include <linux/pm_runtime.h>
>>>
>>>    #include <drm/drm_debugfs.h>
>>>
>>> @@ -154,7 +155,7 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f,
>>>                       seq);
>>>        amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr,
>>>                               seq, flags | AMDGPU_FENCE_FLAG_INT);
>>> -
>>> +     pm_runtime_get_noresume(adev->ddev->dev);
>>>        ptr = &ring->fence_drv.fences[seq & ring->fence_drv.num_fences_mask];
>>>        if (unlikely(rcu_dereference_protected(*ptr, 1))) {
>>>                struct dma_fence *old; @@ -234,6 +235,7 @@ static 
>>> void amdgpu_fence_schedule_fallback(struct amdgpu_ring *ring)
>>>    bool amdgpu_fence_process(struct amdgpu_ring *ring)
>>>    {
>>>        struct amdgpu_fence_driver *drv = &ring->fence_drv;
>>> +     struct amdgpu_device *adev = ring->adev;
>>>        uint32_t seq, last_seq;
>>>        int r;
>>>
>>> @@ -274,6 +276,8 @@ bool amdgpu_fence_process(struct amdgpu_ring *ring)
>>>                        BUG();
>>>
>>>                dma_fence_put(fence);
>>> +             pm_runtime_mark_last_busy(adev->ddev->dev);
>>> +             pm_runtime_put_autosuspend(adev->ddev->dev);
>> Are you sure this is ok? Keep in mind that this function is called in 
>> interrupt context.
> According to:
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.
> kernel.org%2Fdoc%2FDocumentation%2Fpower%2Fruntime_pm.txt&amp;data=02%
> 7C01%7Coak.zeng%40amd.com%7C7008cf5373094160552b08d78266032d%7C3dd8961
> fe4884e608e11a82d994e183d%7C0%7C0%7C637121247082078997&amp;sdata=kfUKc
> dw0PSXWspOBfXQT6BF4r4q3m64cPMbkX7xjOaA%3D&amp;reserved=0
> it's ok to call those in an interrupt context.

In this case the patch is Reviewed-by: Christian König <christian.koenig@xxxxxxx>.

[Oak] Yes, pm_runtime_put_autosuspend calls __pm_runtime_suspend in the rpmflags set to RPM_ASYNC flag so it can be called in atomic context.

Christian.

>
> Alex
>
>> Christian.
>>
>>>        } while (last_seq != seq);
>>>
>>>        return true;
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Coa
> k.zeng%40amd.com%7C7008cf5373094160552b08d78266032d%7C3dd8961fe4884e60
> 8e11a82d994e183d%7C0%7C0%7C637121247082078997&amp;sdata=OIeDvbaRaR4lMJ
> 1munKIMkhGwQpSqxroNhIPJGmqx6c%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Coak.zeng%40amd.com%7C7008cf5373094160552b08d78266032d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637121247082078997&amp;sdata=OIeDvbaRaR4lMJ1munKIMkhGwQpSqxroNhIPJGmqx6c%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux