1. 28 Dec, 2018 12 commits
    • Jiri Olsa's avatar
      perf c2c: Change the default coalesce setup · 423701a0
      Jiri Olsa authored
      Joe suggested to have the coalesce default set just to 'iaddr', because
      it's easier to read on the default 'perf c2c report' output.
      
      By removing the "pid" field from the default -c/--coalesce option, the
      'perf c2c' report will group all the relevant PIDs under the instruction
      address ('iaddr') bucket. User can always run "-c pid,iaddr" for a more
      fine grained output on particular PIDs.
      Suggested-by: default avatarJoe Mario <jmario@redhat.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20181228101820.28010-1-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      423701a0
    • Arnaldo Carvalho de Melo's avatar
      perf trace beauty ioctl: Beautify USBDEVFS_ commands · 38fc9da6
      Arnaldo Carvalho de Melo authored
      For instance, while debugging the 'galileo' python utility to
      synchronize fitbit trackers:
      
        # perf trace -e ioctl ./run --force
        ioctl(0</dev/pts/8>, TCSETS, 0x7ffe28666420) = 0
        ioctl(0</dev/pts/8>, TCSETS, 0x7ffe28666290) = 0
        ioctl(1</dev/pts/8>, TCSETS, 0x7ffe28666290) = 0
        ioctl(2</dev/pts/8>, TCSETS, 0x7ffe28666290) = 0
        ioctl(3</home/acme/hg/galileo/run>, TCSETS, 0x7ffe286663f0) = -1 ENOTTY (Inappropriate ioctl for device)
        ioctl(1</dev/pts/8>, TCSETS, 0x7ffe286655a0) = 0
        ioctl(1</dev/pts/8>, TCSETS, 0x7ffe28665470) = 0
        ioctl(1</dev/pts/8>, TCSETS, 0x7ffe28665470) = 0
        ioctl(1</dev/pts/8>, TCSETS, 0x7ffe286654a0) = 0
        ioctl(1</dev/pts/8>, TCSETS, 0x7ffe286654a0) = 0
        ioctl(1</dev/pts/8>, TCSETS, 0x7ffe28665400) = 0
        ioctl(1</dev/pts/8>, TIOCSWINSZ, 0x7ffe286654c0) = 0
        ioctl(0</dev/pts/8>, TIOCSWINSZ, 0x7ffe28665560) = 0
        ioctl(0</dev/pts/8>, TIOCSWINSZ, 0x7ffe28665560) = 0
        ioctl(0</dev/pts/8>, TIOCMGET, 0x7ffe28665560) = 0
        ioctl(0</dev/pts/8>, TCSETS, 0x7ffe28665530) = 0
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_GET_CAPABILITIES, 0x561468dad048) = 0
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_GETDRIVER, 0x7ffe28665500) = -1 ENODATA (No data available)
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_GETDRIVER, 0x7ffe28665500) = -1 ENODATA (No data available)
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_SETCONFIGURATION, 0x7ffe2866513c) = 0
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_CLAIMINTERFACE, 0x7ffe286647bc) = 0
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_SUBMITURB, 0x561468dace40) = 0
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_REAPURBNDELAY, 0x7ffe28664c10) = 0
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_REAPURBNDELAY, 0x7ffe28664c10) = -1 EAGAIN (Resource temporarily unavailable)
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_SUBMITURB, 0x561468dace40) = 0
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_REAPURBNDELAY, 0x7ffe28664dd0) = 0
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_REAPURBNDELAY, 0x7ffe28664dd0) = -1 EAGAIN (Resource temporarily unavailable)
        <SNIP>
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_SUBMITURB, 0x561468e72ec0) = 0
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_REAPURBNDELAY, 0x7ffe28664cc0) = 0
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_REAPURBNDELAY, 0x7ffe28664cc0) = -1 EAGAIN (Resource temporarily unavailable)
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_RELEASEINTERFACE, 0x7ffe2866463c) = 0
        ioctl(10</dev/bus/usb/001/011>, USBDEVFS_RELEASEINTERFACE, 0x7ffe2866463c) = 0
        Tracker: 813F4690C3D1: Synchronisation successful
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-6x2cawak7jno3gpp5pagzj50@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      38fc9da6
    • Arnaldo Carvalho de Melo's avatar
      perf trace beauty: Export function to get the files for a thread · 2d473389
      Arnaldo Carvalho de Melo authored
      So that beautifiers can access things like dev_maj.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-wm5o51f206c5pi063dsaeraq@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2d473389
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Wire up ioctl's USBDEBFS_ cmd table generator · 86cf4c65
      Arnaldo Carvalho de Melo authored
      That ends up generating this:
      
        [acme@quaco perf]$ cat /tmp/build/perf/trace/beauty/generated/ioctl/usbdevfs_ioctl_array.c
        static const char *usbdevfs_ioctl_cmds[] = {
      	[0] = "CONTROL",
      	[10] = "SUBMITURB",
      	[11] = "DISCARDURB",
      	[12] = "REAPURB",
      	[13] = "REAPURBNDELAY",
      	[14] = "DISCSIGNAL",
      	[15] = "CLAIMINTERFACE",
      	[16] = "RELEASEINTERFACE",
      	[17] = "CONNECTINFO",
      	[18] = "IOCTL",
      	[19] = "HUB_PORTINFO",
      	[2] = "BULK",
      	[20] = "RESET",
      	[21] = "CLEAR_HALT",
      	[22] = "DISCONNECT",
      	[23] = "CONNECT",
      	[24] = "CLAIM_PORT",
      	[25] = "RELEASE_PORT",
      	[26] = "GET_CAPABILITIES",
      	[27] = "DISCONNECT_CLAIM",
      	[28] = "ALLOC_STREAMS",
      	[29] = "FREE_STREAMS",
      	[3] = "RESETEP",
      	[30] = "DROP_PRIVILEGES",
      	[31] = "GET_SPEED",
      	[4] = "SETINTERFACE",
      	[5] = "SETCONFIGURATION",
      	[8] = "GETDRIVER",
        };
      
        #if 0
        static const char *usbdevfs_ioctl_32_cmds[] = {
      	[0] = "CONTROL32",
      	[10] = "SUBMITURB32",
      	[12] = "REAPURB32",
      	[13] = "REAPURBNDELAY32",
      	[14] = "DISCSIGNAL32",
      	[18] = "IOCTL32",
      	[2] = "BULK32",
        };
        #endif
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-hkam6lt1g806l0p4b7buif3n@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      86cf4c65
    • Arnaldo Carvalho de Melo's avatar
      perf beauty ioctl: Add generator for USBDEVFS_ ioctl commands · 870c3f40
      Arnaldo Carvalho de Melo authored
      Will be associated with fds with the right device major.
      
        $ tools/perf/trace/beauty/usbdevfs_ioctl.sh
        static const char *usbdevfs_ioctl_cmds[] = {
      	[0] = "CONTROL",
      	[10] = "SUBMITURB",
      	[11] = "DISCARDURB",
      	[12] = "REAPURB",
      	[13] = "REAPURBNDELAY",
      	[14] = "DISCSIGNAL",
      	[15] = "CLAIMINTERFACE",
      	[16] = "RELEASEINTERFACE",
      	[17] = "CONNECTINFO",
      	[18] = "IOCTL",
      	[19] = "HUB_PORTINFO",
      	[20] = "RESET",
      	[21] = "CLEAR_HALT",
      	[22] = "DISCONNECT",
      	[23] = "CONNECT",
      	[24] = "CLAIM_PORT",
      	[25] = "RELEASE_PORT",
      	[26] = "GET_CAPABILITIES",
      	[27] = "DISCONNECT_CLAIM",
      	[28] = "ALLOC_STREAMS",
      	[29] = "FREE_STREAMS",
      	[2] = "BULK",
      	[30] = "DROP_PRIVILEGES",
      	[31] = "GET_SPEED",
      	[3] = "RESETEP",
      	[4] = "SETINTERFACE",
      	[5] = "SETCONFIGURATION",
      	[8] = "GETDRIVER",
        };
      
        #if 0
        static const char *usbdevfs_ioctl_32_cmds[] = {
      	[0] = "CONTROL32",
      	[10] = "SUBMITURB32",
      	[12] = "REAPURB32",
      	[13] = "REAPURBNDELAY32",
      	[14] = "DISCSIGNAL32",
      	[18] = "IOCTL32",
      	[2] = "BULK32",
        };
        #endif
        $
      
      Leaving the '32' variants commented, later we can try to support those
      as well, from some other hint (maybe something about the thread issuing
      the ioctls) and from the _IOC_SIZE(cmd).
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-neq1lrji5k4ku0rktn7ytnri@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      870c3f40
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Grab a copy of usbdevice_fs.h · 2bd71d11
      Arnaldo Carvalho de Melo authored
      Will be used to generate the string table for the USBDEVFS_ prefixed
      ioctl commands.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-3vrm9b55tdhzn8sw9qazh4z5@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2bd71d11
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Store the major number for a file when storing its pathname · 4bcc4cff
      Arnaldo Carvalho de Melo authored
      We keep a table for the fds to map them back to pathnames when showing
      'fd' based APIs such as write(), store as well the major number for the
      device the path is in, to use in things like choosing the right ioctl
      'cmd' beautifier.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-qjkds7bnk7v7fk2xhqsb0a4v@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4bcc4cff
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Move the files table resizing to outside set_pathname() · d7e13484
      Arnaldo Carvalho de Melo authored
      So that we can have that table expanded when setting other attributes.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-hzvpe3qwafe6sqcq3bhtbxds@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d7e13484
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Rename thread_thread->paths to thread_trace->files · f4a74fcb
      Arnaldo Carvalho de Melo authored
      So that we can add more per file attributes besides the pathname, such
      as which ioctl beautifier to use, for cases such as the sound and
      usbdeffs ioctls, that both use the 'U' command, so we have to
      differentiate at the major number for the device file.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-1895cmhrdz2dkl5prf2cj2yj@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f4a74fcb
    • Andi Kleen's avatar
      perf script: Fix LBR skid dump problems in brstackinsn · 61f61159
      Andi Kleen authored
      This is a fix for another instance of the skid problem Milian recently
      found [1]
      
      The LBRs don't freeze at the exact same time as the PMI is triggered.
      The perf script brstackinsn code that dumps LBR assembler assumes that
      the last branch in the LBR leads to the sample point.  But with skid
      it's possible that the CPU executes one or more branches before the
      sample, but which do not appear in the LBR.
      
      What happens then is either that the sample point is before the last LBR
      branch. In this case the dumper sees a negative length and ignores it.
      Or it the sample point is long after the last branch. Then the dumper
      sees a very long block and dumps it upto its block limit (16k bytes),
      which is noise in the output.
      
      On typical sample session this can happen regularly.
      
      This patch tries to detect and handle the situation. On the last block
      that is dumped by the LBR dumper we always stop on the first branch. If
      the block length is negative just scan forward to the first branch.
      Otherwise scan until a branch is found.
      
      The PT decoder already has a function that uses the instruction decoder
      to detect branches, so we can just reuse it here.
      
      Then when a terminating branch is found print an indication and stop
      dumping. This might miss a few instructions, but at least shows no
      runaway blocks.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Link: http://lkml.kernel.org/r/20181120050617.4119-1-andi@firstfloor.org
      [ Resolved conflict with dd2e18e9 ("perf tools: Support 'srccode' output") ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      61f61159
    • Jiri Olsa's avatar
      perf python: Do not force closing original perf descriptor in evlist.get_pollfd() · a389aece
      Jiri Olsa authored
      Ondřej reported that when compiled with python3, the python extension
      regresses in evlist.get_pollfd function behaviour.
      
      The evlist.get_pollfd function creates file objects from evlist's fds
      and returns them in a list. The python3 version also sets them to 'close
      the original descriptor' when the object dies (is closed), by passing
      True via the 'closefd' arg in the PyFile_FromFd call.
      
      The python's closefd doc says:
      
        If closefd is False, the underlying file descriptor will be kept open
        when the file is closed.
      
      That's why the following line in python3 closes all evlist fds:
      
        evlist.get_pollfd()
      
      the returned list is immediately destroyed and that takes down the
      original events fds.
      
      Passing closefd as False to PyFile_FromFd to fix this.
      Reported-by: default avatarOndřej Lysoněk <olysonek@redhat.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jaroslav Škarvada <jskarvad@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Fixes: 66dfdff0 ("perf tools: Add Python 3 support")
      Link: http://lkml.kernel.org/r/20181226112121.5285-1-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a389aece
    • Colin Ian King's avatar
      perf trace: Use correct SECCOMP prefix spelling, "SECOMP_*" -> "SECCOMP_*" · fbe7e425
      Colin Ian King authored
      The spelling of the SECCOMP is incorrect, fix these.
      Signed-off-by: default avatarColin King <colin.king@canonical.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: kernel-janitors@vger.kernel.org
      Fixes: c65c83ff ("perf trace: Allow asking for not suppressing common string prefixes")
      Link: http://lkml.kernel.org/r/20181221084809.6108-1-colin.king@canonical.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fbe7e425
  2. 21 Dec, 2018 4 commits
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Do not hardcode the size of the tracepoint common_ fields · b9b6a2ea
      Arnaldo Carvalho de Melo authored
      We shouldn't hardcode the size of the tracepoint common_ fields, use the
      offset of the 'id'/'__syscallnr' field in the sys_enter event instead.
      
      This caused the augmented syscalls code to fail on a particular build of a
      PREEMPT_RT_FULL kernel where these extra 'common_migrate_disable' and
      'common_padding' fields were before the syscall id one:
      
        # cat /sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/format
        name: sys_enter
        ID: 22
        format:
      	field:unsigned short common_type;	offset:0;	size:2;	signed:0;
      	field:unsigned char common_flags;	offset:2;	size:1;	signed:0;
      	field:unsigned char common_preempt_count;	offset:3;	size:1;	signed:0;
      	field:int common_pid;	offset:4;	size:4;	signed:1;
      	field:unsigned short common_migrate_disable;	offset:8;	size:2;	signed:0;
      	field:unsigned short common_padding;	offset:10;	size:2;	signed:0;
      
      	field:long id;	offset:16;	size:8;	signed:1;
      	field:unsigned long args[6];	offset:24;	size:48;	signed:0;
      
        print fmt: "NR %ld (%lx, %lx, %lx, %lx, %lx, %lx)", REC->id, REC->args[0], REC->args[1], REC->args[2], REC->args[3], REC->args[4], REC->args[5]
        #
      
      All those 'common_' prefixed fields are zeroed when they hit a BPF tracepoint
      hook, we better just discard those, i.e. somehow pass an offset to the
      BPF program from the start of the ctx and make adjustments in the 'perf trace'
      handlers to adjust the offset of the syscall arg offsets obtained from tracefs.
      
      Till then, fix it the quick way and add this to the augmented_raw_syscalls.c to
      bet it to work in such kernels:
      
        diff --git a/tools/perf/examples/bpf/augmented_raw_syscalls.c b/tools/perf/examples/bpf/augmented_raw_syscalls.c
        index 53c233370fae..1f746f931e13 100644
        --- a/tools/perf/examples/bpf/augmented_raw_syscalls.c
        +++ b/tools/perf/examples/bpf/augmented_raw_syscalls.c
        @@ -38,12 +38,14 @@ struct bpf_map SEC("maps") syscalls = {
      
         struct syscall_enter_args {
                unsigned long long common_tp_fields;
        +       long               rt_common_tp_fields;
                long               syscall_nr;
                unsigned long      args[6];
         };
      
         struct syscall_exit_args {
                unsigned long long common_tp_fields;
        +       long               rt_common_tp_fields;
                long               syscall_nr;
                long               ret;
         };
      
      Just to check that this was the case. Fix it properly later, for now remove the
      hardcoding of the offset in the 'perf trace' side and document the situation
      with this patch.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-2pqavrktqkliu5b9nzouio21@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b9b6a2ea
    • Stanislav Fomichev's avatar
      perf build: Don't unconditionally link the libbfd feature test to -liberty and -lz · 14541b1e
      Stanislav Fomichev authored
      Current libbfd feature test unconditionally links against -liberty and -lz.
      While it's required on some systems (e.g. opensuse), it's completely
      unnecessary on the others, where only -lbdf is sufficient (debian).
      This patch streamlines (and renames) the following feature checks:
      
      feature-libbfd           - only link against -lbfd (debian),
                                 see commit 2cf90407 ("perf tools: Fix bfd
      			   dependency libraries detection")
      feature-libbfd-liberty   - link against -lbfd and -liberty
      feature-libbfd-liberty-z - link against -lbfd, -liberty and -lz (opensuse),
                                 see commit 280e7c48 ("perf tools: fix BFD
      			   detection on opensuse")
      
      (feature-liberty{,-z} were renamed to feature-libbfd-liberty{,z}
      for clarity)
      
      The main motivation is to fix this feature test for bpftool which is
      currently broken on debian (libbfd feature shows OFF, but we still
      unconditionally link against -lbfd and it works).
      
      Tested on debian with only -lbfd installed (without -liberty); I'd
      appreciate if somebody on the other systems can test this new detection
      method.
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/4dfc634cfcfb236883971b5107cf3c28ec8a31be.1542328222.git.sdf@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      14541b1e
    • Arnaldo Carvalho de Melo's avatar
      perf beauty mmap: PROT_WRITE should come before PROT_EXEC · 5ce29d52
      Arnaldo Carvalho de Melo authored
      To match strace output:
      
        # cat mmap.c
        #include <sys/mman.h>
      
        int main(void)
        {
      	  mmap(0, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
      	  return 0;
        }
        # strace -e mmap ./mmap |& grep -v ^+++
        mmap(NULL, 103484, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5bae400000
        mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5bae3fe000
        mmap(NULL, 3889792, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5bade40000
        mmap(0x7f5bae1ec000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ac000) = 0x7f5bae1ec000
        mmap(0x7f5bae1f2000, 14976, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f5bae1f2000
        mmap(NULL, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5bae419000
        # trace -e mmap ./mmap |& grep -v ^+++
        mmap(NULL, 103484, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f6646c25000
        mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS) = 0x7f6646c23000
        mmap(NULL, 3889792, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f6646665000
        mmap(0x7f6646a11000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ac000) = 0x7f6646a11000
        mmap(0x7f6646a17000, 14976, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS) = 0x7f6646a17000
        mmap(NULL, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS) = 0x7f6646c3e000
        #
      Reported-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-nt49d6iqle80cw8f529ovaqi@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5ce29d52
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Check if the raw_syscalls:sys_{enter,exit} are setup before setting tp filter · f76214f9
      Arnaldo Carvalho de Melo authored
      While updating 'perf trace' on an machine with an old precompiled
      augmented_raw_syscalls.o that didn't setup the syscall map the new 'perf
      trace' codebase notices the augmented_raw_syscalls.o eBPF event, decides
      to use it instead of the old raw_syscalls:sys_{enter,exit} method, but
      then because we don't have the syscall map tries to set the tracepoint
      filter on the sys_{enter,exit} evsels, that are NULL, segfaulting.
      
      Make the code more robust by checking it those tracepoints have
      their respective evsels in place before trying to set the tp filter.
      
      With this we still get everything to work, just not setting up the
      syscall filters, which is better than a segfault. Now to update the
      precompiled augmented_raw_syscalls.o and continue development :-)
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-3ft5rjdl05wgz2pwpx2z8btu@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f76214f9
  3. 20 Dec, 2018 1 commit
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-4.21-20181218' of... · 883f4def
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-4.21-20181218' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      - Implement BPF based syscall filtering in 'perf trace', using BPF maps and
        the augmented_raw_syscalls.c BPF proggie (Arnaldo Carvalho de Melo)
      
      - Allow specifying in .perfconfig a set of events use in 'perf trace' in
        addition to any other specified from the command line. This initially
        will be used to always use the augmented_raw_syscalls.o precompiled
        BPF program for getting pointer contents. (Arnaldo Carvalho de Melo)
      
      - Allow fine grained control about how the syscall output should be
        formatted. This will be used to allow producing the same output produced
        by the 'strace' tool, to then use in regression tests comparing the
        output of 'perf trace' with the one produced from 'strace' (Arnaldo Carvalho de Melo)
      
      - Beautify the renameat2 olddirfd, newdirfd and flags arguments (Arnaldo Carvalho de Melo)
      
      - Beautify arch_prctl 'code' syscall arg (Arnaldo Carvalho de Melo)
      
      - Beautify fadvise64 'advice' syscall arg (Arnaldo Carvalho de Melo)
      
      - Relax checks on perf-PID.map ownership, resulting in symbols in
        executable anonymous maps setup by JITs in things like node.js to
        be resolved in a 'perf top' session run by root without the need
        for --force to be used (Arnaldo Carvalho de Melo)
      
      - Update asm-generic/unistd.h copy (Arnaldo Carvalho de Melo)
      
      - Do not use the first and last symbols when setting up address filters in
        auxtrace, this fails when we don't have a symbol table, filter the entire
        area based on the dso size. (Adrian Hunter)
      
      - Do not use kernel headers to build libsubcmd, we shouldn't use
        anything from outside tools/, fixes the build with the Android NDK (Arnaldo Carvalho de Melo)
      
      - Add several prototypes for systems lacking those, such as open_memstream(),
        sigqueue(), fixing warnings building with Android's bionic libc that were
        preventing the use of -Werror there (Arnaldo Carvalho de Melo)
      
      - Use LDFLAGS in the libtraceevent build commands, allowing developers
        to override its values (Jiri Olsa)
      
      - Link libperf-jvmti.so with LDFLAGS variable, allowing distro
        packages to propagate its settings when building this library (Jiri Olsa)
      
      - cs-etm (ARM CoreSight) fixes: (Leo Yan)
      
        - Correct packets swapping in cs_etm__flush()
        - Avoid stale branch samples when flush packet
        - Remove unused 'trace_on' in cs_etm_decoder
        - Refactor enumeration cs_etm_sample_type
        - Rename CS_ETM_TRACE_ON to CS_ETM_DISCONTINUITY
        - Treat NO_SYNC element as trace discontinuity
        - Treat EO_TRACE element as trace discontinuity
        - Generate branch sample for exception packet
      
      - Use shebangs in the 'perf test' shell scripts, making them identifiable as
        shell scripts (Michael Petlan)
      
      - Avoid segfaults caused by negated options in 'perf stat' (Michael Petlan)
      
      - Fix processing of dereferenced args in bprintk events in libtracevent (Steven Rostedt)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      883f4def
  4. 18 Dec, 2018 23 commits