Patches contributed by Eötvös Lorand University
commit 75329f1f0c0e2e2ad611734a2ef08309391a4d9f
Merge: b6b301aa9fba 3c92ec8ae91e
Author: Ingo Molnar <mingo@elte.hu>
Date: Mon Dec 29 13:09:40 2008 +0100
Merge branch 'linus' into x86/cleanups
commit f7d48cbde5c0710008caeaf7dbf14f4a9b064940
Author: Ingo Molnar <mingo@elte.hu>
Date: Mon Dec 29 13:02:17 2008 +0100
tracing/ftrace: make trace_find_cmdline() generally available
Impact: build fix
On !CONFIG_CONTEXT_SWITCH_TRACER trace_find_cmdline() is not defined:
kernel/trace/trace_output.c: In function 'trace_ctxwake_print':
kernel/trace/trace_output.c:499: error: implicit declaration of function 'trace_find_cmdline'
kernel/trace/trace_output.c:499: warning: assignment makes pointer from integer without a cast
Move it to the generic section in trace.h.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 05fa804d1c16..a8b624ccd4d6 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -469,10 +469,10 @@ struct tracer_switch_ops {
void *private;
struct tracer_switch_ops *next;
};
-
-char *trace_find_cmdline(int pid);
#endif /* CONFIG_CONTEXT_SWITCH_TRACER */
+extern char *trace_find_cmdline(int pid);
+
#ifdef CONFIG_DYNAMIC_FTRACE
extern unsigned long ftrace_update_tot_cnt;
#define DYN_FTRACE_TEST_NAME trace_selftest_dynamic_test_func
commit 0f01f07fad4ee11d98fe6faa442afbeb0328a378
Merge: 3871f2ffe53d 412d0bb553c0 3c92ec8ae91e
Author: Ingo Molnar <mingo@elte.hu>
Date: Mon Dec 29 11:25:11 2008 +0100
Merge branches 'tracing/docs', 'tracing/function-graph-tracer' and 'linus' into tracing/core
commit 0ce74d9296c971b2355c26984ad0bc538e34dd6c
Merge: 1cc4fff0b360 3c92ec8ae91e
Author: Ingo Molnar <mingo@elte.hu>
Date: Mon Dec 29 09:42:58 2008 +0100
Merge branch 'linus' into timers/hrtimers
Conflicts:
sound/drivers/pcsp/pcsp.c
Semantic conflict:
sound/core/hrtimer.c
diff --cc sound/core/hrtimer.c
index 000000000000,c1d285921f80..34c7d48f5061
mode 000000,100644..100644
--- a/sound/core/hrtimer.c
+++ b/sound/core/hrtimer.c
@@@ -1,0 -1,155 +1,154 @@@
+ /*
+ * ALSA timer back-end using hrtimer
+ * Copyright (C) 2008 Takashi Iwai
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+ #include <linux/init.h>
+ #include <linux/module.h>
+ #include <linux/moduleparam.h>
+ #include <linux/hrtimer.h>
+ #include <sound/core.h>
+ #include <sound/timer.h>
+
+ MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
+ MODULE_DESCRIPTION("ALSA hrtimer backend");
+ MODULE_LICENSE("GPL");
+
+ MODULE_ALIAS("snd-timer-" __stringify(SNDRV_TIMER_GLOBAL_HRTIMER));
+
+ #define NANO_SEC 1000000000UL /* 10^9 in sec */
+ static unsigned int resolution;
+
+ struct snd_hrtimer {
+ struct snd_timer *timer;
+ struct hrtimer hrt;
+ };
+
+ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
+ {
+ struct snd_hrtimer *stime = container_of(hrt, struct snd_hrtimer, hrt);
+ struct snd_timer *t = stime->timer;
+ hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution));
+ snd_timer_interrupt(stime->timer, t->sticks);
+ return HRTIMER_RESTART;
+ }
+
+ static int snd_hrtimer_open(struct snd_timer *t)
+ {
+ struct snd_hrtimer *stime;
+
+ stime = kmalloc(sizeof(*stime), GFP_KERNEL);
+ if (!stime)
+ return -ENOMEM;
+ hrtimer_init(&stime->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+ stime->timer = t;
- stime->hrt.cb_mode = HRTIMER_CB_IRQSAFE_UNLOCKED;
+ stime->hrt.function = snd_hrtimer_callback;
+ t->private_data = stime;
+ return 0;
+ }
+
+ static int snd_hrtimer_close(struct snd_timer *t)
+ {
+ struct snd_hrtimer *stime = t->private_data;
+
+ if (stime) {
+ hrtimer_cancel(&stime->hrt);
+ kfree(stime);
+ t->private_data = NULL;
+ }
+ return 0;
+ }
+
+ static int snd_hrtimer_start(struct snd_timer *t)
+ {
+ struct snd_hrtimer *stime = t->private_data;
+
+ hrtimer_start(&stime->hrt, ns_to_ktime(t->sticks * resolution),
+ HRTIMER_MODE_REL);
+ return 0;
+ }
+
+ static int snd_hrtimer_stop(struct snd_timer *t)
+ {
+ struct snd_hrtimer *stime = t->private_data;
+
+ hrtimer_cancel(&stime->hrt);
+ return 0;
+ }
+
+ static struct snd_timer_hardware hrtimer_hw = {
+ .flags = SNDRV_TIMER_HW_AUTO,
+ .open = snd_hrtimer_open,
+ .close = snd_hrtimer_close,
+ .start = snd_hrtimer_start,
+ .stop = snd_hrtimer_stop,
+ };
+
+ /*
+ * entry functions
+ */
+
+ static struct snd_timer *mytimer;
+
+ static int __init snd_hrtimer_init(void)
+ {
+ struct snd_timer *timer;
+ struct timespec tp;
+ int err;
+
+ hrtimer_get_res(CLOCK_MONOTONIC, &tp);
+ if (tp.tv_sec > 0 || !tp.tv_nsec) {
+ snd_printk(KERN_ERR
+ "snd-hrtimer: Invalid resolution %u.%09u",
+ (unsigned)tp.tv_sec, (unsigned)tp.tv_nsec);
+ return -EINVAL;
+ }
+ resolution = tp.tv_nsec;
+
+ /* Create a new timer and set up the fields */
+ err = snd_timer_global_new("hrtimer", SNDRV_TIMER_GLOBAL_HRTIMER,
+ &timer);
+ if (err < 0)
+ return err;
+
+ timer->module = THIS_MODULE;
+ strcpy(timer->name, "HR timer");
+ timer->hw = hrtimer_hw;
+ timer->hw.resolution = resolution;
+ timer->hw.ticks = NANO_SEC / resolution;
+
+ err = snd_timer_global_register(timer);
+ if (err < 0) {
+ snd_timer_global_free(timer);
+ return err;
+ }
+ mytimer = timer; /* remember this */
+
+ return 0;
+ }
+
+ static void __exit snd_hrtimer_exit(void)
+ {
+ if (mytimer) {
+ snd_timer_global_free(mytimer);
+ mytimer = NULL;
+ }
+ }
+
+ module_init(snd_hrtimer_init);
+ module_exit(snd_hrtimer_exit);
commit e1df957670aef74ffd9a4ad93e6d2c90bf6b4845
Merge: 2b583d8bc8d7 3c92ec8ae91e
Author: Ingo Molnar <mingo@elte.hu>
Date: Mon Dec 29 09:45:15 2008 +0100
Merge branch 'linus' into perfcounters/core
Conflicts:
fs/exec.c
include/linux/init_task.h
Simple context conflicts.
diff --cc arch/x86/kernel/apic.c
index 4f859acb1563,b5229affb953..6c83ac10e6d3
--- a/arch/x86/kernel/apic.c
+++ b/arch/x86/kernel/apic.c
@@@ -30,8 -30,8 +30,9 @@@
#include <linux/module.h>
#include <linux/dmi.h>
#include <linux/dmar.h>
+ #include <linux/ftrace.h>
+#include <asm/perf_counter.h>
#include <asm/atomic.h>
#include <asm/smp.h>
#include <asm/mtrr.h>
diff --cc arch/x86/kernel/cpu/Makefile
index 89e53361fe24,82db7f45e2de..c3813306e0b4
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@@ -1,9 -1,15 +1,15 @@@
#
-# Makefile for x86-compatible CPU details and quirks
+# Makefile for x86-compatible CPU details, features and quirks
#
+ # Don't trace early stages of a secondary CPU boot
+ ifdef CONFIG_FUNCTION_TRACER
+ CFLAGS_REMOVE_common.o = -pg
+ endif
+
obj-y := intel_cacheinfo.o addon_cpuid_features.o
obj-y += proc.o capflags.o powerflags.o common.o
+ obj-y += vmware.o hypervisor.o
obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o
obj-$(CONFIG_X86_64) += bugs_64.o
diff --cc fs/exec.c
index d5165d899a49,1f59ea079cbb..911dd0fd7e09
--- a/fs/exec.c
+++ b/fs/exec.c
@@@ -1018,13 -1017,8 +1018,15 @@@ int flush_old_exec(struct linux_binprm
set_dumpable(current->mm, suid_dumpable);
}
+ current->personality &= ~bprm->per_clear;
+
+ /*
+ * Flush performance counters when crossing a
+ * security domain:
+ */
+ if (!get_dumpable(current->mm))
+ perf_counter_exit_task(current);
+
/* An exec changes our domain. We are no longer part of the thread
group */
diff --cc include/linux/init_task.h
index 467cff545c30,959f5522d10a..d0e6cf3b201c
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@@ -113,16 -112,8 +112,18 @@@ extern struct group_info init_groups
# define CAP_INIT_BSET CAP_INIT_EFF_SET
#endif
+ extern struct cred init_cred;
+
+#ifdef CONFIG_PERF_COUNTERS
+# define INIT_PERF_COUNTERS(tsk) \
+ .perf_counter_ctx.counter_list = \
+ LIST_HEAD_INIT(tsk.perf_counter_ctx.counter_list), \
+ .perf_counter_ctx.lock = \
+ __SPIN_LOCK_UNLOCKED(tsk.perf_counter_ctx.lock),
+#else
+# define INIT_PERF_COUNTERS(tsk)
+#endif
+
/*
* INIT_TASK is used to set up the first task table, touch at
* your own risk!. Base=0, limit=0x1fffff (=2MB)
diff --cc kernel/Makefile
index 1f184a1dc406,027edda63511..4476da868f86
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@@ -89,9 -88,8 +88,9 @@@ obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT
obj-$(CONFIG_FUNCTION_TRACER) += trace/
obj-$(CONFIG_TRACING) += trace/
obj-$(CONFIG_SMP) += sched_cpupri.o
+obj-$(CONFIG_PERF_COUNTERS) += perf_counter.o
- ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y)
+ ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y)
# According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is
# needed for x86 only. Why this used to be enabled for all architectures is beyond
# me. I suspect most platforms don't need this, but until we know that for sure
commit b2e2fe99628c4f944c3075258e536197b5a4f3f8
Author: Ingo Molnar <mingo@elte.hu>
Date: Mon Dec 29 00:16:45 2008 +0100
sparseirq: work around __weak alias bug
Impact: fix boot crash if the kernel is built with certain GCC versions
GCC has a bug with __weak alias functions: if the functions are in
the same compilation unit as their call site, GCC can decide to
inline them - and thus rob the linker of the opportunity to override
the weak alias with the real thing.
This can lead to the boot crash reported by Kamalesh Babulal:
ACPI: Core revision 20080926
Setting APIC routing to flat
BUG: unable to handle kernel NULL pointer dereference at
0000000000000000
IP: [<ffffffff8021f9a8>] add_pin_to_irq_cpu+0x14/0x74
PGD 0
Oops: 0000 [#1] SMP
[...]
So move the arch_init_chip_data() function from handle.c to manage.c.
Reported-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 157c04c3b158..c20db0be9173 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -86,11 +86,6 @@ void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr)
desc->kstat_irqs = (unsigned int *)ptr;
}
-int __weak arch_init_chip_data(struct irq_desc *desc, int cpu)
-{
- return 0;
-}
-
static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu)
{
memcpy(desc, &irq_desc_init, sizeof(struct irq_desc));
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 46953a06f4a8..c2741b02ad38 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -261,6 +261,15 @@ void enable_irq(unsigned int irq)
}
EXPORT_SYMBOL(enable_irq);
+/*
+ * [ Not in kernel/irq/handle.c, so that GCC does not
+ * inline the __weak alias: ]
+ */
+int __weak arch_init_chip_data(struct irq_desc *desc, int cpu)
+{
+ return 0;
+}
+
static int set_irq_wake_real(unsigned int irq, unsigned int on)
{
struct irq_desc *desc = irq_to_desc(irq);
commit 34bf5d0ff54d03f0a8ed690d47efb806ee2fffcb
Merge: bd8b96dfc216 79a66b96c339
Author: Ingo Molnar <mingo@elte.hu>
Date: Sat Dec 27 11:30:05 2008 +0100
Merge branch 'x86/core' into x86/cleanups
commit 793f7b12a0c95e7bfec1badf9628043fb78fd440
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Dec 26 19:02:20 2008 +0100
sparseirq: fix desc->lock init
Impact: cleanup
init_one_irq_desc() does not initialize the desc->lock properly -
you cannot init a lock by memcpying some other lock on it.
This happens to work right now (because irq_desc_init is never in use),
but it's a dangerous construct nevertheless, so fix it.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 06b05a4d3007..893da67b7781 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -93,6 +93,8 @@ void __attribute__((weak)) arch_init_chip_data(struct irq_desc *desc, int cpu)
static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu)
{
memcpy(desc, &irq_desc_init, sizeof(struct irq_desc));
+
+ spin_lock_init(&desc->lock);
desc->irq = irq;
#ifdef CONFIG_SMP
desc->cpu = cpu;
diff --git a/kernel/irq/numa_migrate.c b/kernel/irq/numa_migrate.c
index a565ce3a4fb5..ecf765c6a77a 100644
--- a/kernel/irq/numa_migrate.c
+++ b/kernel/irq/numa_migrate.c
@@ -42,6 +42,7 @@ static void init_copy_one_irq_desc(int irq, struct irq_desc *old_desc,
struct irq_desc *desc, int cpu)
{
memcpy(desc, old_desc, sizeof(struct irq_desc));
+ spin_lock_init(&desc->lock);
desc->cpu = cpu;
lockdep_set_class(&desc->lock, &irq_desc_lock_class);
init_copy_kstat_irqs(old_desc, desc, cpu, nr_cpu_ids);
commit 8b07cd44511f3aa78dd912cca6493275a6787dc5
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Dec 26 19:10:04 2008 +0100
sparseirq: do not printk when migrating IRQ descriptors
Impact: reduce printk noise
There were a couple of leftover KERN_DEBUG debugging printks, remove
them. Also clarify an error message.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/kernel/irq/numa_migrate.c b/kernel/irq/numa_migrate.c
index 089c3746358a..a565ce3a4fb5 100644
--- a/kernel/irq/numa_migrate.c
+++ b/kernel/irq/numa_migrate.c
@@ -74,10 +74,8 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc,
node = cpu_to_node(cpu);
desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node);
- printk(KERN_DEBUG " move irq_desc for %d to cpu %d node %d\n",
- irq, cpu, node);
if (!desc) {
- printk(KERN_ERR "can not get new irq_desc for moving\n");
+ printk(KERN_ERR "irq %d: can not get new irq_desc for migration.\n", irq);
/* still use old one */
desc = old_desc;
goto out_unlock;
@@ -106,8 +104,6 @@ struct irq_desc *move_irq_desc(struct irq_desc *desc, int cpu)
return desc;
old_cpu = desc->cpu;
- printk(KERN_DEBUG
- "try to move irq_desc from cpu %d to %d\n", old_cpu, cpu);
if (old_cpu != cpu) {
node = cpu_to_node(cpu);
old_node = cpu_to_node(old_cpu);
commit bd8b96dfc216eebc72950a6c40da8d3eca8667df
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Dec 26 09:20:22 2008 +0100
x86: clean up comment style in arch/x86/kernel/traps.c
Impact: cleanup
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index f5a640ba04bc..dbfb80289928 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -292,8 +292,10 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
tsk->thread.error_code = error_code;
tsk->thread.trap_no = 8;
- /* This is always a kernel trap and never fixable (and thus must
- never return). */
+ /*
+ * This is always a kernel trap and never fixable (and thus must
+ * never return).
+ */
for (;;)
die(str, regs, error_code);
}
@@ -524,9 +526,11 @@ dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code)
}
#ifdef CONFIG_X86_64
-/* Help handler running on IST stack to switch back to user stack
- for scheduling or signal handling. The actual stack switch is done in
- entry.S */
+/*
+ * Help handler running on IST stack to switch back to user stack
+ * for scheduling or signal handling. The actual stack switch is done in
+ * entry.S
+ */
asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
{
struct pt_regs *regs = eregs;
@@ -536,8 +540,10 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
/* Exception from user space */
else if (user_mode(eregs))
regs = task_pt_regs(current);
- /* Exception from kernel and interrupts are enabled. Move to
- kernel process stack. */
+ /*
+ * Exception from kernel and interrupts are enabled. Move to
+ * kernel process stack.
+ */
else if (eregs->flags & X86_EFLAGS_IF)
regs = (struct pt_regs *)(eregs->sp -= sizeof(struct pt_regs));
if (eregs != regs)
@@ -707,8 +713,10 @@ void math_error(void __user *ip)
} else if (err & 0x020) { /* Precision */
info.si_code = FPE_FLTRES;
} else {
- /* If we're using IRQ 13, or supposedly even some trap 16
- implementations, it's possible we get a spurious trap... */
+ /*
+ * If we're using IRQ 13, or supposedly even some trap 16
+ * implementations, it's possible we get a spurious trap...
+ */
return; /* Spurious trap, no error */
}
force_sig_info(SIGFPE, &info, task);