1. 16 Mar, 2012 12 commits
  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 17 commits
    • Hugh Dickins's avatar
      memcg: revert fix to mapcount check for this release · be22aece
      Hugh Dickins authored
      Respectfully revert commit e6ca7b89 "memcg: fix mapcount check
      in move charge code for anonymous page" for the 3.3 release, so that
      it behaves exactly like releases 2.6.35 through 3.2 in this respect.
      
      Horiguchi-san's commit is correct in itself, 1 makes much more sense
      than 2 in that check; but it does not go far enough - swapcount
      should be considered too - if we really want such a check at all.
      
      We appear to have reached agreement now, and expect that 3.4 will
      remove the mapcount check, but had better not make 3.3 different.
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Reviewed-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      be22aece
    • Thomas Gleixner's avatar
      x86: Derandom delay_tsc for 64 bit · a7f4255f
      Thomas Gleixner authored
      Commit f0fbf0ab ("x86: integrate delay functions") converted
      delay_tsc() into a random delay generator for 64 bit.  The reason is
      that it merged the mostly identical versions of delay_32.c and
      delay_64.c.  Though the subtle difference of the result was:
      
       static void delay_tsc(unsigned long loops)
       {
      -	unsigned bclock, now;
      +	unsigned long bclock, now;
      
      Now the function uses rdtscl() which returns the lower 32bit of the
      TSC. On 32bit that's not problematic as unsigned long is 32bit. On 64
      bit this fails when the lower 32bit are close to wrap around when
      bclock is read, because the following check
      
             if ((now - bclock) >= loops)
             	  	break;
      
      evaluated to true on 64bit for e.g. bclock = 0xffffffff and now = 0
      because the unsigned long (now - bclock) of these values results in
      0xffffffff00000001 which is definitely larger than the loops
      value. That explains Tvortkos observation:
      
      "Because I am seeing udelay(500) (_occasionally_) being short, and
       that by delaying for some duration between 0us (yep) and 491us."
      
      Make those variables explicitely u32 again, so this works for both 32
      and 64 bit.
      Reported-by: default avatarTvrtko Ursulin <tvrtko.ursulin@onelan.co.uk>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org # >= 2.6.27
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a7f4255f
    • Linus Torvalds's avatar
      Merge tag 'sound-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · c447064d
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Nothing exciting here: just a few regression fixes for HD-audio and
        ASoC, also the support of missing 32bit compat ioctl for HDSPM."
      
      * tag 'sound-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hdspm - Provide ioctl_compat
        ALSA: hda/realtek - Apply the coef-setup only to ALC269VB
        ALSA: hda - add quirk to detect CD input on Gigabyte EP45-DS3
        ASoC: neo1973: fix neo1973 wm8753 initialization
      c447064d
    • David Brown's avatar
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://linux-c6x.org/git/projects/linux-c6x-upstreaming · 0ab5d757
      Linus Torvalds authored
      Pull C6X fix from Mark Salter:
       "Fix for C6X KSTK_EIP and KSTK_ESP macros."
      
      * tag 'for-linus' of git://linux-c6x.org/git/projects/linux-c6x-upstreaming:
        C6X: fix KSTK_EIP and KSTK_ESP macros
      0ab5d757
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v3.3-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 0cacaf51
      Linus Torvalds authored
      Pull two IOMMU fixes from Joerg Roedel:
       "The first is an additional fix for the OMAP initialization order issue
        and the second patch fixes a possible section mismatch which can lead
        to a kernel crash in the AMD IOMMU driver when suspend/resume is used
        and the compiler has not inlined the iommu_set_device_table function."
      
      * tag 'iommu-fixes-v3.3-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        x86/amd: iommu_set_device_table() must not be __init
        ARM: OMAP: fix iommu, not mailbox
      0cacaf51
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · 45b8da90
      Linus Torvalds authored
      Pull radeon drm stuff from Dave Airlie:
       "Just some radeon fixes, one is for an oops where we run out of ioremap
        space on some big hardware systems in 32-bit mode, stuff doesn't work
        properly but at least the machine will boot.
      
        One regression fix, and two bugs, one hw, one blit code."
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
        drm/radeon/kms: fix hdmi duallink checks
        drm/radeon/kms: set SX_MISC in the r6xx blit code (v2)
        drm/radeon: deal with errors from framebuffer init path.
        drm/radeon: fix a semaphore deadlock on pre cayman asics
      45b8da90
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · e304dfdb
      Linus Torvalds authored
      Pull networking from David Miller:
      
      1) IPV4 routing metrics can become stale when routes are changed by the
         administrator, fix from Steffen Klassert.
      
      2) atl1c does "val |= XXX;" where XXX is a bit number not a bit mask,
         fix by using set_bit.  From Dan Carpenter.
      
      3) Memory accounting bug in carl9170 driver results in wedged TX queue.
         Fix from Nicolas Cavallari.
      
      4) iwlwifi accidently uses "sizeof(ptr)" instead of "sizeof(*ptr)", fix
         from Johannes Berg.
      
      5) Openvswitch doesn't honor dp_ifindex when doing vport lookups, fix
         from Ben Pfaff.
      
      6) ehea conversion to 64-bit stats lost multicast and rx_errors
         accounting, fix from Eric Dumazet.
      
      7) Bridge state transition logging in br_stp_disable_port() is busted,
         it's emitted at the wrong time and the message is in the wrong tense,
         fix from Paulius Zaleckas.
      
      8) mlx4 device erroneously invokes the queue resize firmware operation
         twice, fix from Jack Morgenstein.
      
      9) Fix deadlock in usbnet, need to drop lock when invoking usb_unlink_urb()
         otherwise we recurse into taking it again.  Fix from Sebastian Siewior.
      
      10) hyperv network driver uses the wrong driver name string, fix from
          Haiyang Zhang.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
        net/hyperv: Use the built-in macro KBUILD_MODNAME for this driver
        net/usbnet: avoid recursive locking in usbnet_stop()
        route: Remove redirect_genid
        inetpeer: Invalidate the inetpeer tree along with the routing cache
        mlx4_core: fix bug in modify_cq wrapper for resize flow.
        atl1c: set ATL1C_WORK_EVENT_RESET bit correctly
        bridge: fix state reporting when port is disabled
        bridge: br_log_state() s/entering/entered/
        ehea: restore multicast and rx_errors fields
        openvswitch: Fix checksum update for actions on UDP packets.
        openvswitch: Honor dp_ifindex, when specified, for vport lookup by name.
        iwlwifi: fix wowlan suspend
        mwifiex: reset encryption mode flag before association
        carl9170: fix frame delivery if sta is in powersave mode
        carl9170: Fix memory accounting when sta is in power-save mode.
      e304dfdb
    • Stephane Eranian's avatar
      perf report: Enable TUI in branch view mode · a68c2c58
      Stephane Eranian authored
      This patch updates perf report to support TUI mode
      when the perf.data file contains samples with branch
      stacks.
      
      For each row in the report, it is possible to annotate
      either the source or target of each branch.
      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/1331246868-19905-5-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a68c2c58
    • Stephane Eranian's avatar
      perf report: Auto-detect branch stack sampling mode · 993ac88d
      Stephane Eranian authored
      This patch enhances perf report to auto-detect when the
      perf.data file contains samples with branch stacks. That way it
      is not necessary to use the -b option.
      
      To force branch view mode to off, simply use --no-branch-stack.
      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/1331246868-19905-4-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      993ac88d
    • Stephane Eranian's avatar
      perf record: Add HEADER_BRANCH_STACK tag · 330aa675
      Stephane Eranian authored
      This patch adds a new feature bit, namely,
      HEADER_BRANCH_STACK.  When present, it indicates
      that sample records may contain branch stack.
      
      This could be useful to a viewer to switch to
      branch mode without having to parse all the
      samples or without a specific cmdline option.
      
      This will be used in a subsequent patch to
      enhance perf report with branch stacks.
      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/1331246868-19905-3-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      330aa675
    • Stephane Eranian's avatar
      perf record: Provide default branch stack sampling mode option · a5aabdac
      Stephane Eranian authored
      This patch chanegs the logic of the -b, --branch-stack options
      of perf record.
      
      Based on users' request, the patch provides a default filter
      mode with the -b (or --branch-any) option.  With the option,
      any type of taken branches is sampled.
      
      With -j (or --branch-filter), the user can specify any
      valid combination of branch types and privilege levels
      if supported by the underlying hardware.
      
      The -b (--branch any) is a shortcut for: --branch-filter any.
      
       $ perf record -b foo
      
      or:
      
       $ perf record --branch-filter any foo
      
      For more specific filtering:
      
       $ perf record --branch-filter ind_call,u foo
      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/1331246868-19905-2-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a5aabdac
    • Stephane Eranian's avatar
      perf tools: Make perf able to read files from older ABIs · 114382a0
      Stephane Eranian authored
      This patches provides a way to handle legacy perf.data
      files.  Legacy files are those using the older PERFFILE
      signature.
      
      For those, it is still necessary to detect endianness but
      without comparing their header->attr_size with the
      tool's own version as it may be different. Instead, we use
      a reference table for all known sizes from the legacy era.
      
      We try all the combinations for sizes and endianness. If we find
      a match, we proceed, otherwise we return: "incompatible file
      format".
      
      This is also done for the pipe-mode file format.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: peterz@infradead.org
      Cc: acme@redhat.com
      Cc: robert.richter@amd.com
      Cc: ming.m.lin@intel.com
      Cc: andi@firstfloor.org
      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/1328826068-11713-19-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      114382a0
    • Stephane Eranian's avatar
      perf tools: Fix ABI compatibility bug in print_event_desc() · 62db9068
      Stephane Eranian authored
      This patches cleans up local variable types for msz and ret.
      They need to be size_t and ssize_t respectively.
      
      It also fixes a bug whereby perf would not read attr struct
      with a different size than what it knows about.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: peterz@infradead.org
      Cc: acme@redhat.com
      Cc: robert.richter@amd.com
      Cc: ming.m.lin@intel.com
      Cc: andi@firstfloor.org
      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/1328826068-11713-18-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      62db9068
    • Stephane Eranian's avatar
      perf tools: Enable reading of perf.data files from different ABI rev · 69996df4
      Stephane Eranian authored
      This patch allows perf to process perf.data files generated
      using an ABI that has a different perf_event_attr struct size,
      i.e., a different ABI version.
      
      The perf_event_attr can be extended, yet perf needs to cope with
      older perf.data files. Similarly, perf must be able to cope with
      a perf.data file which is using a newer version of the ABI than
      what it knows about.
      
      This patch adds read_attr(), a routine that reads a
      perf_event_attr struct from a file incrementally based on its
      advertised size. If the on-file struct is smaller than what perf
      knows, then the extra fields are zeroed. If the on-file struct
      is bigger, then perf only uses what it knows about, the rest is
      skipped.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: peterz@infradead.org
      Cc: acme@redhat.com
      Cc: robert.richter@amd.com
      Cc: ming.m.lin@intel.com
      Cc: andi@firstfloor.org
      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/1328826068-11713-17-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      69996df4
    • Stephane Eranian's avatar
      perf: Add ABI reference sizes · cb5d7699
      Stephane Eranian authored
      This patch adds reference sizes for revision 1
      and 2 of the perf_event ABI, i.e., the size of
      the perf_event_attr struct.
      
      With Rev1: config2 was added = +8 bytes
      With Rev2: branch_sample_type was added = +8 bytes
      
      Adds the definition for Rev1, Rev2.
      
      This is useful for tools trying to decode the revision
      numbers based on the size of the struct.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: peterz@infradead.org
      Cc: acme@redhat.com
      Cc: robert.richter@amd.com
      Cc: ming.m.lin@intel.com
      Cc: andi@firstfloor.org
      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/1328826068-11713-16-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      cb5d7699
    • Roberto Agostino Vitillo's avatar
      perf report: Add support for taken branch sampling · b50311dc
      Roberto Agostino Vitillo authored
      This patch adds support for taken branch sampling, i.e, the
      PERF_SAMPLE_BRANCH_STACK feature to perf report. In other
      words, to display histograms based on taken branches rather
      than executed instructions addresses.
      
      The new option is called -b and it takes no argument. To
      generate meaningful output, the perf.data must have been
      obtained using perf record -b xxx ... where xxx is a branch
      filter option.
      
      The output shows symbols, modules, sorted by 'who branches
      where' the most often. The percentages reported in the first
      column refer to the total number of branches captured and
      not the usual number of samples.
      
      Here is a quick example.
      Here branchy is simple test program which looks as follows:
      
      void f2(void)
      {}
      void f3(void)
      {}
      void f1(unsigned long n)
      {
        if (n & 1UL)
          f2();
        else
          f3();
      }
      int main(void)
      {
        unsigned long i;
      
        for (i=0; i < N; i++)
         f1(i);
        return 0;
      }
      
      Here is the output captured on Nehalem, if we are
      only interested in user level function calls.
      
      $ perf record -b any_call,u -e cycles:u branchy
      
      $ perf report -b --sort=symbol
          52.34%  [.] main                   [.] f1
          24.04%  [.] f1                     [.] f3
          23.60%  [.] f1                     [.] f2
           0.01%  [k] _IO_new_file_xsputn    [k] _IO_file_overflow
           0.01%  [k] _IO_vfprintf_internal  [k] _IO_new_file_xsputn
           0.01%  [k] _IO_vfprintf_internal  [k] strchrnul
           0.01%  [k] __printf               [k] _IO_vfprintf_internal
           0.01%  [k] main                   [k] __printf
      
      About half (52%) of the call branches captured are from main()
      -> f1(). The second half (24%+23%) is split in two equal shares
      between f1() -> f2(), f1() ->f3(). The output is as expected
      given the code.
      
      It should be noted, that using -b in perf record does not
      eliminate information in the perf.data file. Consequently, a
      typical profile can also be obtained by perf report by simply
      not using its -b option.
      
      It is possible to sort on branch related columns:
      
         - dso_from, symbol_from
         - dso_to, symbol_to
         - mispredict
      Signed-off-by: default avatarRoberto Agostino Vitillo <ravitillo@lbl.gov>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: peterz@infradead.org
      Cc: acme@redhat.com
      Cc: robert.richter@amd.com
      Cc: ming.m.lin@intel.com
      Cc: andi@firstfloor.org
      Cc: asharma@fb.com
      Cc: vweaver1@eecs.utk.edu
      Cc: khandual@linux.vnet.ibm.com
      Cc: dsahern@gmail.com
      Link: http://lkml.kernel.org/r/1328826068-11713-14-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b50311dc