From: Ingo Molnar Date: Mon, 6 Apr 2009 07:02:57 +0000 (+0200) Subject: Merge branch 'linus' into perfcounters/core-v2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f541ae326fa120fa5c57433e4d9a133df212ce41;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git Merge branch 'linus' into perfcounters/core-v2 Merge reason: we have gathered quite a few conflicts, need to merge upstream Conflicts: arch/powerpc/kernel/Makefile arch/x86/ia32/ia32entry.S arch/x86/include/asm/hardirq.h arch/x86/include/asm/unistd_32.h arch/x86/include/asm/unistd_64.h arch/x86/kernel/cpu/common.c arch/x86/kernel/irq.c arch/x86/kernel/syscall_table_32.S arch/x86/mm/iomap_32.c include/linux/sched.h kernel/Makefile Signed-off-by: Ingo Molnar --- f541ae326fa120fa5c57433e4d9a133df212ce41 diff --cc arch/powerpc/include/asm/hw_irq.h index e10f151c3db6,b7e034b0a6dd..b43076ff92c9 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h @@@ -129,38 -129,7 +129,38 @@@ static inline int irqs_disabled_flags(u * interrupt-retrigger: should we handle this via lost interrupts and IPIs * or should we not care like we do now ? --BenH. */ - struct hw_interrupt_type; + struct irq_chip; +#ifdef CONFIG_PERF_COUNTERS +static inline unsigned long get_perf_counter_pending(void) +{ + unsigned long x; + + asm volatile("lbz %0,%1(13)" + : "=r" (x) + : "i" (offsetof(struct paca_struct, perf_counter_pending))); + return x; +} + +static inline void set_perf_counter_pending(int x) +{ + asm volatile("stb %0,%1(13)" : : + "r" (x), + "i" (offsetof(struct paca_struct, perf_counter_pending))); +} + +extern void perf_counter_do_pending(void); + +#else + +static inline unsigned long get_perf_counter_pending(void) +{ + return 0; +} + +static inline void set_perf_counter_pending(int x) {} +static inline void perf_counter_do_pending(void) {} +#endif /* CONFIG_PERF_COUNTERS */ + #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_HW_IRQ_H */ diff --cc arch/powerpc/kernel/Makefile index 8e5e2c74971e,71901fbda4a5..9ba1bb731fcc --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@@ -94,8 -93,7 +93,9 @@@ obj-$(CONFIG_AUDIT) += audit. obj64-$(CONFIG_AUDIT) += compat_audit.o obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o + obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o +obj-$(CONFIG_PERF_COUNTERS) += perf_counter.o power4-pmu.o ppc970-pmu.o \ + power5-pmu.o power5+-pmu.o power6-pmu.o obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o diff --cc arch/x86/ia32/ia32entry.S index e4baa06bbceb,a505202086e8..19c61ef6ab57 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S @@@ -825,8 -825,9 +825,10 @@@ ia32_sys_call_table .quad compat_sys_signalfd4 .quad sys_eventfd2 .quad sys_epoll_create1 - .quad sys_dup3 /* 330 */ + .quad sys_dup3 /* 330 */ .quad sys_pipe2 .quad sys_inotify_init1 + .quad compat_sys_preadv + .quad compat_sys_pwritev + .quad sys_perf_counter_open ia32_syscall_end: diff --cc arch/x86/include/asm/hardirq.h index 46ebed797e4f,039db6aa8e02..25454427ceea --- a/arch/x86/include/asm/hardirq.h +++ b/arch/x86/include/asm/hardirq.h @@@ -12,7 -12,7 +12,8 @@@ typedef struct unsigned int apic_timer_irqs; /* arch dependent */ unsigned int irq_spurious_count; #endif + unsigned int generic_irqs; /* arch dependent */ + unsigned int apic_perf_irqs; #ifdef CONFIG_SMP unsigned int irq_resched_count; unsigned int irq_call_count; diff --cc arch/x86/include/asm/hw_irq.h index f39881b6b68b,b762ea49bd70..ae80f64973e0 --- a/arch/x86/include/asm/hw_irq.h +++ b/arch/x86/include/asm/hw_irq.h @@@ -27,9 -27,8 +27,10 @@@ /* Interrupt handlers registered during init_IRQ */ extern void apic_timer_interrupt(void); + extern void generic_interrupt(void); extern void error_interrupt(void); +extern void perf_counter_interrupt(void); + extern void spurious_interrupt(void); extern void thermal_interrupt(void); extern void reschedule_interrupt(void); diff --cc arch/x86/include/asm/unistd_32.h index 7e47658b0a6f,6e72d74cf8dc..0b4d8c2b157d --- a/arch/x86/include/asm/unistd_32.h +++ b/arch/x86/include/asm/unistd_32.h @@@ -338,7 -338,8 +338,9 @@@ #define __NR_dup3 330 #define __NR_pipe2 331 #define __NR_inotify_init1 332 + #define __NR_preadv 333 + #define __NR_pwritev 334 +#define __NR_perf_counter_open 333 #ifdef __KERNEL__ diff --cc arch/x86/include/asm/unistd_64.h index 53025feaf88d,f81829462325..d9aad876ad76 --- a/arch/x86/include/asm/unistd_64.h +++ b/arch/x86/include/asm/unistd_64.h @@@ -653,8 -653,11 +653,12 @@@ __SYSCALL(__NR_dup3, sys_dup3 __SYSCALL(__NR_pipe2, sys_pipe2) #define __NR_inotify_init1 294 __SYSCALL(__NR_inotify_init1, sys_inotify_init1) + #define __NR_preadv 295 + __SYSCALL(__NR_preadv, sys_preadv) + #define __NR_pwritev 296 + __SYSCALL(__NR_pwritev, sys_pwritev) - +#define __NR_perf_counter_open 295 +__SYSCALL(__NR_perf_counter_open, sys_perf_counter_open) #ifndef __NO_STUBS #define __ARCH_WANT_OLD_READDIR diff --cc arch/x86/kernel/cpu/common.c index b66af09a6c7d,c4f667896c28..a86769efe0df --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@@ -1,30 -1,39 +1,40 @@@ - #include - #include - #include - #include #include + #include #include + #include #include - #include - #include + #include + #include #include + #include + #include + #include #include - #include - #include - #include - #include - #include + #include + + #include ++#include #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include #include + #include + #include + #include #include - #include + #include #include - #include - #include #include - #include - #include - #include #ifdef CONFIG_X86_LOCAL_APIC #include diff --cc arch/x86/kernel/irq.c index 7c95c8918a8f,3aaf7b9e3a8b..9c2754302ecc --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c @@@ -55,13 -58,20 +58,24 @@@ static int show_other_interrupts(struc for_each_online_cpu(j) seq_printf(p, "%10u ", irq_stats(j)->apic_timer_irqs); seq_printf(p, " Local timer interrupts\n"); + + seq_printf(p, "%*s: ", prec, "SPU"); + for_each_online_cpu(j) + seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count); + seq_printf(p, " Spurious interrupts\n"); + seq_printf(p, "CNT: "); + for_each_online_cpu(j) + seq_printf(p, "%10u ", irq_stats(j)->apic_perf_irqs); + seq_printf(p, " Performance counter interrupts\n"); #endif + if (generic_interrupt_extension) { + seq_printf(p, "PLT: "); + for_each_online_cpu(j) + seq_printf(p, "%10u ", irq_stats(j)->generic_irqs); + seq_printf(p, " Platform interrupts\n"); + } #ifdef CONFIG_SMP - seq_printf(p, "RES: "); + seq_printf(p, "%*s: ", prec, "RES"); for_each_online_cpu(j) seq_printf(p, "%10u ", irq_stats(j)->irq_resched_count); seq_printf(p, " Rescheduling interrupts\n"); @@@ -166,8 -165,10 +169,11 @@@ u64 arch_irq_stat_cpu(unsigned int cpu #ifdef CONFIG_X86_LOCAL_APIC sum += irq_stats(cpu)->apic_timer_irqs; + sum += irq_stats(cpu)->irq_spurious_count; + sum += irq_stats(cpu)->apic_perf_irqs; #endif + if (generic_interrupt_extension) + sum += irq_stats(cpu)->generic_irqs; #ifdef CONFIG_SMP sum += irq_stats(cpu)->irq_resched_count; sum += irq_stats(cpu)->irq_call_count; diff --cc arch/x86/kernel/syscall_table_32.S index b7607c4f2042,ff5c8736b491..c3ebbb901379 --- a/arch/x86/kernel/syscall_table_32.S +++ b/arch/x86/kernel/syscall_table_32.S @@@ -332,4 -332,5 +332,6 @@@ ENTRY(sys_call_table .long sys_dup3 /* 330 */ .long sys_pipe2 .long sys_inotify_init1 + .long sys_perf_counter_open + .long sys_preadv + .long sys_pwritev diff --cc include/linux/sched.h index 3aee42384f0e,b94f3541f67b..75b2fc5306d8 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@@ -68,10 -68,9 +68,10 @@@ struct sched_param #include #include #include - #include + #include #include #include +#include #include #include #include @@@ -137,9 -137,9 +138,11 @@@ extern unsigned long nr_running(void) extern unsigned long nr_uninterruptible(void); extern unsigned long nr_active(void); extern unsigned long nr_iowait(void); +extern u64 cpu_nr_switches(int cpu); +extern u64 cpu_nr_migrations(int cpu); + extern unsigned long get_parent_ip(unsigned long addr); + struct seq_file; struct cfs_rq; struct task_group; @@@ -1055,8 -1048,10 +1051,11 @@@ struct sched_entity u64 last_wakeup; u64 avg_overlap; + u64 nr_migrations; + + u64 start_runtime; + u64 avg_wakeup; - u64 nr_migrations; + #ifdef CONFIG_SCHEDSTATS u64 wait_start; u64 wait_max; diff --cc kernel/Makefile index 9ef39e5b0211,bab1dffe37e9..63c697529ca1 --- a/kernel/Makefile +++ b/kernel/Makefile @@@ -93,7 -93,7 +93,8 @@@ obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT obj-$(CONFIG_FUNCTION_TRACER) += trace/ obj-$(CONFIG_TRACING) += trace/ obj-$(CONFIG_SMP) += sched_cpupri.o + obj-$(CONFIG_SLOW_WORK) += slow-work.o +obj-$(CONFIG_PERF_COUNTERS) += perf_counter.o ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y) # According to Alan Modra , the -fno-omit-frame-pointer is diff --cc kernel/sched.c index 78f4424b7c43,bec249885e17..39e708602169 --- a/kernel/sched.c +++ b/kernel/sched.c @@@ -2429,9 -2460,10 +2505,11 @@@ static void __sched_fork(struct task_st p->se.exec_start = 0; p->se.sum_exec_runtime = 0; p->se.prev_sum_exec_runtime = 0; + p->se.nr_migrations = 0; p->se.last_wakeup = 0; p->se.avg_overlap = 0; + p->se.start_runtime = 0; + p->se.avg_wakeup = sysctl_sched_wakeup_granularity; #ifdef CONFIG_SCHEDSTATS p->se.wait_start = 0; @@@ -2650,10 -2690,9 +2736,10 @@@ static void finish_task_switch(struct r */ prev_state = prev->state; finish_arch_switch(prev); + perf_counter_task_sched_in(current, cpu_of(rq)); finish_lock_switch(rq, prev); #ifdef CONFIG_SMP - if (current->sched_class->post_schedule) + if (post_schedule) current->sched_class->post_schedule(rq); #endif