1. Jun 30, 2022
    • Ian Rogers's avatar
      perf jevents: Remove jevents.c · 5a059790
      Ian Rogers authored
      
      
      Remove files and build rules.
      
      Remove test for comparing with jevents.py as there is no longer a binary
      to compare with.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarJohn Garry <john.garry@huawei.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/20220629182505.406269-5-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5a059790
    • Ian Rogers's avatar
      perf jevents: Switch build to use jevents.py · 00facc76
      Ian Rogers authored
      
      
      Generate pmu-events.c using jevents.py rather than the binary built from
      jevents.c.
      
      Add a new config variable NO_JEVENTS that is set when there is no
      architecture json or an appropriate python interpreter isn't present.
      
      When NO_JEVENTS is defined the file pmu-events/empty-pmu-events.c is
      copied and used as the pmu-events.c file.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarJohn Garry <john.garry@huawei.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: Ian Rogers <rogers.email@gmail.com>
      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/20220629182505.406269-4-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      00facc76
    • Ian Rogers's avatar
      perf jevents: Add python converter script · ffc606ad
      Ian Rogers authored
      
      
      jevents.c is large, has a dependency on an old forked version of jsmn,
      and is challenging to work upon. A lot of jevents.c's complexity comes
      from needing to write json and csv parsing from first principles. In
      contrast python has this functionality in standard libraries and is
      already a build pre-requisite for tools like asciidoc (that builds all
      of the perf man pages).
      
      Introduce jevents.py that produces identical output to jevents.c. Add a
      test that runs both converter tools and validates there are no output
      differences. The test can be invoked with a phony build target like:
      
        $ make -C tools/perf jevents-py-test
      
      The python code deliberately tries to replicate the behavior of
      jevents.c so that the output matches and transitioning tools shouldn't
      introduce regressions. In some cases the code isn't as elegant as hoped,
      but fixing this can be done as follow up.
      
      Committer testing:
      
        $ make -C tools/perf jevents-py-test
        make: Entering directory '/var/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j32' parallel build
          HOSTCC  fixdep.o
          HOSTLD  fixdep-in.o
          LINK    fixdep
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        ...                        libbfd: [ on  ]
        ...                libbfd-buildid: [ on  ]
        ...                        libcap: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...        numa_num_possible_cpus: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                     libcrypto: [ OFF ]
        ...                     libunwind: [ on  ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                          zlib: [ on  ]
        ...                          lzma: [ on  ]
        ...                     get_cpuid: [ on  ]
        ...                           bpf: [ on  ]
        ...                        libaio: [ on  ]
        ...                       libzstd: [ on  ]
        ...        disassembler-four-args: [ on  ]
      
          HOSTCC  pmu-events/json.o
          HOSTCC  pmu-events/jsmn.o
          HOSTCC  pmu-events/jevents.o
          HOSTLD  pmu-events/jevents-in.o
          LINK    pmu-events/jevents
        Checking architecture: arm64
        Generating using jevents.c
        Generating using jevents.py
        Diffing
        Checking architecture: nds32
        Generating using jevents.c
        Generating using jevents.py
        Diffing
        Checking architecture: powerpc
        Generating using jevents.c
        Generating using jevents.py
        Diffing
        Checking architecture: s390
        Generating using jevents.c
        Generating using jevents.py
        Diffing
        Checking architecture: x86
        Generating using jevents.c
        Generating using jevents.py
        Diffing
        make: Leaving directory '/var/home/acme/git/perf/tools/perf'
        $
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarJohn Garry <john.garry@huawei.com>
      Tested-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Tested-by: default avatarXing Zhengjun <zhengjun.xing@linux.intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.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>
      Link: https://lore.kernel.org/r/20220629182505.406269-3-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ffc606ad
    • Ian Rogers's avatar
      perf python: Prefer python3 · 4c41cb46
      Ian Rogers authored
      The PYTHON_AUTO code orders the preference for the PYTHON command to be
      python3, python and then python2. python3 makes a more logical
      preference as python2 is no longer supported:
      
        https://www.python.org/doc/sunset-python-2/
      
      
      
      Reorder the priority of the PYTHON command to be python2, python and
      then python3.
      
      Reported-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarJohn Garry <john.garry@huawei.com>
      Tested-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Tested-by: default avatarXing Zhengjun <zhengjun.xing@linux.intel.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>
      Link: https://lore.kernel.org/r/20220629182505.406269-2-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4c41cb46
  2. Jun 25, 2022
    • Ravi Bangoria's avatar
      perf script ibs: Support new IBS bits in raw trace dump · 0429796e
      Ravi Bangoria authored
      
      
      Interpret Additional set of IBS register bits while doing
      perf report/script raw dump.
      
      IBS op PMU ex:
      
        $ sudo ./perf record -c 130 -a -e ibs_op/l3missonly=1/ --raw-samples
        $ sudo ./perf report -D
        ...
        ibs_op_ctl:     0000004500070008 MaxCnt       128 L3MissOnly 1 En 1
              Val 1 CntCtl 0=cycles CurCnt        69
        ibs_op_data:    0000000000710002 CompToRetCtr     2 TagToRetCtr   113
              BrnRet 0  RipInvalid 0 BrnFuse 0 Microcode 0
        ibs_op_data2:   0000000000000002 CacheHitSt 0=M-state RmtNode 0
              DataSrc 2=A peer cache in a near CCX
        ibs_op_data3:   000000681d1700a1 LdOp 1 StOp 0 DcL1TlbMiss 0
              DcL2TlbMiss 0 DcL1TlbHit2M 0 DcL1TlbHit1G 1 DcL2TlbHit2M 0
              DcMiss 1 DcMisAcc 0 DcWcMemAcc 0 DcUcMemAcc 0 DcLockedOp 0
              DcMissNoMabAlloc 1 DcLinAddrValid 1 DcPhyAddrValid 1
              DcL2TlbHit1G 0 L2Miss 1 SwPf 0 OpMemWidth  8 bytes
              OpDcMissOpenMemReqs  7 DcMissLat   104 TlbRefillLat     0
      
      IBS Fetch PMU ex:
        $ sudo ./perf record -c 130 -a -e ibs_fetch/l3missonly=1/ --raw-samples
        $ sudo ./perf report -D
        ...
        ibs_fetch_ctl:  3c1f00c700080008 MaxCnt     128 Cnt     128 Lat   199
              En 1 Val 1 Comp 1 IcMiss 1 PhyAddrValid        1 L1TlbPgSz 4KB
              L1TlbMiss 0 L2TlbMiss 0 RandEn 0 L2Miss 1 L3MissOnly 1
              FetchOcMiss 1 FetchL3Miss 1
      
      With the DataSrc extensions, the source of data can be decoded among:
       - Local L3 or other L1/L2 in CCX.
       - A peer cache in a near CCX.
       - Data returned from DRAM.
       - A peer cache in a far CCX.
       - DRAM address map with "long latency" bit set.
       - Data returned from MMIO/Config/PCI/APIC.
       - Extension Memory (S-Link, GenZ, etc - identified by the CS target
          and/or address map at DF's choice).
       - Peer Agent Memory.
      
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@amd.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <rrichter@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Santosh Shukla <santosh.shukla@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: like.xu.linux@gmail.com
      Cc: x86@kernel.org
      Link: https://lore.kernel.org/r/20220604044519.594-9-ravi.bangoria@amd.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0429796e
    • Ravi Bangoria's avatar
      perf tool ibs: Sync AMD IBS header file · c1f4f92b
      Ravi Bangoria authored
      
      
      IBS support has been enhanced with two new features in upcoming uarch:
      
      1. DataSrc extension
      2. L3 miss filtering.
      
      Additional set of bits has been introduced in IBS registers to exploit
      these features.
      
      New bits are already defining in arch/x86/ header. Sync it with tools
      header file. Also rename existing ibs_op_data field 'data_src' to
      'data_src_lo'.
      
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@amd.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <rrichter@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Santosh Shukla <santosh.shukla@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: like.xu.linux@gmail.com
      Cc: x86@kernel.org
      Link: https://lore.kernel.org/r/20220604044519.594-8-ravi.bangoria@amd.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c1f4f92b
    • Ravi Bangoria's avatar
      perf header: Record non-CPU PMU capabilities · 2139f742
      Ravi Bangoria authored
      
      
      PMUs advertise their capabilities via sysfs attribute files but
      the perf tool currently parses only core(CPU) or hybrid core PMU
      capabilities. Add support of recording non-core PMU capabilities
      int perf.data header.
      
      Note that a newly proposed HEADER_PMU_CAPS is replacing existing
      HEADER_HYBRID_CPU_PMU_CAPS. Special care is taken for hybrid core
      PMUs by writing their capabilities first in the perf.data header
      to make sure new perf.data file being read by old perf tool does
      not break.
      
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@amd.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <rrichter@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Santosh Shukla <santosh.shukla@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: like.xu.linux@gmail.com
      Cc: x86@kernel.org
      Link: https://lore.kernel.org/r/20220604044519.594-6-ravi.bangoria@amd.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2139f742
    • Ravi Bangoria's avatar
      perf header: Store PMU caps in an array of strings · ff34eaa8
      Ravi Bangoria authored
      
      
      Currently all capabilities are stored in a single string separated by
      NULL character. Instead, store them in an array which makes searching of
      capability easier.
      
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@amd.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <rrichter@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Santosh Shukla <santosh.shukla@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: like.xu.linux@gmail.com
      Cc: x86@kernel.org
      Link: https://lore.kernel.org/r/20220604044519.594-5-ravi.bangoria@amd.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ff34eaa8
    • Ravi Bangoria's avatar
      perf header: Pass "cpu" pmu name while printing caps · 2a12bef4
      Ravi Bangoria authored
      
      
      Avoid unnecessary conditional code to check if pmu name is NULL
      or not by passing "cpu" pmu name to the printing function.
      
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@amd.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <rrichter@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Santosh Shukla <santosh.shukla@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: like.xu.linux@gmail.com
      Cc: x86@kernel.org
      Link: https://lore.kernel.org/r/20220604044519.594-4-ravi.bangoria@amd.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2a12bef4
    • Ravi Bangoria's avatar
      perf pmu: Parse pmu caps sysfs only once · 3339ec44
      Ravi Bangoria authored
      
      
      In addition to returning nr_caps, cache it locally in struct perf_pmu.
      
      Similarly, cache status of whether caps sysfs has already been parsed
      or not. These will help to avoid parsing sysfs every time the function
      gets called.
      
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@amd.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <rrichter@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Santosh Shukla <santosh.shukla@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: like.xu.linux@gmail.com
      Cc: x86@kernel.org
      Link: https://lore.kernel.org/r/20220604044519.594-3-ravi.bangoria@amd.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3339ec44
    • Ravi Bangoria's avatar
      perf record ibs: Warn about sampling period skew · 9ab95b0b
      Ravi Bangoria authored
      
      
      Samples without an L3 miss are discarded and counter is reset with
      random value (between 1-15 for fetch PMU and 1-127 for op PMU) when IBS
      L3 miss filtering is enabled. This causes a sampling period skew but
      there is no way to reconstruct aggregated sampling period. So print a
      warning at perf record if user sets l3missonly=1.
      
      Ex:
      
        # perf record -c 10000 -C 0 -e ibs_op/l3missonly=1/
        WARNING: Hw internally resets sampling period when L3 Miss Filtering is enabled
        and tagged operation does not cause L3 Miss. This causes sampling period skew.
      
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@amd.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <rrichter@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Santosh Shukla <santosh.shukla@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: like.xu.linux@gmail.com
      Cc: x86@kernel.org
      Link: http://lore.kernel.org/lkml/20220604044519.594-2-ravi.bangoria@amd.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9ab95b0b
  3. Jun 23, 2022
  4. Jun 22, 2022
    • Tim Crawford's avatar
      ALSA: hda/realtek: Add quirk for Clevo NS50PU · 627ce0d6
      Tim Crawford authored
      
      
      Fixes headset detection on Clevo NS50PU.
      
      Signed-off-by: default avatarTim Crawford <tcrawford@system76.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20220622150017.9897-1-tcrawford@system76.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      627ce0d6
    • Linus Torvalds's avatar
      Merge tag '9p-for-5.19-rc4' of https://github.com/martinetd/linux · 3abc3ae5
      Linus Torvalds authored
      Pull 9pfs fixes from Dominique Martinet:
       "A couple of fid refcount and fscache fixes:
      
         - fid refcounting was incorrect in some corner cases and would leak
           resources, only freed at umount time. The first three commits fix
           three such cases
      
         - 'cache=loose' or fscache was broken when trying to write a partial
           page to a file with no read permission since the rework a few
           releases ago.
      
           The fix taken here is just to restore old behavior of using the
           special 'writeback_fid' for such reads, which is open as root/RDWR
           and such not get complains that we try to read on a WRONLY fid.
      
           Long-term it'd be nice to get rid of this and not issue the read at
           all (skip cache?) in such cases, but that direction hasn't
           progressed"
      
      * tag '9p-for-5.19-rc4' of https://github.com/martinetd/linux:
        9p: fix EBADF errors in cached mode
        9p: Fix refcounting during full path walks for fid lookups
        9p: fix fid refcount leak in v9fs_vfs_get_link
        9p: fix fid refcount leak in v9fs_vfs_atomic_open_dotl
      3abc3ae5
    • Jakub Kicinski's avatar
      Revert "drivers/net/ethernet/neterion/vxge: Fix a use-after-free bug in vxge-main.c" · 877fe9d4
      Jakub Kicinski authored
      This reverts commit 8fc74d18.
      
      BAR0 is the main (only?) register bank for this device. We most
      obviously can't unmap it before the netdev is unregistered.
      This was pointed out in review but the patch got reposted and
      merged, anyway.
      
      The author of the patch was only testing it with a QEMU model,
      which I presume does not emulate enough for the netdev to be brought
      up (author's replies are not visible in lore because they kept sending
      their emails in HTML).
      
      Link: https://lore.kernel.org/all/20220616085059.680dc215@kernel.org/
      Fixes: 8fc74d18
      
       ("drivers/net/ethernet/neterion/vxge: Fix a use-after-free bug in vxge-main.c")
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      877fe9d4
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf · 53664d51
      Jakub Kicinski authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      1) Use get_random_u32() instead of prandom_u32_state() in nft_meta
         and nft_numgen, from Florian Westphal.
      
      2) Incorrect list head in nfnetlink_cttimeout in recent update coming
         from previous development cycle. Also from Florian.
      
      3) Incorrect path to pktgen scripts for nft_concat_range.sh selftest.
         From Jie2x Zhou.
      
      4) Two fixes for the for nft_fwd and nft_dup egress support, from Florian.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
        netfilter: nf_dup_netdev: add and use recursion counter
        netfilter: nf_dup_netdev: do not push mac header a second time
        selftests: netfilter: correct PKTGEN_SCRIPT_PATHS in nft_concat_range.sh
        netfilter: cttimeout: fix slab-out-of-bounds read typo in cttimeout_net_exit
        netfilter: use get_random_u32 instead of prandom
      ====================
      
      Link: https://lore.kernel.org/r/20220621085618.3975-1-pablo@netfilter.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      53664d51
    • Lukas Wunner's avatar
      net: phy: smsc: Disable Energy Detect Power-Down in interrupt mode · 2642cc6c
      Lukas Wunner authored
      Simon reports that if two LAN9514 USB adapters are directly connected
      without an intermediate switch, the link fails to come up and link LEDs
      remain dark.  The issue was introduced by commit 1ce8b372 ("usbnet:
      smsc95xx: Forward PHY interrupts to PHY driver to avoid polling").
      
      The PHY suffers from a known erratum wherein link detection becomes
      unreliable if Energy Detect Power-Down is used.  In poll mode, the
      driver works around the erratum by briefly disabling EDPD for 640 msec
      to detect a neighbor, then re-enabling it to save power.
      
      In interrupt mode, no interrupt is signaled if EDPD is used by both link
      partners, so it must not be enabled at all.
      
      We'll recoup the power savings by enabling SUSPEND1 mode on affected
      LAN95xx chips in a forthcoming commit.
      
      Fixes: 1ce8b372
      
       ("usbnet: smsc95xx: Forward PHY interrupts to PHY driver to avoid polling")
      Reported-by: default avatarSimon Han <z.han@kunbus.com>
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Link: https://lore.kernel.org/r/439a3f3168c2f9d44b5fd9bb8d2b551711316be6.1655714438.git.lukas@wunner.de
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2642cc6c
    • Anatolii Gerasymenko's avatar
      ice: ethtool: Prohibit improper channel config for DCB · a632b2a4
      Anatolii Gerasymenko authored
      Do not allow setting less channels, than Traffic Classes there are
      via ethtool. There must be at least one channel per Traffic Class.
      
      If you set less channels, than Traffic Classes there are, then during
      ice_vsi_rebuild there would be allocated only the requested amount
      of tx/rx rings in ice_vsi_alloc_arrays. But later in ice_vsi_setup_q_map
      there would be requested at least one channel per Traffic Class. This
      results in setting num_rxq > alloc_rxq and num_txq > alloc_txq.
      Later, there would be a NULL pointer dereference in
      ice_vsi_map_rings_to_vectors, because we go beyond of rx_rings or
      tx_rings arrays.
      
      Change ice_set_channels() to return error if you try to allocate less
      channels, than Traffic Classes there are.
      Change ice_vsi_setup_q_map() and ice_vsi_setup_q_map_mqprio() to return
      status code instead of void.
      Add error handling for ice_vsi_setup_q_map() and
      ice_vsi_setup_q_map_mqprio() in ice_vsi_init() and ice_vsi_cfg_tc().
      
      [53753.889983] INFO: Flow control is disabled for this traffic class (0) on this vsi.
      [53763.984862] BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
      [53763.992915] PGD 14b45f5067 P4D 0
      [53763.996444] Oops: 0002 [#1] SMP NOPTI
      [53764.000312] CPU: 12 PID: 30661 Comm: ethtool Kdump: loaded Tainted: GOE    --------- -  - 4.18.0-240.el8.x86_64 #1
      [53764.011825] Hardware name: Intel Corporation WilsonCity/WilsonCity, BIOS WLYDCRB1.SYS.0020.P21.2012150710 12/15/2020
      [53764.022584] RIP: 0010:ice_vsi_map_rings_to_vectors+0x7e/0x120 [ice]
      [53764.029089] Code: 41 0d 0f b7 b7 12 05 00 00 0f b6 d0 44 29 de 44 0f b7 c6 44 01 c2 41 39 d0 7d 2d 4c 8b 47 28 44 0f b7 ce 83 c6 01 4f 8b 04 c8 <49> 89 48 28 4                           c 8b 89 b8 01 00 00 4d 89 08 4c 89 81 b8 01 00 00 44
      [53764.048379] RSP: 0018:ff550dd88ea47b20 EFLAGS: 00010206
      [53764.053884] RAX: 0000000000000002 RBX: 0000000000000004 RCX: ff385ea42fa4a018
      [53764.061301] RDX: 0000000000000006 RSI: 0000000000000005 RDI: ff385e9baeedd018
      [53764.068717] RBP: 0000000000000010 R08: 0000000000000000 R09: 0000000000000004
      [53764.076133] R10: 0000000000000002 R11: 0000000000000004 R12: 0000000000000000
      [53764.083553] R13: 0000000000000000 R14: ff385e658fdd9000 R15: ff385e9baeedd018
      [53764.090976] FS:  000014872c5b5740(0000) GS:ff385e847f100000(0000) knlGS:0000000000000000
      [53764.099362] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [53764.105409] CR2: 0000000000000028 CR3: 0000000a820fa002 CR4: 0000000000761ee0
      [53764.112851] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [53764.120301] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [53764.127747] PKRU: 55555554
      [53764.130781] Call Trace:
      [53764.133564]  ice_vsi_rebuild+0x611/0x870 [ice]
      [53764.138341]  ice_vsi_recfg_qs+0x94/0x100 [ice]
      [53764.143116]  ice_set_channels+0x1a8/0x3e0 [ice]
      [53764.147975]  ethtool_set_channels+0x14e/0x240
      [53764.152667]  dev_ethtool+0xd74/0x2a10
      [53764.156665]  ? __mod_lruvec_state+0x44/0x110
      [53764.161280]  ? __mod_lruvec_state+0x44/0x110
      [53764.165893]  ? page_add_file_rmap+0x15/0x170
      [53764.170518]  ? inet_ioctl+0xd1/0x220
      [53764.174445]  ? netdev_run_todo+0x5e/0x290
      [53764.178808]  dev_ioctl+0xb5/0x550
      [53764.182485]  sock_do_ioctl+0xa0/0x140
      [53764.186512]  sock_ioctl+0x1a8/0x300
      [53764.190367]  ? selinux_file_ioctl+0x161/0x200
      [53764.195090]  do_vfs_ioctl+0xa4/0x640
      [53764.199035]  ksys_ioctl+0x60/0x90
      [53764.202722]  __x64_sys_ioctl+0x16/0x20
      [53764.206845]  do_syscall_64+0x5b/0x1a0
      [53764.210887]  entry_SYSCALL_64_after_hwframe+0x65/0xca
      
      Fixes: 87324e74
      
       ("ice: Implement ethtool ops for channels")
      Signed-off-by: default avatarAnatolii Gerasymenko <anatolii.gerasymenko@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      a632b2a4
    • Anatolii Gerasymenko's avatar
      ice: ethtool: advertise 1000M speeds properly · c3d184c8
      Anatolii Gerasymenko authored
      In current implementation ice_update_phy_type enables all link modes
      for selected speed. This approach doesn't work for 1000M speeds,
      because both copper (1000baseT) and optical (1000baseX) standards
      cannot be enabled at once.
      
      Fix this, by adding the function `ice_set_phy_type_from_speed()`
      for 1000M speeds.
      
      Fixes: 48cb27f2
      
       ("ice: Implement handlers for ethtool PHY/link operations")
      Signed-off-by: default avatarAnatolii Gerasymenko <anatolii.gerasymenko@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      c3d184c8
    • Wojciech Drewek's avatar
      ice: Fix switchdev rules book keeping · 3578dc90
      Wojciech Drewek authored
      Adding two filters with same matching criteria ends up with
      one rule in hardware with act = ICE_FWD_TO_VSI_LIST.
      In order to remove them properly we have to keep the
      information about vsi handle which is used in VSI bitmap
      (ice_adv_fltr_mgmt_list_entry::vsi_list_info::vsi_map).
      
      Fixes: 0d08a441
      
       ("ice: ndo_setup_tc implementation for PF")
      Reported-by: default avatarSridhar Samudrala <sridhar.samudrala@intel.com>
      Signed-off-by: default avatarWojciech Drewek <wojciech.drewek@intel.com>
      Tested-by: default avatarSandeep Penigalapati <sandeep.penigalapati@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      3578dc90
    • Marcin Szycik's avatar
      ice: ignore protocol field in GTP offload · d4ea6f63
      Marcin Szycik authored
      Commit 34a89775 ("ice: Add support for inner etype in switchdev")
      added the ability to match on inner ethertype. A side effect of that change
      is that it is now impossible to add some filters for protocols which do not
      contain inner ethtype field. tc requires the protocol field to be specified
      when providing certain other options, e.g. src_ip. This is a problem in
      case of GTP - when user wants to specify e.g. src_ip, they also need to
      specify protocol in tc command (otherwise tc fails with: Illegal "src_ip").
      Because GTP is a tunnel, the protocol field is treated as inner protocol.
      GTP does not contain inner ethtype field and the filter cannot be added.
      
      To fix this, ignore the ethertype field in case of GTP filters.
      
      Fixes: 9a225f81
      
       ("ice: Support GTP-U and GTP-C offload in switchdev")
      Signed-off-by: default avatarMarcin Szycik <marcin.szycik@linux.intel.com>
      Tested-by: default avatarSandeep Penigalapati <sandeep.penigalapati@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      d4ea6f63