1. 15 Sep, 2020 9 commits
    • Namhyung Kim's avatar
      perf metric: Free metric when it failed to resolve · 27adafcd
      Namhyung Kim authored
      The metricgroup__add_metric() can find multiple match for a metric group
      and it's possible to fail.  Also it can fail in the middle like in
      resolve_metric() even for single metric.
      
      In those cases, the intermediate list and ids will be leaked like:
      
        Direct leak of 3 byte(s) in 1 object(s) allocated from:
          #0 0x7f4c938f40b5 in strdup (/lib/x86_64-linux-gnu/libasan.so.5+0x920b5)
          #1 0x55f7e71c1bef in __add_metric util/metricgroup.c:683
          #2 0x55f7e71c31d0 in add_metric util/metricgroup.c:906
          #3 0x55f7e71c3844 in metricgroup__add_metric util/metricgroup.c:940
          #4 0x55f7e71c488d in metricgroup__add_metric_list util/metricgroup.c:993
          #5 0x55f7e71c488d in parse_groups util/metricgroup.c:1045
          #6 0x55f7e71c60a4 in metricgroup__parse_groups_test util/metricgroup.c:1087
          #7 0x55f7e71235ae in __compute_metric tests/parse-metric.c:164
          #8 0x55f7e7124650 in compute_metric tests/parse-metric.c:196
          #9 0x55f7e7124650 in test_recursion_fail tests/parse-metric.c:318
          #10 0x55f7e7124650 in test__parse_metric tests/parse-metric.c:356
          #11 0x55f7e70be09b in run_test tests/builtin-test.c:410
          #12 0x55f7e70be09b in test_and_print tests/builtin-test.c:440
          #13 0x55f7e70c101a in __cmd_test tests/builtin-test.c:661
          #14 0x55f7e70c101a in cmd_test tests/builtin-test.c:807
          #15 0x55f7e7126214 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
          #16 0x55f7e6fc41a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
          #17 0x55f7e6fc41a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
          #18 0x55f7e6fc41a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
          #19 0x7f4c93492cc9 in __libc_start_main ../csu/libc-start.c:308
      
      Fixes: 83de0b7d ("perf metric: Collect referenced metrics in struct metric_ref_node")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-9-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      27adafcd
    • Namhyung Kim's avatar
      perf metric: Release expr_parse_ctx after testing · 437822bf
      Namhyung Kim authored
      The test_generic_metric() missed to release entries in the pctx.  Asan
      reported following leak (and more):
      
        Direct leak of 128 byte(s) in 1 object(s) allocated from:
          #0 0x7f4c9396980e in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10780e)
          #1 0x55f7e748cc14 in hashmap_grow (/home/namhyung/project/linux/tools/perf/perf+0x90cc14)
          #2 0x55f7e748d497 in hashmap__insert (/home/namhyung/project/linux/tools/perf/perf+0x90d497)
          #3 0x55f7e7341667 in hashmap__set /home/namhyung/project/linux/tools/perf/util/hashmap.h:111
          #4 0x55f7e7341667 in expr__add_ref util/expr.c:120
          #5 0x55f7e7292436 in prepare_metric util/stat-shadow.c:783
          #6 0x55f7e729556d in test_generic_metric util/stat-shadow.c:858
          #7 0x55f7e712390b in compute_single tests/parse-metric.c:128
          #8 0x55f7e712390b in __compute_metric tests/parse-metric.c:180
          #9 0x55f7e712446d in compute_metric tests/parse-metric.c:196
          #10 0x55f7e712446d in test_dcache_l2 tests/parse-metric.c:295
          #11 0x55f7e712446d in test__parse_metric tests/parse-metric.c:355
          #12 0x55f7e70be09b in run_test tests/builtin-test.c:410
          #13 0x55f7e70be09b in test_and_print tests/builtin-test.c:440
          #14 0x55f7e70c101a in __cmd_test tests/builtin-test.c:661
          #15 0x55f7e70c101a in cmd_test tests/builtin-test.c:807
          #16 0x55f7e7126214 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
          #17 0x55f7e6fc41a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
          #18 0x55f7e6fc41a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
          #19 0x55f7e6fc41a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
          #20 0x7f4c93492cc9 in __libc_start_main ../csu/libc-start.c:308
      
      Fixes: 6d432c4c ("perf tools: Add test_generic_metric function")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-8-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      437822bf
    • Namhyung Kim's avatar
      perf test: Fix memory leaks in parse-metric test · f5a56570
      Namhyung Kim authored
      It didn't release resources when there's an error so the
      test_recursion_fail() will leak some memory.
      
      Fixes: 0a507af9 ("perf tests: Add parse metric test for ipc metric")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-7-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f5a56570
    • Namhyung Kim's avatar
      perf parse-event: Fix memory leak in evsel->unit · b12eea5a
      Namhyung Kim authored
      The evsel->unit borrows a pointer of pmu event or alias instead of
      owns a string.  But tool event (duration_time) passes a result of
      strdup() caused a leak.
      
      It was found by ASAN during metric test:
      
        Direct leak of 210 byte(s) in 70 object(s) allocated from:
          #0 0x7fe366fca0b5 in strdup (/lib/x86_64-linux-gnu/libasan.so.5+0x920b5)
          #1 0x559fbbcc6ea3 in add_event_tool util/parse-events.c:414
          #2 0x559fbbcc6ea3 in parse_events_add_tool util/parse-events.c:1414
          #3 0x559fbbd8474d in parse_events_parse util/parse-events.y:439
          #4 0x559fbbcc95da in parse_events__scanner util/parse-events.c:2096
          #5 0x559fbbcc95da in __parse_events util/parse-events.c:2141
          #6 0x559fbbc28555 in check_parse_id tests/pmu-events.c:406
          #7 0x559fbbc28555 in check_parse_id tests/pmu-events.c:393
          #8 0x559fbbc28555 in check_parse_cpu tests/pmu-events.c:415
          #9 0x559fbbc28555 in test_parsing tests/pmu-events.c:498
          #10 0x559fbbc0109b in run_test tests/builtin-test.c:410
          #11 0x559fbbc0109b in test_and_print tests/builtin-test.c:440
          #12 0x559fbbc03e69 in __cmd_test tests/builtin-test.c:695
          #13 0x559fbbc03e69 in cmd_test tests/builtin-test.c:807
          #14 0x559fbbc691f4 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
          #15 0x559fbbb071a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
          #16 0x559fbbb071a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
          #17 0x559fbbb071a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
          #18 0x7fe366b68cc9 in __libc_start_main ../csu/libc-start.c:308
      
      Fixes: f0fbb114 ("perf stat: Implement duration_time as a proper event")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-6-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b12eea5a
    • Namhyung Kim's avatar
      perf evlist: Fix cpu/thread map leak · bfd1b83d
      Namhyung Kim authored
      Asan reported leak of cpu and thread maps as they have one more refcount
      than released.  I found that after setting evlist maps it should release
      it's refcount.
      
      It seems to be broken from the beginning so I chose the original commit
      as the culprit.  But not sure how it's applied to stable trees since
      there are many changes in the code after that.
      
      Fixes: 7e2ed097 ("perf evlist: Store pointer to the cpu and thread maps")
      Fixes: 4112eb18 ("perf evlist: Default to syswide target when no thread/cpu maps set")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-4-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bfd1b83d
    • Namhyung Kim's avatar
      perf metric: Fix some memory leaks - part 2 · b033ab11
      Namhyung Kim authored
      The metric_event_delete() missed to free expr->metric_events and it
      should free an expr when metric_refs allocation failed.
      
      Fixes: 4ea28967 ("perf metric: Collect referenced metrics in struct metric_expr")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-3-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b033ab11
    • Namhyung Kim's avatar
      perf metric: Fix some memory leaks · 4f57a1ed
      Namhyung Kim authored
      I found some memory leaks while reading the metric code.  Some are real
      and others only occur in the error path.  When it failed during metric
      or event parsing, it should release all resources properly.
      
      Fixes: b18f3e36 ("perf stat: Support JSON metrics in perf stat")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4f57a1ed
    • Namhyung Kim's avatar
      perf test: Free aliases for PMU event map aliases test · 22fe5a25
      Namhyung Kim authored
      The aliases were never released causing the following leaks:
      
        Indirect leak of 1224 byte(s) in 9 object(s) allocated from:
          #0 0x7feefb830628 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x107628)
          #1 0x56332c8f1b62 in __perf_pmu__new_alias util/pmu.c:322
          #2 0x56332c8f401f in pmu_add_cpu_aliases_map util/pmu.c:778
          #3 0x56332c792ce9 in __test__pmu_event_aliases tests/pmu-events.c:295
          #4 0x56332c792ce9 in test_aliases tests/pmu-events.c:367
          #5 0x56332c76a09b in run_test tests/builtin-test.c:410
          #6 0x56332c76a09b in test_and_print tests/builtin-test.c:440
          #7 0x56332c76ce69 in __cmd_test tests/builtin-test.c:695
          #8 0x56332c76ce69 in cmd_test tests/builtin-test.c:807
          #9 0x56332c7d2214 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
          #10 0x56332c6701a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
          #11 0x56332c6701a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
          #12 0x56332c6701a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
          #13 0x7feefb359cc9 in __libc_start_main ../csu/libc-start.c:308
      
      Fixes: 956a7835 ("perf test: Test pmu-events aliases")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-11-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      22fe5a25
    • Henry Burns's avatar
      perf vendor events amd: Remove trailing commas · 56f3a1cd
      Henry Burns authored
      The amdzen2/core.json and amdzen/core.json vendor events files have the
      occasional trailing comma. Since that goes against the JSON standard,
      lets remove it.
      Signed-off-by: default avatarHenry Burns <henrywolfeburns@gmail.com>
      Acked-by: default avatarKim Phillips <kim.phillips@amd.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Vijay Thakkar <vijaythakkar@me.com>
      Link: http://lore.kernel.org/lkml/20200915004125.971-1-henrywolfeburns@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      56f3a1cd
  2. 14 Sep, 2020 8 commits
    • Ian Rogers's avatar
      perf test: Leader sampling shouldn't clear sample period · 880a7843
      Ian Rogers authored
      Add test that a sibling with leader sampling doesn't have its period
      cleared.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@chromium.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.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>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200912025655.1337192-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      880a7843
    • Ian Rogers's avatar
      perf record: Don't clear event's period if set by a term · 3b0a18c1
      Ian Rogers authored
      If events in a group explicitly set a frequency or period with leader
      sampling, don't disable the samples on those events.
      
      Prior to 5.8:
      
        perf record -e '{cycles/period=12345000/,instructions/period=6789000/}:S'
      
      would clear the attributes then apply the config terms. In commit
      5f342788 leader sampling configuration was moved to after applying the
      config terms, in the example, making the instructions' event have its period
      cleared.
      
      This change makes it so that sampling is only disabled if configuration
      terms aren't present.
      
      Committer testing:
      
      Before:
      
        # perf record -e '{cycles/period=1/,instructions/period=2/}:S' sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.051 MB perf.data (6 samples) ]
        #
        # perf evlist -v
        cycles/period=1/: size: 120, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|READ|ID, read_format: ID|GROUP, disabled: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
        instructions/period=2/: size: 120, config: 0x1, sample_type: IP|TID|TIME|READ|ID, read_format: ID|GROUP, sample_id_all: 1, exclude_guest: 1
        #
      
      After:
      
        # perf record -e '{cycles/period=1/,instructions/period=2/}:S' sleep 0.0001
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.052 MB perf.data (4 samples) ]
        # perf evlist -v
        cycles/period=1/: size: 120, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|READ|ID, read_format: ID|GROUP, disabled: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
        instructions/period=2/: size: 120, config: 0x1, { sample_period, sample_freq }: 2, sample_type: IP|TID|TIME|READ|ID, read_format: ID|GROUP, sample_id_all: 1, exclude_guest: 1
        #
      
      Fixes: 5f342788 ("perf evlist: Move leader-sampling configuration")
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@chromium.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.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>
      Cc: Yonghong Song <yhs@fb.com>
      Link: http://lore.kernel.org/lkml/20200912025655.1337192-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3b0a18c1
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: update linux/in.h copy · 2fa3fc95
      Arnaldo Carvalho de Melo authored
      To get the changes from:
      
        645f0897 ("net: Fix some comments")
      
      That don't cause any changes in tooling, its just a typo fix.
      
      This silences this tools/perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
        diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Miaohe Lin <linmiaohe@huawei.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2fa3fc95
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync kvm.h headers with the kernel sources · 8d761d2c
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        15e9e35c ("KVM: MIPS: Change the definition of kvm type")
        004a0124 ("arm64/x86: KVM: Introduce steal-time cap")
      
      That do not result in any change in tooling, as the additions are not
      being used in any table generator.
      
      This silences these perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
        diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andrew Jones <drjones@redhat.com>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8d761d2c
    • Stephane Eranian's avatar
      perf record: Prevent override of attr->sample_period for libpfm4 events · ae5dcc8a
      Stephane Eranian authored
      Before:
      
        $ perf record -c 10000 --pfm-events=cycles:period=77777
      
      Would yield a cycles event with period=10000, instead of 77777.
      
      the event string and perf record initializing the event.
      This was due to an ordering issue between libpfm4 parsing
      
      events with attr->sample_period != 0 by the time
      intent of the author.
      perf_evsel__config() is invoked. This seems to have been the
      This patch fixes the problem by preventing override for
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@chromium.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Yonghong Song <yhs@fb.com>
      Link: http://lore.kernel.org/lkml/20200912025655.1337192-3-irogers@google.comSigned-off-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ae5dcc8a
    • David Sharp's avatar
      perf record: Set PERF_RECORD_PERIOD if attr->freq is set. · ce4326d2
      David Sharp authored
      evsel__config() would only set PERF_RECORD_PERIOD if it set attr->freq
      from perf record options. When it is set by libpfm events, it would not
      get set. This changes evsel__config to see if attr->freq is set outside
      of whether or not it changes attr->freq itself.
      Signed-off-by: default avatarDavid Sharp <dhsharp@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@chromium.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.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>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: david sharp <dhsharp@google.com>
      Link: http://lore.kernel.org/lkml/20200912025655.1337192-2-irogers@google.comSigned-off-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ce4326d2
    • Ian Rogers's avatar
      perf bench: Fix 2 memory sanitizer warnings · d2c73501
      Ian Rogers authored
      Memory sanitizer warns if a write is performed where the memory being
      read for the write is uninitialized. Avoid this warning by initializing
      the memory.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.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/20200912053725.1405857-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d2c73501
    • Jiri Olsa's avatar
      perf test: Fix the "signal" test inline assembly · 8a39e8c4
      Jiri Olsa authored
      When compiling with DEBUG=1 on Fedora 32 I'm getting crash for 'perf
      test signal':
      
        Program received signal SIGSEGV, Segmentation fault.
        0x0000000000c68548 in __test_function ()
        (gdb) bt
        #0  0x0000000000c68548 in __test_function ()
        #1  0x00000000004d62e9 in test_function () at tests/bp_signal.c:61
        #2  0x00000000004d689a in test__bp_signal (test=0xa8e280 <generic_ ...
        #3  0x00000000004b7d49 in run_test (test=0xa8e280 <generic_tests+1 ...
        #4  0x00000000004b7e7f in test_and_print (t=0xa8e280 <generic_test ...
        #5  0x00000000004b8927 in __cmd_test (argc=1, argv=0x7fffffffdce0, ...
        ...
      
      It's caused by the symbol __test_function being in the ".bss" section:
      
        $ readelf -a ./perf | less
          [Nr] Name              Type             Address           Offset
               Size              EntSize          Flags  Link  Info  Align
          ...
          [28] .bss              NOBITS           0000000000c356a0  008346a0
               00000000000511f8  0000000000000000  WA       0     0     32
      
        $ nm perf | grep __test_function
        0000000000c68548 B __test_function
      
      I guess most of the time we're just lucky the inline asm ended up in the
      ".text" section, so making it specific explicit with push and pop
      section clauses.
      
        $ readelf -a ./perf | less
          [Nr] Name              Type             Address           Offset
               Size              EntSize          Flags  Link  Info  Align
          ...
          [13] .text             PROGBITS         0000000000431240  00031240
               0000000000306faa  0000000000000000  AX       0     0     16
      
        $ nm perf | grep __test_function
        00000000004d62c8 T __test_function
      
      Committer testing:
      
        $ readelf -wi ~/bin/perf | grep producer -m1
          <c>   DW_AT_producer    : (indirect string, offset: 0x254a): GNU C99 10.2.1 20200723 (Red Hat 10.2.1-1) -mtune=generic -march=x86-64 -ggdb3 -std=gnu99 -fno-omit-frame-pointer -funwind-tables -fstack-protector-all
                                                                                                                                               ^^^^^
                                                                                                                                               ^^^^^
                                                                                                                                               ^^^^^
        $
      
      Before:
      
        $ perf test signal
        20: Breakpoint overflow signal handler                    : FAILED!
        $
      
      After:
      
        $ perf test signal
        20: Breakpoint overflow signal handler                    : Ok
        $
      
      Fixes: 8fd34e1c ("perf test: Improve bp_signal")
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lore.kernel.org/lkml/20200911130005.1842138-1-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8a39e8c4
  3. 13 Sep, 2020 10 commits
    • Linus Torvalds's avatar
      Linux 5.9-rc5 · 856deb86
      Linus Torvalds authored
      856deb86
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 5712c3ed
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
       "A collection of fixes I've been accruing over the last few weeks, none
        of them have been severe enough to warrant flushing the queue but it's
        been long enough now that it's a good idea to send them in.
      
        A handful of them are fixups for QSPI DT/bindings/compatibles, some
        smaller fixes for system DMA clock control and TMU interrupts on i.MX,
        a handful of fixes for OMAP, including a fix for DSI (display) on
        omap5"
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (27 commits)
        arm64: dts: ns2: Fixed QSPI compatible string
        ARM: dts: BCM5301X: Fixed QSPI compatible string
        ARM: dts: NSP: Fixed QSPI compatible string
        ARM: dts: bcm: HR2: Fixed QSPI compatible string
        dt-bindings: spi: Fix spi-bcm-qspi compatible ordering
        ARM: dts: imx6sx: fix the pad QSPI1B_SCLK mux mode for uart3
        arm64: dts: imx8mp: correct sdma1 clk setting
        arm64: dts: imx8mq: Fix TMU interrupt property
        ARM: dts: imx7d-zii-rmu2: fix rgmii phy-mode for ksz9031 phy
        ARM: dts: vfxxx: Add syscon compatible with OCOTP
        ARM: dts: imx6q-logicpd: Fix broken PWM
        arm64: dts: imx: Add missing imx8mm-beacon-kit.dtb to build
        ARM: dts: imx6q-prtwd2: Remove unneeded i2c unit name
        ARM: dts: imx6qdl-gw51xx: Remove unneeded #address-cells/#size-cells
        ARM: dts: imx7ulp: Correct gpio ranges
        ARM: dts: ls1021a: fix QuadSPI-memory reg range
        arm64: defconfig: Enable ptn5150 extcon driver
        arm64: defconfig: Enable USB gadget with configfs
        ARM: configs: Update Integrator defconfig
        ARM: dts: omap5: Fix DSI base address and clocks
        ...
      5712c3ed
    • Linus Torvalds's avatar
      Merge tag 'usb-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · e4c26faa
      Linus Torvalds authored
      Pull USB/Thunderbolt fixes from Greg KH:
       "Here are some small USB and Thunderbolt driver fixes for 5.9-rc5.
      
        Nothing huge, just a number of bugfixes and new device ids for
        problems reported:
      
         - new USB serial driver ids
      
         - bug fixes for syzbot reported problems
      
         - typec driver fixes
      
         - thunderbolt driver fixes
      
         - revert of reported broken commit
      
        All of these have been in linux-next with no reported issues"
      
      * tag 'usb-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: typec: intel_pmc_mux: Do not configure SBU and HSL Orientation in Alternate modes
        usb: typec: intel_pmc_mux: Do not configure Altmode HPD High
        usb: core: fix slab-out-of-bounds Read in read_descriptors
        Revert "usb: dwc3: meson-g12a: fix shared reset control use"
        usb: typec: ucsi: acpi: Check the _DEP dependencies
        usb: typec: intel_pmc_mux: Un-register the USB role switch
        usb: Fix out of sync data toggle if a configured device is reconfigured
        USB: serial: option: support dynamic Quectel USB compositions
        USB: serial: option: add support for SIM7070/SIM7080/SIM7090 modules
        thunderbolt: Use maximum USB3 link rate when reclaiming if link is not up
        thunderbolt: Disable ports that are not implemented
        USB: serial: ftdi_sio: add IDs for Xsens Mti USB converter
      e4c26faa
    • Linus Torvalds's avatar
      Merge tag 'staging-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 6c7247f6
      Linus Torvalds authored
      Pull staging/IIO driver fixes from Greg KH:
       "Here are a number of staging and IIO driver fixes for 5.9-rc5.
      
        The majority of these are IIO driver fixes, to resolve a timestamp
        issue that was recently found to affect a bunch of IIO drivers.
      
        The other fixes in here are:
      
         - small IIO driver fixes
      
         - greybus driver fix
      
         - counter driver fix (came in through the IIO fixes tree)
      
        All of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'staging-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (23 commits)
        iio: adc: mcp3422: fix locking on error path
        iio: adc: mcp3422: fix locking scope
        iio: adc: meson-saradc: Use the parent device to look up the calib data
        iio:adc:max1118 Fix alignment of timestamp and data leak issues
        iio:adc:ina2xx Fix timestamp alignment issue.
        iio:adc:ti-adc084s021 Fix alignment and data leak issues.
        iio:adc:ti-adc081c Fix alignment and data leak issues
        iio:magnetometer:ak8975 Fix alignment and data leak issues.
        iio:light:ltr501 Fix timestamp alignment issue.
        iio:light:max44000 Fix timestamp alignment and prevent data leak.
        iio:chemical:ccs811: Fix timestamp alignment and prevent data leak.
        iio:proximity:mb1232: Fix timestamp alignment and prevent data leak.
        iio:accel:mma7455: Fix timestamp alignment and prevent data leak.
        iio:accel:bmc150-accel: Fix timestamp alignment and prevent data leak.
        iio:accel:mma8452: Fix timestamp alignment and prevent data leak.
        iio: accel: kxsd9: Fix alignment of local buffer.
        iio: adc: rockchip_saradc: select IIO_TRIGGERED_BUFFER
        iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set
        counter: microchip-tcb-capture: check the correct variable
        iio: cros_ec: Set Gyroscope default frequency to 25Hz
        ...
      6c7247f6
    • Linus Torvalds's avatar
      Merge tag 'driver-core-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core · 20a7b6be
      Linus Torvalds authored
      Pull driver core fixes from Greg KH:
       "Here are some small driver core and debugfs fixes for 5.9-rc5
      
        Included in here are:
      
         - firmware loader memory leak fix
      
         - firmware loader testing fixes for non-EFI systems
      
         - device link locking fixes found by lockdep
      
         - kobject_del() bugfix that has been affecting some callers
      
         - debugfs minor fix
      
        All of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'driver-core-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        test_firmware: Test platform fw loading on non-EFI systems
        PM: <linux/device.h>: fix @em_pd kernel-doc warning
        kobject: Drop unneeded conditional in __kobject_del()
        driver core: Fix device_pm_lock() locking for device links
        MAINTAINERS: Add the security document to SECURITY CONTACT
        driver code: print symbolic error code
        debugfs: Fix module state check condition
        kobject: Restore old behaviour of kobject_del(NULL)
        firmware_loader: fix memory leak for paged buffer
      20a7b6be
    • Olof Johansson's avatar
      Merge tag 'arm-soc/for-5.9/devicetree-fixes' of https://github.com/Broadcom/stblinux into arm/fixes · a4da411e
      Olof Johansson authored
      This pull request contains Broadcom ARM-based SoCs Device Tree fixes for
      5.9, please pull the following:
      
      - Florian fixes the Broadcom QSPI controller binding such that the most
        specific compatible string is the left most one, and all existing
        in-tree users are updated as well.
      
      * tag 'arm-soc/for-5.9/devicetree-fixes' of https://github.com/Broadcom/stblinux:
        arm64: dts: ns2: Fixed QSPI compatible string
        ARM: dts: BCM5301X: Fixed QSPI compatible string
        ARM: dts: NSP: Fixed QSPI compatible string
        ARM: dts: bcm: HR2: Fixed QSPI compatible string
        dt-bindings: spi: Fix spi-bcm-qspi compatible ordering
      
      Link: https://lore.kernel.org/r/20200909211857.4144718-1-f.fainelli@gmail.comSigned-off-by: default avatarOlof Johansson <olof@lixom.net>
      a4da411e
    • Olof Johansson's avatar
      Merge tag 'imx-fixes-5.9-2' of... · 2aedcb04
      Olof Johansson authored
      Merge tag 'imx-fixes-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into arm/fixes
      
      i.MX fixes for 5.9, round 2:
      
      - Fix the misspelling of 'interrupts' property in i.MX8MQ TMU DT node.
      - Correct 'ahb' clock for i.MX8MP SDMA1 in device tree.
      - Fix pad QSPI1B_SCLK mux mode for UART3 on i.MX6SX.
      
      * tag 'imx-fixes-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux:
        ARM: dts: imx6sx: fix the pad QSPI1B_SCLK mux mode for uart3
        arm64: dts: imx8mp: correct sdma1 clk setting
        arm64: dts: imx8mq: Fix TMU interrupt property
      
      Link: https://lore.kernel.org/r/20200909143844.GA25109@dragonSigned-off-by: default avatarOlof Johansson <olof@lixom.net>
      2aedcb04
    • Olof Johansson's avatar
      Merge tag 'omap-for-v5.9/fixes-rc3' of... · 0e384029
      Olof Johansson authored
      Merge tag 'omap-for-v5.9/fixes-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into arm/fixes
      
      Fixes for omaps for v5.9-rc cycle
      
      Few fixes for omap based devices:
      
      - Fix of_clk_get() error handling for omap-iommu
      
      - Fix missing audio pinctrl entries for logicpd boards
      
      - Fix video for logicpd-som-lv after switch to generic panels
      
      - Fix omap5 DSI clocks base
      
      * tag 'omap-for-v5.9/fixes-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
        ARM: dts: omap5: Fix DSI base address and clocks
        ARM: dts: logicpd-som-lv-baseboard: Fix missing video
        ARM: dts: logicpd-som-lv-baseboard: Fix broken audio
        ARM: dts: logicpd-torpedo-baseboard: Fix broken audio
        ARM: OMAP2+: Fix an IS_ERR() vs NULL check in _get_pwrdm()
      
      Link: https://lore.kernel.org/r/pull-1599132064-54898@atomide.comSigned-off-by: default avatarOlof Johansson <olof@lixom.net>
      0e384029
    • Linus Torvalds's avatar
      Merge tag 'char-misc-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 2a1a4bee
      Linus Torvalds authored
      Pull char / misc driver fixes from Greg KH:
       "Here are a number of small driver fixes for 5.9-rc5
      
        Included in here are:
      
         - habanalabs driver fixes
      
         - interconnect driver fixes
      
         - soundwire driver fixes
      
         - dyndbg fixes for reported issues, and then reverts to fix it all up
           to a sane state.
      
         - phy driver fixes
      
        All of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'char-misc-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        Revert "dyndbg: accept query terms like file=bar and module=foo"
        Revert "dyndbg: fix problem parsing format="foo bar""
        scripts/tags.sh: exclude tools directory from tags generation
        video: fbdev: fix OOB read in vga_8planes_imageblit()
        dyndbg: fix problem parsing format="foo bar"
        dyndbg: refine export, rename to dynamic_debug_exec_queries()
        dyndbg: give %3u width in pr-format, cosmetic only
        interconnect: qcom: Fix small BW votes being truncated to zero
        soundwire: fix double free of dangling pointer
        interconnect: Show bandwidth for disabled paths as zero in debugfs
        habanalabs: fix report of RAZWI initiator coordinates
        habanalabs: prevent user buff overflow
        phy: omap-usb2-phy: disable PHY charger detect
        phy: qcom-qmp: Use correct values for ipq8074 PCIe Gen2 PHY init
        soundwire: bus: fix typo in comment on INTSTAT registers
        phy: qualcomm: fix return value check in qcom_ipq806x_usb_phy_probe()
        phy: qualcomm: fix platform_no_drv_owner.cocci warnings
      2a1a4bee
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 84b13499
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "A bit on the bigger side, mostly due to me being on vacation, then
        busy, then on parental leave, but there's nothing worrisome.
      
        ARM:
         - Multiple stolen time fixes, with a new capability to match x86
         - Fix for hugetlbfs mappings when PUD and PMD are the same level
         - Fix for hugetlbfs mappings when PTE mappings are enforced (dirty
           logging, for example)
         - Fix tracing output of 64bit values
      
        x86:
         - nSVM state restore fixes
         - Async page fault fixes
         - Lots of small fixes everywhere"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (25 commits)
        KVM: emulator: more strict rsm checks.
        KVM: nSVM: more strict SMM checks when returning to nested guest
        SVM: nSVM: setup nested msr permission bitmap on nested state load
        SVM: nSVM: correctly restore GIF on vmexit from nesting after migration
        x86/kvm: don't forget to ACK async PF IRQ
        x86/kvm: properly use DEFINE_IDTENTRY_SYSVEC() macro
        KVM: VMX: Don't freeze guest when event delivery causes an APIC-access exit
        KVM: SVM: avoid emulation with stale next_rip
        KVM: x86: always allow writing '0' to MSR_KVM_ASYNC_PF_EN
        KVM: SVM: Periodically schedule when unregistering regions on destroy
        KVM: MIPS: Change the definition of kvm type
        kvm x86/mmu: use KVM_REQ_MMU_SYNC to sync when needed
        KVM: nVMX: Fix the update value of nested load IA32_PERF_GLOBAL_CTRL control
        KVM: fix memory leak in kvm_io_bus_unregister_dev()
        KVM: Check the allocation of pv cpu mask
        KVM: nVMX: Update VMCS02 when L2 PAE PDPTE updates detected
        KVM: arm64: Update page shift if stage 2 block mapping not supported
        KVM: arm64: Fix address truncation in traces
        KVM: arm64: Do not try to map PUDs when they are folded into PMD
        arm64/x86: KVM: Introduce steal-time cap
        ...
      84b13499
  4. 12 Sep, 2020 13 commits