public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eli Cohen <eli@mellanox.co.il>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Cc: rdreier@cisco.com, "Michael S. Tsirkin" <mst@mellanox.co.il>
Subject: wait_for_completion_timeout problem ???
Date: Thu, 01 Mar 2007 15:32:12 +0200	[thread overview]
Message-ID: <1172755932.5175.37.camel@mtls03> (raw)

Hi,
	
I have a problem with using this function. I am referring to
drivers/infiniband/hw/mthca/mthca_cmd.c line 394. For convenience I
quote from this code:

	init_completion(&context->done);

	err = mthca_cmd_post(dev, in_param,
			     out_param ? *out_param : 0,
			     in_modifier, op_modifier,
			     op, context->token, 1);
	if (err)
		goto out;

	if (!wait_for_completion_timeout(&context->done, timeout)) {
		err = -EBUSY;
		goto out;
	}

timeout is 10 * HZ. Sometimes this function returns 0 which signifies
timeout. However I can see that the interrupt handler called
complete(&context->done)
around 200 usec after calling wait_for_completion_timout(). When the
function returns I can see that context->done.done equals 1 which
confirms that complete was indeed called. Looking at the implementation
of wait_for_completion_timout() it appears that complete() did not
succeed to wake the process sleeping. But the timer callback function in
schedule_timeout() did manage to wake up the sleeping process. Do you
have any idea if there are any known circumstances that can lead to this
behaviour. Any idea how to debug this?

Thanks
Eli

             reply	other threads:[~2007-03-01 13:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-01 13:32 Eli Cohen [this message]
2007-03-01 14:28 ` wait_for_completion_timeout problem ??? Dmitry Adamushko
2007-03-01 14:49   ` Eli Cohen
2007-03-01 15:14     ` Dmitry Adamushko
2007-03-01 15:39       ` Eli Cohen
2007-03-01 16:05   ` Eli Cohen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1172755932.5175.37.camel@mtls03 \
    --to=eli@mellanox.co.il \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@mellanox.co.il \
    --cc=rdreier@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox