Merge commit 'perf/core' into perf/hw-breakpoint
authorFrederic Weisbecker <fweisbec@gmail.com>
Sat, 17 Oct 2009 23:09:09 +0000 (01:09 +0200)
committerFrederic Weisbecker <fweisbec@gmail.com>
Sat, 17 Oct 2009 23:12:33 +0000 (01:12 +0200)
Conflicts:
kernel/Makefile
kernel/trace/Makefile
kernel/trace/trace.h
samples/Makefile

Merge reason: We need to be uptodate with the perf events development
branch because we plan to rewrite the breakpoints API on top of
perf events.

18 files changed:
1  2 
arch/Kconfig
arch/x86/Kconfig
arch/x86/include/asm/processor.h
arch/x86/kernel/Makefile
arch/x86/kernel/process.c
arch/x86/kernel/ptrace.c
arch/x86/kernel/signal.c
arch/x86/kernel/smpboot.c
arch/x86/kernel/traps.c
arch/x86/kvm/x86.c
arch/x86/power/cpu.c
kernel/Makefile
kernel/trace/Kconfig
kernel/trace/Makefile
kernel/trace/trace.h
kernel/trace/trace_entries.h
samples/Kconfig
samples/Makefile

diff --cc arch/Kconfig
Simple merge
Simple merge
index 1153037ae9ffe9c3b3e1b792f69bbc9cb6ef1368,c3429e8b2424841af488615785a9d2d098580eb0..61aafb71c7efec5f4dd498e199a31412fc610145
@@@ -27,9 -27,9 +27,10 @@@ struct mm_struct
  #include <linux/cpumask.h>
  #include <linux/cache.h>
  #include <linux/threads.h>
+ #include <linux/math64.h>
  #include <linux/init.h>
  
 +#define HBP_NUM 4
  /*
   * Default implementation of macro that returns current
   * instruction pointer ("program counter").
Simple merge
Simple merge
Simple merge
Simple merge
index ec7b64c2df82042d944043b0284761a0e8875b8b,565ebc65920e3e685161758acb03c4f8106c6b40..213a7a3e45629fa61b1f26cc8fd882602945766f
@@@ -324,10 -324,9 +325,10 @@@ notrace static void __cpuinit start_sec
        /* enable local interrupts */
        local_irq_enable();
  
-       setup_secondary_clock();
+       x86_cpuinit.setup_percpu_clockev();
  
        wmb();
 +      load_debug_registers();
        cpu_idle();
  }
  
Simple merge
Simple merge
Simple merge
diff --cc kernel/Makefile
index 69943fdd7a412c61b676bc9b634c174c862bb4ff,b8d4cd8ac0b9d5d93e303833e70ed55d450582ee..17b575ec7d07aa001ff550f584dddb6d8aaf73e9
@@@ -97,8 -94,7 +94,8 @@@ obj-$(CONFIG_X86_DS) += trace
  obj-$(CONFIG_RING_BUFFER) += trace/
  obj-$(CONFIG_SMP) += sched_cpupri.o
  obj-$(CONFIG_SLOW_WORK) += slow-work.o
- obj-$(CONFIG_PERF_COUNTERS) += perf_counter.o
+ obj-$(CONFIG_PERF_EVENTS) += perf_event.o
 +obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
  
  ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y)
  # According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is
Simple merge
index ce3b1cd02732b923c7fb850f66cbb36ed16714fa,26f03ac07c2bc2164ce809cea5a48fce15d09ff1..0f84c52e58fe641db0e5b4afe5beb1eed49368ba
@@@ -54,6 -53,6 +53,7 @@@ obj-$(CONFIG_EVENT_TRACING) += trace_ex
  obj-$(CONFIG_FTRACE_SYSCALLS) += trace_syscalls.o
  obj-$(CONFIG_EVENT_PROFILE) += trace_event_profile.o
  obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
 +obj-$(CONFIG_KSYM_TRACER) += trace_ksym.o
+ obj-$(CONFIG_EVENT_TRACING) += power-traces.o
  
  libftrace-y := ftrace.o
index ea7e0bcbd53993fecfa994286feed405e2c0cbcf,4959ada9e0bbd38e07407637656d15d2afd83b9c..91c3d0e9a5a1c9a2fbdfeb713e62868c228a25d6
@@@ -40,9 -36,7 +40,8 @@@ enum trace_type 
        TRACE_HW_BRANCHES,
        TRACE_KMEM_ALLOC,
        TRACE_KMEM_FREE,
-       TRACE_POWER,
        TRACE_BLK,
 +      TRACE_KSYM,
  
        __TRACE_LAST_TYPE,
  };
@@@ -485,7 -362,8 +368,11 @@@ void tracing_stop_sched_switch_record(v
  void tracing_start_sched_switch_record(void);
  int register_tracer(struct tracer *type);
  void unregister_tracer(struct tracer *type);
+ int is_tracing_stopped(void);
++#define KSYM_SELFTEST_ENTRY "ksym_selftest_dummy"
++extern int process_new_ksym_entry(char *ksymname, int op, unsigned long addr);
 +
  extern unsigned long nsecs_to_usecs(unsigned long nsecs);
  
  #ifdef CONFIG_TRACER_MAX_TRACE
index 0000000000000000000000000000000000000000,ead3d724599d2d701b29014c1eb575529162d4f9..e19747d4f86087a37f6a02da2b2fd2ab18d9921e
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,366 +1,382 @@@
+ /*
+  * This file defines the trace event structures that go into the ring
+  * buffer directly. They are created via macros so that changes for them
+  * appear in the format file. Using macros will automate this process.
+  *
+  * The macro used to create a ftrace data structure is:
+  *
+  * FTRACE_ENTRY( name, struct_name, id, structure, print )
+  *
+  * @name: the name used the event name, as well as the name of
+  *   the directory that holds the format file.
+  *
+  * @struct_name: the name of the structure that is created.
+  *
+  * @id: The event identifier that is used to detect what event
+  *    this is from the ring buffer.
+  *
+  * @structure: the structure layout
+  *
+  *  - __field(        type,   item    )
+  *      This is equivalent to declaring
+  *            type    item;
+  *      in the structure.
+  *  - __array(        type,   item,   size    )
+  *      This is equivalent to declaring
+  *            type    item[size];
+  *      in the structure.
+  *
+  *   * for structures within structures, the format of the internal
+  *    structure is layed out. This allows the internal structure
+  *    to be deciphered for the format file. Although these macros
+  *    may become out of sync with the internal structure, they
+  *    will create a compile error if it happens. Since the
+  *    internel structures are just tracing helpers, this is not
+  *    an issue.
+  *
+  *    When an internal structure is used, it should use:
+  *
+  *    __field_struct( type,   item    )
+  *
+  *    instead of __field. This will prevent it from being shown in
+  *    the output file. The fields in the structure should use.
+  *
+  *    __field_desc(   type,   container,      item            )
+  *    __array_desc(   type,   container,      item,   len     )
+  *
+  *    type, item and len are the same as __field and __array, but
+  *    container is added. This is the name of the item in
+  *    __field_struct that this is describing.
+  *
+  *
+  * @print: the print format shown to users in the format file.
+  */
+ /*
+  * Function trace entry - function address and parent function addres:
+  */
+ FTRACE_ENTRY(function, ftrace_entry,
+       TRACE_FN,
+       F_STRUCT(
+               __field(        unsigned long,  ip              )
+               __field(        unsigned long,  parent_ip       )
+       ),
+       F_printk(" %lx <-- %lx", __entry->ip, __entry->parent_ip)
+ );
+ /* Function call entry */
+ FTRACE_ENTRY(funcgraph_entry, ftrace_graph_ent_entry,
+       TRACE_GRAPH_ENT,
+       F_STRUCT(
+               __field_struct( struct ftrace_graph_ent,        graph_ent       )
+               __field_desc(   unsigned long,  graph_ent,      func            )
+               __field_desc(   int,            graph_ent,      depth           )
+       ),
+       F_printk("--> %lx (%d)", __entry->func, __entry->depth)
+ );
+ /* Function return entry */
+ FTRACE_ENTRY(funcgraph_exit, ftrace_graph_ret_entry,
+       TRACE_GRAPH_RET,
+       F_STRUCT(
+               __field_struct( struct ftrace_graph_ret,        ret     )
+               __field_desc(   unsigned long,  ret,            func    )
+               __field_desc(   unsigned long long, ret,        calltime)
+               __field_desc(   unsigned long long, ret,        rettime )
+               __field_desc(   unsigned long,  ret,            overrun )
+               __field_desc(   int,            ret,            depth   )
+       ),
+       F_printk("<-- %lx (%d) (start: %llx  end: %llx) over: %d",
+                __entry->func, __entry->depth,
+                __entry->calltime, __entry->rettime,
+                __entry->depth)
+ );
+ /*
+  * Context switch trace entry - which task (and prio) we switched from/to:
+  *
+  * This is used for both wakeup and context switches. We only want
+  * to create one structure, but we need two outputs for it.
+  */
+ #define FTRACE_CTX_FIELDS                                     \
+       __field(        unsigned int,   prev_pid        )       \
+       __field(        unsigned char,  prev_prio       )       \
+       __field(        unsigned char,  prev_state      )       \
+       __field(        unsigned int,   next_pid        )       \
+       __field(        unsigned char,  next_prio       )       \
+       __field(        unsigned char,  next_state      )       \
+       __field(        unsigned int,   next_cpu        )
+ FTRACE_ENTRY(context_switch, ctx_switch_entry,
+       TRACE_CTX,
+       F_STRUCT(
+               FTRACE_CTX_FIELDS
+       ),
+       F_printk("%u:%u:%u  ==> %u:%u:%u [%03u]",
+                __entry->prev_pid, __entry->prev_prio, __entry->prev_state,
+                __entry->next_pid, __entry->next_prio, __entry->next_state,
+                __entry->next_cpu
+               )
+ );
+ /*
+  * FTRACE_ENTRY_DUP only creates the format file, it will not
+  *  create another structure.
+  */
+ FTRACE_ENTRY_DUP(wakeup, ctx_switch_entry,
+       TRACE_WAKE,
+       F_STRUCT(
+               FTRACE_CTX_FIELDS
+       ),
+       F_printk("%u:%u:%u  ==+ %u:%u:%u [%03u]",
+                __entry->prev_pid, __entry->prev_prio, __entry->prev_state,
+                __entry->next_pid, __entry->next_prio, __entry->next_state,
+                __entry->next_cpu
+               )
+ );
+ /*
+  * Special (free-form) trace entry:
+  */
+ FTRACE_ENTRY(special, special_entry,
+       TRACE_SPECIAL,
+       F_STRUCT(
+               __field(        unsigned long,  arg1    )
+               __field(        unsigned long,  arg2    )
+               __field(        unsigned long,  arg3    )
+       ),
+       F_printk("(%08lx) (%08lx) (%08lx)",
+                __entry->arg1, __entry->arg2, __entry->arg3)
+ );
+ /*
+  * Stack-trace entry:
+  */
+ #define FTRACE_STACK_ENTRIES  8
+ FTRACE_ENTRY(kernel_stack, stack_entry,
+       TRACE_STACK,
+       F_STRUCT(
+               __array(        unsigned long,  caller, FTRACE_STACK_ENTRIES    )
+       ),
+       F_printk("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
+                "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n",
+                __entry->caller[0], __entry->caller[1], __entry->caller[2],
+                __entry->caller[3], __entry->caller[4], __entry->caller[5],
+                __entry->caller[6], __entry->caller[7])
+ );
+ FTRACE_ENTRY(user_stack, userstack_entry,
+       TRACE_USER_STACK,
+       F_STRUCT(
+               __field(        unsigned int,   tgid    )
+               __array(        unsigned long,  caller, FTRACE_STACK_ENTRIES    )
+       ),
+       F_printk("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
+                "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n",
+                __entry->caller[0], __entry->caller[1], __entry->caller[2],
+                __entry->caller[3], __entry->caller[4], __entry->caller[5],
+                __entry->caller[6], __entry->caller[7])
+ );
+ /*
+  * trace_printk entry:
+  */
+ FTRACE_ENTRY(bprint, bprint_entry,
+       TRACE_BPRINT,
+       F_STRUCT(
+               __field(        unsigned long,  ip      )
+               __field(        const char *,   fmt     )
+               __dynamic_array(        u32,    buf     )
+       ),
+       F_printk("%08lx fmt:%p",
+                __entry->ip, __entry->fmt)
+ );
+ FTRACE_ENTRY(print, print_entry,
+       TRACE_PRINT,
+       F_STRUCT(
+               __field(        unsigned long,  ip      )
+               __dynamic_array(        char,   buf     )
+       ),
+       F_printk("%08lx %s",
+                __entry->ip, __entry->buf)
+ );
+ FTRACE_ENTRY(mmiotrace_rw, trace_mmiotrace_rw,
+       TRACE_MMIO_RW,
+       F_STRUCT(
+               __field_struct( struct mmiotrace_rw,    rw      )
+               __field_desc(   resource_size_t, rw,    phys    )
+               __field_desc(   unsigned long,  rw,     value   )
+               __field_desc(   unsigned long,  rw,     pc      )
+               __field_desc(   int,            rw,     map_id  )
+               __field_desc(   unsigned char,  rw,     opcode  )
+               __field_desc(   unsigned char,  rw,     width   )
+       ),
+       F_printk("%lx %lx %lx %d %x %x",
+                (unsigned long)__entry->phys, __entry->value, __entry->pc,
+                __entry->map_id, __entry->opcode, __entry->width)
+ );
+ FTRACE_ENTRY(mmiotrace_map, trace_mmiotrace_map,
+       TRACE_MMIO_MAP,
+       F_STRUCT(
+               __field_struct( struct mmiotrace_map,   map     )
+               __field_desc(   resource_size_t, map,   phys    )
+               __field_desc(   unsigned long,  map,    virt    )
+               __field_desc(   unsigned long,  map,    len     )
+               __field_desc(   int,            map,    map_id  )
+               __field_desc(   unsigned char,  map,    opcode  )
+       ),
+       F_printk("%lx %lx %lx %d %x",
+                (unsigned long)__entry->phys, __entry->virt, __entry->len,
+                __entry->map_id, __entry->opcode)
+ );
+ FTRACE_ENTRY(boot_call, trace_boot_call,
+       TRACE_BOOT_CALL,
+       F_STRUCT(
+               __field_struct( struct boot_trace_call, boot_call       )
+               __field_desc(   pid_t,  boot_call,      caller          )
+               __array_desc(   char,   boot_call,      func,   KSYM_SYMBOL_LEN)
+       ),
+       F_printk("%d  %s", __entry->caller, __entry->func)
+ );
+ FTRACE_ENTRY(boot_ret, trace_boot_ret,
+       TRACE_BOOT_RET,
+       F_STRUCT(
+               __field_struct( struct boot_trace_ret,  boot_ret        )
+               __array_desc(   char,   boot_ret,       func,   KSYM_SYMBOL_LEN)
+               __field_desc(   int,    boot_ret,       result          )
+               __field_desc(   unsigned long, boot_ret, duration       )
+       ),
+       F_printk("%s %d %lx",
+                __entry->func, __entry->result, __entry->duration)
+ );
+ #define TRACE_FUNC_SIZE 30
+ #define TRACE_FILE_SIZE 20
+ FTRACE_ENTRY(branch, trace_branch,
+       TRACE_BRANCH,
+       F_STRUCT(
+               __field(        unsigned int,   line                            )
+               __array(        char,           func,   TRACE_FUNC_SIZE+1       )
+               __array(        char,           file,   TRACE_FILE_SIZE+1       )
+               __field(        char,           correct                         )
+       ),
+       F_printk("%u:%s:%s (%u)",
+                __entry->line,
+                __entry->func, __entry->file, __entry->correct)
+ );
+ FTRACE_ENTRY(hw_branch, hw_branch_entry,
+       TRACE_HW_BRANCHES,
+       F_STRUCT(
+               __field(        u64,    from    )
+               __field(        u64,    to      )
+       ),
+       F_printk("from: %llx to: %llx", __entry->from, __entry->to)
+ );
+ FTRACE_ENTRY(kmem_alloc, kmemtrace_alloc_entry,
+       TRACE_KMEM_ALLOC,
+       F_STRUCT(
+               __field(        enum kmemtrace_type_id, type_id         )
+               __field(        unsigned long,          call_site       )
+               __field(        const void *,           ptr             )
+               __field(        size_t,                 bytes_req       )
+               __field(        size_t,                 bytes_alloc     )
+               __field(        gfp_t,                  gfp_flags       )
+               __field(        int,                    node            )
+       ),
+       F_printk("type:%u call_site:%lx ptr:%p req:%zi alloc:%zi"
+                " flags:%x node:%d",
+                __entry->type_id, __entry->call_site, __entry->ptr,
+                __entry->bytes_req, __entry->bytes_alloc,
+                __entry->gfp_flags, __entry->node)
+ );
+ FTRACE_ENTRY(kmem_free, kmemtrace_free_entry,
+       TRACE_KMEM_FREE,
+       F_STRUCT(
+               __field(        enum kmemtrace_type_id, type_id         )
+               __field(        unsigned long,          call_site       )
+               __field(        const void *,           ptr             )
+       ),
+       F_printk("type:%u call_site:%lx ptr:%p",
+                __entry->type_id, __entry->call_site, __entry->ptr)
+ );
++
++FTRACE_ENTRY(ksym_trace, ksym_trace_entry,
++
++      TRACE_KSYM,
++
++      F_STRUCT(
++              __field(        unsigned long,  ip                        )
++              __field(        unsigned char,  type                      )
++              __array(        char         ,  ksym_name, KSYM_NAME_LEN  )
++              __array(        char         ,  cmd,       TASK_COMM_LEN  )
++      ),
++
++      F_printk("ip: %pF type: %d ksym_name: %s cmd: %s",
++              (void *)__entry->ip, (unsigned int)__entry->type,
++              __entry->ksym_name, __entry->cmd)
++);
diff --cc samples/Kconfig
Simple merge
index 42e175598777ae42d93186a7f8b44261ea28d338,43343a03b1f4a8cbeca3b1371802135366bbaea5..0f15e6d77fd641a516f3ed53ba2d16a3a273108d
@@@ -1,4 -1,3 +1,4 @@@
  # Makefile for Linux samples code
  
- obj-$(CONFIG_SAMPLES) += markers/ kobject/ kprobes/ tracepoints/ \
-                       trace_events/ hw_breakpoint/
 -obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ tracepoints/ trace_events/
++obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ tracepoints/ trace_events/ \
++                         hw_breakpoint/