<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/kernel/time/clocksource.c, branch v4.9.235</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.235</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.235'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2020-02-14T21:31:08Z</updated>
<entry>
<title>clocksource: Prevent double add_timer_on() for watchdog_timer</title>
<updated>2020-02-14T21:31:08Z</updated>
<author>
<name>Konstantin Khlebnikov</name>
<email>khlebnikov@yandex-team.ru</email>
</author>
<published>2020-01-31T16:08:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=75fc4654a244504683f322ccbeff293f8578a3a3'/>
<id>urn:sha1:75fc4654a244504683f322ccbeff293f8578a3a3</id>
<content type='text'>
commit febac332a819f0e764aa4da62757ba21d18c182b upstream.

Kernel crashes inside QEMU/KVM are observed:

  kernel BUG at kernel/time/timer.c:1154!
  BUG_ON(timer_pending(timer) || !timer-&gt;function) in add_timer_on().

At the same time another cpu got:

  general protection fault: 0000 [#1] SMP PTI of poinson pointer 0xdead000000000200 in:

  __hlist_del at include/linux/list.h:681
  (inlined by) detach_timer at kernel/time/timer.c:818
  (inlined by) expire_timers at kernel/time/timer.c:1355
  (inlined by) __run_timers at kernel/time/timer.c:1686
  (inlined by) run_timer_softirq at kernel/time/timer.c:1699

Unfortunately kernel logs are badly scrambled, stacktraces are lost.

Printing the timer-&gt;function before the BUG_ON() pointed to
clocksource_watchdog().

The execution of clocksource_watchdog() can race with a sequence of
clocksource_stop_watchdog() .. clocksource_start_watchdog():

expire_timers()
 detach_timer(timer, true);
  timer-&gt;entry.pprev = NULL;
 raw_spin_unlock_irq(&amp;base-&gt;lock);
 call_timer_fn
  clocksource_watchdog()

					clocksource_watchdog_kthread() or
					clocksource_unbind()

					spin_lock_irqsave(&amp;watchdog_lock, flags);
					clocksource_stop_watchdog();
					 del_timer(&amp;watchdog_timer);
					 watchdog_running = 0;
					spin_unlock_irqrestore(&amp;watchdog_lock, flags);

					spin_lock_irqsave(&amp;watchdog_lock, flags);
					clocksource_start_watchdog();
					 add_timer_on(&amp;watchdog_timer, ...);
					 watchdog_running = 1;
					spin_unlock_irqrestore(&amp;watchdog_lock, flags);

  spin_lock(&amp;watchdog_lock);
  add_timer_on(&amp;watchdog_timer, ...);
   BUG_ON(timer_pending(timer) || !timer-&gt;function);
    timer_pending() -&gt; true
    BUG()

I.e. inside clocksource_watchdog() watchdog_timer could be already armed.

Check timer_pending() before calling add_timer_on(). This is sufficient as
all operations are synchronized by watchdog_lock.

Fixes: 75c5158f70c0 ("timekeeping: Update clocksource with stop_machine")
Signed-off-by: Konstantin Khlebnikov &lt;khlebnikov@yandex-team.ru&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/158048693917.4378.13823603769948933793.stgit@buzz
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>clocksource: Defer override invalidation unless clock is unstable</title>
<updated>2016-08-31T21:43:33Z</updated>
<author>
<name>Kyle Walker</name>
<email>kwalker@redhat.com</email>
</author>
<published>2016-08-06T16:07:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=36374583f9084cdab4b5dcf5521a3ce55bebb9fa'/>
<id>urn:sha1:36374583f9084cdab4b5dcf5521a3ce55bebb9fa</id>
<content type='text'>
Clocksources don't get the VALID_FOR_HRES flag until they have been
checked by a watchdog. However, when using an override, the
clocksource_select logic will clear the override value if the
clocksource is not marked VALID_FOR_HRES during that inititial check.
When using the boot arguments clocksource=&lt;foo&gt;, this selection can
run before the watchdog, and can cause the override to be incorrectly
cleared.

To address this condition, the override_name is only invalidated for
unstable clocksources. Otherwise, the override is left intact until after
the watchdog has validated the clocksource as stable/unstable.

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;
Cc: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Signed-off-by: Kyle Walker &lt;kwalker@redhat.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>clocksource: Make clocksource insert entry more efficient</title>
<updated>2016-06-20T19:46:34Z</updated>
<author>
<name>Minfei Huang</name>
<email>mnghuan@gmail.com</email>
</author>
<published>2016-04-25T09:20:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0fb71d340d355156818bb53eb36ae79a3f88bda9'/>
<id>urn:sha1:0fb71d340d355156818bb53eb36ae79a3f88bda9</id>
<content type='text'>
In clocksource_enqueue(), it is unnecessary to continue looping
the list, if we find there is an entry that the value of rating
is smaller than the new one. It is safe to be out the loop,
because all of entry are inserted in descending order.

Cc: Prarit Bhargava &lt;prarit@redhat.com&gt;
Cc: Richard Cochran &lt;richardcochran@gmail.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Signed-off-by: Minfei Huang &lt;mnghuan@gmail.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>clocksource: Allow unregistering the watchdog</title>
<updated>2016-01-27T11:38:05Z</updated>
<author>
<name>Vitaly Kuznetsov</name>
<email>vkuznets@redhat.com</email>
</author>
<published>2016-01-22T17:31:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=bbf66d897adf2bb0c310db96c97e8db6369f39e1'/>
<id>urn:sha1:bbf66d897adf2bb0c310db96c97e8db6369f39e1</id>
<content type='text'>
Hyper-V vmbus module registers TSC page clocksource when loaded. This is
the clocksource with the highest rating and thus it becomes the watchdog
making unloading of the vmbus module impossible.
Separate clocksource_select_watchdog() from clocksource_enqueue_watchdog()
and use it on clocksource register/rating change/unregister.

After all, lobotomized monkeys may need some love too.

Signed-off-by: Vitaly Kuznetsov &lt;vkuznets@redhat.com&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Dexuan Cui &lt;decui@microsoft.com&gt;
Cc: K. Y. Srinivasan &lt;kys@microsoft.com&gt;
Link: http://lkml.kernel.org/r/1453483913-25672-1-git-send-email-vkuznets@redhat.com
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>clocksource: Add CPU info to clocksource watchdog reporting</title>
<updated>2015-12-07T20:15:28Z</updated>
<author>
<name>Seiichi Ikarashi</name>
<email>s.ikarashi@jp.fujitsu.com</email>
</author>
<published>2015-09-10T09:01:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=390dd67c471a43a8a0f36c7d5177de49e7749c59'/>
<id>urn:sha1:390dd67c471a43a8a0f36c7d5177de49e7749c59</id>
<content type='text'>
The clocksource watchdog reporting was improved by 0b046b217ad4c6.
I want to add the info of CPU where the watchdog detects a
deviation because it is necessary to identify the trouble spot
if the clocksource is TSC.

Signed-off-by: Seiichi Ikarashi &lt;s.ikarashi@jp.fujitsu.com&gt;
[jstultz: Tweaked commit message]
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>remove abs64()</title>
<updated>2015-11-09T23:11:24Z</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@linux-foundation.org</email>
</author>
<published>2015-11-09T22:58:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=79211c8ed19c055ca105502c8733800d442a0ae6'/>
<id>urn:sha1:79211c8ed19c055ca105502c8733800d442a0ae6</id>
<content type='text'>
Switch everything to the new and more capable implementation of abs().
Mainly to give the new abs() a bit of a workout.

Cc: Michal Nazarewicz &lt;mina86@mina86.com&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Masami Hiramatsu &lt;masami.hiramatsu.pt@hitachi.com&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&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>Merge tag 'v4.3-rc5' into timers/core, to pick up fixes before applying new changes</title>
<updated>2015-10-12T07:51:18Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@kernel.org</email>
</author>
<published>2015-10-12T07:51:18Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b9f27c0f4f7db9e5a4ba59228442a75d3177470c'/>
<id>urn:sha1:b9f27c0f4f7db9e5a4ba59228442a75d3177470c</id>
<content type='text'>
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>clocksource: Remove return statement from void functions</title>
<updated>2015-10-11T20:13:46Z</updated>
<author>
<name>Guillaume Gomez</name>
<email>guillaume1.gomez@gmail.com</email>
</author>
<published>2015-09-23T11:19:19Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=cfed432d7f4114e16e0163bcfe65e96f0c304493'/>
<id>urn:sha1:cfed432d7f4114e16e0163bcfe65e96f0c304493</id>
<content type='text'>
Signed-off-by: Guillaume Gomez &lt;guillaume1.gomez@gmail.com&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Link: http://lkml.kernel.org/r/CAAOQCfSDgmqSWDBsetau%2ByF8x0%2BDagCF_pfFw0p5xH_BKkKEog@mail.gmail.com
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>clocksource: Fix abs() usage w/ 64bit values</title>
<updated>2015-10-02T20:53:01Z</updated>
<author>
<name>John Stultz</name>
<email>john.stultz@linaro.org</email>
</author>
<published>2015-09-15T01:05:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=67dfae0cd72fec5cd158b6e5fb1647b7dbe0834c'/>
<id>urn:sha1:67dfae0cd72fec5cd158b6e5fb1647b7dbe0834c</id>
<content type='text'>
This patch fixes one cases where abs() was being used with 64-bit
nanosecond values, where the result may be capped at 32-bits.

This potentially could cause watchdog false negatives on 32-bit
systems, so this patch addresses the issue by using abs64().

Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Prarit Bhargava &lt;prarit@redhat.com&gt;
Cc: Richard Cochran &lt;richardcochran@gmail.com&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1442279124-7309-2-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>time: Fix spelling in comments</title>
<updated>2015-09-22T10:54:23Z</updated>
<author>
<name>Zhen Lei</name>
<email>thunder.leizhen@huawei.com</email>
</author>
<published>2015-08-25T06:42:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=571af55a31d3652ac1f758f116835a76d0335661'/>
<id>urn:sha1:571af55a31d3652ac1f758f116835a76d0335661</id>
<content type='text'>
Signed-off-by: Zhen Lei &lt;thunder.leizhen@huawei.com&gt;
Cc: Hanjun Guo &lt;guohanjun@huawei.com&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: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Tianhong Ding &lt;dingtianhong@huawei.com&gt;
Cc: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Cc: Xinwei Hu &lt;huxinwei@huawei.com&gt;
Cc: Xunlei Pang &lt;pang.xunlei@linaro.org&gt;
Cc: Zefan Li &lt;lizefan@huawei.com&gt;
Link: http://lkml.kernel.org/r/1440484973-13892-1-git-send-email-thunder.leizhen@huawei.com
[ Fixed yet another typo in one of the sentences fixed. ]
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
</feed>
