<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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 - General]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Please add these details to the patch description when you respin.<br>
</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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Liu, Shaoyun <Shaoyun.Liu@amd.com><br>
<b>Sent:</b> Monday, August 8, 2022 6:30 PM<br>
<b>To:</b> Alex Deucher <alexdeucher@gmail.com>; Milinkovic, Dusica <Dusica.Milinkovic@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> Re: [PATCH] Increase tlb flush timeout for sriov</font>
<div> </div>
</div>
<div>
<div style="font-family:inherit; font-size:inherit; color:inherit"></div>
<div>As I discussed with Alice ,this change is when multi-vf running compute benchmark (Luxmark) at the same time, which involves multiple vf  do the tlb invalidation at the same time. They observed kiq timeout after submit the tlb invalidate command. Although
 each vf has the invalidate register set, but from hw, the invalidate requests are queue to execute.
</div>
<div><br>
</div>
<div>Alice, as we discussed, we can use maximum 12*100ms for the timeout , it shouldn't be 6000ms. Did you see issues with 1200 ms timeout?</div>
<div><br>
</div>
<div>Regards</div>
<div>Shaoyun.liu</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Alex Deucher <alexdeucher@gmail.com><br>
<b>Sent:</b> August 8, 2022 4:49 PM<br>
<b>To:</b> Milinkovic, Dusica <Dusica.Milinkovic@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> Re: [PATCH] Increase tlb flush timeout for sriov</font>
<div> </div>
</div>
<div class="x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_PlainText">On Wed, Aug 3, 2022 at 5:02 AM Dusica Milinkovic<br>
<dusica.milinkovic@amd.com> wrote:<br>
><br>
<br>
Please include a patch description.  Why do you need a longer timeout?<br>
 What problem does it fix?<br>
<br>
> Signed-off-by: Dusica Milinkovic <dusica.milinkovic@amd.com><br>
> ---<br>
>  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 6 +++++-<br>
>  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 6 +++++-<br>
>  2 files changed, 10 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c<br>
> index 9ae8cdaa033e..6ab7d329916f 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c<br>
> @@ -419,6 +419,7 @@ static int gmc_v10_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,<br>
>         uint32_t seq;<br>
>         uint16_t queried_pasid;<br>
>         bool ret;<br>
> +       uint32_t sriov_usec_timeout = 6000000;  /* wait for 12 * 500ms for SRIOV */<br>
>         struct amdgpu_ring *ring = &adev->gfx.kiq.ring;<br>
>         struct amdgpu_kiq *kiq = &adev->gfx.kiq;<br>
><br>
> @@ -437,7 +438,10 @@ static int gmc_v10_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,<br>
><br>
>                 amdgpu_ring_commit(ring);<br>
>                 spin_unlock(&adev->gfx.kiq.ring_lock);<br>
> -               r = amdgpu_fence_wait_polling(ring, seq, adev->usec_timeout);<br>
> +               if (amdgpu_sriov_vf(adev))<br>
> +                       r = amdgpu_fence_wait_polling(ring, seq, sriov_usec_timeout);<br>
> +               else<br>
> +                       r = amdgpu_fence_wait_polling(ring, seq, adev->usec_timeout);<br>
<br>
What about something like this?<br>
u32 usec_timeout = amdgpu_sriov_vf(adev) ? 6000000 :<br>
adev->usec_timeout;  /* wait for 12 * 500ms for SRIOV */<br>
...<br>
r = amdgpu_fence_wait_polling(ring, seq, usec_timeout);<br>
<br>
<br>
>                 if (r < 1) {<br>
>                         dev_err(adev->dev, "wait for kiq fence error: %ld.\n", r);<br>
>                         return -ETIME;<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c<br>
> index 22761a3bb818..941a6b52fa72 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c<br>
> @@ -896,6 +896,7 @@ static int gmc_v9_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,<br>
>         uint32_t seq;<br>
>         uint16_t queried_pasid;<br>
>         bool ret;<br>
> +       uint32_t sriov_usec_timeout = 6000000;  /* wait for 12 * 500ms for SRIOV */<br>
>         struct amdgpu_ring *ring = &adev->gfx.kiq.ring;<br>
>         struct amdgpu_kiq *kiq = &adev->gfx.kiq;<br>
><br>
> @@ -935,7 +936,10 @@ static int gmc_v9_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,<br>
><br>
>                 amdgpu_ring_commit(ring);<br>
>                 spin_unlock(&adev->gfx.kiq.ring_lock);<br>
> -               r = amdgpu_fence_wait_polling(ring, seq, adev->usec_timeout);<br>
> +               if (amdgpu_sriov_vf(adev))<br>
> +                       r = amdgpu_fence_wait_polling(ring, seq, sriov_usec_timeout);<br>
> +               else<br>
> +                       r = amdgpu_fence_wait_polling(ring, seq, adev->usec_timeout);<br>
<br>
Same comment here.<br>
<br>
Alex<br>
<br>
>                 if (r < 1) {<br>
>                         dev_err(adev->dev, "wait for kiq fence error: %ld.\n", r);<br>
>                         up_read(&adev->reset_domain->sem);<br>
> --<br>
> 2.25.1<br>
><br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>