public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* wait_for_completion_timeout problem ???
@ 2007-03-01 13:32 Eli Cohen
  2007-03-01 14:28 ` Dmitry Adamushko
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Cohen @ 2007-03-01 13:32 UTC (permalink / raw)
  To: Linux Kernel; +Cc: rdreier, Michael S. Tsirkin

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-03-01 16:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-01 13:32 wait_for_completion_timeout problem ??? Eli Cohen
2007-03-01 14:28 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox