Flexible I/O Tester development
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: Jens Axboe <jens.axboe@oracle.com>, fio@vger.kernel.org
Subject: "Fix wrong clock source in mutex" broke fio for me
Date: Tue, 06 Oct 2009 23:56:25 -0700	[thread overview]
Message-ID: <ada1vlfqan3.fsf@cisco.com> (raw)

With the latest fio git tree, I get:

    fio: job startup hung? exiting.

on startup, and it looks like the latest commit, 69a852f5 ("Fix wrong
clock source in mutex") breaks things for me (Ubuntu 9.10 beta).  My
system seems to use CLOCK_REALTIME for pthread_cond_timedwait() by
default.

The cleanest solution seems to be to explicitly set which clock to use
in pthread_cond_timedwait() via pthread_condattr_setclock() when
initializing the condition variable, although I'm not sure how portable
this is away from modern Linux (ie do all platforms that fio cares about
have pthread_condattr_setclock()?).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
---
 mutex.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/mutex.c b/mutex.c
index 9f0f094..34b3324 100644
--- a/mutex.c
+++ b/mutex.c
@@ -72,6 +72,7 @@ struct fio_mutex *fio_mutex_init(int value)
 
 	pthread_condattr_init(&cond);
 	pthread_condattr_setpshared(&cond, mflag);
+	pthread_condattr_setclock(&cond, CLOCK_MONOTONIC);
 	pthread_cond_init(&mutex->cond, &cond);
 
 	ret = pthread_mutex_init(&mutex->lock, &attr);


             reply	other threads:[~2009-10-07 19:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-07  6:56 Roland Dreier [this message]
2009-10-07 20:01 ` "Fix wrong clock source in mutex" broke fio for me Jens Axboe
2009-10-07 20:22   ` Roland Dreier
2009-10-08  6:54     ` Jens Axboe

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=ada1vlfqan3.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=fio@vger.kernel.org \
    --cc=jens.axboe@oracle.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