<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/kernel/time/hrtimer.c, branch v4.9.160</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.160</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.160'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2018-03-03T09:23:20Z</updated>
<entry>
<title>hrtimer: Ensure POSIX compliance (relative CLOCK_REALTIME hrtimers)</title>
<updated>2018-03-03T09:23:20Z</updated>
<author>
<name>Anna-Maria Gleixner</name>
<email>anna-maria@linutronix.de</email>
</author>
<published>2017-12-21T10:41:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5a9f69b2c11bee48b1884165e4e1473f7672dc28'/>
<id>urn:sha1:5a9f69b2c11bee48b1884165e4e1473f7672dc28</id>
<content type='text'>
commit 48d0c9becc7f3c66874c100c126459a9da0fdced upstream.

The POSIX specification defines that relative CLOCK_REALTIME timers are not
affected by clock modifications. Those timers have to use CLOCK_MONOTONIC
to ensure POSIX compliance.

The introduction of the additional HRTIMER_MODE_PINNED mode broke this
requirement for pinned timers.

There is no user space visible impact because user space timers are not
using pinned mode, but for consistency reasons this needs to be fixed.

Check whether the mode has the HRTIMER_MODE_REL bit set instead of
comparing with HRTIMER_MODE_ABS.

Signed-off-by: Anna-Maria Gleixner &lt;anna-maria@linutronix.de&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: keescook@chromium.org
Fixes: 597d0275736d ("timers: Framework for identifying pinned timers")
Link: http://lkml.kernel.org/r/20171221104205.7269-7-anna-maria@linutronix.de
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Mike Galbraith &lt;efault@gmx.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>hrtimer: Reset hrtimer cpu base proper on CPU hotplug</title>
<updated>2018-01-31T11:55:56Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2018-01-26T13:54:32Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c98ff7299b404f110167883695f81080723e6e15'/>
<id>urn:sha1:c98ff7299b404f110167883695f81080723e6e15</id>
<content type='text'>
commit d5421ea43d30701e03cadc56a38854c36a8b4433 upstream.

The hrtimer interrupt code contains a hang detection and mitigation
mechanism, which prevents that a long delayed hrtimer interrupt causes a
continous retriggering of interrupts which prevent the system from making
progress. If a hang is detected then the timer hardware is programmed with
a certain delay into the future and a flag is set in the hrtimer cpu base
which prevents newly enqueued timers from reprogramming the timer hardware
prior to the chosen delay. The subsequent hrtimer interrupt after the delay
clears the flag and resumes normal operation.

If such a hang happens in the last hrtimer interrupt before a CPU is
unplugged then the hang_detected flag is set and stays that way when the
CPU is plugged in again. At that point the timer hardware is not armed and
it cannot be armed because the hang_detected flag is still active, so
nothing clears that flag. As a consequence the CPU does not receive hrtimer
interrupts and no timers expire on that CPU which results in RCU stalls and
other malfunctions.

Clear the flag along with some other less critical members of the hrtimer
cpu base to ensure starting from a clean state when a CPU is plugged in.

Thanks to Paul, Sebastian and Anna-Maria for their help to get down to the
root cause of that hard to reproduce heisenbug. Once understood it's
trivial and certainly justifies a brown paperbag.

Fixes: 41d2e4949377 ("hrtimer: Tune hrtimer_interrupt hang logic")
Reported-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Sebastian Sewior &lt;bigeasy@linutronix.de&gt;
Cc: Anna-Maria Gleixner &lt;anna-maria@linutronix.de&gt;
Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1801261447590.2067@nanos
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>hrtimer: Catch invalid clockids again</title>
<updated>2017-10-21T15:21:38Z</updated>
<author>
<name>Marc Zyngier</name>
<email>marc.zyngier@arm.com</email>
</author>
<published>2016-01-15T17:41:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0c92e732937c8b159c73ba3c244d29eed5be9f57'/>
<id>urn:sha1:0c92e732937c8b159c73ba3c244d29eed5be9f57</id>
<content type='text'>
[ Upstream commit 336a9cde10d641e70bac67d90ae91b3190c3edca ]

commit 82e88ff1ea94 ("hrtimer: Revert CLOCK_MONOTONIC_RAW support") removed
unfortunately a sanity check in the hrtimer code which was part of that
MONOTONIC_RAW patch series.

It would have caught the bogus usage of CLOCK_MONOTONIC_RAW in the wireless
code. So bring it back.

It is way too easy to take any random clockid and feed it to the hrtimer
subsystem. At best, it gets mapped to a monotonic base, but it would be
better to just catch illegal values as early as possible.

Detect invalid clockids, map them to CLOCK_MONOTONIC and emit a warning.

[ tglx: Replaced the BUG by a WARN and gracefully map to CLOCK_MONOTONIC ]

Signed-off-by: Marc Zyngier &lt;marc.zyngier@arm.com&gt;
Cc: Tomasz Nowicki &lt;tn@semihalf.com&gt;
Cc: Christoffer Dall &lt;christoffer.dall@linaro.org&gt;
Link: http://lkml.kernel.org/r/1452879670-16133-3-git-send-email-marc.zyngier@arm.com
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<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>
</feed>
