From: Andrew Morton <akpm@linux-foundation.org>
To: NeilBrown <neilb@suse.de>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
lkml <linux-kernel@vger.kernel.org>,
"Dr. H. Nikolaus Schaller" <hns@goldelico.com>,
Marek Belisko <marek@goldelico.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH/RFC] wait_for_completion_timeout() considered harmful.
Date: Mon, 18 Nov 2013 15:27:46 -0800 [thread overview]
Message-ID: <20131118152746.937b2b7971d7a4bba4ef996d@linux-foundation.org> (raw)
In-Reply-To: <20131117080603.2a0d3b6d@notabene.brown>
On Sun, 17 Nov 2013 08:06:03 +1100 NeilBrown <neilb@suse.de> wrote:
> It would be reasonable to assume that
>
> wait_for_completion_timeout(&wm8350->auxadc_done, msecs_to_jiffies(5));
>
> would wait at least 5 msecs for the auxadc_done to complete. But it does not.
> With a HZ of 200 or less, msecs_to_jiffies(5) has value '1', and so this
> will only wait until the next "timer tick", which could happen immediately.
>
> This can lead to incorrect results - and has done so in out-of-tree patches
> for drivers/misc/bmp085.c which uses a very similar construct to enable interrupt
> based result collection.
>
> The documentation for several *_timeout* functions claim they will wait for
> "timeout jiffies" to have elapsed where this is not the case. They will
> actually wait for "timeout" jiffies to have started implying an elapsed time
> between (timeout-1) and (timeout).
>
> This patch corrects some of this documentation, and adds a collection of
> wait_for_completion*_msecs()
> interfaces which wait at least the given number of milliseconds for the
> completion (or a signal).
Mutter. wait_for_x(..., 5ms) should wait for a minimum of 5ms, no matter
what.
So I'd suggest we make that happen, rather than adding some new interfaces?
next prev parent reply other threads:[~2013-11-18 23:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-16 21:06 NeilBrown
2013-11-18 23:27 ` Andrew Morton [this message]
2013-11-18 23:42 ` Peter Zijlstra
2013-11-19 0:49 ` Jonathan Corbet
2013-11-19 7:05 ` Ingo Molnar
2013-11-19 8:29 ` Peter Zijlstra
2013-11-18 23:44 ` NeilBrown
2013-11-19 8:25 ` Peter Zijlstra
2013-11-19 8:58 ` NeilBrown
2013-11-19 12:23 ` Peter Zijlstra
2013-11-19 14:39 ` Thomas Gleixner
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=20131118152746.937b2b7971d7a4bba4ef996d@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=hns@goldelico.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marek@goldelico.com \
--cc=mingo@redhat.com \
--cc=neilb@suse.de \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome