<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:Calibri;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - AMD Internal Distribution Only]<br>
</p>
<br>
<div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Ok, thank you!<br>
<br>
Regards,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Shikang.</div>
<div id="appendonsend"></div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display: inline-block; width: 98%;">
<div dir="ltr" id="divRplyFwdMsg"><span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>From:</b> Koenig, Christian <Christian.Koenig@amd.com><br>
<b>Sent:</b> Thursday, November 21, 2024 4:12 PM<br>
<b>To:</b> Fan, Shikang <Shikang.Fan@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deng, Emily <Emily.Deng@amd.com><br>
<b>Subject:</b> Re: [PATCH v3] drm/amdgpu: Check fence emitted count to identify bad jobs</span>
<div> </div>
</div>
<div>Yeah, just wanted to point out the unused variable as well.<br>
<br>
With that fixed the patch is Reviewed-by: Christian König <a href="mailto:christian.koenig@amd.com" id="OWAb1402645-f293-8142-3dee-5daaed440c43" class="x_moz-txt-link-rfc2396E OWAAutoLink">
<christian.koenig@amd.com></a><br>
<br>
Regards,<br>
Christian.<br>
<br>
</div>
<div>Am 21.11.24 um 07:49 schrieb Fan, Shikang:</div>
<blockquote>
<p style="margin: 5pt; font-family: Calibri; font-size: 10pt; color: rgb(0, 0, 255);">
[AMD Official Use Only - AMD Internal Distribution Only]</p>
<br>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
I forgot to delete the unused counter "j" from the patch, I'll remove it when submit the patch to the branch.<br>
<br>
Thanks,</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Shikang</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display: inline-block; width: 98%;">
<div dir="ltr" id="x_divRplyFwdMsg"><span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>From:</b> Fan, Shikang
<a href="mailto:Shikang.Fan@amd.com" id="OWAd855acdb-88e5-8c45-49bd-398e3f4e685f" class="x_moz-txt-link-rfc2396E OWAAutoLink">
<Shikang.Fan@amd.com></a><br>
<b>Sent:</b> Thursday, November 21, 2024 2:47 PM<br>
<b>To:</b> <a href="mailto:amd-gfx@lists.freedesktop.org" id="OWAe71d8f54-d8e4-52bb-2913-148a503eed05" class="x_moz-txt-link-abbreviated OWAAutoLink">
amd-gfx@lists.freedesktop.org</a> <a href="mailto:amd-gfx@lists.freedesktop.org" id="OWA299a5084-eb1b-e1e5-aeb8-8c6e1ddc2c4f" class="x_moz-txt-link-rfc2396E OWAAutoLink">
<amd-gfx@lists.freedesktop.org></a>; Koenig, Christian <a href="mailto:Christian.Koenig@amd.com" id="OWAf64e6e5d-c0b2-9805-9a02-6c0b3b19bc78" class="x_moz-txt-link-rfc2396E OWAAutoLink">
<Christian.Koenig@amd.com></a><br>
<b>Cc:</b> Deng, Emily <a href="mailto:Emily.Deng@amd.com" id="OWAb7afa9ac-3418-bba9-9404-9014b06895fb" class="x_moz-txt-link-rfc2396E OWAAutoLink">
<Emily.Deng@amd.com></a><br>
<b>Subject:</b> Re: [PATCH v3] drm/amdgpu: Check fence emitted count to identify bad jobs</span>
<div> </div>
</div>
<div style="direction: ltr; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
+<a href="mailto:Christian.Koenig@amd.com" id="OWAAM340083" class="x_x_tWKOu x_x_mention x_x_ms-bgc-nlr x_x_ms-fcl-b">@Koenig, Christian</a><br>
<br>
Hi Christian,<br>
Could you please help review this patch? I removed the timeout wait in the function.<br>
<br>
Thanks,</div>
<div style="direction: ltr; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Shikang</div>
<div style="direction: ltr; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="direction: ltr; display: inline-block; width: 98%;">
<div id="x_x_divRplyFwdMsg" dir="ltr"><span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>From:</b> Shikang Fan
<a href="mailto:shikang.fan@amd.com" id="OWA588dadcf-d48c-dd95-22d8-fb153d5a16a2" class="x_moz-txt-link-rfc2396E OWAAutoLink">
<shikang.fan@amd.com></a><br>
<b>Sent:</b> Thursday, November 21, 2024 11:48 AM<br>
<b>To:</b> <a href="mailto:amd-gfx@lists.freedesktop.org" id="OWAffa0e8c4-626f-b3b0-b374-46b3256d169c" class="x_moz-txt-link-abbreviated OWAAutoLink">amd-gfx@lists.freedesktop.org</a>
<a href="mailto:amd-gfx@lists.freedesktop.org" id="OWA255b5eba-51ee-f848-bca5-c435842e698c" class="x_moz-txt-link-rfc2396E OWAAutoLink">
<amd-gfx@lists.freedesktop.org></a><br>
<b>Cc:</b> Fan, Shikang <a href="mailto:Shikang.Fan@amd.com" id="OWA2e9217cd-a5e1-e0db-1933-9907c38ac97f" class="x_moz-txt-link-rfc2396E OWAAutoLink">
<Shikang.Fan@amd.com></a>; Deng, Emily <a href="mailto:Emily.Deng@amd.com" id="OWAec7685c6-0db2-d435-c979-4088409c6fe0" class="x_moz-txt-link-rfc2396E OWAAutoLink">
<Emily.Deng@amd.com></a><br>
<b>Subject:</b> [PATCH v3] drm/amdgpu: Check fence emitted count to identify bad jobs</span>
<div> </div>
</div>
<div style="direction: ltr; font-size: 11pt;">In SRIOV, when host driver performs MODE 1 reset and notifies FLR to<br>
guest driver, there is a small chance that there is no job running on hw<br>
but the driver has not updated the pending list yet, causing the driver<br>
not respond the FLR request. Modify the has_job_running function to<br>
make sure if there is still running job.<br>
<br>
v2: Use amdgpu_fence_count_emitted to determine job running status.<br>
v3: Remove the timeout wait in has_job_running<br>
<br>
Signed-off-by: Emily Deng <a href="mailto:Emily.Deng@amd.com" id="OWA62837c60-60c3-f148-35fd-fdda97a1a33b" class="x_moz-txt-link-rfc2396E OWAAutoLink">
<Emily.Deng@amd.com></a><br>
Signed-off-by: Shikang Fan <a href="mailto:shikang.fan@amd.com" id="OWAb715c14a-aebf-bc1e-d72b-c99105026e83" class="x_moz-txt-link-rfc2396E OWAAutoLink">
<shikang.fan@amd.com></a><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++++++--------<br>
1 file changed, 7 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
index b3ca911e55d6..f53889ce71a8 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -5222,15 +5222,18 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev,<br>
}<br>
<br>
/**<br>
- * amdgpu_device_has_job_running - check if there is any job in mirror list<br>
+ * amdgpu_device_has_job_running - check if there is any unfinished job<br>
*<br>
* @adev: amdgpu_device pointer<br>
*<br>
- * check if there is any job in mirror list<br>
+ * check if there is any job running on the device when guest driver receives<br>
+ * FLR notification from host driver. If there are still jobs running, then<br>
+ * the guest driver will not respond the FLR reset. Instead, let the job hit<br>
+ * the timeout and guest driver then issue the reset request.<br>
*/<br>
bool amdgpu_device_has_job_running(struct amdgpu_device *adev)<br>
{<br>
- int i;<br>
+ int i, j;<br>
struct drm_sched_job *job;<br>
<br>
for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {<br>
@@ -5239,11 +5242,7 @@ bool amdgpu_device_has_job_running(struct amdgpu_device *adev)<br>
if (!amdgpu_ring_sched_ready(ring))<br>
continue;<br>
<br>
- spin_lock(&ring->sched.job_list_lock);<br>
- job = list_first_entry_or_null(&ring->sched.pending_list,<br>
- struct drm_sched_job, list);<br>
- spin_unlock(&ring->sched.job_list_lock);<br>
- if (job)<br>
+ if (amdgpu_fence_count_emitted(ring))<br>
return true;<br>
}<br>
return false;<br>
--<br>
2.34.1<br>
<br>
</div>
</blockquote>
<br>
</div>
</body>
</html>