[Accel-config] [PATCH] accfg: test: add extra check for completion timeout

Dave Jiang <dave.jiang at intel.com> Thu, 14 Apr 2022 10:21:02 -0700
Newsgroups dev.linux.lists.accel-config
Message-ID < <164995686292.3177535.9717372718939670201.stgit@djiang5-desk3.ch.intel.com>>
Add check for the case where it timed out but descriptor is completed. This
gives us an additional warning to see if something else may be broken.

Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
---
 test/dsa.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/dsa.c b/test/dsa.c
index d3eb4ce67b2f..a5f933b9ad51 100644
--- a/test/dsa.c
+++ b/test/dsa.c
@@ -917,6 +917,7 @@ static int dsa_wait_on_desc_timeout(struct dsa_completion_record *comp,
 				    unsigned int msec_timeout)
 {
 	unsigned int j = 0;
+	bool timed_out = false;
 
 	if (!umwait_support) {
 		while (j < msec_timeout && comp->status == 0) {
@@ -949,7 +950,12 @@ static int dsa_wait_on_desc_timeout(struct dsa_completion_record *comp,
 
 	dump_compl_rec(comp);
 
-	return (j == msec_timeout) ? -EAGAIN : 0;
+	timed_out = (j == msec_timeout);
+
+	if (timed_out && comp->status && umwait_support)
+		err("Timed out, but operation completed. umwait may be broken?\n");
+
+	return (timed_out && !comp->status) ? -EAGAIN : 0;
 }
 
 /* the pattern is 8 bytes long while the dst can with any length */