Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933203AbcJLNPO (ORCPT ); Wed, 12 Oct 2016 09:15:14 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:55276 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932607AbcJLNPF (ORCPT ); Wed, 12 Oct 2016 09:15:05 -0400 Date: Wed, 12 Oct 2016 15:11:32 +0200 (CEST) From: Thomas Gleixner To: Andreas Mohr cc: Douglas Anderson , John Stultz , briannorris@chromium.org, huangtao@rock-chips.com, tony.xie@rock-chips.com, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] timers: Fix usleep_range() in the context of wake_up_process() In-Reply-To: <20161011182541.GA32165@rhlx01.hs-esslingen.de> Message-ID: References: <1476133442-17757-1-git-send-email-dianders@chromium.org> <20161011182541.GA32165@rhlx01.hs-esslingen.de> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2453 Lines: 57 On Tue, 11 Oct 2016, Andreas Mohr wrote: > On Tue, Oct 11, 2016 at 09:14:38AM +0200, Thomas Gleixner wrote: > > On Mon, 10 Oct 2016, Douglas Anderson wrote: > > > Users of usleep_range() expect that it will _never_ return in less time > > > than the minimum passed parameter. However, nothing in any of the code > > > ensures this. Specifically: > > > > There is no such guarantee for that interface and never has been, so how > > did you make sure that none of the existing users is relying on this? > > > > You can't just can't just declare that all all of the users expect that and > > be done with it. > > Hmm, somehow I don't manage to follow these thoughts. > > https://www.kernel.org/doc/htmldocs/device-drivers/API-usleep-range.html > (as a hopefully sufficiently authoritative source of documentation) > clearly specifies min to be > "Minimum time in usecs to sleep" > , which is what one would expect a two-param interface here to be > (minimum-maximum), > i.e. what would be the *natural* protocol I'd think. > > Also, [finally...] starting to enforce the minimum time > is an additional *constraint* on the protocol, > i.e. it's not at all like we are getting more *liberal* here > (since usually getting more liberal in certain protocols > is what will cause trouble, I'd think). > > Not to mention that > desiring a delay in processing most certainly is > what caused users of this API to decide to invoke it in the first place > (else they would just have chosen to carry on with delay-less processing > and be done with it). > And those users then surely wouldn't want to experience a behaviour > where the delay may be ended at any time, > however short that may end up being. I'm well aware what Doug wants to do and I'm not saying that this is wrong, but I'm not going to look at all usleep() usage sites to make sure none is relying on such a behaviour and gets surprised by the change, The point is that we had cases over and over where stuff was depending on implementation bugs which made the buggy behaviour into an expected behaviour. I'm not saying that this is the case here, but it's not my duty to make sure it isn't. So the very minimum I need in the changelog is some mentioning that the author at least tried to verify that this is not going to break the world and some more. That's what I meant by: You can't just can't just declare that all all of the users expect that and be done with it. Thanks, tglx