<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:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Hawking,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The process is to send request first, and then to poll and wait 6 seconds.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
So the time delta between the 1-st request and the 11-th request is actually 60 seconds.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Jiange<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> Zhang, Hawking <Hawking.Zhang@amd.com><br>
<b>Sent:</b> Tuesday, December 8, 2020 12:16 AM<br>
<b>To:</b> Zhao, Jiange <Jiange.Zhao@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Chen, Horace <Horace.Chen@amd.com>; Zhang, Andy <Andy.Zhang@amd.com><br>
<b>Subject:</b> RE: [PATCH] drm/amdgpu/SRIOV: Extend VF reset request wait period</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">[AMD Public Use]<br>
<br>
Re - Poll happens every 6 seconds and it will last for 60 seconds.<br>
+ int ret, i = 0;<br>
+ #define AI_MAILBOX_POLL_MSG_REP_MAX 11<br>
<br>
The definition seems not match with your description that the polling will last for 60s.... with that fixed, the patch is<br>
<br>
Acked-by: Hawking Zhang <Hawking.Zhang@amd.com><br>
<br>
Regards,<br>
Hawking<br>
-----Original Message-----<br>
From: Zhao, Jiange <Jiange.Zhao@amd.com> <br>
Sent: Monday, December 7, 2020 18:06<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Zhang, Hawking <Hawking.Zhang@amd.com>; Chen, Horace <Horace.Chen@amd.com>; Zhang, Andy <Andy.Zhang@amd.com>; Zhao, Jiange <Jiange.Zhao@amd.com><br>
Subject: [PATCH] drm/amdgpu/SRIOV: Extend VF reset request wait period<br>
<br>
From: Jiange Zhao <Jiange.Zhao@amd.com><br>
<br>
In Virtualization case, when one VF is sending too many FLR requests, hypervisor would stop responding to this VF's request for a long period of time. This is called event guard. During this period of cooling time, guest driver should wait instead of doing
other things. After this period of time, guest driver would resume reset process and return to normal.<br>
<br>
Currently, guest driver would wait 12 seconds and return fail if it doesn't get response from host.<br>
<br>
Solution: extend this waiting time in guest driver and poll response periodically. Poll happens every 6 seconds and it will last for 60 seconds.<br>
<br>
v2: change the max repetition times from number to macro.<br>
<br>
Signed-off-by: Jiange Zhao <Jiange.Zhao@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 11 ++++++++++- drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h | 3 ++- drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c | 11 ++++++++++- drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h | 1 +<br>
4 files changed, 23 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c<br>
index f5ce9a9f4cf5..7767ccca526b 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c<br>
@@ -187,7 +187,16 @@ static int xgpu_ai_send_access_requests(struct amdgpu_device *adev,<br>
<br>
static int xgpu_ai_request_reset(struct amdgpu_device *adev) {<br>
- return xgpu_ai_send_access_requests(adev, IDH_REQ_GPU_RESET_ACCESS);<br>
+ int ret, i = 0;<br>
+<br>
+ while (i < AI_MAILBOX_POLL_MSG_REP_MAX) {<br>
+ ret = xgpu_ai_send_access_requests(adev, IDH_REQ_GPU_RESET_ACCESS);<br>
+ if (!ret)<br>
+ break;<br>
+ i++;<br>
+ }<br>
+<br>
+ return ret;<br>
}<br>
<br>
static int xgpu_ai_request_full_gpu_access(struct amdgpu_device *adev, diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h<br>
index 83b453f5d717..50572635d0f8 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h<br>
@@ -25,8 +25,9 @@<br>
#define __MXGPU_AI_H__<br>
<br>
#define AI_MAILBOX_POLL_ACK_TIMEDOUT 500<br>
-#define AI_MAILBOX_POLL_MSG_TIMEDOUT 12000<br>
+#define AI_MAILBOX_POLL_MSG_TIMEDOUT 6000<br>
#define AI_MAILBOX_POLL_FLR_TIMEDOUT 5000<br>
+#define AI_MAILBOX_POLL_MSG_REP_MAX 11<br>
<br>
enum idh_request {<br>
IDH_REQ_GPU_INIT_ACCESS = 1,<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c<br>
index 666ed99cc14b..dd5c1e6ce009 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c<br>
@@ -200,7 +200,16 @@ static int xgpu_nv_send_access_requests(struct amdgpu_device *adev,<br>
<br>
static int xgpu_nv_request_reset(struct amdgpu_device *adev) {<br>
- return xgpu_nv_send_access_requests(adev, IDH_REQ_GPU_RESET_ACCESS);<br>
+ int ret, i = 0;<br>
+<br>
+ while (i < NV_MAILBOX_POLL_MSG_REP_MAX) {<br>
+ ret = xgpu_nv_send_access_requests(adev, IDH_REQ_GPU_RESET_ACCESS);<br>
+ if (!ret)<br>
+ break;<br>
+ i++;<br>
+ }<br>
+<br>
+ return ret;<br>
}<br>
<br>
static int xgpu_nv_request_full_gpu_access(struct amdgpu_device *adev, diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h b/drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h<br>
index 52605e14a1a5..9f5808616174 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h<br>
@@ -27,6 +27,7 @@<br>
#define NV_MAILBOX_POLL_ACK_TIMEDOUT 500<br>
#define NV_MAILBOX_POLL_MSG_TIMEDOUT 6000<br>
#define NV_MAILBOX_POLL_FLR_TIMEDOUT 5000<br>
+#define NV_MAILBOX_POLL_MSG_REP_MAX 11<br>
<br>
enum idh_request {<br>
IDH_REQ_GPU_INIT_ACCESS = 1,<br>
--<br>
2.25.1<br>
</div>
</span></font></div>
</div>
</body>
</html>