<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
This<span style="color:#c0c0c0"> </span>patch<span style="color:#c0c0c0"> </span>
is<span style="color:#c0c0c0"> </span>Reviewed-by:<span style="color:#c0c0c0"> </span>
James<span style="color:#c0c0c0"> </span>Zhu<span style="color:#c0c0c0"> </span><James.Zhu@amd.com><br>
</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p style="margin-top: 0px; margin-bottom: 0px;">Thanks & Best Regards!</p>
<p style="margin-top: 0px; margin-bottom: 0px;"><br>
</p>
<p style="margin-top: 0px; margin-bottom: 0px;">James Zhu<br>
</p>
</div>
</div>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Alex Deucher <alexdeucher@gmail.com><br>
<b>Sent:</b> Wednesday, August 11, 2021 4:34 PM<br>
<b>To:</b> Michel Dänzer <michel@daenzer.net><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Liu, Leo <Leo.Liu@amd.com>; Zhu, James <James.Zhu@amd.com>; amd-gfx list <amd-gfx@lists.freedesktop.org>; Maling list - DRI developers <dri-devel@lists.freedesktop.org><br>
<b>Subject:</b> Re: [PATCH 2/2] drm/amdgpu: Use mod_delayed_work in JPEG/UVD/VCE/VCN ring_end_use hooks</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Wed, Aug 11, 2021 at 12:52 PM Michel Dänzer <michel@daenzer.net> wrote:<br>
><br>
> From: Michel Dänzer <mdaenzer@redhat.com><br>
><br>
> In contrast to schedule_delayed_work, this pushes back the work if it<br>
> was already scheduled before. Specific behaviour change:<br>
><br>
> Before:<br>
><br>
> The scheduled work ran ~1 second after the first time ring_end_use was<br>
> called, even if the ring was used again during that second.<br>
><br>
> After:<br>
><br>
> The scheduled work runs ~1 second after the last time ring_end_use is<br>
> called.<br>
><br>
> Inspired by the corresponding change in amdgpu_gfx_off_ctrl. While I<br>
> haven't run into specific issues in this case, the new behaviour makes<br>
> more sense to me.<br>
><br>
> Signed-off-by: Michel Dänzer <mdaenzer@redhat.com><br>
<br>
Makes sense to me.  Applied the series.<br>
<br>
Thanks!<br>
<br>
Alex<br>
<br>
<br>
> ---<br>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 2 +-<br>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c  | 2 +-<br>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c  | 2 +-<br>
>  drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c    | 2 +-<br>
>  4 files changed, 4 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c<br>
> index 8996cb4ed57a..2c0040153f6c 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c<br>
> @@ -110,7 +110,7 @@ void amdgpu_jpeg_ring_begin_use(struct amdgpu_ring *ring)<br>
>  void amdgpu_jpeg_ring_end_use(struct amdgpu_ring *ring)<br>
>  {<br>
>         atomic_dec(&ring->adev->jpeg.total_submission_cnt);<br>
> -       schedule_delayed_work(&ring->adev->jpeg.idle_work, JPEG_IDLE_TIMEOUT);<br>
> +       mod_delayed_work(system_wq, &ring->adev->jpeg.idle_work, JPEG_IDLE_TIMEOUT);<br>
>  }<br>
><br>
>  int amdgpu_jpeg_dec_ring_test_ring(struct amdgpu_ring *ring)<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c<br>
> index 0f576f294d8a..b6b1d7eeb8e5 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c<br>
> @@ -1283,7 +1283,7 @@ void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring)<br>
>  void amdgpu_uvd_ring_end_use(struct amdgpu_ring *ring)<br>
>  {<br>
>         if (!amdgpu_sriov_vf(ring->adev))<br>
> -               schedule_delayed_work(&ring->adev->uvd.idle_work, UVD_IDLE_TIMEOUT);<br>
> +               mod_delayed_work(system_wq, &ring->adev->uvd.idle_work, UVD_IDLE_TIMEOUT);<br>
>  }<br>
><br>
>  /**<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c<br>
> index 1ae7f824adc7..2253c18a6688 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c<br>
> @@ -401,7 +401,7 @@ void amdgpu_vce_ring_begin_use(struct amdgpu_ring *ring)<br>
>  void amdgpu_vce_ring_end_use(struct amdgpu_ring *ring)<br>
>  {<br>
>         if (!amdgpu_sriov_vf(ring->adev))<br>
> -               schedule_delayed_work(&ring->adev->vce.idle_work, VCE_IDLE_TIMEOUT);<br>
> +               mod_delayed_work(system_wq, &ring->adev->vce.idle_work, VCE_IDLE_TIMEOUT);<br>
>  }<br>
><br>
>  /**<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c<br>
> index 284bb42d6c86..d5937ab5ac80 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c<br>
> @@ -1874,7 +1874,7 @@ void vcn_v1_0_set_pg_for_begin_use(struct amdgpu_ring *ring, bool set_clocks)<br>
><br>
>  void vcn_v1_0_ring_end_use(struct amdgpu_ring *ring)<br>
>  {<br>
> -       schedule_delayed_work(&ring->adev->vcn.idle_work, VCN_IDLE_TIMEOUT);<br>
> +       mod_delayed_work(system_wq, &ring->adev->vcn.idle_work, VCN_IDLE_TIMEOUT);<br>
>         mutex_unlock(&ring->adev->vcn.vcn1_jpeg1_workaround);<br>
>  }<br>
><br>
> --<br>
> 2.32.0<br>
><br>
</div>
</span></font></div>
</div>
</body>
</html>