<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only - General]<br>
</p>
<br>
<div>
<div class="WordSection1">
<p class="MsoNormal">Hello all, <br>
<br>
I just checked this with 1200ms for timeout, test case successfully passed 10 loops.<br>
If all of you agree, I will change a value in the patch.<br>
<br>
Regards, <br>
Dusica<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Liu, Shaoyun <Shaoyun.Liu@amd.com> <br>
<b>Sent:</b> Tuesday, August 9, 2022 12:31 AM<br>
<b>To:</b> Alex Deucher <alexdeucher@gmail.com>; Milinkovic, Dusica <Dusica.Milinkovic@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH] Increase tlb flush timeout for sriov<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">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.
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Regards<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Shaoyun.liu<o:p></o:p></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org">amd-gfx-bounces@lists.freedesktop.org</a>> on behalf of Alex Deucher <<a href="mailto:alexdeucher@gmail.com">alexdeucher@gmail.com</a>><br>
<b>Sent:</b> August 8, 2022 4:49 PM<br>
<b>To:</b> Milinkovic, Dusica <<a href="mailto:Dusica.Milinkovic@amd.com">Dusica.Milinkovic@amd.com</a>><br>
<b>Cc:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>><br>
<b>Subject:</b> Re: [PATCH] Increase tlb flush timeout for sriov</span> <o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">On Wed, Aug 3, 2022 at 5:02 AM Dusica Milinkovic<br>
<<a href="mailto:dusica.milinkovic@amd.com">dusica.milinkovic@amd.com</a>> 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 <<a href="mailto:dusica.milinkovic@amd.com">dusica.milinkovic@amd.com</a>><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>
><o:p></o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>