1. 10 Aug, 2022 4 commits
    • Roberto Sassu's avatar
      bpftool: Complete libbfd feature detection · 13e6f53a
      Roberto Sassu authored
      Commit 6e8ccb4f ("tools/bpf: properly account for libbfd variations")
      sets the linking flags depending on which flavor of the libbfd feature was
      detected.
      
      However, the flavors except libbfd cannot be detected, as they are not in
      the feature list.
      
      Complete the list of features to detect by adding libbfd-liberty and
      libbfd-liberty-z.
      
      Committer notes:
      
      Adjust conflict with with:
      
        1e1613f6 ("tools bpftool: Don't display disassembler-four-args feature test")
        600b7b26 ("tools bpftool: Fix compilation error with new binutils")
      
      Fixes: 6e8ccb4f ("tools/bpf: properly account for libbfd variations")
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: bpf@vger.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: llvm@lists.linux.dev
      Cc: Martin KaFai Lau <martin.lau@linux.dev>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stanislav Fomichev <sdf@google.com>
      Link: https://lore.kernel.org/r/20220719170555.2576993-2-roberto.sassu@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      13e6f53a
    • Roberto Sassu's avatar
      tools, build: Retry detection of bfd-related features · 629b98e2
      Roberto Sassu authored
      While separate features have been defined to determine which linking flags
      are required to use libbfd depending on the distribution (libbfd,
      libbfd-liberty and libbfd-liberty-z), the same has not been done for other
      features requiring linking to libbfd.
      
      For example, disassembler-four-args requires linking to libbfd too, but it
      should use the right linking flags. If not all the required ones are
      specified, e.g. -liberty, detection will always fail even if the feature is
      available.
      
      Instead of creating new features, similarly to libbfd, simply retry
      detection with the different set of flags until detection succeeds (or
      fails, if the libraries are missing). In this way, feature detection is
      transparent for the users of this building mechanism (e.g. perf), and those
      users don't have for example to set an appropriate value for the
      FEATURE_CHECK_LDFLAGS-disassembler-four-args variable.
      
      The number of retries and features for which the retry mechanism is
      implemented is low enough to make the increase in the complexity of
      Makefile negligible.
      
      Tested with perf and bpftool on Ubuntu 20.04.4 LTS, Fedora 36 and openSUSE
      Tumbleweed.
      
      Committer notes:
      
      Do the retry for disassembler-init-styled as well.
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andres Freund <andres@anarazel.de>
      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: Martin KaFai Lau <martin.lau@linux.dev>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stanislav Fomichev <sdf@google.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20220719170555.2576993-1-roberto.sassu@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      629b98e2
    • Claire Jensen's avatar
      perf test: JSON format checking · 0c343af2
      Claire Jensen authored
      Add field checking tests for perf stat JSON output.
      
      Sanity checks the expected number of fields are present, that the
      expected keys are present and they have the correct values.
      
      Committer notes:
      
      Had to fix this:
      
        -               $(INSTALL) tests/shell/lib/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib' \
        +               $(INSTALL) tests/shell/lib/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
      
      Committer testing:
      
        [root@quaco ~]# perf test json
         90: perf stat JSON output linter                                    : Ok
        [root@quaco ~]# set -o vi
        [root@quaco ~]# perf test -v json
         90: perf stat JSON output linter                                    :
        --- start ---
        test child forked, pid 560794
        Checking json output: no args [Success]
        Checking json output: system wide [Success]
        Checking json output: system wide Checking json output: system wide no aggregation [Success]
        Checking json output: interval [Success]
        Checking json output: event [Success]
        Checking json output: per core [Success]
        Checking json output: per thread [Success]
        Checking json output: per die [Success]
        Checking json output: per node [Success]
        Checking json output: per socket [Success]
        test child finished with 0
        ---- end ----
        perf stat JSON output linter: Ok
        [root@quaco ~]#
      Signed-off-by: default avatarClaire Jensen <cjense@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alyssa Ross <hi@alyssa.is>
      Cc: Claire Jensen <clairej735@gmail.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      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: Like Xu <likexu@tencent.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20220805200105.2020995-3-irogers@google.comSigned-off-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0c343af2
    • Claire Jensen's avatar
      perf stat: Add JSON output option · df936cad
      Claire Jensen authored
      CSV output is tricky to format and column layout changes are susceptible
      to breaking parsers. New JSON-formatted output has variable names to
      identify fields that are consistent and informative, making the output
      parseable.
      
      CSV output example:
      
        1.20,msec,task-clock:u,1204272,100.00,0.697,CPUs utilized
        0,,context-switches:u,1204272,100.00,0.000,/sec
        0,,cpu-migrations:u,1204272,100.00,0.000,/sec
        70,,page-faults:u,1204272,100.00,58.126,K/sec
      
      JSON output example:
      
        {"counter-value" : "3805.723968", "unit" : "msec", "event" :
        "cpu-clock", "event-runtime" : 3805731510100.00, "pcnt-running"
        : 100.00, "metric-value" : 4.007571, "metric-unit" : "CPUs utilized"}
        {"counter-value" : "6166.000000", "unit" : "", "event" :
        "context-switches", "event-runtime" : 3805723045100.00, "pcnt-running"
        : 100.00, "metric-value" : 1.620191, "metric-unit" : "K/sec"}
        {"counter-value" : "466.000000", "unit" : "", "event" :
        "cpu-migrations", "event-runtime" : 3805727613100.00, "pcnt-running"
        : 100.00, "metric-value" : 122.447136, "metric-unit" : "/sec"}
        {"counter-value" : "208.000000", "unit" : "", "event" :
        "page-faults", "event-runtime" : 3805726799100.00, "pcnt-running"
        : 100.00, "metric-value" : 54.654516, "metric-unit" : "/sec"}
      
      Also added documentation for JSON option.
      
      There is some tidy up of CSV code including a potential memory over run
      in the os.nfields set up. To facilitate this an AGGR_MAX value is added.
      
      Committer notes:
      
      Fixed up using PRIu64 to format u64 values, not %lu.
      
      Committer testing:
      
        ⬢[acme@toolbox perf]$ perf stat -j sleep 1
        {"counter-value" : "0.731750", "unit" : "msec", "event" : "task-clock:u", "event-runtime" : 731750, "pcnt-running" : 100.00, "metric-value" : 0.000731, "metric-unit" : "CPUs utilized"}
        {"counter-value" : "0.000000", "unit" : "", "event" : "context-switches:u", "event-runtime" : 731750, "pcnt-running" : 100.00, "metric-value" : 0.000000, "metric-unit" : "/sec"}
        {"counter-value" : "0.000000", "unit" : "", "event" : "cpu-migrations:u", "event-runtime" : 731750, "pcnt-running" : 100.00, "metric-value" : 0.000000, "metric-unit" : "/sec"}
        {"counter-value" : "75.000000", "unit" : "", "event" : "page-faults:u", "event-runtime" : 731750, "pcnt-running" : 100.00, "metric-value" : 102.494021, "metric-unit" : "K/sec"}
        {"counter-value" : "578765.000000", "unit" : "", "event" : "cycles:u", "event-runtime" : 379366, "pcnt-running" : 49.00, "metric-value" : 0.790933, "metric-unit" : "GHz"}
        {"counter-value" : "1298.000000", "unit" : "", "event" : "stalled-cycles-frontend:u", "event-runtime" : 768020, "pcnt-running" : 100.00, "metric-value" : 0.224271, "metric-unit" : "frontend cycles idle"}
        {"counter-value" : "21984.000000", "unit" : "", "event" : "stalled-cycles-backend:u", "event-runtime" : 768020, "pcnt-running" : 100.00, "metric-value" : 3.798433, "metric-unit" : "backend cycles idle"}
        {"counter-value" : "468197.000000", "unit" : "", "event" : "instructions:u", "event-runtime" : 768020, "pcnt-running" : 100.00, "metric-value" : 0.808959, "metric-unit" : "insn per cycle"}
        {"metric-value" : 0.046955, "metric-unit" : "stalled cycles per insn"}
        {"counter-value" : "103335.000000", "unit" : "", "event" : "branches:u", "event-runtime" : 768020, "pcnt-running" : 100.00, "metric-value" : 141.216262, "metric-unit" : "M/sec"}
        {"counter-value" : "2381.000000", "unit" : "", "event" : "branch-misses:u", "event-runtime" : 388654, "pcnt-running" : 50.00, "metric-value" : 2.304156, "metric-unit" : "of all branches"}
        ⬢[acme@toolbox perf]$
      Signed-off-by: default avatarClaire Jensen <cjense@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alyssa Ross <hi@alyssa.is>
      Cc: Claire Jensen <clairej735@gmail.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      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: Like Xu <likexu@tencent.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20220805200105.2020995-2-irogers@google.comSigned-off-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      df936cad
  2. 09 Aug, 2022 34 commits
  3. 08 Aug, 2022 2 commits
    • Linus Torvalds's avatar
      Merge tag 'rproc-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux · 5d5d353b
      Linus Torvalds authored
      Pull remoteproc updates from Bjorn Andersson:
       "This introduces support for the remoteproc on Mediatek MT8188, and
        enables caches for MT8186 SCP. It adds support for PRU cores found on
        the TI K3 AM62x SoCs.
      
        It moves the recovery work after a firmware crash to an unbound
        workqueue, to allow recovery to happen in parallel.
      
        A new DMA API is introduced to release dma_mem for a device.
      
        It adds support a panic handler for the Qualcomm modem remoteproc,
        with the goal of having caches flushed in memory dumps for post-mortem
        debugging and it introduces a mechanism to wait for the modem firmware
        on SM8450 to decrypt part of its memory for post-mortem debugging.
      
        Qualcomm sysmon is restricted to only inform remote processors about
        peers that are actually running, to avoid a race where Linux tries to
        notify a recovering remote processor about its peers new state. A
        mechanism for waiting for the sysmon connection to be established is
        also introduced, to avoid out-of-sync updates for rapidly restarting
        remote processors.
      
        A number of Devicetree binding cleanups and conversions to YAML are
        introduced, to facilitate Devicetree validation. Lastly it introduces
        a number of smaller fixes and cleanups in the core and a few different
        drivers"
      
      * tag 'rproc-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux: (42 commits)
        remoteproc: qcom_q6v5_pas: Do not fail if regulators are not found
        drivers/remoteproc: fix repeated words in comments
        remoteproc: Directly use ida_alloc()/free()
        remoteproc: Use unbounded workqueue for recovery work
        remoteproc: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
        remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators
        remoteproc: sysmon: Send sysmon state only for running rprocs
        remoteproc: sysmon: Wait for SSCTL service to come up
        remoteproc: qcom: q6v5: Set q6 state to offline on receiving wdog irq
        remoteproc: qcom: pas: Check if coredump is enabled
        remoteproc: qcom: pas: Mark devices as wakeup capable
        remoteproc: qcom: pas: Mark va as io memory
        remoteproc: qcom: pas: Add decrypt shutdown support for modem
        remoteproc: qcom: q6v5-mss: add powerdomains to MSM8996 config
        remoteproc: qcom_q6v5: Introduce panic handler for MSS
        remoteproc: qcom_q6v5_mss: Update MBA log info
        remoteproc: qcom: correct kerneldoc
        remoteproc: qcom_q6v5_mss: map/unmap metadata region before/after use
        remoteproc: qcom: using pm_runtime_resume_and_get to simplify the code
        remoteproc: mediatek: Support MT8188 SCP
        ...
      5d5d353b
    • Linus Torvalds's avatar
      Merge tag 'rpmsg-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux · c7268761
      Linus Torvalds authored
      Pull rpmsg updates from Bjorn Andersson:
       "This contains fixes and cleanups in the rpmsg core, Qualcomm SMD and
        GLINK drivers, a circular lock dependency in the Mediatek driver and
        a possible race condition in the rpmsg_char driver is resolved"
      
      * tag 'rpmsg-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux:
        rpmsg: convert sysfs snprintf to sysfs_emit
        rpmsg: qcom_smd: Fix refcount leak in qcom_smd_parse_edge
        rpmsg: qcom: correct kerneldoc
        rpmsg: qcom: glink: remove unused name
        rpmsg: qcom: glink: replace strncpy() with strscpy_pad()
        rpmsg: Strcpy is not safe, use strscpy_pad() instead
        rpmsg: Fix possible refcount leak in rpmsg_register_device_override()
        rpmsg: Fix parameter naming for announce_create/destroy ops
        rpmsg: mtk_rpmsg: Fix circular locking dependency
        rpmsg: char: Add mutex protection for rpmsg_eptdev_open()
      c7268761