1. 14 Dec, 2022 9 commits
    • James Clark's avatar
      perf stat: Fix invalid output handle · 3f81f72d
      James Clark authored
      In this context, 'os' is already a pointer so the extra dereference
      isn't required. This fixes the following test failure on aarch64:
      
        $ ./perf test "json output" -vvv
        92: perf stat JSON output linter                                    :
        --- start ---
        Checking json output: no args Test failed for input:
        ...
        Fatal error: glibc detected an invalid stdio handle
        ---- end ----
        perf stat JSON output linter: FAILED!
      
      Fixes: e7f4da31 ("perf stat: Pass struct outstate to printout()")
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Tested-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.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: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20221130111521.334152-2-james.clark@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3f81f72d
    • Namhyung Kim's avatar
      perf stat: Fix multi-line metric output in JSON · 117195d9
      Namhyung Kim authored
      When a metric produces more than one values, it missed to print the opening
      bracket.
      
      Fixes: ab6baaae ("perf stat: Fix JSON output in metric-only mode")
      Reported-by: default avatarWeilin Wang <weilin.wang@intel.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarWeilin Wang <weilin.wang@intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.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/20221202190447.1588680-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      117195d9
    • Ian Rogers's avatar
      tools lib symbol: Add dependency test to install_headers · 113bb396
      Ian Rogers authored
      Compute the headers to be installed from their source headers and make
      each have its own build target to install it. Using dependencies
      avoids headers being reinstalled and getting a new timestamp which
      then causes files that depend on the header to be rebuilt.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nicolas Schier <nicolas@fjasle.eu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20221202045743.2639466-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      113bb396
    • Ian Rogers's avatar
      tools lib subcmd: Add dependency test to install_headers · 5d890591
      Ian Rogers authored
      Compute the headers to be installed from their source headers and make
      each have its own build target to install it. Using dependencies
      avoids headers being reinstalled and getting a new timestamp which
      then causes files that depend on the header to be rebuilt.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nicolas Schier <nicolas@fjasle.eu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20221202045743.2639466-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5d890591
    • Ian Rogers's avatar
      tools lib perf: Add dependency test to install_headers · 47e02b94
      Ian Rogers authored
      Compute the headers to be installed from their source headers and make
      each have its own build target to install it. Using dependencies
      avoids headers being reinstalled and getting a new timestamp which
      then causes files that depend on the header to be rebuilt.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nicolas Schier <nicolas@fjasle.eu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20221202045743.2639466-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      47e02b94
    • Ian Rogers's avatar
      tools lib api: Add dependency test to install_headers · 1849f9f0
      Ian Rogers authored
      Compute the headers to be installed from their source headers and make
      each have its own build target to install it. Using dependencies
      avoids headers being reinstalled and getting a new timestamp which
      then causes files that depend on the header to be rebuilt.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nicolas Schier <nicolas@fjasle.eu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20221202045743.2639466-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1849f9f0
    • Athira Rajeev's avatar
      perf stat: Fix printing field separator in CSV metrics output · 8f4b1e3c
      Athira Rajeev authored
      In 'perf stat' with CSV output option, number of fields in metrics
      output is not matching with number of fields in other event output
      lines.
      
      Sample output below after applying patch to fix printing os->prefix.
      
      	# ./perf stat -x, --per-socket -a -C 1 ls
      	S0,1,82.11,msec,cpu-clock,82111626,100.00,1.000,CPUs utilized
      	S0,1,2,,context-switches,82109314,100.00,24.358,/sec
      	------
      ====>	S0,1,,,,,,,1.71,stalled cycles per insn
      
      The above command line uses field separator as "," via "-x," option and
      per-socket option displays socket value as first field. But here the
      last line for "stalled cycles per insn" has more separators.  Each csv
      output line is expected to have 8 field separators (for the 9 fields),
      where as last line has 9 "," in the result. Patch fixes this issue.
      
      The counter stats are displayed by function
      "perf_stat__print_shadow_stats" in code "util/stat-shadow.c". While
      printing the stats info for "stalled cycles per insn", function
      "new_line_csv" is used as new_line callback.
      
      The fields printed in each line contains: "Socket_id,aggr
      nr,Avg,unit,event_name,run,enable_percent,ratio,unit"
      
      The metric output prints Socket_id, aggr nr, ratio and unit. It has to
      skip through remaining five fields ie,
      Avg,unit,event_name,run,enable_percent. The csv line callback uses
      "os->nfields" to know the number of fields to skip to match with other
      lines.
      
      Currently it is set as:
      
      	os.nfields = 3 + aggr_fields[config->aggr_mode] + (counter->cgrp ? 1 : 0);
      
      But in case of aggregation modes, csv_sep already gets printed along
      with each field (Function "aggr_printout" in util/stat-display.c). So
      aggr_fields can be removed from nfields. And fixed number of fields to
      skip has to be "4". This is to skip fields for: "avg, unit, event name,
      run, enable_percent"
      
      This needs 4 csv separators. Patch removes aggr_fields
      and uses 4 as fixed number of os->nfields to skip.
      
      After the patch:
      
      	# ./perf stat -x, --per-socket -a -C 1 ls
      	S0,1,79.08,msec,cpu-clock,79085956,100.00,1.000,CPUs utilized
      	S0,1,7,,context-switches,79084176,100.00,88.514,/sec
      	------
      ====>	S0,1,,,,,,0.81,stalled cycles per insn
      
      Fixes: 92a61f64 ("perf stat: Implement CSV metrics output")
      Reported-by: default avatarDisha Goel <disgoel@linux.vnet.ibm.com>
      Reviewed-by: default avatarKajol Jain <kjain@linux.ibm.com>
      Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarDisha Goel <disgoel@linux.vnet.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: James Clark <james.clark@arm.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: Namhyung Kim <namhyung@kernel.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20221205042852.83382-1-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8f4b1e3c
    • Anshuman Khandual's avatar
      perf record: Add remaining branch filters: "no_cycles", "no_flags" & "hw_index" · 955f6def
      Anshuman Khandual authored
      This adds all remaining branch filters i.e "no_cycles", "no_flags" and
      "hw_index". While here, also updates the documentation.
      Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20221205064443.533587-1-anshuman.khandual@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      955f6def
    • Ian Rogers's avatar
      perf stat: Check existence of os->prefix, fixing a segfault · 3c97d25c
      Ian Rogers authored
      We need to check if we have a OS prefix, otherwise we stumble on a
      metric segv that I'm now seeing in Arnaldo's tree:
      
        $ gdb --args perf stat -M Backend true
        ...
        Performance counter stats for 'true':
      
                4,712,355      TOPDOWN.SLOTS                    #     17.3 % tma_core_bound
      
        Program received signal SIGSEGV, Segmentation fault.
        __strlen_evex () at ../sysdeps/x86_64/multiarch/strlen-evex.S:77
        77      ../sysdeps/x86_64/multiarch/strlen-evex.S: No such file or directory.
        (gdb) bt
        #0  __strlen_evex () at ../sysdeps/x86_64/multiarch/strlen-evex.S:77
        #1  0x00007ffff74749a5 in __GI__IO_fputs (str=0x0, fp=0x7ffff75f5680 <_IO_2_1_stderr_>)
        #2  0x0000555555779f28 in do_new_line_std (config=0x555555e077c0 <stat_config>, os=0x7fffffffbf10) at util/stat-display.c:356
        #3  0x000055555577a081 in print_metric_std (config=0x555555e077c0 <stat_config>, ctx=0x7fffffffbf10, color=0x0, fmt=0x5555558b77b5 "%8.1f", unit=0x7fffffffbb10 "%  tma_memory_bound", val=13.165355724442199) at util/stat-display.c:380
        #4  0x00005555557768b6 in generic_metric (config=0x555555e077c0 <stat_config>, metric_expr=0x55555593d5b7 "((CYCLE_ACTIVITY.STALLS_MEM_ANY + EXE_ACTIVITY.BOUND_ON_STORES) / (CYCLE_ACTIVITY.STALLS_TOTAL + (EXE_ACTIVITY.1_PORTS_UTIL + tma_retiring * EXE_ACTIVITY.2_PORTS_UTIL) + EXE_ACTIVITY.BOUND_ON_STORES))"..., metric_events=0x555555f334e0, metric_refs=0x555555ec81d0, name=0x555555f32e80 "TOPDOWN.SLOTS", metric_name=0x555555f26c80 "tma_memory_bound", metric_unit=0x55555593d5b1 "100%", runtime=0, map_idx=0, out=0x7fffffffbd90, st=0x555555e9e620 <rt_stat>) at util/stat-shadow.c:934
        #5  0x0000555555778cac in perf_stat__print_shadow_stats (config=0x555555e077c0 <stat_config>, evsel=0x555555f289d0, avg=4712355, map_idx=0, out=0x7fffffffbd90, metric_events=0x555555e078e8 <stat_config+296>, st=0x555555e9e620 <rt_stat>) at util/stat-shadow.c:1329
        #6  0x000055555577b6a0 in printout (config=0x555555e077c0 <stat_config>, os=0x7fffffffbf10, uval=4712355, run=325322, ena=325322, noise=4712355, map_idx=0) at util/stat-display.c:741
        #7  0x000055555577bc74 in print_counter_aggrdata (config=0x555555e077c0 <stat_config>, counter=0x555555f289d0, s=0, os=0x7fffffffbf10) at util/stat-display.c:838
        #8  0x000055555577c1d8 in print_counter (config=0x555555e077c0 <stat_config>, counter=0x555555f289d0, os=0x7fffffffbf10) at util/stat-display.c:957
        #9  0x000055555577dba0 in evlist__print_counters (evlist=0x555555ec3610, config=0x555555e077c0 <stat_config>, _target=0x555555e01c80 <target>, ts=0x0, argc=1, argv=0x7fffffffe450) at util/stat-display.c:1413
        #10 0x00005555555fc821 in print_counters (ts=0x0, argc=1, argv=0x7fffffffe450) at builtin-stat.c:1040
        #11 0x000055555560091a in cmd_stat (argc=1, argv=0x7fffffffe450) at builtin-stat.c:2665
        #12 0x00005555556b1eea in run_builtin (p=0x555555e11f70 <commands+336>, argc=4, argv=0x7fffffffe450) at perf.c:322
        #13 0x00005555556b2181 in handle_internal_command (argc=4, argv=0x7fffffffe450) at perf.c:376
        #14 0x00005555556b22d7 in run_argv (argcp=0x7fffffffe27c, argv=0x7fffffffe270) at perf.c:420
        #15 0x00005555556b26ef in main (argc=4, argv=0x7fffffffe450) at perf.c:550
        (gdb)
      
      Fixes: f123b2d8 ("perf stat: Remove prefix argument in print_metric_headers()")
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.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: http://lore.kernel.org/lkml/CAP-5=fUOjSM5HajU9TCD6prY39LbX4OQbkEbtKPPGRBPBN=_VQ@mail.gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3c97d25c
  2. 05 Dec, 2022 4 commits
  3. 24 Nov, 2022 24 commits
  4. 23 Nov, 2022 3 commits
    • Linus Torvalds's avatar
      Merge tag 'pci-v6.1-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · c3eb11fb
      Linus Torvalds authored
      Pull pci fixes from Bjorn Helgaas:
      
       - Update MAINTAINERS to add Manivannan Sadhasivam as Qcom PCIe RC
         maintainer (replacing Stanimir Varbanov) and include DT PCI bindings
         in the "PCI native host bridge and endpoint drivers" entry.
      
      * tag 'pci-v6.1-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        MAINTAINERS: Include PCI bindings in host bridge entry
        MAINTAINERS: Add Manivannan Sadhasivam as Qcom PCIe RC maintainer
      c3eb11fb
    • Linus Torvalds's avatar
      Merge tag 'spi-fix-v6.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · 4312098b
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "A few fixes, all device specific.
      
        The most important ones are for the i.MX driver which had a couple of
        nasty data corruption inducing errors appear after the change to
        support PIO mode in the last merge window (one introduced by the
        change and one latent one which the PIO changes exposed).
      
        Thanks to Frieder, Fabio, Marc and Marek for jumping on that and
        resolving the issues quickly once they were found"
      
      * tag 'spi-fix-v6.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        spi: spi-imx: spi_imx_transfer_one(): check for DMA transfer first
        spi: tegra210-quad: Fix duplicate resource error
        spi: dw-dma: decrease reference count in dw_spi_dma_init_mfld()
        spi: spi-imx: Fix spi_bus_clk if requested clock is higher than input clock
        spi: mediatek: Fix DEVAPC Violation at KO Remove
      4312098b
    • Linus Torvalds's avatar
      Merge tag '9p-for-6.1-rc7' of https://github.com/martinetd/linux · fd64898d
      Linus Torvalds authored
      Pull 9p fixes from Dominique Martinet:
      
       - 9p now uses a variable size for its recv buffer, but every place
         hadn't been updated properly to use it and some buffer overflows have
         been found and needed fixing.
      
         There's still one place where msize is incorrectly used in a safety
         check (p9_check_errors), but all paths leading to it should already
         be avoiding overflows and that patch took a bit more time to get
         right for zero-copy requests so I'll send it for 6.2
      
       - yet another race condition in p9_conn_cancel introduced by a fix for
         a syzbot report in the same place. Maybe at some point we'll get it
         right without burning it all down...
      
      * tag '9p-for-6.1-rc7' of https://github.com/martinetd/linux:
        9p/xen: check logical size for buffer size
        9p/fd: Use P9_HDRSZ for header size
        9p/fd: Fix write overflow in p9_read_work
        9p/fd: fix issue of list_del corruption in p9_fd_cancel()
      fd64898d