Sunday, January 12, 2014

linux.kernel - 26 new messages in 20 topics - digest

linux.kernel
http://groups.google.com/group/linux.kernel?hl=en

linux.kernel@googlegroups.com

Today's topics:

* sched, net: Fixup busy_loop_us_clock() - 3 messages, 1 author
http://groups.google.com/group/linux.kernel/t/e1ae94c359c2f29c?hl=en
* arch: Move smp_mb__{before,after}_atomic_{inc, dec}.h into asm/atomic.h - 1
messages, 1 author
http://groups.google.com/group/linux.kernel/t/2f35f08fafc309a0?hl=en
* perf/x86: Fix active_entry initialization - 2 messages, 1 author
http://groups.google.com/group/linux.kernel/t/58b19477d8508830?hl=en
* perf tools: Use zfree to help detect use after free bugs - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/7a68882f60061d4f?hl=en
* perf annotate: Auto allocate symbol per addr hist buckets - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/238ee10b21a4edc6?hl=en
* perf tests: Factor make install tests - 2 messages, 1 author
http://groups.google.com/group/linux.kernel/t/3e1aa0b8b884cd89?hl=en
* perf ui/tui: Protect windows by ui__lock - 3 messages, 1 author
http://groups.google.com/group/linux.kernel/t/3a035d7dee5e7567?hl=en
* sched: Calculate effective load even if local weight is 0 - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/e4060f4841a17772?hl=en
* arch: Clean up asm/ barrier.h implementations using asm-generic/barrier.h -
1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/1ee502f73a2af4a4?hl=en
* sched_clock: Disable seqlock lockdep usage in sched_clock() - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/319d06ce78cc6f61?hl=en
* perf top: Use hist_entry__inc_addr_sample - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/bb59d0eb90da4e18?hl=en
* perf ui browser: Remove misplaced __maybe_unused - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/312749a0698bf518?hl=en
* sched, thermal: Clean up preempt_enable_no_resched() abuse - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/6dd8123c44df12dc?hl=en
* sched/preempt: Fix up missed PREEMPT_NEED_RESCHED folding - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/ce4bd886bfc04e54?hl=en
* x86/irq: Fix do_IRQ() interrupt warning for cpu hotplug retriggered irqs - 1
messages, 1 author
http://groups.google.com/group/linux.kernel/t/33857d87ba514966?hl=en
* locking/doc: Rename LOCK/UNLOCK to ACQUIRE/ RELEASE - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/1e8e365df7e87516?hl=en
* arch: Introduce smp_load_acquire(), smp_store_release() - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/86c5b082062de06c?hl=en
* perf tools: No need to test against NULL before calling free() - 1 messages,
1 author
http://groups.google.com/group/linux.kernel/t/69426257cd64951e?hl=en
* perf annotate: Make symbol__inc_addr_samples private - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/90ac4abe0917f94a?hl=en
* perf tools: Introduce zfree - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/f973d62ea336172a?hl=en

==============================================================================
TOPIC: sched, net: Fixup busy_loop_us_clock()
http://groups.google.com/group/linux.kernel/t/e1ae94c359c2f29c?hl=en
==============================================================================

== 1 of 3 ==
Date: Sun, Jan 12 2014 10:50 am
From: tip-bot for Peter Zijlstra


Commit-ID: 29fc2f66b552770909591d89ee87ab8690d67e61
Gitweb: http://git.kernel.org/tip/29fc2f66b552770909591d89ee87ab8690d67e61
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Tue, 19 Nov 2013 16:13:38 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 12 Jan 2014 14:50:37 +0100

sched, net: Fixup busy_loop_us_clock()

The only valid use of preempt_enable_no_resched() is if the very next
line is schedule() or if we know preemption cannot actually be enabled
by that statement due to known more preempt_count 'refs'.

This busy_poll stuff looks to be completely and utterly broken,
sched_clock() can return utter garbage with interrupts enabled (rare
but still) and it can drift unbounded between CPUs.

This means that if you get preempted/migrated and your new CPU is
years behind on the previous CPU we get to busy spin for a _very_ long
time.

There is a _REASON_ sched_clock() warns about preemptability -
papering over it with a preempt_disable()/preempt_enable_no_resched()
is just terminal brain damage on so many levels.

Replace sched_clock() usage with local_clock() which has a bounded
drift between CPUs (<2 jiffies).

There is a further problem with the entire busy wait poll thing in
that the spin time is additive to the syscall timeout, not inclusive.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: rui.zhang@intel.com
Cc: jacob.jun.pan@linux.intel.com
Cc: Mike Galbraith <bitbucket@online.de>
Cc: hpa@zytor.com
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: lenb@kernel.org
Cc: rjw@rjwysocki.net
Cc: Eliezer Tamir <eliezer.tamir@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20131119151338.GF3694@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
include/net/busy_poll.h | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
index 829627d..1d67fb6 100644
--- a/include/net/busy_poll.h
+++ b/include/net/busy_poll.h
@@ -42,27 +42,10 @@ static inline bool net_busy_loop_on(void)
return sysctl_net_busy_poll;
}

-/* a wrapper to make debug_smp_processor_id() happy
- * we can use sched_clock() because we don't care much about precision
- * we only care that the average is bounded
- */
-#ifdef CONFIG_DEBUG_PREEMPT
-static inline u64 busy_loop_us_clock(void)
-{
- u64 rc;
-
- preempt_disable_notrace();
- rc = sched_clock();
- preempt_enable_no_resched_notrace();
-
- return rc >> 10;
-}
-#else /* CONFIG_DEBUG_PREEMPT */
static inline u64 busy_loop_us_clock(void)
{
- return sched_clock() >> 10;
+ return local_clock() >> 10;
}
-

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate