1. 28 12月, 2020 9 次提交
    • H
      perf record: Tweak "Lowering..." warning in record_opts__config_freq · c07b45a3
      Hans-Peter Nilsson 提交于
      That is, instead of "Lowering default frequency rate to <F>" say
      "Lowering default frequency rate from <f> to <F>", specifying the
      overridden default frequency <f>, so you don't have to grep through the
      source to "remember" that was e.g. 4000.
      Signed-off-by: NHans-Peter Nilsson <hp@axis.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20201228031908.B049B203B5@pchp3.se.axis.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c07b45a3
    • J
      perf tools: Add support to display build ids when available in PERF_RECORD_MMAP2 events · 0b5c8821
      Jiri Olsa 提交于
      Add support to display the build id in PERF_RECORD_MMAP2 events, when
      available:
      
        $ perf script --show-mmap-events | head -4
        swapper ... @ 0xffffffff81000000 <ff1969b3ba5e43911208bb46fa7d5b1eb809e422>]: ---p [kernel.kallsyms]_text
        swapper ... @ 0 <5f62adb730272c9417883ae8b8a8ec224df8cddd>]: ---p /lib/modules/5.9.0-rc5buildid+/kernel/drivers/firmware/qemu_fw_cfg.ko
        swapper ... @ 0 <c9ac6e1dafc1ebdadb048f967854e810706c8bab>]: ---p /lib/modules/5.9.0-rc5buildid+/kernel/drivers/char/virtio_console.ko
        swapper ... @ 0 <86441a4c5b2c2ff5b440682f4c612bd4b426eb5c>]: ---p /lib/modules/5.9.0-rc5buildid+/kernel/lib/libcrc32c.ko
      
        $ perf report -D | grep MMAP2 | head -4
        0 0 ... @ 0xffffffff81000000 <ff1969b3ba5e43911208bb46fa7d5b1eb809e422>]: ---p [kernel.kallsyms]_text
        0 0 ... @ 0 <5f62adb730272c9417883ae8b8a8ec224df8cddd>]: ---p /lib/modules/5.9.0-rc5buildid+/kernel/drivers/firmware/qemu_fw_cfg.ko
        0 0 ... @ 0 <c9ac6e1dafc1ebdadb048f967854e810706c8bab>]: ---p /lib/modules/5.9.0-rc5buildid+/kernel/drivers/char/virtio_console.ko
        0 0 ... @ 0 <86441a4c5b2c2ff5b440682f4c612bd4b426eb5c>]: ---p /lib/modules/5.9.0-rc5buildid+/kernel/lib/libcrc32c.ko
      
      Adding build id data into <> brackets.
      
      Committer testing:
      
        $ perf record -vv --buildid-mmap sleep 1 |& grep -m1 build
        Enabling build id in mmap2 events.
        $ perf evlist -v
        cycles:u: size: 120, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|PERIOD, read_format: ID, disabled: 1, inherit: 1, exclude_kernel: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1, build_id: 1
        $
        $ perf script --show-mmap-events | head -4
                 sleep 274800  2843.556112: PERF_RECORD_MMAP2 274800/274800: [0x564e2fd32000(0x3000) @ 0x2000 <c37cb90b77c79fc719798b066d78ef121285843e>]: r-xp /usr/bin/sleep
                 sleep 274800  2843.556129: PERF_RECORD_MMAP2 274800/274800: [0x7fa9550d7000(0x21000) @ 0x1000 <fc190f17c4f4dc4a8a26df18eaeed41ecdb2c61b>]: r-xp /usr/lib64/ld-2.32.so
                 sleep 274800  2843.556140: PERF_RECORD_MMAP2 274800/274800: [0x7ffd8fa96000(0x2000) @ 0 00:00 0 0]: r-xp [vdso]
                 sleep 274800  2843.556162:          1 cycles:u:  ffffffffbb26bff4 [unknown] ([unknown])
        $
        $ perf buildid-list -i /usr/bin/sleep
        c37cb90b77c79fc719798b066d78ef121285843e
        $ perf buildid-list -i /usr/lib64/ld-2.32.so
        fc190f17c4f4dc4a8a26df18eaeed41ecdb2c61b
      
      And now on a system wide session to check the build ids synthesized for
      the kernel and some kernel modules:
      
        # perf record -a --buildid-mmap sleep 2s
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.717 MB perf.data ]
        # perf script --show-mmap-events | head -4
                 swapper     0 [000]     0.000000: PERF_RECORD_MMAP2 -1/0: [0xffffffffbb000000(0xe02557) @ 0xffffffffbb000000 <e71ac4b0b0631c27181dab25d63be18dad02feb8>]: ---p [kernel.kallsyms]_text
                 swapper     0 [000]     0.000000: PERF_RECORD_MMAP2 -1/0: [0xffffffffc01dc000(0x6000) @ 0 <36d21515c0b22eb2859b6419a6cdf87ef4cd01c8>]: ---p /lib/modules/5.11.0-rc1+/kernel/drivers/i2c/i2c-dev.ko
                 swapper     0 [000]     0.000000: PERF_RECORD_MMAP2 -1/0: [0xffffffffc01eb000(0x24000) @ 0 <c4fbfea32d0518b3e7879de8deca40ea142bb782>]: ---p /lib/modules/5.11.0-rc1+/kernel/fs/fuse/fuse.ko
                 swapper     0 [000]     0.000000: PERF_RECORD_MMAP2 -1/0: [0xffffffffc0210000(0x7000) @ 0 <dd6cfb10ae66aa7b1e7b37000a004004be8092e0>]: ---p /lib/modules/5.11.0-rc1+/kernel/drivers/block/zram/zram.ko
        # perf buildid-list -h kernel
      
         Usage: perf buildid-list [<options>]
      
            -k, --kernel          Show current kernel build id
      
        # perf buildid-list --kernel
        e71ac4b0b0631c27181dab25d63be18dad02feb8
        # file /lib/modules/5.11.0-rc1+/kernel/drivers/i2c/i2c-dev.ko
        /lib/modules/5.11.0-rc1+/kernel/drivers/i2c/i2c-dev.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), BuildID[sha1]=36d21515c0b22eb2859b6419a6cdf87ef4cd01c8, with debug_info, not stripped
        # perf buildid-list -i /lib/modules/5.11.0-rc1+/kernel/drivers/i2c/i2c-dev.ko
        36d21515c0b22eb2859b6419a6cdf87ef4cd01c8
        # perf buildid-list -i /lib/modules/5.11.0-rc1+/kernel/fs/fuse/fuse.ko
        c4fbfea32d0518b3e7879de8deca40ea142bb782
        # perf buildid-list -i /lib/modules/5.11.0-rc1+/kernel/drivers/block/zram/zram.ko
        dd6cfb10ae66aa7b1e7b37000a004004be8092e0
        #
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NIan Rogers <irogers@google.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Budankov <abudankov@huawei.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20201214105457.543111-12-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0b5c8821
    • J
      perf record: Add --buildid-mmap option to enable PERF_RECORD_MMAP2's build id · e29386c8
      Jiri Olsa 提交于
      Add --buildid-mmap option to enable build id in PERF_RECORD_MMAP2 events.
      
      It will only work if there's kernel support for that and it disables
      build id cache (implies --no-buildid).
      
      It's also possible to enable it permanently via config option in
      ~/.perfconfig file:
      
        [record]
        build-id=mmap
      
      Also added build_id bit in the verbose output for perf_event_attr:
      
        # perf record --buildid-mmap -vv
        ...
        perf_event_attr:
          type                             1
          size                             120
          ...
          build_id                         1
      
      Adding also missing text_poke bit.
      
      Committer testing:
      
        $ perf record -h build
      
         Usage: perf record [<options>] [<command>]
            or: perf record [<options>] -- <command> [<options>]
      
            -B, --no-buildid      do not collect buildids in perf.data
            -N, --no-buildid-cache
                                  do not update the buildid cache
                --buildid-all     Record build-id of all DSOs regardless of hits
                --buildid-mmap    Record build-id in map events
      
        $
      
        $ perf record --buildid-mmap sleep 1
        Failed: no support to record build id in mmap events, update your kernel.
        $
      
      After adding the needed kernel bits in a test kernel:
      
        $ perf record -vv --buildid-mmap sleep 1 |& grep -m1 build
        Enabling build id in mmap2 events.
        $ perf evlist -v
        cycles:u: size: 120, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|PERIOD, read_format: ID, disabled: 1, inherit: 1, exclude_kernel: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1, build_id: 1
        $
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NIan Rogers <irogers@google.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Budankov <abudankov@huawei.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20201214105457.543111-16-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e29386c8
    • J
      perf tools: Allow synthesizing the build id for kernel/modules/tasks in PERF_RECORD_MMAP2 · 4183a8d7
      Jiri Olsa 提交于
      Adding build id to synthesized mmap2 events for everything -
      kernel/modules/tasks, when symbol_conf.buildid_mmap2 is true.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Budankov <abudankov@huawei.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20201214105457.543111-11-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4183a8d7
    • J
      perf tools: Allow using PERF_RECORD_MMAP2 to synthesize the kernel modules maps · e0dbf18f
      Jiri Olsa 提交于
      Allow using PERF_RECORD_MMAP2 to synthesize the kernel modules maps so
      that we can use PERF_RECORD_MMAP2 to encode the kernel modules build ids
      in the following csets.
      
      It's enabled by a new symbol_conf.buildid_mmap2 bool field, which will
      be switchable in following changes.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NIan Rogers <irogers@google.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Budankov <abudankov@huawei.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20201214105457.543111-10-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e0dbf18f
    • J
      perf tools: Allow using PERF_RECORD_MMAP2 to synthesize the kernel map · 978410ff
      Jiri Olsa 提交于
      Allow using PERF_RECORD_MMAP2 to synthesize the kernel map so that we
      can use PERF_RECORD_MMAP2 to encode the kernel build id in the following
      csets.
      
      It's enabled by a new symbol_conf.buildid_mmap2 bool field, which will
      be switchable in following changes.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Budankov <abudankov@huawei.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20201214105457.543111-9-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      978410ff
    • J
      perf tools: Store build id when available in PERF_RECORD_MMAP2 metadata events · 1ca6e802
      Jiri Olsa 提交于
      When processing a PERF_RECORD_MMAP2 metadata event, check on the build
      id misc bit: PERF_RECORD_MISC_MMAP_BUILD_ID and if it is set, store the
      build id in mmap's dso object.
      
      Also adding the build id data to struct perf_record_mmap2 event
      definition.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Budankov <abudankov@huawei.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20201214105457.543111-8-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1ca6e802
    • J
      perf tools: Do not swap mmap2 fields in case it contains build id · 29245ae8
      Jiri Olsa 提交于
      If the PERF_RECORD_MISC_MMAP_BUILD_ID misc bit is set, mmap2 events
      carries a build id, placed in the following union:
      
        union {
                struct {
                        u32       maj;
                        u32       min;
                        u64       ino;
                        u64       ino_generation;
                };
                struct {
                        u8        build_id_size;
                        u8        __reserved_1;
                        u16       __reserved_2;
                        u8        build_id[20];
                };
        };
      
      In this case we can't swap above fields.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Budankov <abudankov@huawei.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20201214105457.543111-6-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      29245ae8
    • L
      perf probe: Fixup Arm64 SDT arguments · f19b5872
      Leo Yan 提交于
      Arm64 ELF section '.note.stapsdt' uses string format "-4@[sp, NUM]" if
      the probe is to access data in stack, e.g. below is an example for
      dumping Arm64 ELF file and shows the argument format:
      
        Arguments: -4@[sp, 12] -4@[sp, 8] -4@[sp, 4]
      
      Comparing against other archs' argument format, Arm64's argument
      introduces an extra space character in the middle of square brackets,
      due to argv_split() uses space as splitter, the argument is wrongly
      divided into two items.
      
      To support Arm64 SDT, this patch fixes up for this case, if any item
      contains sub string "[sp", concatenates the two continuous items.  And
      adds the detailed explaination in comment.
      Signed-off-by: NLeo Yan <leo.yan@linaro.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Truong <alexandre.truong@arm.com>
      Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
      Cc: He Zhe <zhe.he@windriver.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lore.kernel.org/lkml/20201225052751.24513-3-leo.yan@linaro.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f19b5872
  2. 24 12月, 2020 12 次提交
  3. 20 12月, 2020 2 次提交
    • K
      perf sort: Add sort option for data page size · a50d03e3
      Kan Liang 提交于
      Add a new sort option "data_page_size" for --mem-mode sort.  With this
      option applied, perf can sort and report by sample's data page size.
      
      Here is an example:
      
      perf report --stdio --mem-mode
      --sort=comm,symbol,phys_daddr,data_page_size
      
       # To display the perf.data header info, please use
       # --header/--header-only options.
       #
       #
       # Total Lost Samples: 0
       #
       # Samples: 9K of event 'mem-loads:uP'
       # Total weight : 9028
       # Sort order   : comm,symbol,phys_daddr,data_page_size
       #
       # Overhead  Command  Symbol                        Data Physical
       # Address
       # Data Page Size
       # ........  .......  ............................
       # ......................  ......................
       #
          11.19%  dtlb     [.] touch_buffer              [.] 0x00000003fec82ea8  4K
           8.61%  dtlb     [.] GetTickCount              [.] 0x00000003c4f2c8a8  4K
           4.52%  dtlb     [.] GetTickCount              [.] 0x00000003fec82f58  4K
           4.33%  dtlb     [.] __gettimeofday            [.] 0x00000003fec82f48  4K
           4.32%  dtlb     [.] GetTickCount              [.] 0x00000003fec82f78  4K
           4.28%  dtlb     [.] GetTickCount              [.] 0x00000003fec82f50  4K
           4.23%  dtlb     [.] GetTickCount              [.] 0x00000003fec82f70  4K
           4.11%  dtlb     [.] GetTickCount              [.] 0x00000003fec82f68  4K
           4.00%  dtlb     [.] Calibrate                 [.] 0x00000003fec82f98  4K
           3.91%  dtlb     [.] Calibrate                 [.] 0x00000003fec82f90  4K
           3.43%  dtlb     [.] touch_buffer              [.] 0x00000003fec82e98  4K
           3.42%  dtlb     [.] touch_buffer              [.] 0x00000003fec82e90  4K
           0.09%  dtlb     [.] DoDependentLoads          [.] 0x000000036ea084c0  2M
           0.08%  dtlb     [.] DoDependentLoads          [.] 0x000000032b010b80  2M
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lore.kernel.org/lkml/20201216185805.9981-3-kan.liang@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a50d03e3
    • K
      perf script: Support data page size · 6b9bae63
      Kan Liang 提交于
      Display the data page size if it is available and asked by the user:
      
      Can be configured by the user, for example:
      
        perf script --fields comm,event,phys_addr,data_page_size
                  dtlb mem-loads:uP:        3fec82ea8 4K
                  dtlb mem-loads:uP:        3fec82e90 4K
                  dtlb mem-loads:uP:        3e23700a4 4K
                  dtlb mem-loads:uP:        3fec82f20 4K
                  dtlb mem-loads:uP:        3e23700a4 4K
                  dtlb mem-loads:uP:        3b4211bec 4K
                  dtlb mem-loads:uP:        382205dc0 2M
                  dtlb mem-loads:uP:        36fa082c0 2M
                  dtlb mem-loads:uP:        377607340 2M
                  dtlb mem-loads:uP:        330010180 2M
                  dtlb mem-loads:uP:        33200fd80 2M
                  dtlb mem-loads:uP:        31b012b80 2M
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lore.kernel.org/lkml/20201216185805.9981-2-kan.liang@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6b9bae63
  4. 18 12月, 2020 14 次提交
    • J
      perf tools: Add support to read build id from compressed elf · 47dce51a
      Jiri Olsa 提交于
      Adding support to decompress file before reading build id.
      
      Adding filename__read_build_id and change its current versions to
      read_build_id.
      
      Shutting down stderr output of perf list in the shell test:
        82: Check open filename arg using perf trace + vfs_getname          : Ok
      
      because with decompression code in the place we the
      filename__read_build_id function is more verbose in case
      of error and the test did not account for that.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Budankov <abudankov@huawei.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20201214105457.543111-7-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      47dce51a
    • J
      perf debug: Add debug_set_file function · 8abceacf
      Jiri Olsa 提交于
      Allow to set debug output file via new debug_set_file function.
      
      It's called during perf startup in perf_debug_setup to set stderr file
      as default and any perf command can set it later to different file.
      
      It will be used in perf daemon command to get verbose output into log
      file.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Budankov <abudankov@huawei.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20201212104358.412065-2-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8abceacf
    • J
      perf tools: Add evlist__disable_evsel/evlist__enable_evsel · 7cfcd1e0
      Jiri Olsa 提交于
      Adding interface to enable/disable single event in the evlist based on
      its name. It will be used later in new control enable/disable interface.
      
      Keeping the evlist::enabled true when one or more events are enabled so
      the toggle can work properly and toggle evlist to disabled state.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NAlexei Budankov <abudankov@huawei.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20201210204330.233864-2-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7cfcd1e0
    • J
      perf metricgroup: Support adding metrics for system PMUs · be335ec2
      John Garry 提交于
      Currently adding metrics for core- or uncore-based events matched by CPUID
      is supported.
      
      Extend this for system events.
      Signed-off-by: NJohn Garry <john.garry@huawei.com>
      Acked-by: NKajol Jain <kjain@linux.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxarm@huawei.com
      Link: http://lore.kernel.org/lkml/1607080216-36968-10-git-send-email-john.garry@huawei.com
      [ Reorder 'struct metricgroup_add_iter_data' field to avoid alignment holes ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      be335ec2
    • J
      perf metricgroup: Support printing metric groups for system PMUs · a36fadb1
      John Garry 提交于
      Currently printing metricgroups for core- or uncore-based events matched
      by CPUID is supported.
      
      Extend this for system events.
      Signed-off-by: NJohn Garry <john.garry@huawei.com>
      Acked-by: NKajol Jain <kjain@linux.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxarm@huawei.com
      Link: http://lore.kernel.org/lkml/1607080216-36968-9-git-send-email-john.garry@huawei.com
      [ Reorder 'struct metricgroup_print_sys_idata' field to avoid alignment holes ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a36fadb1
    • J
      perf metricgroup: Split up metricgroup__print() · f6fe1e48
      John Garry 提交于
      To aid supporting system event metric groups, break up the function
      metricgroup__print() into a part which iterates metrics and a part which
      actually "prints" the metric.
      
      No functional change intended.
      Signed-off-by: NJohn Garry <john.garry@huawei.com>
      Acked-by: NKajol Jain <kjain@linux.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxarm@huawei.com
      Link: http://lore.kernel.org/lkml/1607080216-36968-8-git-send-email-john.garry@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f6fe1e48
    • J
      perf metricgroup: Fix metrics using aliases covering multiple PMUs · c2337d67
      John Garry 提交于
      Support for metric expressions using aliases which cover multiple PMUs
      is broken. Consider the following test metric expression:
      
        "MetricExpr": "UNC_CBO_XSNP_RESPONSE.MISS_XCORE * UNC_CBO_XSNP_RESPONSE.MISS_EVICTION"
      
      When used on my broadwell, "perf stat" gives:
      
        unc_cbo_xsnp_response.miss_eviction -> uncore_cbox_1/umask=0x81,event=0x22/
        unc_cbo_xsnp_response.miss_eviction -> uncore_cbox_0/umask=0x81,event=0x22/
        unc_cbo_xsnp_response.miss_xcore -> uncore_cbox_1/umask=0x41,event=0x22/
        unc_cbo_xsnp_response.miss_xcore -> uncore_cbox_0/umask=0x41,event=0x22/
        Control descriptor is not initialized
        unc_cbo_xsnp_response.miss_eviction: 3645925 1000850523 1000850523
        unc_cbo_xsnp_response.miss_xcore: 106850 1000850523 1000850523
      
         Performance counter stats for 'system wide':
      
                 3,645,925      unc_cbo_xsnp_response.miss_eviction # 389567086250.00 test_metric_inc
                   106,850      unc_cbo_xsnp_response.miss_xcore
      
               1.000883096 seconds time elapsed
      
      Notice that only the results from one PMU are included. Fix the logic of
      find_evsel_group() to enable events which apply to multiple PMUs, by
      checking if the event pmu_name matches that of the metric event.
      
      With that, "perf stat" now gives:
      
        unc_cbo_xsnp_response.miss_eviction -> uncore_cbox_1/umask=0x81,event=0x22/
        unc_cbo_xsnp_response.miss_eviction -> uncore_cbox_0/umask=0x81,event=0x22/
        unc_cbo_xsnp_response.miss_xcore -> uncore_cbox_1/umask=0x41,event=0x22/
        unc_cbo_xsnp_response.miss_xcore -> uncore_cbox_0/umask=0x41,event=0x22/
        Control descriptor is not initialized
        unc_cbo_xsnp_response.miss_eviction: 4237983 1000904100 1000904100
        unc_cbo_xsnp_response.miss_xcore: 218643 1000904100 1000904100
        unc_cbo_xsnp_response.miss_eviction: 4254148 1000902629 1000902629
        unc_cbo_xsnp_response.miss_xcore: 213352 1000902629 1000902629
      
         Performance counter stats for 'system wide':
      
                 4,237,983      unc_cbo_xsnp_response.miss_eviction # 3668558131345.00 test_metric_inc
                   218,643      unc_cbo_xsnp_response.miss_xcore
                 4,254,148      unc_cbo_xsnp_response.miss_eviction
                   213,352      unc_cbo_xsnp_response.miss_xcore
      
               1.000938151 seconds time elapsed
      Signed-off-by: NJohn Garry <john.garry@huawei.com>
      Acked-by: NKajol Jain <kjain@linux.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxarm@huawei.com
      Link: http://lore.kernel.org/lkml/1607080216-36968-7-git-send-email-john.garry@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c2337d67
    • J
      perf evlist: Change evlist__splice_list_tail() ordering · 6d2783fe
      John Garry 提交于
      Function find_evsel_group() expects events to be ordered such that they
      are grouped after their leader.
      
      Modify evlist__splice_list_tail() to guarantee this (ordering).
      
      [Should prob also change the function name]
      Signed-off-by: NJohn Garry <john.garry@huawei.com>
      Acked-by: NKajol Jain <kjain@linux.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxarm@huawei.com
      Link: http://lore.kernel.org/lkml/1607080216-36968-6-git-send-email-john.garry@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6d2783fe
    • J
      perf pmu: Add pmu_add_sys_aliases() · 4513c719
      John Garry 提交于
      Add pmu_add_sys_aliases() to add system PMU events aliases.
      
      For adding system PMU events, iterate through all the events for all SoC
      event tables in pmu_sys_event_tables[].
      
      Matches must satisfy both:
      - PMU identifier matches event "compat" value
      - event "Unit" member must match, same as uncore event aliases matched by
        CPUID
      Signed-off-by: NJohn Garry <john.garry@huawei.com>
      Acked-by: NKajol Jain <kjain@linux.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxarm@huawei.com
      Link: http://lore.kernel.org/lkml/1607080216-36968-5-git-send-email-john.garry@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4513c719
    • J
      perf pmu: Add pmu_id() · 51d54847
      John Garry 提交于
      Add a function to read the PMU id sysfs entry. This is only done for uncore
      PMUs where this would possibly be relevant.
      Signed-off-by: NJohn Garry <john.garry@huawei.com>
      Acked-by: NKajol Jain <kjain@linux.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxarm@huawei.com
      Link: http://lore.kernel.org/lkml/1607080216-36968-4-git-send-email-john.garry@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      51d54847
    • A
      perf evsel: Emit warning about kernel not supporting the data page size sample_type bit · 456ef4c1
      Arnaldo Carvalho de Melo 提交于
      Before we had this unhelpful message:
      
        $ perf record --data-page-size sleep 1
        Error:
        The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles:u).
        /bin/dmesg | grep -i perf may provide additional information.
        $
      
      Add support to the perf_missing_features variable to remember what
      caused evsel__open() to fail and then use that information in
      evsel__open_strerror().
      
        $ perf record --data-page-size sleep 1
        Error:
        Asking for the data page size isn't supported by this kernel.
        $
      
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lore.kernel.org/lkml/20201207170759.GB129853@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      456ef4c1
    • K
      perf record: Support new sample type for data page size · 542b88fd
      Kan Liang 提交于
      Support new sample type PERF_SAMPLE_DATA_PAGE_SIZE for page size.
      
      Add new option --data-page-size to record sample data page size.
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lore.kernel.org/lkml/20201130172803.2676-3-kan.liang@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      542b88fd
    • J
      perf unwind: Fix separate debug info files when using elfutils' libdw's unwinder · bf53fc6b
      Jan Kratochvil 提交于
      elfutils needs to be provided main binary and separate debug info file
      respectively. Providing separate debug info file instead of the main
      binary is not sufficient.
      
      One needs to try both supplied filename and its possible cache by its
      build-id depending on the use case.
      Signed-off-by: NJan Kratochvil <jan.kratochvil@redhat.com>
      Tested-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bf53fc6b
    • Z
      perf record: Fix memory leak when using '--user-regs=?' to list registers · 2eb5dd41
      Zheng Zengkai 提交于
      When using 'perf record's option '-I' or '--user-regs=' along with
      argument '?' to list available register names, memory of variable 'os'
      allocated by strdup() needs to be released before __parse_regs()
      returns, otherwise memory leak will occur.
      
      Fixes: bcc84ec6 ("perf record: Add ability to name registers to record")
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Li Bin <huawei.libin@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20200703093344.189450-1-zhengzengkai@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2eb5dd41
  5. 01 12月, 2020 3 次提交