From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753944AbbL2UNm (ORCPT ); Tue, 29 Dec 2015 15:13:42 -0500 Received: from mout.gmx.net ([212.227.15.19]:58224 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753612AbbL2UNj (ORCPT ); Tue, 29 Dec 2015 15:13:39 -0500 Subject: Re: timerfd_settime/timerfd_gettime issue ? To: Thomas Gleixner References: <567E8766.6020707@gmx.de> Cc: Linux Kernel Development , linux-parisc From: Helge Deller Message-ID: <5682E96A.5040008@gmx.de> Date: Tue, 29 Dec 2015 21:13:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:xEcHwZm09lpi9rCTb5YTRBRFi9lR5MIG9/fZRwW3fCN1qNYQ6iB OHo5bALLS96mYymxJmr0y/K7rVNTKH53geHgcjIbfhLhZHvtnZoKMNGN9wox1qZ3LOTQ6xB WIFP3IVB4xKL298/LGqnRlIJrEBuw5gTYcTCJLNfL88kX9BAR01+ZHg08UeG16aQC7VKsd7 UlNJz15Is5QODiupU4yEQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:g+k61IKeyqA=:fGfh88nFgZl6ZJ6IygWO0J vgy6J2vKSeFlgiPctftUPLnahqroa2BkqAWpXq1K4dhE08wwi5lcUFOTo5t4P5aLkPOuqOHP3 Md55nEeBKFXhSUVNJ6MHfTRz7F20skhK7PpOaN9maNZCpfEWVaMM8g2PclcJusW2druHWX38Y pAGGdpvyE7psE6dcYp8tBe2fLyGxjlYuYgDbEtLq8h4l6X0SCKT5DvjAlyaMkBG8hme0ixCIa C4zqO4V4GWekDcGjtGEaPPTmCjcir8gkyK5T3YejXZPlAKJlRSDmmbdis9Fu5bdHPXzVG987w NgyyXvdyeyLIc9zgpmA7XREYyyLiPgJAOXpR29b7uijuD06eE0kXd5j0wHIYDCOugTH4F/JUp ZjNvdKQuFUsZuYEseH31IYfs+xQAK+fqR6rccL60Xt80EcA0Ut+uQzlg+k3CamG3SNDElrK7u j2kwhoqgvUZ1B6KQYJRPwx/b8XGi090fqHuB+X+fjgmaylWnV4+IwgdlQFaxVUMuQHgcSjT2e JZ5DeKiJyU0UoSN9WVNw/YtzQFtuSOYd+PEQQTPuMoyJc/g6Ltq8lKM04Ltm9Vpu8mvJCSZ1w HSH5i36mO6DQPJntbf9+f1fIy2Q5VmFatEaA6AVKDY3+uDfkCRZFf00MkuLNQsBKxpIYv2hhe DDWTlrMM44zuP6qs5x6w7NexR7Mfzo3CftCLsux5H9cBDijqVevdNMx/bFJQtt3axbG2QDM4K oy+c7WPUx7pKMM+vw/MGq67F2Aoz5BLeXqa076EO+wEKpKsalAXnAL6sy7k6lKAZC3DfQ6fuc 7I9Hey2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29.12.2015 10:44, Thomas Gleixner wrote: > On Sat, 26 Dec 2015, Helge Deller wrote: >> I see a strange behavior on the parisc platform, for which I'm not sure if >> it's intended or if there is a bug somewhere. > >> The program calls timerfd_settime() and sets a timer (e.g. sec=0, nsec=100000000). >> Directly after setting the timer it calls timerfd_gettime() and receives >> (sec=0, nsec=103914413). >> The second nsec is higher than the initial nsec value which was set. >> >> Does timerfd_settime() maybe tries to add the initial time it takes to start >> the timer? >> >> Any idea or hint? > > Yes. This is a fallout from the power aware batching magic. Interesting that > nobody noticed this within 7 years. > > Does the patch below fix your issue? No, the patch below doesn't help. I still see: [ 644.916000] timerfd_settime: interval (sec=0, nsec=100000000) it_value (sec=0, nsec=100000000) [ 645.024000] timerfd_gettime: interval (sec=0, nsec=100000000) it_value (sec=0, nsec=103029949) Helge > diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h > index 76dd4f0da5ca..0f4a3e8734f1 100644 > --- a/include/linux/hrtimer.h > +++ b/include/linux/hrtimer.h > @@ -268,7 +268,7 @@ static inline s64 hrtimer_get_expires_ns(const struct hrtimer *timer) > > static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer) > { > - return ktime_sub(timer->node.expires, timer->base->get_time()); > + return ktime_sub(timer->_softexpires, timer->base->get_time()); > } > > static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)