[ofa-general] [PATCH] IB/mlx4: Check completion done when a command

Eli Cohen eli at dev.mellanox.co.il
Thu Jun 19 07:15:20 PDT 2008


timeouts
Reply-To: 

>From 2ace4c00ef256a22a9a223ba658d62c1f6adf8e7 Mon Sep 17 00:00:00 2001
From: Eli Cohen <eli at mellanox.co.il>
Date: Thu, 19 Jun 2008 16:54:43 +0300
Subject: [PATCH] IB/mlx4: Check completion done when a command timeouts

When the system is busy it may happen that a command actually
completed but it took more than the specified timeout till the
task executing the command was actually given CPU time. This patch
checks that the completion is really missing before failing.

Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---
Roland,
we've been using this patch in ofed for a long time now. We have seen
cases where there are many processes running and it takes quite some
time before the task that executed the command gets CPU time. It seems
that the semantics of wait_for_completion_timeout has loose relation
to the actual time the event occurred -- however the done field itself
gives a more accurate indication as for whether the command was
completed or not.


 drivers/net/mlx4/cmd.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx4/cmd.c b/drivers/net/mlx4/cmd.c
index 70dff94..d50ee9a 100644
--- a/drivers/net/mlx4/cmd.c
+++ b/drivers/net/mlx4/cmd.c
@@ -279,10 +279,11 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
 	mlx4_cmd_post(dev, in_param, out_param ? *out_param : 0,
 		      in_modifier, op_modifier, op, context->token, 1);
 
-	if (!wait_for_completion_timeout(&context->done, msecs_to_jiffies(timeout))) {
-		err = -EBUSY;
-		goto out;
-	}
+	if (!wait_for_completion_timeout(&context->done, msecs_to_jiffies(timeout)))
+		if (!context->done.done) {
+			err = -EBUSY;
+			goto out;
+		}
 
 	err = context->result;
 	if (err)
-- 
1.5.5.4




More information about the general mailing list