<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/kernel/time/hrtimer.c, branch v4.9.16</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.16</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.16'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2016-08-31T21:43:36Z</updated>
<entry>
<title>time: Avoid undefined behaviour in ktime_add_safe()</title>
<updated>2016-08-31T21:43:36Z</updated>
<author>
<name>Vegard Nossum</name>
<email>vegard.nossum@oracle.com</email>
</author>
<published>2016-08-12T23:37:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=979515c5645830465739254abc1b1648ada41518'/>
<id>urn:sha1:979515c5645830465739254abc1b1648ada41518</id>
<content type='text'>
I ran into this:

    ================================================================================
    UBSAN: Undefined behaviour in kernel/time/hrtimer.c:310:16
    signed integer overflow:
    9223372036854775807 + 50000 cannot be represented in type 'long long int'
    CPU: 2 PID: 4798 Comm: trinity-c2 Not tainted 4.8.0-rc1+ #91
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
     0000000000000000 ffff88010ce6fb88 ffffffff82344740 0000000041b58ab3
     ffffffff84f97a20 ffffffff82344694 ffff88010ce6fbb0 ffff88010ce6fb60
     000000000000c350 ffff88010ce6f968 dffffc0000000000 ffffffff857bc320
    Call Trace:
     [&lt;ffffffff82344740&gt;] dump_stack+0xac/0xfc
     [&lt;ffffffff82344694&gt;] ? _atomic_dec_and_lock+0xc4/0xc4
     [&lt;ffffffff8242df78&gt;] ubsan_epilogue+0xd/0x8a
     [&lt;ffffffff8242e6b4&gt;] handle_overflow+0x202/0x23d
     [&lt;ffffffff8242e4b2&gt;] ? val_to_string.constprop.6+0x11e/0x11e
     [&lt;ffffffff8236df71&gt;] ? timerqueue_add+0x151/0x410
     [&lt;ffffffff81485c48&gt;] ? hrtimer_start_range_ns+0x3b8/0x1380
     [&lt;ffffffff81795631&gt;] ? memset+0x31/0x40
     [&lt;ffffffff8242e6fd&gt;] __ubsan_handle_add_overflow+0xe/0x10
     [&lt;ffffffff81488ac9&gt;] hrtimer_nanosleep+0x5d9/0x790
     [&lt;ffffffff814884f0&gt;] ? hrtimer_init_sleeper+0x80/0x80
     [&lt;ffffffff813a9ffb&gt;] ? __might_sleep+0x5b/0x260
     [&lt;ffffffff8148be10&gt;] common_nsleep+0x20/0x30
     [&lt;ffffffff814906c7&gt;] SyS_clock_nanosleep+0x197/0x210
     [&lt;ffffffff81490530&gt;] ? SyS_clock_getres+0x150/0x150
     [&lt;ffffffff823c7113&gt;] ? __this_cpu_preempt_check+0x13/0x20
     [&lt;ffffffff8162ef60&gt;] ? __context_tracking_exit.part.3+0x30/0x1b0
     [&lt;ffffffff81490530&gt;] ? SyS_clock_getres+0x150/0x150
     [&lt;ffffffff81007bd3&gt;] do_syscall_64+0x1b3/0x4b0
     [&lt;ffffffff845f85aa&gt;] entry_SYSCALL64_slow_path+0x25/0x25
    ================================================================================

Add a new ktime_add_unsafe() helper which doesn't check for overflow, but
doesn't throw a UBSAN warning when it does overflow either.

Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Richard Cochran &lt;richardcochran@gmail.com&gt;
Cc: Prarit Bhargava &lt;prarit@redhat.com&gt;
Signed-off-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>hrtimer: Spelling fixes</title>
<updated>2016-08-31T21:43:20Z</updated>
<author>
<name>Pratyush Patel</name>
<email>pratyushpatel.1995@gmail.com</email>
</author>
<published>2016-06-23T18:50:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b4d90e9f1ef1f19dcb2b1b1942c786c9c4225460'/>
<id>urn:sha1:b4d90e9f1ef1f19dcb2b1b1942c786c9c4225460</id>
<content type='text'>
Fix a minor spelling error.

Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Richard Cochran &lt;richardcochran@gmail.com&gt;
Cc: Prarit Bhargava &lt;prarit@redhat.com&gt;
Signed-off-by: Pratyush Patel &lt;pratyushpatel.1995@gmail.com&gt;
[jstultz: Added commit message]
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>hrtimer: Convert to hotplug state machine</title>
<updated>2016-07-15T08:41:37Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2016-07-15T08:41:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=27590dc17b34aedc4f3e14bd107ee59b9db9b0a6'/>
<id>urn:sha1:27590dc17b34aedc4f3e14bd107ee59b9db9b0a6</id>
<content type='text'>
Split out the clockevents callbacks instead of piggybacking them on
hrtimers.

This gets rid of a POST_DEAD user. See commit:

  54e88fad223c ("sched: Make sure timers have migrated before killing the migration_thread")

We just move the callback state to the proper place in the state machine.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Anna-Maria Gleixner &lt;anna-maria@linutronix.de&gt;
Reviewed-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153337.485419196@linutronix.de
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>hrtimer: Remove redundant #ifdef block</title>
<updated>2016-06-10T09:25:35Z</updated>
<author>
<name>Pratyush Patel</name>
<email>pratyushpatel.1995@gmail.com</email>
</author>
<published>2016-03-01T17:28:49Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=86721ab63b61ef1dd7305308e4049f644703decf'/>
<id>urn:sha1:86721ab63b61ef1dd7305308e4049f644703decf</id>
<content type='text'>
Only need CONFIG_NO_HZ_COMMON as this block is already in a
CONFIG_SMP block.

Signed-off-by: Pratyush Patel &lt;pratyushpatel.1995@gmail.com&gt;
Link: http://lkml.kernel.org/r/20160301172849.GA18152@cyborg
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>timer: Export destroy_hrtimer_on_stack()</title>
<updated>2016-05-31T18:44:08Z</updated>
<author>
<name>Guenter Roeck</name>
<email>linux@roeck-us.net</email>
</author>
<published>2016-05-27T00:21:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c08376ac97cb202ec65320f3d90d5c4c5e2adb0b'/>
<id>urn:sha1:c08376ac97cb202ec65320f3d90d5c4c5e2adb0b</id>
<content type='text'>
hrtimer_init_on_stack() needs a matching call to
destroy_hrtimer_on_stack(), so both need to be exported.

Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>debugobjects: insulate non-fixup logic related to static obj from fixup callbacks</title>
<updated>2016-05-20T02:12:14Z</updated>
<author>
<name>Du, Changbin</name>
<email>changbin.du@intel.com</email>
</author>
<published>2016-05-20T00:09:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b9fdac7f660609abb157500e468d2165b3c9cf08'/>
<id>urn:sha1:b9fdac7f660609abb157500e468d2165b3c9cf08</id>
<content type='text'>
When activating a static object we need make sure that the object is
tracked in the object tracker.  If it is a non-static object then the
activation is illegal.

In previous implementation, each subsystem need take care of this in
their fixup callbacks.  Actually we can put it into debugobjects core.
Thus we can save duplicated code, and have *pure* fixup callbacks.

To achieve this, a new callback "is_static_object" is introduced to let
the type specific code decide whether a object is static or not.  If
yes, we take it into object tracker, otherwise give warning and invoke
fixup callback.

This change has paassed debugobjects selftest, and I also do some test
with all debugobjects supports enabled.

At last, I have a concern about the fixups that can it change the object
which is in incorrect state on fixup? Because the 'addr' may not point
to any valid object if a non-static object is not tracked.  Then Change
such object can overwrite someone's memory and cause unexpected
behaviour.  For example, the timer_fixup_activate bind timer to function
stub_timer.

Link: http://lkml.kernel.org/r/1462576157-14539-1-git-send-email-changbin.du@intel.com
[changbin.du@intel.com: improve code comments where invoke the new is_static_object callback]
  Link: http://lkml.kernel.org/r/1462777431-8171-1-git-send-email-changbin.du@intel.com
Signed-off-by: Du, Changbin &lt;changbin.du@intel.com&gt;
Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Cc: Josh Triplett &lt;josh@kernel.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Christian Borntraeger &lt;borntraeger@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>timer: update debugobjects fixup callbacks return type</title>
<updated>2016-05-20T02:12:14Z</updated>
<author>
<name>Du, Changbin</name>
<email>changbin.du@intel.com</email>
</author>
<published>2016-05-20T00:09:29Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e3252464da222ef2c2ca52dff383a824080ea3d5'/>
<id>urn:sha1:e3252464da222ef2c2ca52dff383a824080ea3d5</id>
<content type='text'>
Update the return type to use bool instead of int, corresponding to
cheange (debugobjects: make fixup functions return bool instead of int).

Signed-off-by: Du, Changbin &lt;changbin.du@intel.com&gt;
Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Cc: Josh Triplett &lt;josh@kernel.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Christian Borntraeger &lt;borntraeger@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>param: convert some "on"/"off" users to strtobool</title>
<updated>2016-03-17T22:09:34Z</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2016-03-17T21:23:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4cc7ecb7f2a60e8deb783b8fbf7c1ae467acb920'/>
<id>urn:sha1:4cc7ecb7f2a60e8deb783b8fbf7c1ae467acb920</id>
<content type='text'>
This changes several users of manual "on"/"off" parsing to use
strtobool.

Some side-effects:
- these uses will now parse y/n/1/0 meaningfully too
- the early_param uses will now bubble up parse errors

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Acked-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Cc: Amitkumar Karwar &lt;akarwar@marvell.com&gt;
Cc: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Cc: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Cc: Nishant Sarmukadam &lt;nishants@marvell.com&gt;
Cc: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Cc: Steve French &lt;sfrench@samba.org&gt;
Cc: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>timer: convert timer_slack_ns from unsigned long to u64</title>
<updated>2016-03-17T22:09:34Z</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2016-03-17T21:20:51Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=da8b44d5a9f8bf26da637b7336508ca534d6b319'/>
<id>urn:sha1:da8b44d5a9f8bf26da637b7336508ca534d6b319</id>
<content type='text'>
This patchset introduces a /proc/&lt;pid&gt;/timerslack_ns interface which
would allow controlling processes to be able to set the timerslack value
on other processes in order to save power by avoiding wakeups (Something
Android currently does via out-of-tree patches).

The first patch tries to fix the internal timer_slack_ns usage which was
defined as a long, which limits the slack range to ~4 seconds on 32bit
systems.  It converts it to a u64, which provides the same basically
unlimited slack (500 years) on both 32bit and 64bit machines.

The second patch introduces the /proc/&lt;pid&gt;/timerslack_ns interface
which allows the full 64bit slack range for a task to be read or set on
both 32bit and 64bit machines.

With these two patches, on a 32bit machine, after setting the slack on
bash to 10 seconds:

$ time sleep 1

real    0m10.747s
user    0m0.001s
sys     0m0.005s

The first patch is a little ugly, since I had to chase the slack delta
arguments through a number of functions converting them to u64s.  Let me
know if it makes sense to break that up more or not.

Other than that things are fairly straightforward.

This patch (of 2):

The timer_slack_ns value in the task struct is currently a unsigned
long.  This means that on 32bit applications, the maximum slack is just
over 4 seconds.  However, on 64bit machines, its much much larger (~500
years).

This disparity could make application development a little (as well as
the default_slack) to a u64.  This means both 32bit and 64bit systems
have the same effective internal slack range.

Now the existing ABI via PR_GET_TIMERSLACK and PR_SET_TIMERSLACK specify
the interface as a unsigned long, so we preserve that limitation on
32bit systems, where SET_TIMERSLACK can only set the slack to a unsigned
long value, and GET_TIMERSLACK will return ULONG_MAX if the slack is
actually larger then what can be stored by an unsigned long.

This patch also modifies hrtimer functions which specified the slack
delta as a unsigned long.

Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Arjan van de Ven &lt;arjan@linux.intel.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Oren Laadan &lt;orenl@cellrox.com&gt;
Cc: Ruchi Kandoi &lt;kandoiruchi@google.com&gt;
Cc: Rom Lemarchand &lt;romlem@android.com&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Android Kernel Team &lt;kernel-team@android.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>hrtimer: Handle remaining time proper for TIME_LOW_RES</title>
<updated>2016-01-17T10:13:55Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2016-01-14T16:54:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=203cbf77de59fc8f13502dcfd11350c6d4a5c95f'/>
<id>urn:sha1:203cbf77de59fc8f13502dcfd11350c6d4a5c95f</id>
<content type='text'>
If CONFIG_TIME_LOW_RES is enabled we add a jiffie to the relative timeout to
prevent short sleeps, but we do not account for that in interfaces which
retrieve the remaining time.

Helge observed that timerfd can return a remaining time larger than the
relative timeout. That's not expected and breaks userland test programs.

Store the information that the timer was armed relative and provide functions
to adjust the remaining time. To avoid bloating the hrtimer struct make state
a u8, which as a bonus results in better code on x86 at least.

Reported-and-tested-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: linux-m68k@lists.linux-m68k.org
Cc: dhowells@redhat.com
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20160114164159.273328486@linutronix.de
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
</feed>
