1. 20 Jan, 2021 1 commit
    • Song Liu's avatar
      perf stat: Enable counting events for BPF programs · fa853c4b
      Song Liu authored
      Introduce 'perf stat -b' option, which counts events for BPF programs, like:
      
        [root@localhost ~]# ~/perf stat -e ref-cycles,cycles -b 254 -I 1000
           1.487903822            115,200      ref-cycles
           1.487903822             86,012      cycles
           2.489147029             80,560      ref-cycles
           2.489147029             73,784      cycles
           3.490341825             60,720      ref-cycles
           3.490341825             37,797      cycles
           4.491540887             37,120      ref-cycles
           4.491540887             31,963      cycles
      
      The example above counts 'cycles' and 'ref-cycles' of BPF program of id
      254.  This is similar to bpftool-prog-profile command, but more
      flexible.
      
      'perf stat -b' creates per-cpu perf_event and loads fentry/fexit BPF
      programs (monitor-progs) to the target BPF program (target-prog). The
      monitor-progs read perf_event before and after the target-prog, and
      aggregate the difference in a BPF map. Then the user space reads data
      from these maps.
      
      A new 'struct bpf_counter' is introduced to provide a common interface
      that uses BPF programs/maps to count perf events.
      
      Committer notes:
      
      Removed all but bpf_counter.h includes from evsel.h, not needed at all.
      
      Also BPF map lookups for PERCPU_ARRAYs need to have as its value receive
      buffer passed to the kernel libbpf_num_possible_cpus() entries, not
      evsel__nr_cpus(evsel), as the former uses
      /sys/devices/system/cpu/possible while the later uses
      /sys/devices/system/cpu/online, which may be less than the 'possible'
      number making the bpf map lookup overwrite memory and cause hard to
      debug memory corruption.
      
      We need to continue using evsel__nr_cpus(evsel) when accessing the
      perf_counts array tho, not to overwrite another are of memory :-)
      Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Link: https://lore.kernel.org/lkml/20210120163031.GU12699@kernel.org/Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: kernel-team@fb.com
      Link: http://lore.kernel.org/lkml/20201229214214.3413833-4-songliubraving@fb.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fa853c4b
  2. 15 Jan, 2021 2 commits
  3. 28 Dec, 2020 13 commits
    • Hans-Peter Nilsson's avatar
      perf record: Tweak "Lowering..." warning in record_opts__config_freq · c07b45a3
      Hans-Peter Nilsson authored
      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: default avatarHans-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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c07b45a3
    • Jiri Olsa's avatar
      perf buildid-list: Add support for mmap2's buildid events · d176db95
      Jiri Olsa authored
      Add buildid-list support for mmap2's build id data, so we can display
      build ids for dso objects for data without the build id cache update.
      
        $ perf buildid-list
        1805c738c8f3ec0f47b7ea09080c28f34d18a82b /usr/lib64/ld-2.31.so
        d278249792061c6b74d1693ca59513be1def13f2 /usr/lib64/libc-2.31.so
      
      By default only dso objects with hits are shown.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung 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-15-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d176db95
    • Jiri Olsa's avatar
      perf buildid-cache: Add --debuginfod option to specify a server to fetch debug files · e8a2061f
      Jiri Olsa authored
      Add the --debuginfod option to specify debuginfod URL and support to do
      that through config file as well.
      
      Use the following in ~/.perfconfig file:
      
        [buildid-cache]
        debuginfod=http://192.168.122.174:8002Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung 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-14-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e8a2061f
    • Jiri Olsa's avatar
      perf tools: Add support to display build ids when available in PERF_RECORD_MMAP2 events · 0b5c8821
      Jiri Olsa authored
      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: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0b5c8821
    • Jiri Olsa's avatar
      perf record: Add --buildid-mmap option to enable PERF_RECORD_MMAP2's build id · e29386c8
      Jiri Olsa authored
      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: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e29386c8
    • Jiri Olsa's avatar
      perf tools: Allow synthesizing the build id for kernel/modules/tasks in PERF_RECORD_MMAP2 · 4183a8d7
      Jiri Olsa authored
      Adding build id to synthesized mmap2 events for everything -
      kernel/modules/tasks, when symbol_conf.buildid_mmap2 is true.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4183a8d7
    • Jiri Olsa's avatar
      perf tools: Allow using PERF_RECORD_MMAP2 to synthesize the kernel modules maps · e0dbf18f
      Jiri Olsa authored
      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: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e0dbf18f
    • Jiri Olsa's avatar
      perf tools: Allow using PERF_RECORD_MMAP2 to synthesize the kernel map · 978410ff
      Jiri Olsa authored
      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: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      978410ff
    • Jiri Olsa's avatar
      perf tools: Store build id when available in PERF_RECORD_MMAP2 metadata events · 1ca6e802
      Jiri Olsa authored
      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: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1ca6e802
    • Jiri Olsa's avatar
      perf tools: Do not swap mmap2 fields in case it contains build id · 29245ae8
      Jiri Olsa authored
      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: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      29245ae8
    • Jiri Olsa's avatar
      tools headers uapi: Sync tools/include/uapi/linux/perf_event.h · dde587aa
      Jiri Olsa authored
      Syncing tools's uapi with mmap2 build id data changes.
      
      Committer notes:
      
      I'm taking the tools/ bits, so this will be in fact ahead of the kernel
      till the bpf/perf-kernel bits are merged.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung 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-5-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dde587aa
    • Leo Yan's avatar
      perf arm64: Add argument support for SDT · feab999e
      Leo Yan authored
      Now the two OP formats are used for SDT marker argument in Arm64 ELF,
      one format is general register xNUM (e.g. x1, x2, etc), another is for
      using stack pointer to access local variables (e.g. [sp], [sp, 8]).
      
      This patch adds support SDT marker argument for Arm64, it parses OP and
      converts to uprobe compatible format.
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.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: 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-4-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      feab999e
    • Leo Yan's avatar
      perf probe: Fixup Arm64 SDT arguments · f19b5872
      Leo Yan authored
      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: default avatarLeo 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f19b5872
  4. 27 Dec, 2020 8 commits
  5. 26 Dec, 2020 5 commits
  6. 25 Dec, 2020 5 commits
    • Linus Torvalds's avatar
      drm/amd/display: avoid uninitialized variable warning · 61d79136
      Linus Torvalds authored
      clang (quite rightly) complains fairly loudly about the newly added
      mpc1_get_mpc_out_mux() function returning an uninitialized value if the
      'opp_id' checks don't pass.
      
      This may not happen in practice, but the code really shouldn't return
      garbage if the sanity checks don't pass.
      
      So just initialize 'val' to zero to avoid the issue.
      
      Fixes: 110b055b ("drm/amd/display: add getter routine to retrieve mpcc mux")
      Cc: Josip Pavic <Josip.Pavic@amd.com>
      Cc: Bindu Ramamurthy <bindu.r@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      61d79136
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-2020-12-24' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux · 5814bc2d
      Linus Torvalds authored
      Pull more perf tools updates from Arnaldo Carvalho de Melo:
      
       - Refactor 'perf stat' per CPU/socket/die/thread aggregation fixing use
         cases in ARM machines.
      
       - Fix memory leak when synthesizing SDT probes in 'perf probe'.
      
       - Update kernel header copies related to KVM, epol_pwait. msr-index and
         powerpc and s390 syscall tables.
      
      * tag 'perf-tools-2020-12-24' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: (24 commits)
        perf probe: Fix memory leak when synthesizing SDT probes
        perf stat aggregation: Add separate thread member
        perf stat aggregation: Add separate core member
        perf stat aggregation: Add separate die member
        perf stat aggregation: Add separate socket member
        perf stat aggregation: Add separate node member
        perf stat aggregation: Start using cpu_aggr_id in map
        perf cpumap: Drop in cpu_aggr_map struct
        perf cpumap: Add new map type for aggregation
        perf stat: Replace aggregation ID with a struct
        perf cpumap: Add new struct for cpu aggregation
        perf cpumap: Use existing allocator to avoid using malloc
        perf tests: Improve topology test to check all aggregation types
        perf tools: Update s390's syscall.tbl copy from the kernel sources
        perf tools: Update powerpc's syscall.tbl copy from the kernel sources
        perf s390: Move syscall.tbl check into check-headers.sh
        perf powerpc: Move syscall.tbl check to check-headers.sh
        tools headers UAPI: Synch KVM's svm.h header with the kernel
        tools kvm headers: Update KVM headers from the kernel sources
        tools headers UAPI: Sync KVM's vmx.h header with the kernel sources
        ...
      5814bc2d
    • Linus Torvalds's avatar
      Merge branch 'for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux · 42dc45e8
      Linus Torvalds authored
      Pull coccinelle updates from Julia Lawall.
      
      * 'for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux:
        scripts: coccicheck: Correct usage of make coccicheck
        coccinelle: update expiring email addresses
        coccinnelle: Remove ptr_ret script
        kbuild: do not use scripts/ld-version.sh for checking spatch version
        remove boolinit.cocci
      42dc45e8
    • Michael Ellerman's avatar
      genirq: Fix export of irq_to_desc() for powerpc KVM · 11cc92eb
      Michael Ellerman authored
      Commit 64a1b95b ("genirq: Restrict export of irq_to_desc()") removed
      the export of irq_to_desc() unless powerpc KVM is being built, because
      there is still a use of irq_to_desc() in modular code there.
      
      However it used:
      
        #ifdef CONFIG_KVM_BOOK3S_64_HV
      
      Which doesn't work when that symbol is =m, leading to a build failure:
      
        ERROR: modpost: "irq_to_desc" [arch/powerpc/kvm/kvm-hv.ko] undefined!
      
      Fix it by checking for the definedness of the correct symbol which is
      CONFIG_KVM_BOOK3S_64_HV_MODULE.
      
      Fixes: 64a1b95b ("genirq: Restrict export of irq_to_desc()")
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      11cc92eb
    • Linus Torvalds's avatar
      Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 7bb5226c
      Linus Torvalds authored
      Pull misc vfs updates from Al Viro:
       "Assorted patches from previous cycle(s)..."
      
      * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        fix hostfs_open() use of ->f_path.dentry
        Make sure that make_create_in_sticky() never sees uninitialized value of dir_mode
        fs: Kill DCACHE_DONTCACHE dentry even if DCACHE_REFERENCED is set
        fs: Handle I_DONTCACHE in iput_final() instead of generic_drop_inode()
        fs/namespace.c: WARN if mnt_count has become negative
      7bb5226c
  7. 24 Dec, 2020 6 commits
    • Linus Torvalds's avatar
      Merge tag 'docs-5.11-2' of git://git.lwn.net/linux · 71c5f031
      Linus Torvalds authored
      Pull documentation fixes from Jonathan Corbet:
       "A small set of late-arriving, small documentation fixes"
      
      * tag 'docs-5.11-2' of git://git.lwn.net/linux:
        docs: admin-guide: Fix default value of max_map_count in sysctl/vm.rst
        Documentation/submitting-patches: Document the SoB chain
        Documentation: process: Correct numbering
        docs: submitting-patches: Trivial - fix grammatical error
      71c5f031
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 555a6e8c
      Linus Torvalds authored
      Pull ext4 updates from Ted Ts'o:
       "Various bug fixes and cleanups for ext4; no new features this cycle"
      
      * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (29 commits)
        ext4: remove unnecessary wbc parameter from ext4_bio_write_page
        ext4: avoid s_mb_prefetch to be zero in individual scenarios
        ext4: defer saving error info from atomic context
        ext4: simplify ext4 error translation
        ext4: move functions in super.c
        ext4: make ext4_abort() use __ext4_error()
        ext4: standardize error message in ext4_protect_reserved_inode()
        ext4: remove redundant sb checksum recomputation
        ext4: don't remount read-only with errors=continue on reboot
        ext4: fix deadlock with fs freezing and EA inodes
        jbd2: add a helper to find out number of fast commit blocks
        ext4: make fast_commit.h byte identical with e2fsprogs/fast_commit.h
        ext4: fix fall-through warnings for Clang
        ext4: add docs about fast commit idempotence
        ext4: remove the unused EXT4_CURRENT_REV macro
        ext4: fix an IS_ERR() vs NULL check
        ext4: check for invalid block size early when mounting a file system
        ext4: fix a memory leak of ext4_free_data
        ext4: delete nonsensical (commented-out) code inside ext4_xattr_block_set()
        ext4: update ext4_data_block_valid related comments
        ...
      555a6e8c
    • Linus Torvalds's avatar
      Merge tag 'Smack-for-5.11-io_uring-fix' of git://github.com/cschaufler/smack-next · 2f2fce3d
      Linus Torvalds authored
      Pull smack fix from Casey Schaufler:
       "Provide a fix for the incorrect handling of privilege in the face of
        io_uring's use of kernel threads. That invalidated an long standing
        assumption regarding the privilege of kernel threads.
      
        The fix is simple and safe. It was provided by Jens Axboe and has been
        tested"
      
      * tag 'Smack-for-5.11-io_uring-fix' of git://github.com/cschaufler/smack-next:
        Smack: Handle io_uring kernel thread privileges
      2f2fce3d
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 7a2fde8d
      Linus Torvalds authored
      Pull RISC-V fix from Palmer Dabbelt
       "Avoid trying to initialize memory regions outside the usable range"
      
      * tag 'riscv-for-linus-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        RISC-V: Fix usage of memblock_enforce_memory_limit
      7a2fde8d
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 9b3f7f1b
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Four commits fixing various things in the new C VDSO code
      
       - One fix for a 32-bit VMAP stack bug
      
       - Two minor build fixes
      
      Thanks to Cédric Le Goater, Christophe Leroy, and Will Springer.
      
      * tag 'powerpc-5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/32: Fix vmap stack - Properly set r1 before activating MMU on syscall too
        powerpc/vdso: Fix DOTSYM for 32-bit LE VDSO
        powerpc/vdso: Don't pass 64-bit ABI cflags to 32-bit VDSO
        powerpc/vdso: Block R_PPC_REL24 relocations
        powerpc/smp: Add __init to init_big_cores()
        powerpc/time: Force inlining of get_tb()
        powerpc/boot: Fix build of dts/fsl
      9b3f7f1b
    • Linus Torvalds's avatar
      Merge tag 'irq-core-2020-12-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 3913d00a
      Linus Torvalds authored
      Pull irq updates from Thomas Gleixner:
       "This is the second attempt after the first one failed miserably and
        got zapped to unblock the rest of the interrupt related patches.
      
        A treewide cleanup of interrupt descriptor (ab)use with all sorts of
        racy accesses, inefficient and disfunctional code. The goal is to
        remove the export of irq_to_desc() to prevent these things from
        creeping up again"
      
      * tag 'irq-core-2020-12-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (30 commits)
        genirq: Restrict export of irq_to_desc()
        xen/events: Implement irq distribution
        xen/events: Reduce irq_info:: Spurious_cnt storage size
        xen/events: Only force affinity mask for percpu interrupts
        xen/events: Use immediate affinity setting
        xen/events: Remove disfunct affinity spreading
        xen/events: Remove unused bind_evtchn_to_irq_lateeoi()
        net/mlx5: Use effective interrupt affinity
        net/mlx5: Replace irq_to_desc() abuse
        net/mlx4: Use effective interrupt affinity
        net/mlx4: Replace irq_to_desc() abuse
        PCI: mobiveil: Use irq_data_get_irq_chip_data()
        PCI: xilinx-nwl: Use irq_data_get_irq_chip_data()
        NTB/msi: Use irq_has_action()
        mfd: ab8500-debugfs: Remove the racy fiddling with irq_desc
        pinctrl: nomadik: Use irq_has_action()
        drm/i915/pmu: Replace open coded kstat_irqs() copy
        drm/i915/lpe_audio: Remove pointless irq_to_desc() usage
        s390/irq: Use irq_desc_kstat_cpu() in show_msi_interrupt()
        parisc/irq: Use irq_desc_kstat_cpu() in show_interrupts()
        ...
      3913d00a