Skip to content
  1. May 23, 2022
    • Adrian Hunter's avatar
      perf inject: Keep a copy of kcore_dir · d8fc0855
      Adrian Hunter authored
      
      
      If the input perf.data has a kcore_dir, copy it into the output, since
      at least the kallsyms in the kcore_dir will be useful to the output.
      
      Example:
      
       Before:
      
        $ ls -lR perf.data-from-desktop
        perf.data-from-desktop:
        total 916
        -rw------- 1 user user 931756 May 19 09:55 data
        drwx------ 2 user user   4096 May 19 09:55 kcore_dir
      
        perf.data-from-desktop/kcore_dir:
        total 42952
        -r-------- 1 user user  7582467 May 19 09:55 kallsyms
        -r-------- 1 user user 36388864 May 19 09:55 kcore
        -r-------- 1 user user     4828 May 19 09:55 modules
      
        $ perf inject -i perf.data-from-desktop -o injected-perf.data
      
        $ ls -lR injected-perf.data
        -rw------- 1 user user 931320 May 20 15:08 injected-perf.data
      
       After:
      
        $ perf inject -i perf.data-from-desktop -o injected-perf.data
      
        $ ls -lR injected-perf.data
        injected-perf.data:
        total 916
        -rw------- 1 user user 931320 May 20 15:21 data
        drwx------ 2 user user   4096 May 20 15:21 kcore_dir
      
        injected-perf.data/kcore_dir:
        total 42952
        -r-------- 1 user user  7582467 May 20 15:21 kallsyms
        -r-------- 1 user user 36388864 May 20 15:21 kcore
        -r-------- 1 user user     4828 May 20 15:21 modules
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220520132404.25853-6-adrian.hunter@intel.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d8fc0855
    • Adrian Hunter's avatar
      perf data: Add has_kcore_dir() · a4455e00
      Adrian Hunter authored
      
      
      Add a helper function has_kcore_dir(), so that perf inject can determine if
      it needs to keep the kcore_dir.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220520132404.25853-5-adrian.hunter@intel.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a4455e00
    • Adrian Hunter's avatar
      perf inject: Keep some features sections from input file · 180b3d06
      Adrian Hunter authored
      
      
      perf inject overwrites feature sections with information from the current
      machine. It makes more sense to keep original information that describes
      the machine or software when perf record was run.
      
      Example: perf.data from "Desktop" injected on "nuc11"
      
       Before:
      
        $ perf script --header-only -i perf.data-from-desktop | head -15
        # ========
        # captured on    : Thu May 19 09:55:50 2022
        # header version : 1
        # data offset    : 1208
        # data size      : 837480
        # feat offset    : 838688
        # hostname : Desktop
        # os release : 5.13.0-41-generic
        # perf version : 5.18.rc5.gac837f7ca7ed
        # arch : x86_64
        # nrcpus online : 28
        # nrcpus avail : 28
        # cpudesc : Intel(R) Core(TM) i9-9940X CPU @ 3.30GHz
        # cpuid : GenuineIntel,6,85,4
        # total memory : 65548656 kB
      
        $ perf inject -i perf.data-from-desktop -o injected-perf.data
      
        $ perf script --header-only -i injected-perf.data | head -15
        # ========
        # captured on    : Fri May 20 15:06:55 2022
        # header version : 1
        # data offset    : 1208
        # data size      : 837480
        # feat offset    : 838688
        # hostname : nuc11
        # os release : 5.17.5-local
        # perf version : 5.18.rc5.g0f828fdeb9af
        # arch : x86_64
        # nrcpus online : 8
        # nrcpus avail : 8
        # cpudesc : 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
        # cpuid : GenuineIntel,6,140,1
        # total memory : 16012124 kB
      
       After:
      
        $ perf inject -i perf.data-from-desktop -o injected-perf.data
      
        $ perf script --header-only -i injected-perf.data | head -15
        # ========
        # captured on    : Fri May 20 15:08:54 2022
        # header version : 1
        # data offset    : 1208
        # data size      : 837480
        # feat offset    : 838688
        # hostname : Desktop
        # os release : 5.13.0-41-generic
        # perf version : 5.18.rc5.gac837f7ca7ed
        # arch : x86_64
        # nrcpus online : 28
        # nrcpus avail : 28
        # cpudesc : Intel(R) Core(TM) i9-9940X CPU @ 3.30GHz
        # cpuid : GenuineIntel,6,85,4
        # total memory : 65548656 kB
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220520132404.25853-4-adrian.hunter@intel.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      180b3d06
    • Adrian Hunter's avatar
      libperf: Add preadn() · 618ee783
      Adrian Hunter authored
      
      
      Add preadn() to provide pread() and readn() semantics.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/ab8918a4-7ac8-a37e-2e2c-28438c422d87@intel.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      618ee783
    • Adrian Hunter's avatar
      perf header: Add ability to keep feature sections · 237c96b8
      Adrian Hunter authored
      
      
      Many feature sections should not be re-written during perf inject. In
      preparation to support that, add callbacks that a tool can use to copy
      a feature section from elsewhere. perf inject will use this facility to
      copy features sections from the input file.
      
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220520132404.25853-2-adrian.hunter@intel.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      237c96b8
    • Ian Rogers's avatar
      perf jevents: Modify match field · 1634b5a1
      Ian Rogers authored
      
      
      The match_field function looks for json values to append to the event
      string. As the C code processes these in order the output order matches
      that in the json dictionary. Python json readers read the entire
      dictionary and lose the ordering. To make the python and C output
      comparable make the C code first read the extra fields then append them
      to the event in an order not determined by their order in the file.
      
      Modify the pmu-events test so that test expectations match the new
      order.
      
      Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrew Kilroy <andrew.kilroy@arm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Felix Fietkau <nbd@nbd.name>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com>
      Cc: Like Xu <likexu@tencent.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nick Forrington <nick.forrington@arm.com>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Qi Liu <liuqi115@huawei.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Santosh Shukla <santosh.shukla@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20220511211526.1021908-5-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1634b5a1
    • Ian Rogers's avatar
      perf vendor events: Fix Ivytown UNC_M_ACT_COUNT.RD umask · afba2b08
      Ian Rogers authored
      The event had two umasks with the umask of 3 being correct.
      Note: this change wasn't automatically generated as there is no CSV for
      Ivytown uncore events at:
      https://github.com/intel/event-converter-for-linux-perf
      
      
      
      Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrew Kilroy <andrew.kilroy@arm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Felix Fietkau <nbd@nbd.name>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com>
      Cc: Like Xu <likexu@tencent.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nick Forrington <nick.forrington@arm.com>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Qi Liu <liuqi115@huawei.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Santosh Shukla <santosh.shukla@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20220511211526.1021908-4-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      afba2b08
    • Ian Rogers's avatar
      perf vendor events: Fix Alderlake metric groups · a583bf18
      Ian Rogers authored
      
      
      Remove unnecessary empty groups.
      
      Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrew Kilroy <andrew.kilroy@arm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Felix Fietkau <nbd@nbd.name>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com>
      Cc: Like Xu <likexu@tencent.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nick Forrington <nick.forrington@arm.com>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Qi Liu <liuqi115@huawei.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Santosh Shukla <santosh.shukla@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20220511211526.1021908-3-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a583bf18
    • Ian Rogers's avatar
      perf jevents: Append PMU description later · fcb120d5
      Ian Rogers authored
      
      
      Append the PMU information from "Unit" to the description later. This
      avoids a problem when "Unit" appears early in a json event and the
      information prepends the description rather than being the expected
      suffix.
      
      Update the pmu-events test so that expectations now match the improved
      output.
      
      Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrew Kilroy <andrew.kilroy@arm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Felix Fietkau <nbd@nbd.name>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com>
      Cc: Like Xu <likexu@tencent.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nick Forrington <nick.forrington@arm.com>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Qi Liu <liuqi115@huawei.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Santosh Shukla <santosh.shukla@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20220511211526.1021908-2-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fcb120d5
    • Ian Rogers's avatar
      perf test: Use skip in PERF_RECORD_* · 2cf88f46
      Ian Rogers authored
      
      
      Check if the error code is EACCES and make the test a skip with
      a "permissions" skip reason if so.
      
      Committer testing:
      
      Before:
      
        $ perf test PERF_RECORD
          8: PERF_RECORD_* events & perf_sample fields            : FAILED!
        $
      
      After:
      
        $ perf test PERF_RECORD
          8: PERF_RECORD_* events & perf_sample fields            : Skip (permissions)
        $
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Marco Elver <elver@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: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220518042027.836799-9-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2cf88f46
    • Ian Rogers's avatar
      perf test: Parse events break apart tests · 7741e03e
      Ian Rogers authored
      
      
      Break multiple tests in the main test into individual test cases. Make
      better use of skip and add reasons. Skip also for parse event permission
      issues (detected by searching the error string). Rather than break out
      of tests on the first failure, keep going and logging to pr_debug.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Marco Elver <elver@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: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220518042027.836799-8-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7741e03e
    • Ian Rogers's avatar
      perf test: Parse events tidy evlist_test · 8252e791
      Ian Rogers authored
      
      
      Remove two unused variables. Make structs const. Also fix the array
      index (aka id) for the event software/r0x1a/.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Marco Elver <elver@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: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220518042027.836799-7-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8252e791
    • Ian Rogers's avatar
      perf test: Parse events tidy terms_test · b58eca40
      Ian Rogers authored
      
      
      Remove an unused variables. Make structs const. Fix checkpatch issue wrt
      unsigned not being with an int.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Marco Elver <elver@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: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220518042027.836799-6-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b58eca40
    • Ian Rogers's avatar
      perf test: Basic mmap use skip · 7312c36c
      Ian Rogers authored
      
      
      If opening the event fails for basic mmap with EACCES it is more
      likely permission related that a true error. Mark the test as skip
      in this case and add a skip reason.
      
      Committer testing:
      
      Before:
      
        $ perf test "mmap interface"
          4: Read samples using the mmap interface           : FAILED!
        $
      
      After:
      
        $ perf test "mmap interface"
          4: Read samples using the mmap interface           : Skip (permissions)
        $
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Marco Elver <elver@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: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220518042027.836799-5-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7312c36c
    • Ian Rogers's avatar
      perf test: Use skip in openat syscall · f9b10c82
      Ian Rogers authored
      
      
      Failures to open the tracepoint cause this test to fail, however,
      typically such failures are permission related. Lower the failure to
      just skipping the test in those cases and add a skip reason.
      
      Committer testing:
      
      Before:
      
        $ perf test "openat syscall"
          2: Detect openat syscall event                        : FAILED!
          3: Detect openat syscall event on all cpus            : FAILED!
        $
      
      After:
      
        $ perf test "openat syscall"
          2: Detect openat syscall event                        : Skip (permissions)
          3: Detect openat syscall event on all cpus            : Skip (permissions)
        $
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Marco Elver <elver@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: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220518042027.836799-4-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f9b10c82
    • Ian Rogers's avatar
      perf test: Use skip in vmlinux kallsyms · 740f8a82
      Ian Rogers authored
      
      
      Currently failures in reading vmlinux or kallsyms result in a test
      failure. However, the failure is typically permission related. Prefer to
      flag these failures as skip.
      
      Committer testing:
      
      Before:
      
        $ perf test vmlinux
          1: vmlinux symtab matches kallsyms                 : FAILED!
        $
      
      After:
      
        $ perf test vmlinux
          1: vmlinux symtab matches kallsyms                 : Skip
        $
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Marco Elver <elver@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: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220518042027.836799-3-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      740f8a82
    • Ian Rogers's avatar
      perf test: Skip reason for suites with 1 test · cfa5013a
      Ian Rogers authored
      
      
      When a suite has just 1 subtest, the subtest number is given as -1 to
      avoid indented printing. When this subtest number is seen for the skip
      reason, use the reason of the first test.
      
      Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Marco Elver <elver@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220518042027.836799-2-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cfa5013a
    • Ian Rogers's avatar
      perf stat: Make use of index clearer with perf_counts · 0b9462d0
      Ian Rogers authored
      
      
      Try to disambiguate further when perf_counts is being accessed it is
      with a cpu map index rather than a CPU.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Lv Ruyi <lv.ruyi@zte.com.cn>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: https://lore.kernel.org/r/20220519032005.1273691-6-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0b9462d0
    • Ian Rogers's avatar
      perf bpf_counter: Tidy use of CPU map index · 54668a4e
      Ian Rogers authored
      
      
      BPF counters are typically running across all CPUs and so the CPU map
      index and CPU number are the same. There may be cases with offline CPUs
      where this isn't the case and so ensure the cpu map index for
      perf_counts is going to be a valid index by explicitly iterating over
      the CPU map. This also makes it clearer that users of perf_counts are
      using an index. Collapse some multiple uses of perf_counts into single
      uses.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Lv Ruyi <lv.ruyi@zte.com.cn>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: https://lore.kernel.org/r/20220519032005.1273691-5-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      54668a4e
    • Ian Rogers's avatar
      perf cpumap: Add perf_cpu_map__for_each_idx() · e696f6db
      Ian Rogers authored
      
      
      A variant of perf_cpu_map__for_each_cpu() that just iterates index values
      without the corresponding load of the CPU.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Lv Ruyi <lv.ruyi@zte.com.cn>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: https://lore.kernel.org/r/20220519032005.1273691-4-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e696f6db
    • Ian Rogers's avatar
      perf stat: Add stat record+report test · 0dd9769f
      Ian Rogers authored
      This would have caught:
      
        "Subject: Re: perf stat report segfaults"
        https://lore.kernel.org/linux-perf-users/CAP-5=fWQR=sCuiSMktvUtcbOLidEpUJLCybVF6=BRvORcDOq+g@mail.gmail.com/
      
      
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Lv Ruyi <lv.ruyi@zte.com.cn>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: https://lore.kernel.org/r/20220519032005.1273691-3-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0dd9769f
    • Namhyung Kim's avatar
      perf lock: Add -t/--thread option for report · 7c3bcbdf
      Namhyung Kim authored
      
      
      The -t option is to show per-thread lock stat like below:
      
        $ perf lock report -t -F acquired,contended,avg_wait
      
                      Name   acquired  contended   avg wait (ns)
      
                      perf     240569          9            5784
                   swapper     106610         19             543
                    :15789      17370          2           14538
              ContainerMgr       8981          6             874
                     sleep       5275          1           11281
           ContainerThread       4416          4             944
           RootPressureThr       3215          5            1215
               rcu_preempt       2954          0               0
              ContainerMgr       2560          0               0
                   unnamed       1873          0               0
           EventManager_De       1845          1             636
           futex-default-S       1609          0               0
        ...
      
      Committer notes:
      
      Add that option to the 'perf lock report' man page.
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220521010811.932703-2-namhyung@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7c3bcbdf
    • Namhyung Kim's avatar
      perf lock: Do not discard broken lock stats · 79d9333b
      Namhyung Kim authored
      
      
      Currently it discards a lock_stat for a lock instance when there's a
      broken lock_seq_stat in a single task for the lock.  But it also means
      that the existing (and later) valid lock stat info for that lock will
      be discarded as well.
      
      This is not ideal since we can lose many valuable info because of a
      single failure.  Actually those failures are indepent to the existing
      stat.  So we can only discard the broken lock_seq_stat but keep the
      valid lock_stat.
      
      The discarded lock_seq_stat will be reallocated in a subsequent event
      with SEQ_STATE_UNINITIALIZED which will be ignored until it see the
      start of the next sequence.  So it should be ok just free it.
      
      Before:
      
        $ perf lock report -F acquired,contended,avg_wait
      
        Warning:
        Processed 1401603 events and lost 18 chunks!
      
        Check IO/CPU overload!
      
                        Name   acquired  contended   avg wait (ns)
      
               rcu_read_lock     251225          0               0
         &(ei->i_block_re...       8731          0               0
         &sb->s_type->i_l...       8731          0               0
          hrtimer_bases.lock       5261          0               0
          hrtimer_bases.lock       2626          0               0
          hrtimer_bases.lock       1953          0               0
          hrtimer_bases.lock       1382          0               0
            cpu_hotplug_lock       1350          0               0
          hrtimer_bases.lock       1273          0               0
          hrtimer_bases.lock       1269          0               0
          hrtimer_bases.lock       1198          0               0
         ...
      
      New:
                        Name   acquired  contended   avg wait (ns)
      
               rcu_read_lock     251225          0               0
         tk_core.seq.seqc...      54074          0               0
                &xa->xa_lock      17470          0               0
              &ei->i_es_lock      17464          0               0
             &ei->i_raw_lock       9391          0               0
         &mapping->privat...       8734          0               0
             &ei->i_data_sem       8731          0               0
         &(ei->i_block_re...       8731          0               0
         &sb->s_type->i_l...       8731          0               0
         jiffies_seq.seqc...       6953          0               0
              &mm->mmap_lock       6889          0               0
                   balancing       5768          0               0
          hrtimer_bases.lock       5261          0               0
         ...
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220521010811.932703-1-namhyung@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      79d9333b
    • Leo Yan's avatar
      perf c2c: Update documentation for store metric 'N/A' · 12aeaaba
      Leo Yan authored
      
      
      The 'N/A' metric is added for store operations, update documentation to
      reflect changes in the report table.
      
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adam Li <adamli@amperemail.onmicrosoft.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Alyssa Ross <hi@alyssa.is>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Joe Mario <jmario@redhat.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Li Huafei <lihuafei1@huawei.com>
      Cc: Like Xu <likexu@tencent.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220518055729.1869566-4-leo.yan@linaro.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      12aeaaba
    • Leo Yan's avatar
      perf c2c: Add dimensions for 'N/A' metrics of store operation · 550b4d6f
      Leo Yan authored
      
      
      Since now we have the statistics 'st_na' for store operations, add
      dimensions for the 'N/A' (no available memory level) metrics and the
      associated percentage calculation for the single cache line view.
      
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adam Li <adamli@amperemail.onmicrosoft.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Alyssa Ross <hi@alyssa.is>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Joe Mario <jmario@redhat.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Li Huafei <lihuafei1@huawei.com>
      Cc: Like Xu <likexu@tencent.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220518055729.1869566-3-leo.yan@linaro.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      550b4d6f
    • Leo Yan's avatar
      perf mem: Add stats for store operation with no available memory level · 98450637
      Leo Yan authored
      
      
      Sometimes we don't know memory store operations happen on exactly which
      memory (or cache) level, the memory level flag is set to PERF_MEM_LVL_NA
      in this case; a practical example is Arm SPE AUX trace sets this flag
      for all store operations due to absent info for cache level.
      
      This patch is to add a new item "st_na" in structure c2c_stats to add
      statistics for store operations with no available cache level.
      
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adam Li <adamli@amperemail.onmicrosoft.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Alyssa Ross <hi@alyssa.is>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Joe Mario <jmario@redhat.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Li Huafei <lihuafei1@huawei.com>
      Cc: Like Xu <likexu@tencent.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220518055729.1869566-2-leo.yan@linaro.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      98450637
    • Ian Rogers's avatar
      perf build: Error for BPF skeletons without LIBBPF · 508c9fbc
      Ian Rogers authored
      
      
      LIBBPF requires LIBELF so doing "make BUILD_BPF_SKEL=1 NO_LIBELF=1"
      fails with compiler errors about missing declarations. Similar could
      happen if libbpf feature detection fails.
      
      Prefer to error when BUILD_BPF_SKEL is enabled but LIBBPF isn't.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.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>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: https://lore.kernel.org/r/20220520211826.1828180-1-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      508c9fbc
    • Arnaldo Carvalho de Melo's avatar
      0869331f
    • Linus Torvalds's avatar
      Linux 5.18 · 4b0986a3
      Linus Torvalds authored
      4b0986a3
    • David Howells's avatar
      afs: Fix afs_getattr() to refetch file status if callback break occurred · 2aeb8c86
      David Howells authored
      If a callback break occurs (change notification), afs_getattr() needs to
      issue an FS.FetchStatus RPC operation to update the status of the file
      being examined by the stat-family of system calls.
      
      Fix afs_getattr() to do this if AFS_VNODE_CB_PROMISED has been cleared
      on a vnode by a callback break.  Skip this if AT_STATX_DONT_SYNC is set.
      
      This can be tested by appending to a file on one AFS client and then
      using "stat -L" to examine its length on a machine running kafs.  This
      can also be watched through tracing on the kafs machine.  The callback
      break is seen:
      
           kworker/1:1-46      [001] .....   978.910812: afs_cb_call: c=0000005f YFSCB.CallBack
           kworker/1:1-46      [001] ...1.   978.910829: afs_cb_break: 100058:23b4c:242d2c2 b=2 s=1 break-cb
           kworker/1:1-46      [001] .....   978.911062: afs_call_done:    c=0000005f ret=0 ab=0 [0000000082994ead]
      
      And then the stat command generated no traffic if unpatched, but with
      this change a call to fetch the status can be observed:
      
                  stat-4471    [000] .....   986.744122: afs_make_fs_call: c=000000ab 100058:023b4c:242d2c2 YFS.FetchStatus
                  stat-4471    [000] .....   986.745578: afs_call_done:    c=000000ab ret=0 ab=0 [0000000087fc8c84]
      
      Fixes: 08e0e7c8
      
       ("[AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.")
      Reported-by: default avatarMarkus Suvanto <markus.suvanto@gmail.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      Tested-by: default avatarMarkus Suvanto <markus.suvanto@gmail.com>
      Tested-by: default avatar <kafs-testing+fedora34_64checkkafs-build-496@auristor.com>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=216010
      Link: https://lore.kernel.org/r/165308359800.162686.14122417881564420962.stgit@warthog.procyon.org.uk/
      
       # v1
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2aeb8c86
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 978df3e1
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "Some I2C driver bugfixes for 5.18. Nothing spectacular but worth
        fixing"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        drivers: i2c: thunderx: Allow driver to work with ACPI defined TWSI controllers
        i2c: ismt: Provide a DMA buffer for Interrupt Cause Logging
        i2c: mt7621: fix missing clk_disable_unprepare() on error in mtk_i2c_probe()
      978df3e1
  2. May 22, 2022
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v5.18-2022-05-21' of... · eaea45fc
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v5.18-2022-05-21' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Fix and validate CPU map inputs in synthetic PERF_RECORD_STAT events
         in 'perf stat'.
      
       - Fix x86's arch__intr_reg_mask() for the hybrid platform.
      
       - Address 'perf bench numa' compiler error on s390.
      
       - Fix check for btf__load_from_kernel_by_id() in libbpf.
      
       - Fix "all PMU test" 'perf test' to skip hv_24x7/hv_gpci tests on
         powerpc.
      
       - Fix session topology test to skip the test in guest environment.
      
       - Skip BPF 'perf test' if clang is not present.
      
       - Avoid shell test description infinite loop in 'perf test'.
      
       - Fix Intel LBR callstack entries and nr print message.
      
      * tag 'perf-tools-fixes-for-v5.18-2022-05-21' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf session: Fix Intel LBR callstack entries and nr print message
        perf test bpf: Skip test if clang is not present
        perf test session topology: Fix test to skip the test in guest environment
        perf bench numa: Address compiler error on s390
        perf test: Avoid shell test description infinite loop
        perf regs x86: Fix arch__intr_reg_mask() for the hybrid platform
        perf test: Fix "all PMU test" to skip hv_24x7/hv_gpci tests on powerpc
        perf stat: Fix and validate CPU map inputs in synthetic PERF_RECORD_STAT events
        perf build: Fix check for btf__load_from_kernel_by_id() in libbpf
      eaea45fc
    • Linus Torvalds's avatar
      Merge tag 'input-for-v5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · 4c493b1a
      Linus Torvalds authored
      Pull input fixes from Dmitry Torokhov:
       "A small fixup to ili210x touchscreen driver, and updated maintainer
        entry for the device tree binding of Mediatek 6779 keypad:
      
         - fix reset timing of Ilitek touchscreens
      
         - update maintainer entry of DT binding of Mediatek 6779 keypad"
      
      * tag 'input-for-v5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
        Input: ili210x - use one common reset implementation
        Input: ili210x - fix reset timing
        dt-bindings: input: mediatek,mt6779-keypad: update maintainer
      4c493b1a
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 36ed2da7
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Two patches, both in drivers.
      
        The iscsi one is fixing the cpumask issue you commented on and the ufs
        one is a late arriving fix for conditions that can occur in Host
        Performance Booster reads"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: ufs: core: Fix referencing invalid rsp field
        scsi: target: Fix incorrect use of cpumask_t
      36ed2da7
    • Chengdong Li's avatar
      perf session: Fix Intel LBR callstack entries and nr print message · 51d0bf99
      Chengdong Li authored
      
      
      When generating callstack information from branch_stack(Intel LBR), the
      actual number of callstack entry should be bigger than the number of
      branch_stack, for example:
      
      	branch_stack records:
      		B() -> C()
      		A() -> B()
      	converted callstack records should be:
      		C()
      		B()
      		A()
      though, the number of callstack equals
      to the number of branch stack plus 1.
      
      This patch fixes above issue in branch_stack__printf(). For example,
      
      	# echo 'scale=2000; 4*a(1)' > cmd
      	# perf record --call-graph lbr bc -l < cmd
      
      Before applying this patch, `perf script -D` output:
      
      	1220022677386876 0x2a40 [0xd8]: PERF_RECORD_SAMPLE(IP, 0x4002): 17990/17990: 0x40a6d6 period: 894172 addr: 0
      	... LBR call chain: nr:8
      	.....  0: fffffffffffffe00
      	.....  1: 000000000040a410
      	.....  2: 000000000040573c
      	.....  3: 0000000000408650
      	.....  4: 00000000004022f2
      	.....  5: 00000000004015f5
      	.....  6: 00007f5ed6dcb553
      	.....  7: 0000000000401698
      	... FP chain: nr:2
      	.....  0: fffffffffffffe00
      	.....  1: 000000000040a6d8
      	... branch callstack: nr:6    # which is not consistent with LBR records.
      	.....  0: 000000000040a410
      	.....  1: 0000000000408650    # ditto
      	.....  2: 00000000004022f2
      	.....  3: 00000000004015f5
      	.....  4: 00007f5ed6dcb553
      	.....  5: 0000000000401698
      	 ... thread: bc:17990
      	 ...... dso: /usr/bin/bc
      	bc 17990 1220022.677386:     894172 cycles:
      			  40a410 [unknown] (/usr/bin/bc)
      			  40573c [unknown] (/usr/bin/bc)
      			  408650 [unknown] (/usr/bin/bc)
      			  4022f2 [unknown] (/usr/bin/bc)
      			  4015f5 [unknown] (/usr/bin/bc)
      		    7f5ed6dcb553 __libc_start_main+0xf3 (/usr/lib64/libc-2.17.so)
      			  401698 [unknown] (/usr/bin/bc)
      
      After applied:
      
      	1220022677386876 0x2a40 [0xd8]: PERF_RECORD_SAMPLE(IP, 0x4002): 17990/17990: 0x40a6d6 period: 894172 addr: 0
      	... LBR call chain: nr:8
      	.....  0: fffffffffffffe00
      	.....  1: 000000000040a410
      	.....  2: 000000000040573c
      	.....  3: 0000000000408650
      	.....  4: 00000000004022f2
      	.....  5: 00000000004015f5
      	.....  6: 00007f5ed6dcb553
      	.....  7: 0000000000401698
      	... FP chain: nr:2
      	.....  0: fffffffffffffe00
      	.....  1: 000000000040a6d8
      	... branch callstack: nr:7
      	.....  0: 000000000040a410
      	.....  1: 000000000040573c
      	.....  2: 0000000000408650
      	.....  3: 00000000004022f2
      	.....  4: 00000000004015f5
      	.....  5: 00007f5ed6dcb553
      	.....  6: 0000000000401698
      	 ... thread: bc:17990
      	 ...... dso: /usr/bin/bc
      	bc 17990 1220022.677386:     894172 cycles:
      			  40a410 [unknown] (/usr/bin/bc)
      			  40573c [unknown] (/usr/bin/bc)
      			  408650 [unknown] (/usr/bin/bc)
      			  4022f2 [unknown] (/usr/bin/bc)
      			  4015f5 [unknown] (/usr/bin/bc)
      		    7f5ed6dcb553 __libc_start_main+0xf3 (/usr/lib64/libc-2.17.so)
      			  401698 [unknown] (/usr/bin/bc)
      
      Change from v1:
      	- refined code style according to Jiri's review comments.
      
      Signed-off-by: default avatarChengdong Li <chengdongli@tencent.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: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: likexu@tencent.com
      Link: https://lore.kernel.org/r/20220517015726.96131-1-chengdongli@tencent.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      51d0bf99
    • Athira Rajeev's avatar
      perf test bpf: Skip test if clang is not present · 8994e97b
      Athira Rajeev authored
      Perf BPF filter test fails in environment where "clang" is not
      installed.
      
      Test failure logs:
      
      <<>>
       42: BPF filter                    :
       42.1: Basic BPF filtering         : Skip
       42.2: BPF pinning                 : FAILED!
       42.3: BPF prologue generation     : FAILED!
      <<>>
      
      Enabling verbose option provided debug logs which says clang/llvm needs
      to be installed. Snippet of verbose logs:
      
      <<>>
       42.2: BPF pinning                  :
       --- start ---
      test child forked, pid 61423
      ERROR:	unable to find clang.
      Hint:	Try to install latest clang/llvm to support BPF.
              Check your $PATH
      
      <<logs_here>>
      
      Failed to compile test case: 'Basic BPF llvm compile'
      Unable to get BPF object, fix kbuild first
      test child finished with -1
       ---- end ----
      BPF filter subtest 2: FAILED!
      <<>>
      
      Here subtests, "BPF pinning" and "BPF prologue generation" failed and
      logs shows clang/llvm is needed. After installing clang, testcase
      passes.
      
      Reason on why subtest failure happens though logs has proper debug
      information:
      
      Main function __test__bpf calls test_llvm__fetch_bpf_obj by
      passing 4th argument as true ( 4th arguments maps to parameter
      "force" in test_llvm__fetch_bpf_obj ). But this will cause
      test_llvm__fetch_bpf_obj to skip the check for clang/llvm.
      
      Snippet of code part which checks for clang based on
      parameter "force" in test_llvm__fetch_bpf_obj:
      
      <<>>
      if (!force && (!llvm_param.user_set_param &&
      <<>>
      
      Since force is set to "false", test won't get skipped and fails to
      compile test case. The BPF code compilation needs clang, So pass the
      fourth argument as "false" and also skip the test if reason for return
      is "TEST_SKIP"
      
      After the patch:
      
      <<>>
       42: BPF filter                    :
       42.1: Basic BPF filtering         : Skip
       42.2: BPF pinning                 : Skip
       42.3: BPF prologue generation     : Skip
      <<>>
      
      Fixes: ba1fae43
      
       ("perf test: Add 'perf test BPF'")
      Reviewed-by: default avatarKajol Jain <kjain@linux.ibm.com>
      Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lore.kernel.org/r/20220511115438.84032-1-atrajeev@linux.vnet.ibm.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8994e97b
    • Athira Rajeev's avatar
      perf test session topology: Fix test to skip the test in guest environment · cfd7092c
      Athira Rajeev authored
      
      
      The session topology test fails in powerpc pSeries platform.
      
      Test logs:
      
        <<>>
        Session topology : FAILED!
        <<>>
      
      This testcases tests cpu topology by checking the core_id and socket_id
      stored in perf_env from perf session. The data from perf session is
      compared with the cpu topology information from
      "/sys/devices/system/cpu/cpuX/topology" like core_id,
      physical_package_id.
      
      In case of virtual environment, detail like physical_package_id is
      restricted to be exposed. Hence physical_package_id is set to -1. The
      testcase fails on such platforms since socket_id can't be fetched from
      topology info.
      
      Skip the testcase in powerpc if physical_package_id returns -1.
      
      Reviewed-by: default avatarKajol Jain <kjain@linux.ibm.com>
      Signed-off-by: default avatarAthira Rajeev <atrajeev@linux.vnet.ibm.com&gt;--->
      Tested-by: default avatarDisha Goel <disgoel@linux.vnet.ibm.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20220511114959.84002-1-atrajeev@linux.vnet.ibm.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cfd7092c
    • Thomas Richter's avatar
      perf bench numa: Address compiler error on s390 · f8ac1c47
      Thomas Richter authored
      The compilation on s390 results in this error:
      
        # make DEBUG=y bench/numa.o
        ...
        bench/numa.c: In function ‘__bench_numa’:
        bench/numa.c:1749:81: error: ‘%d’ directive output may be truncated
                    writing between 1 and 11 bytes into a region of size between
                    10 and 20 [-Werror=format-truncation=]
        1749 |        snprintf(tname, sizeof(tname), "process%d:thread%d", p, t);
                                                                     ^~
        ...
        bench/numa.c:1749:64: note: directive argument in the range
                       [-2147483647, 2147483646]
        ...
        #
      
      The maximum length of the %d replacement is 11 characters because of the
      negative sign.  Therefore extend the array by two more characters.
      
      Output after:
      
        # make  DEBUG=y bench/numa.o > /dev/null 2>&1; ll bench/numa.o
        -rw-r--r-- 1 root root 418320 May 19 09:11 bench/numa.o
        #
      
      Fixes: 3aff8ba0
      
       ("perf bench numa: Avoid possible truncation when using snprintf()")
      Suggested-by: default avatarNamhyung Kim <namhyung@gmail.com>
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20220520081158.2990006-1-tmricht@linux.ibm.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f8ac1c47
    • Ian Rogers's avatar
      perf test: Avoid shell test description infinite loop · caaaa554
      Ian Rogers authored
      
      
      for_each_shell_test() is already strict in expecting tests to be files
      and executable. It is sometimes possible when it iterates over all files
      that it finds one that is executable and lacks a newline character. When
      this happens the loop never terminates as it doesn't check for EOF.
      
      Add the EOF check to make this loop at least bounded by the file size.
      
      If the description is returned as NULL then also skip the test.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Marco Elver <elver@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Sohaib Mohamed <sohaib.amhmd@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220517204144.645913-1-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      caaaa554
    • Kan Liang's avatar
      perf regs x86: Fix arch__intr_reg_mask() for the hybrid platform · 01b28e4a
      Kan Liang authored
      The X86 specific arch__intr_reg_mask() is to check whether the kernel
      and hardware can collect XMM registers. But it doesn't work on some
      hybrid platform.
      
      Without the patch on ADL-N:
      
        $ perf record -I?
        available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10
        R11 R12 R13 R14 R15
      
      The config of the test event doesn't contain the PMU information. The
      kernel may fail to initialize it on the correct hybrid PMU and return
      the wrong non-supported information.
      
      Add the PMU information into the config for the hybrid platform. The
      same register set is supported among different hybrid PMUs. Checking
      the first available one is good enough.
      
      With the patch on ADL-N:
      
        $ perf record -I?
        available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10
        R11 R12 R13 R14 R15 XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 XMM9
        XMM10 XMM11 XMM12 XMM13 XMM14 XMM15
      
      Fixes: 6466ec14
      
       ("perf regs x86: Add X86 specific arch__intr_reg_mask()")
      Reported-by: default avatarAmmy Yi <ammy.yi@intel.com>
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20220518145125.1494156-1-kan.liang@linux.intel.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      01b28e4a