1. 16 Mar, 2012 2 commits
    • Jiri Olsa's avatar
      perf tools: Add parser generator for events parsing · 89812fc8
      Jiri Olsa authored
      Changing event parsing to use flex/bison parse generator.
      The event syntax stays as it was.
      
      grammar description:
      
      events: events ',' event | event
      
      event:  event_def PE_MODIFIER_EVENT | event_def
      
      event_def: event_legacy_symbol sep_dc     |
                 event_legacy_cache sep_dc      |
                 event_legacy_breakpoint sep_dc |
                 event_legacy_tracepoint sep_dc |
                 event_legacy_numeric sep_dc    |
                 event_legacy_raw sep_dc
      
      event_legacy_symbol:      PE_NAME_SYM
      
      event_legacy_cache:       PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT |
                                PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT  |
                                PE_NAME_CACHE_TYPE
      
      event_legacy_raw:         PE_SEP_RAW PE_VALUE
      
      event_legacy_numeric:     PE_VALUE ':' PE_VALUE
      
      event_legacy_breakpoint:  PE_SEP_BP ':' PE_VALUE ':' PE_MODIFIER_BP
      
      event_breakpoint_type:    PE_MODIFIER_BPTYPE | empty
      
      PE_NAME_SYM:              cpu-cycles|cycles                              |
                                stalled-cycles-frontend|idle-cycles-frontend   |
                                stalled-cycles-backend|idle-cycles-backend     |
                                instructions                                   |
                                cache-references                               |
                                cache-misses                                   |
                                branch-instructions|branches                   |
                                branch-misses                                  |
                                bus-cycles                                     |
                                cpu-clock                                      |
                                task-clock                                     |
                                page-faults|faults                             |
                                minor-faults                                   |
                                major-faults                                   |
                                context-switches|cs                            |
                                cpu-migrations|migrations                      |
                                alignment-faults                               |
                                emulation-faults
      
      PE_NAME_CACHE_TYPE:       L1-dcache|l1-d|l1d|L1-data             |
                                L1-icache|l1-i|l1i|L1-instruction      |
                                LLC|L2                                 |
                                dTLB|d-tlb|Data-TLB                    |
                                iTLB|i-tlb|Instruction-TLB             |
                                branch|branches|bpu|btb|bpc            |
                                node
      
      PE_NAME_CACHE_OP_RESULT:  load|loads|read                        |
                                store|stores|write                     |
                                prefetch|prefetches                    |
                                speculative-read|speculative-load      |
                                refs|Reference|ops|access              |
                                misses|miss
      
      PE_MODIFIER_EVENT:        [ukhp]{0,5}
      
      PE_MODIFIER_BP:           [rwx]
      
      PE_SEP_BP:                'mem'
      
      PE_SEP_RAW:               'r'
      
      sep_dc:                   ':' |
      
      Added flex/bison files for event grammar parsing. The generated
      parser is part of the patch. Added makefile rule 'event-parser'
      to generate the parser code out of the bison/flex sources.
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/n/tip-u4pfig5waq3ll2bfcdex8fgi@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      89812fc8
    • Jiri Olsa's avatar
      perf: Adding sysfs group format attribute for pmu device · 641cc938
      Jiri Olsa authored
      Adding sysfs group 'format' attribute for pmu device that
      contains a syntax description on how to construct raw events.
      
      The event configuration is described in following
      struct pefr_event_attr attributes:
      
        config
        config1
        config2
      
      Each sysfs attribute within the format attribute group,
      describes mapping of name and bitfield definition within
      one of above attributes.
      
      eg:
        "/sys/...<dev>/format/event" contains "config:0-7"
        "/sys/...<dev>/format/umask" contains "config:8-15"
        "/sys/...<dev>/format/usr"   contains "config:16"
      
      the attribute value syntax is:
      
        line:      config ':' bits
        config:    'config' | 'config1' | 'config2"
        bits:      bits ',' bit_term | bit_term
        bit_term:  VALUE '-' VALUE | VALUE
      
      Adding format attribute definitions for x86 cpu pmus.
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/n/tip-vhdk5y2hyype9j63prymty36@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      641cc938
  2. 15 Mar, 2012 1 commit
  3. 12 Mar, 2012 6 commits
    • Ingo Molnar's avatar
      Merge branch 'perf/hw-branch-sampling' into perf/core · bea95c15
      Ingo Molnar authored
      Merge reason: The 'perf record -b' hardware branch sampling feature is ready for upstream.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      bea95c15
    • Stephane Eranian's avatar
      perf report: Fix annotate double quit issue in branch view mode · 24bff2dc
      Stephane Eranian authored
      This patch fixes perf report to not go back two levels when
      pressing the 'q' key while annotating in branch view mode.
      
      When pressing 'q' in annotate mode and if the branch source
      and target belong to different functions, perf now brings
      up the annotation popup menu again to offer the option to
      annotate the other branch source or target.
      
      As part of the code restructuring in perf_evsel__hists_browse()
      we also fix a memory leak on options[] in case of error.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: peterz@infradead.org
      Cc: acme@redhat.com
      Cc: asharma@fb.com
      Cc: ravitillo@lbl.gov
      Cc: vweaver1@eecs.utk.edu
      Cc: khandual@linux.vnet.ibm.com
      Cc: dsahern@gmail.com
      Link: http://lkml.kernel.org/r/1331565210-10865-3-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      24bff2dc
    • Stephane Eranian's avatar
      perf report: Remove duplicate annotate choice in branch view mode · 8bcd65fd
      Stephane Eranian authored
      This patch removes the duplicated annotate selection when
      browsing in branch view mode. If the sym and dso oof the branch
      source and target are the same, then only one annotate choice is
      proposed.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: peterz@infradead.org
      Cc: acme@redhat.com
      Cc: asharma@fb.com
      Cc: ravitillo@lbl.gov
      Cc: vweaver1@eecs.utk.edu
      Cc: khandual@linux.vnet.ibm.com
      Cc: dsahern@gmail.com
      Link: http://lkml.kernel.org/r/1331565210-10865-2-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8bcd65fd
    • Peter Zijlstra's avatar
      perf/x86: Prettify pmu config literals · f9b4eeb8
      Peter Zijlstra authored
      I got somewhat tired of having to decode hex numbers..
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Robert Richter <robert.richter@amd.com>
      Link: http://lkml.kernel.org/n/tip-0vsy1sgywc4uar3mu1szm0rg@git.kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f9b4eeb8
    • Ingo Molnar's avatar
      Merge branch 'perf/urgent' into perf/core · 35239e23
      Ingo Molnar authored
      Merge reason: We are going to queue up a dependent patch.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      35239e23
    • Peter Zijlstra's avatar
      perf/x86: Fix local vs remote memory events for NHM/WSM · 87e24f4b
      Peter Zijlstra authored
      Verified using the below proglet.. before:
      
      [root@westmere ~]# perf stat -e node-stores -e node-store-misses ./numa 0
      remote write
      
       Performance counter stats for './numa 0':
      
               2,101,554 node-stores
               2,096,931 node-store-misses
      
             5.021546079 seconds time elapsed
      
      [root@westmere ~]# perf stat -e node-stores -e node-store-misses ./numa 1
      local write
      
       Performance counter stats for './numa 1':
      
                 501,137 node-stores
                     199 node-store-misses
      
             5.124451068 seconds time elapsed
      
      After:
      
      [root@westmere ~]# perf stat -e node-stores -e node-store-misses ./numa 0
      remote write
      
       Performance counter stats for './numa 0':
      
               2,107,516 node-stores
               2,097,187 node-store-misses
      
             5.012755149 seconds time elapsed
      
      [root@westmere ~]# perf stat -e node-stores -e node-store-misses ./numa 1
      local write
      
       Performance counter stats for './numa 1':
      
               2,063,355 node-stores
                     165 node-store-misses
      
             5.082091494 seconds time elapsed
      
      #define _GNU_SOURCE
      
      #include <sched.h>
      #include <stdio.h>
      #include <errno.h>
      #include <sys/mman.h>
      #include <sys/types.h>
      #include <dirent.h>
      #include <signal.h>
      #include <unistd.h>
      #include <numaif.h>
      #include <stdlib.h>
      
      #define SIZE (32*1024*1024)
      
      volatile int done;
      
      void sig_done(int sig)
      {
      	done = 1;
      }
      
      int main(int argc, char **argv)
      {
      	cpu_set_t *mask, *mask2;
      	size_t size;
      	int i, err, t;
      	int nrcpus = 1024;
      	char *mem;
      	unsigned long nodemask = 0x01; /* node 0 */
      	DIR *node;
      	struct dirent *de;
      	int read = 0;
      	int local = 0;
      
      	if (argc < 2) {
      		printf("usage: %s [0-3]\n", argv[0]);
      		printf("  bit0 - local/remote\n");
      		printf("  bit1 - read/write\n");
      		exit(0);
      	}
      
      	switch (atoi(argv[1])) {
      	case 0:
      		printf("remote write\n");
      		break;
      	case 1:
      		printf("local write\n");
      		local = 1;
      		break;
      	case 2:
      		printf("remote read\n");
      		read = 1;
      		break;
      	case 3:
      		printf("local read\n");
      		local = 1;
      		read = 1;
      		break;
      	}
      
      	mask = CPU_ALLOC(nrcpus);
      	size = CPU_ALLOC_SIZE(nrcpus);
      	CPU_ZERO_S(size, mask);
      
      	node = opendir("/sys/devices/system/node/node0/");
      	if (!node)
      		perror("opendir");
      	while ((de = readdir(node))) {
      		int cpu;
      
      		if (sscanf(de->d_name, "cpu%d", &cpu) == 1)
      			CPU_SET_S(cpu, size, mask);
      	}
      	closedir(node);
      
      	mask2 = CPU_ALLOC(nrcpus);
      	CPU_ZERO_S(size, mask2);
      	for (i = 0; i < size; i++)
      		CPU_SET_S(i, size, mask2);
      	CPU_XOR_S(size, mask2, mask2, mask); // invert
      
      	if (!local)
      		mask = mask2;
      
      	err = sched_setaffinity(0, size, mask);
      	if (err)
      		perror("sched_setaffinity");
      
      	mem = mmap(0, SIZE, PROT_READ|PROT_WRITE,
      			MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
      	err = mbind(mem, SIZE, MPOL_BIND, &nodemask, 8*sizeof(nodemask), MPOL_MF_MOVE);
      	if (err)
      		perror("mbind");
      
      	signal(SIGALRM, sig_done);
      	alarm(5);
      
      	if (!read) {
      		while (!done) {
      			for (i = 0; i < SIZE; i++)
      				mem[i] = 0x01;
      		}
      	} else {
      		while (!done) {
      			for (i = 0; i < SIZE; i++)
      				t += *(volatile char *)(mem + i);
      		}
      	}
      
      	return 0;
      }
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: <stable@kernel.org>
      Link: http://lkml.kernel.org/n/tip-tq73sxus35xmqpojf7ootxgs@git.kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      87e24f4b
  4. 10 Mar, 2012 4 commits
    • Linus Torvalds's avatar
      Linux 3.3-rc7 · fde7d904
      Linus Torvalds authored
      fde7d904
    • Al Viro's avatar
      aio: fix the "too late munmap()" race · c7b28555
      Al Viro authored
      Current code has put_ioctx() called asynchronously from aio_fput_routine();
      that's done *after* we have killed the request that used to pin ioctx,
      so there's nothing to stop io_destroy() waiting in wait_for_all_aios()
      from progressing.  As the result, we can end up with async call of
      put_ioctx() being the last one and possibly happening during exit_mmap()
      or elf_core_dump(), neither of which expects stray munmap() being done
      to them...
      
      We do need to prevent _freeing_ ioctx until aio_fput_routine() is done
      with that, but that's all we care about - neither io_destroy() nor
      exit_aio() will progress past wait_for_all_aios() until aio_fput_routine()
      does really_put_req(), so the ioctx teardown won't be done until then
      and we don't care about the contents of ioctx past that point.
      
      Since actual freeing of these suckers is RCU-delayed, we don't need to
      bump ioctx refcount when request goes into list for async removal.
      All we need is rcu_read_lock held just over the ->ctx_lock-protected
      area in aio_fput_routine().
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Reviewed-by: default avatarJeff Moyer <jmoyer@redhat.com>
      Acked-by: default avatarBenjamin LaHaise <bcrl@kvack.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c7b28555
    • Al Viro's avatar
      aio: fix io_setup/io_destroy race · 86b62a2c
      Al Viro authored
      Have ioctx_alloc() return an extra reference, so that caller would drop it
      on success and not bother with re-grabbing it on failure exit.  The current
      code is obviously broken - io_destroy() from another thread that managed
      to guess the address io_setup() would've returned would free ioctx right
      under us; gets especially interesting if aio_context_t * we pass to
      io_setup() points to PROT_READ mapping, so put_user() fails and we end
      up doing io_destroy() on kioctx another thread has just got freed...
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Acked-by: default avatarBenjamin LaHaise <bcrl@kvack.org>
      Reviewed-by: default avatarJeff Moyer <jmoyer@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      86b62a2c
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · 86e06008
      Linus Torvalds authored
      Pull btrfs updates from Chris Mason:
       "I have two additional and btrfs fixes in my for-linus branch.  One is
        a casting error that leads to memory corruption on i386 during scrub,
        and the other fixes a corner case in the backref walking code (also
        triggered by scrub)."
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        Btrfs: fix casting error in scrub reada code
        btrfs: fix locking issues in find_parent_nodes()
      86e06008
  5. 09 Mar, 2012 25 commits
  6. 08 Mar, 2012 2 commits