Patches contributed by Eötvös Lorand University
commit 4fcc50abdffb517cee36cec9cb22138d84fb62d0
Author: Ingo Molnar <mingo@elte.hu>
Date: Sun Nov 9 08:10:03 2008 +0100
x86: clean up vget_cycles()
Impact: remove unused variable
I forgot to remove the now unused "cycles_t cycles" parameter from
vget_cycles() - which triggers build warnings as tsc.h is included
in a number of files.
Remove it.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h
index 700aeb8d2098..38ae163cc91b 100644
--- a/arch/x86/include/asm/tsc.h
+++ b/arch/x86/include/asm/tsc.h
@@ -34,8 +34,6 @@ static inline cycles_t get_cycles(void)
static __always_inline cycles_t vget_cycles(void)
{
- cycles_t cycles;
-
/*
* We only do VDSOs on TSC capable CPUs, so this shouldnt
* access boot_cpu_data (which is not VDSO-safe):
commit cb9e35dce94a1b9c59d46224e8a94377d673e204
Author: Ingo Molnar <mingo@elte.hu>
Date: Sat Nov 8 20:27:00 2008 +0100
x86: clean up rdtsc_barrier() use
Impact: cleanup
Move rdtsc_barrier() use to vsyscall_64.c where it's relied on,
and point out its role in the context of its use.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h
index 9cd83a8e40d5..700aeb8d2098 100644
--- a/arch/x86/include/asm/tsc.h
+++ b/arch/x86/include/asm/tsc.h
@@ -44,11 +44,7 @@ static __always_inline cycles_t vget_cycles(void)
if (!cpu_has_tsc)
return 0;
#endif
- rdtsc_barrier();
- cycles = (cycles_t)__native_read_tsc();
- rdtsc_barrier();
-
- return cycles;
+ return (cycles_t)__native_read_tsc();
}
extern void tsc_init(void);
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 0b8b6690a86d..ebf2f12900f5 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -128,7 +128,16 @@ static __always_inline void do_vgettimeofday(struct timeval * tv)
gettimeofday(tv,NULL);
return;
}
+
+ /*
+ * Surround the RDTSC by barriers, to make sure it's not
+ * speculated to outside the seqlock critical section and
+ * does not cause time warps:
+ */
+ rdtsc_barrier();
now = vread();
+ rdtsc_barrier();
+
base = __vsyscall_gtod_data.clock.cycle_last;
mask = __vsyscall_gtod_data.clock.mask;
mult = __vsyscall_gtod_data.clock.mult;
commit 895e031707954a9ca26ed4f5f794575313854ed1
Merge: 838e8bb71dc0 a622cf69b806
Author: Ingo Molnar <mingo@elte.hu>
Date: Sat Nov 8 20:23:02 2008 +0100
Merge branch 'linus' into x86/cleanups
commit 7cbaef9c83e58bbd4bdd534b09052b6c5ec457d5
Author: Ingo Molnar <mingo@elte.hu>
Date: Sat Nov 8 17:05:38 2008 +0100
sched: optimize sched_clock() a bit
sched_clock() uses cycles_2_ns() needlessly - which is an irq-disabling
variant of __cycles_2_ns().
Most of the time sched_clock() is called with irqs disabled already.
The few places that call it with irqs enabled need to be updated.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 2ef80e301925..424093b157d3 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -55,7 +55,7 @@ u64 native_sched_clock(void)
rdtscll(this_offset);
/* return the value in ns */
- return cycles_2_ns(this_offset);
+ return __cycles_2_ns(this_offset);
}
/* We need to define a real function for sched_clock, to override the
commit 0d12cdd5f883f508d33b85c1bae98fa28987c8c7
Author: Ingo Molnar <mingo@elte.hu>
Date: Sat Nov 8 16:19:55 2008 +0100
sched: improve sched_clock() performance
in scheduler-intense workloads native_read_tsc() overhead accounts for
20% of the system overhead:
659567 system_call 41222.9375
686796 schedule 435.7843
718382 __switch_to 665.1685
823875 switch_mm 4526.7857
1883122 native_read_tsc 55385.9412
9761990 total 2.8468
this is large part due to the rdtsc_barrier() that is done before
and after reading the TSC.
But sched_clock() is not a precise clock in the GTOD sense, using such
barriers is completely pointless. So remove the barriers and only use
them in vget_cycles().
This improves lat_ctx performance by about 5%.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 46be2fa7ac26..c2a812ebde89 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -108,9 +108,7 @@ static __always_inline unsigned long long __native_read_tsc(void)
{
DECLARE_ARGS(val, low, high);
- rdtsc_barrier();
asm volatile("rdtsc" : EAX_EDX_RET(val, low, high));
- rdtsc_barrier();
return EAX_EDX_VAL(val, low, high);
}
diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h
index 38ae163cc91b..9cd83a8e40d5 100644
--- a/arch/x86/include/asm/tsc.h
+++ b/arch/x86/include/asm/tsc.h
@@ -34,6 +34,8 @@ static inline cycles_t get_cycles(void)
static __always_inline cycles_t vget_cycles(void)
{
+ cycles_t cycles;
+
/*
* We only do VDSOs on TSC capable CPUs, so this shouldnt
* access boot_cpu_data (which is not VDSO-safe):
@@ -42,7 +44,11 @@ static __always_inline cycles_t vget_cycles(void)
if (!cpu_has_tsc)
return 0;
#endif
- return (cycles_t)__native_read_tsc();
+ rdtsc_barrier();
+ cycles = (cycles_t)__native_read_tsc();
+ rdtsc_barrier();
+
+ return cycles;
}
extern void tsc_init(void);
commit a6b0786f7f83bcc4d414a2977aaebe2941ebe1de
Merge: 3e03fb7f1da2 6a60dd121c5b 072ba49838b4
Author: Ingo Molnar <mingo@elte.hu>
Date: Sat Nov 8 09:34:35 2008 +0100
Merge branches 'tracing/ftrace', 'tracing/fastboot', 'tracing/nmisafe' and 'tracing/urgent' into tracing/core
diff --cc include/linux/ftrace.h
index 7a75fc6d41f4,1b340e3fa249,703eb53cfa2b..1f5608c11023
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@@@ -214,11 -182,8 -181,6 +212,11 @@@@ static inline void __ftrace_enabled_res
#endif
#ifdef CONFIG_TRACING
+extern int ftrace_dump_on_oops;
+
++extern void tracing_start(void);
++extern void tracing_stop(void);
++
extern void
ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
diff --cc kernel/trace/ring_buffer.c
index a2dea5008826,cedf4e268285,3f3380638646..6781e9aab2c0
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@@@ -1526,11 -1532,10 -1547,23 +1541,24 @@@@ rb_get_reader_page(struct ring_buffer_p
{
struct buffer_page *reader = NULL;
unsigned long flags;
++ int nr_loops = 0;
-- spin_lock_irqsave(&cpu_buffer->lock, flags);
++ local_irq_save(flags);
++ __raw_spin_lock(&cpu_buffer->lock);
again:
++ /*
++ * This should normally only loop twice. But because the
++ * start of the reader inserts an empty page, it causes
++ * a case where we will loop three times. There should be no
++ * reason to loop four times (that I know of).
++ */
++ if (unlikely(++nr_loops > 3)) {
++ RB_WARN_ON(cpu_buffer, 1);
++ reader = NULL;
++ goto out;
++ }
++
reader = cpu_buffer->reader_page;
/* If there's more to read, return this page */
diff --cc kernel/trace/trace.c
index ff1e9ed9b587,e4c40c868d67,974973e39e87..d55ccfc8d674
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@@@ -71,36 -62,38 -62,7 +71,36 @@@@ static cpumask_t __read_mostly tracing
#define for_each_tracing_cpu(cpu) \
for_each_cpu_mask(cpu, tracing_buffer_mask)
--static int tracing_disabled = 1;
-
+/*
+ * ftrace_dump_on_oops - variable to dump ftrace buffer on oops
+ *
+ * If there is an oops (or kernel panic) and the ftrace_dump_on_oops
+ * is set, then ftrace_dump is called. This will output the contents
+ * of the ftrace buffers to the console. This is very useful for
+ * capturing traces that lead to crashes and outputing it to a
+ * serial console.
+ *
+ * It is default off, but you can enable it with either specifying
+ * "ftrace_dump_on_oops" in the kernel command line, or setting
+ * /proc/sys/kernel/ftrace_dump_on_oops to true.
+ */
+int ftrace_dump_on_oops;
+
+static int tracing_set_tracer(char *buf);
+
+static int __init set_ftrace(char *str)
+{
+ tracing_set_tracer(str);
+ return 1;
+}
+__setup("ftrace", set_ftrace);
+
+static int __init set_ftrace_dump_on_oops(char *str)
+{
+ ftrace_dump_on_oops = 1;
+ return 1;
+}
+__setup("ftrace_dump_on_oops", set_ftrace_dump_on_oops);
long
ns2usecs(cycle_t nsec)
commit 01aab518b084a547940ed6ff334e9a7721c7dc71
Merge: fed4d59b6ec5 7c64ade53a6f
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Nov 7 19:22:10 2008 +0100
Merge branch 'oprofile-for-tip' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile into x86/urgent
commit 52c642f33b14bfa1b00ef2b68296effb34a573f3
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Nov 7 16:09:23 2008 +0100
sched: fine-tune SD_SIBLING_INIT
fine-tune the HT sched-domains parameters as well.
On a HT capable box, this increases lat_ctx performance from 23.87
usecs to 1.49 usecs:
# before
$ ./lat_ctx -s 0 2
"size=0k ovr=1.89
2 23.87
# after
$ ./lat_ctx -s 0 2
"size=0k ovr=1.84
2 1.49
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/include/linux/topology.h b/include/linux/topology.h
index a8d840595b7e..117f1b7405cf 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -99,7 +99,7 @@ void arch_update_cpu_topology(void);
| SD_BALANCE_FORK \
| SD_BALANCE_EXEC \
| SD_WAKE_AFFINE \
- | SD_WAKE_IDLE \
+ | SD_WAKE_BALANCE \
| SD_SHARE_CPUPOWER, \
.last_balance = jiffies, \
.balance_interval = 1, \
commit 258594a138f4ca9adf214f5272592d7f21def610
Merge: a87d091434ed ca3273f96466
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Nov 7 10:29:58 2008 +0100
Merge branch 'sched/urgent' into sched/core
commit 31f297143b9905647fa5ef12086626a6f172a4ea
Merge: d6f0f39b7d05 80be308dfa37
Author: Ingo Molnar <mingo@elte.hu>
Date: Thu Nov 6 15:23:35 2008 +0100
Merge branch 'iommu-fixes-2.6.28' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu into x86/urgent