1. 14 4月, 2022 5 次提交
    • A
      perf bench: Fix numa bench to fix usage of affinity for machines with #CPUs > 1K · f58faed7
      Athira Rajeev 提交于
      The 'perf bench numa' testcase fails on systems with more than 1K CPUs.
      
      Testcase: perf bench numa mem -p 1 -t 3 -P 512 -s 100 -zZ0qcm --thp  1
      
      Snippet of code:
      
        <<>>
        perf: bench/numa.c:302: bind_to_node: Assertion `!(ret)' failed.
        Aborted (core dumped)
        <<>>
      
      bind_to_node() uses "sched_getaffinity" to save the original cpumask and
      this call is returning EINVAL ((invalid argument).
      
      This happens because the default mask size in glibc is 1024.  To
      overcome this 1024 CPUs mask size limitation of cpu_set_t, change the
      mask size using the CPU_*_S macros ie, use CPU_ALLOC to allocate
      cpumask, CPU_ALLOC_SIZE for size.
      
      Apart from fixing this for "orig_mask", apply same logic to "mask" as
      well which is used to setaffinity so that mask size is large enough to
      represent number of possible CPU's in the system.
      
      sched_getaffinity is used in one more place in perf numa bench. It is in
      "bind_to_cpu" function. Apply the same logic there also. Though
      currently no failure is reported from there, it is ideal to change
      getaffinity to work with such system configurations having CPU's more
      than default mask size supported by glibc.
      
      Also fix "sched_setaffinity" to use mask size which is large enough to
      represent number of possible CPU's in the system.
      
      Fixed all places where "bind_cpumask" which is part of "struct
      thread_data" is used such that bind_cpumask works in all configuration.
      Reported-by: NDisha Goel <disgoel@linux.vnet.ibm.com>
      Signed-off-by: NAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20220412164059.42654-3-atrajeev@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f58faed7
    • A
      perf bench: Fix numa testcase to check if CPU used to bind task is online · 8cb7a188
      Athira Rajeev 提交于
      Perf numa bench test fails with error:
      
      Testcase:
      
        ./perf bench numa mem -p 2 -t 1 -P 1024 -C 0,8 -M 1,0 -s 20 -zZq --thp  1 --no-data_rand_walk
      
      Failure snippet:
      
      <<>>
        Running 'numa/mem' benchmark:
      
        # Running main, "perf bench numa numa-mem -p 2 -t 1 -P 1024 -C 0,8 -M 1,0 -s 20 -zZq --thp 1 --no-data_rand_walk"
      
        perf: bench/numa.c:333: bind_to_cpumask: Assertion `!(ret)' failed.
      <<>>
      
      The Testcases uses CPU's 0 and 8. In function "parse_setup_cpu_list",
      There is check to see if cpu number is greater than max cpu's possible
      in the system ie via "if (bind_cpu_0 >= g->p.nr_cpus || bind_cpu_1 >=
      g->p.nr_cpus) {".
      
      But it could happen that system has say 48 CPU's, but only number of
      online CPU's is 0-7. Other CPU's are offlined. Since "g->p.nr_cpus" is
      48, so function will go ahead and set bit for CPU 8 also in cpumask (
      td->bind_cpumask).
      
      bind_to_cpumask function is called to set affinity using
      sched_setaffinity and the cpumask. Since the CPU8 is not present, set
      affinity will fail here with EINVAL.
      
      Fix this issue by adding a check to make sure that, CPU's provided in
      the input argument values are online before proceeding further and skip
      the test. For this, include new helper function "is_cpu_online" in
      "tools/perf/util/header.c".
      
      Since "BIT(x)" definition will get included from header.h, remove
      that from bench/numa.c
      Reported-by: NDisha Goel <disgoel@linux.vnet.ibm.com>
      Signed-off-by: NAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Tested-by: NDisha Goel <disgoel@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20220412164059.42654-2-atrajeev@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8cb7a188
    • A
      perf record: Fix per-thread option · 23380e4d
      Alexey Bayduraev 提交于
      Per-thread mode doesn't have specific CPUs for events, add checks for
      this case.
      
      Minor fix to a pr_debug by Ian Rogers <irogers@google.com> to avoid an
      out of bound array access.
      
      Fixes: 7954f716 ("perf record: Introduce thread affinity and mmap masks")
      Reported-by: NIan Rogers <irogers@google.com>
      Signed-off-by: NAlexey Bayduraev <alexey.bayduraev@gmail.com>
      Signed-off-by: NIan Rogers <irogers@google.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: 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>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220414014642.3308206-1-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      23380e4d
    • A
      perf tools: Fix segfault accessing sample_id xyarray · a668cc07
      Adrian Hunter 提交于
      perf_evsel::sample_id is an xyarray which can cause a segfault when
      accessed beyond its size. e.g.
      
        # perf record -e intel_pt// -C 1 sleep 1
        Segmentation fault (core dumped)
        #
      
      That is happening because a dummy event is opened to capture text poke
      events accross all CPUs, however the mmap logic is allocating according
      to the number of user_requested_cpus.
      
      In general, perf sometimes uses the evsel cpus to open events, and
      sometimes the evlist user_requested_cpus. However, it is not necessary
      to determine which case is which because the opened event file
      descriptors are also in an xyarray, the size of whch can be used
      to correctly allocate the size of the sample_id xyarray, because there
      is one ID per file descriptor.
      
      Note, in the affected code path, perf_evsel fd array is subsequently
      used to get the file descriptor for the mmap, so it makes sense for the
      xyarrays to be the same size there.
      
      Fixes: d1a17759 ("libperf: Adopt perf_evlist__mmap()/munmap() from tools/perf")
      Fixes: 246eba8e ("perf tools: Add support for PERF_RECORD_TEXT_POKE")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: NIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: stable@vger.kernel.org # 5.5+
      Link: https://lore.kernel.org/r/20220413114232.26914-1-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a668cc07
    • L
      perf stat: Fix error check return value of hashmap__new(), must use IS_ERR() · d73f5d14
      Lv Ruyi 提交于
      hashmap__new() returns ERR_PTR(-ENOMEM) when it fails, so we should use
      IS_ERR() to check it in error handling path.
      Reported-by: NZeal Robot <zealci@zte.com.cn>
      Signed-off-by: NLv Ruyi <lv.ruyi@zte.com.cn>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      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: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220413093302.2538128-1-lv.ruyi@zte.com.cnSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d73f5d14
  2. 13 4月, 2022 2 次提交
  3. 12 4月, 2022 1 次提交
  4. 11 4月, 2022 1 次提交
  5. 10 4月, 2022 4 次提交
  6. 09 4月, 2022 15 次提交
    • A
      perf bench: Fix epoll bench to correct usage of affinity for machines with #CPUs > 1K · 299687e1
      Athira Rajeev 提交于
      The 'perf bench epoll' testcase fails on systems with more than 1K CPUs.
      
      Testcase: perf bench epoll all
      
      Result snippet:
      <<>>
      Run summary [PID 106497]: 1399 threads monitoring on 64 file-descriptors for 8 secs.
      
      perf: pthread_create: No such file or directory
      <<>>
      
      In epoll benchmarks (ctl, wait) pthread_create is invoked in do_threads
      from respective bench_epoll_*  function. Though the logs shows direct
      failure from pthread_create, the actual failure is from
      "sched_setaffinity" returning EINVAL (invalid argument).
      
      This happens because the default mask size in glibc is 1024. To overcome
      this 1024 CPUs mask size limitation of cpu_set_t, change the mask size
      using the CPU_*_S macros.
      
      Patch addresses this by fixing all the epoll benchmarks to use CPU_ALLOC
      to allocate cpumask, CPU_ALLOC_SIZE for size, and CPU_SET_S to set the
      mask.
      Reported-by: NDisha Goel <disgoel@linux.vnet.ibm.com>
      Signed-off-by: NAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Tested-by: NDisha Goel <disgoel@linux.vnet.ibm.com>
      Acked-by: NIan Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20220406175113.87881-3-atrajeev@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      299687e1
    • A
      perf bench: Fix futex bench to correct usage of affinity for machines with #CPUs > 1K · c9c2a427
      Athira Rajeev 提交于
      The 'perf bench futex' testcase fails on systems with more than 1K CPUs.
      
      Testcase: perf bench futex all
      
      Failure snippet:
      <<>>Running futex/hash benchmark...
      
      perf: pthread_create: No such file or directory
      <<>>
      
      All the futex benchmarks (ie hash, lock-api, requeue, wake,
      wake-parallel), pthread_create is invoked in respective bench_futex_*
      function. Though the logs shows direct failure from pthread_create,
      strace logs showed that actual failure is from  "sched_setaffinity"
      returning EINVAL (invalid argument).
      
      This happens because the default mask size in glibc is 1024. To overcome
      this 1024 CPUs mask size limitation of cpu_set_t, change the mask size
      using the CPU_*_S macros.
      
      Patch addresses this by fixing all the futex benchmarks to use CPU_ALLOC
      to allocate cpumask, CPU_ALLOC_SIZE for size, and CPU_SET_S to set the
      mask.
      Reported-by: NDisha Goel <disgoel@linux.vnet.ibm.com>
      Reviewed-by: NSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Signed-off-by: NAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Tested-by: NDisha Goel <disgoel@linux.vnet.ibm.com>
      Acked-by: NIan Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      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/20220406175113.87881-2-atrajeev@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c9c2a427
    • A
      perf tools: Fix perf's libperf_print callback · aeee9dc5
      Adrian Hunter 提交于
      eprintf() does not expect va_list as the type of the 4th parameter.
      
      Use veprintf() because it does.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Fixes: 428dab81 ("libperf: Merge libperf_set_print() into libperf_init()")
      Cc: Jiri Olsa <jolsa@kernel.org>
      Link: https://lore.kernel.org/r/20220408132625.2451452-1-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      aeee9dc5
    • J
      perf: arm-spe: Fix perf report --mem-mode · ffab4870
      James Clark 提交于
      Since commit bb30acae ("perf report: Bail out --mem-mode if mem
      info is not available") "perf mem report" and "perf report --mem-mode"
      don't allow opening the file unless one of the events has
      PERF_SAMPLE_DATA_SRC set.
      
      SPE doesn't have this set even though synthetic memory data is generated
      after it is decoded. Fix this issue by setting DATA_SRC on SPE events.
      This has no effect on the data collected because the SPE driver doesn't
      do anything with that flag and doesn't generate samples.
      
      Fixes: bb30acae ("perf report: Bail out --mem-mode if mem info is not available")
      Signed-off-by: NJames Clark <james.clark@arm.com>
      Tested-by: NLeo Yan <leo.yan@linaro.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: https://lore.kernel.org/r/20220408144056.1955535-1-james.clark@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ffab4870
    • J
      perf unwind: Don't show unwind error messages when augmenting frame pointer stack · fa7095c5
      James Clark 提交于
      Commit Fixes: b9f6fbb3 ("perf arm64: Inject missing frames when
      using 'perf record --call-graph=fp'") intended to add a 'best effort'
      DWARF unwind that improved the frame pointer stack in most scenarios.
      
      It's expected that the unwind will fail sometimes, but this shouldn't be
      reported as an error. It only works when the return address can be
      determined from the contents of the link register alone.
      
      Fix the error shown when the unwinder requires extra registers by adding
      a new flag that suppresses error messages. This flag is not set in the
      normal --call-graph=dwarf unwind mode so that behavior is not changed.
      
      Fixes: b9f6fbb3 ("perf arm64: Inject missing frames when using 'perf record --call-graph=fp'")
      Reported-by: NJohn Garry <john.garry@huawei.com>
      Signed-off-by: NJames Clark <james.clark@arm.com>
      Tested-by: NJohn Garry <john.garry@huawei.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Truong <alexandre.truong@arm.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220406145651.1392529-1-james.clark@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fa7095c5
    • A
      tools headers arm64: Sync arm64's cputype.h with the kernel sources · 278aaba2
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
        83bea32a ("arm64: Add part number for Arm Cortex-A78AE")
      
      That addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/arm64/include/asm/cputype.h' differs from latest version at 'arch/arm64/include/asm/cputype.h'
        diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
      
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Andrew Kilroy <andrew.kilroy@arm.com>
      Cc: Chanho Park <chanho61.park@samsung.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lore.kernel.org/lkml/Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      278aaba2
    • C
      perf test tsc: Fix error message when not supported · 290fa68b
      Chengdong Li 提交于
      By default `perf test tsc` does not return the error message when the
      child process detected kernel does not support it. Instead, the child
      process prints an error message to stderr, unfortunately stderr is
      redirected to /dev/null when verbose <= 0.
      
      This patch does:
      
      - return TEST_SKIP to the parent process instead of TEST_OK when
        perf_read_tsc_conversion() is not supported.
      
      - Add a new subtest of testing if TSC is supported on current
        architecture by moving exist code to a separate function.
        It avoids two places in test__perf_time_to_tsc() that return
        TEST_SKIP by doing this.
      
      - Extend the test suite definition to contain above two subtests.
        Current test_suite and test_case structs do not support printing skip
        reason when the number of subtest less than 1. To print skip reason, it
        is necessary to extend current test suite definition.
      Reviewed-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NChengdong Li <chengdongli@tencent.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.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>
      Cc: likexu@tencent.com
      Link: https://lore.kernel.org/r/20220408084748.43707-1-chengdongli@tencent.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      290fa68b
    • A
      perf build: Don't use -ffat-lto-objects in the python feature test when building with clang-13 · 3a8a0475
      Arnaldo Carvalho de Melo 提交于
      Using -ffat-lto-objects in the python feature test when building with
      clang-13 results in:
      
        clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
        error: command '/usr/sbin/clang' failed with exit code 1
        cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
        make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
      
      Noticed when building on a docker.io/library/archlinux:base container.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Keeping <john@metanate.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Sedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3a8a0475
    • A
      perf python: Fix probing for some clang command line options · dd6e1fe9
      Arnaldo Carvalho de Melo 提交于
      The clang compiler complains about some options even without a source
      file being available, while others require one, so use the simple
      tools/build/feature/test-hello.c file.
      
      Then check for the "is not supported" string in its output, in addition
      to the "unknown argument" already being looked for.
      
      This was noticed when building with clang-13 where -ffat-lto-objects
      isn't supported and since we were looking just for "unknown argument"
      and not providing a source code to clang, was mistakenly assumed as
      being available and not being filtered to set of command line options
      provided to clang, leading to a build failure.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Keeping <john@metanate.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Sedat Dilek <sedat.dilek@gmail.com>
      Link: http://lore.kernel.org/lkml/Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dd6e1fe9
    • A
      tools build: Filter out options and warnings not supported by clang · 41caff45
      Arnaldo Carvalho de Melo 提交于
      These make the feature check fail when using clang, so remove them just
      like is done in tools/perf/Makefile.config to build perf itself.
      
      Adding -Wno-compound-token-split-by-macro to tools/perf/Makefile.config
      when building with clang is also necessary to avoid these warnings
      turned into errors (-Werror):
      
          CC      /tmp/build/perf/util/scripting-engines/trace-event-perl.o
        In file included from util/scripting-engines/trace-event-perl.c:35:
        In file included from /usr/lib64/perl5/CORE/perl.h:4085:
        In file included from /usr/lib64/perl5/CORE/hv.h:659:
        In file included from /usr/lib64/perl5/CORE/hv_func.h:34:
        In file included from /usr/lib64/perl5/CORE/sbox32_hash.h:4:
        /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
            ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /usr/lib64/perl5/CORE/zaphod32_hash.h:80:38: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
        #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                             ^~~~~~~~~~
        /usr/lib64/perl5/CORE/perl.h:737:29: note: expanded from macro 'STMT_START'
        #   define STMT_START   (void)( /* gcc supports "({ STATEMENTS; })" */
                                      ^
        /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: note: '{' token is here
            ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /usr/lib64/perl5/CORE/zaphod32_hash.h:80:49: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
        #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                                        ^
        /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
            ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /usr/lib64/perl5/CORE/zaphod32_hash.h:87:41: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
            v ^= (v>>23);                       \
                                                ^
        /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: note: ')' token is here
            ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /usr/lib64/perl5/CORE/zaphod32_hash.h:88:3: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
        } STMT_END
          ^~~~~~~~
        /usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
        #   define STMT_END     )
                                ^
      
      Please refer to the discussion on the Link: tag below, where Nathan
      clarifies the situation:
      
      <quote>
      acme> And then get to the problems at the end of this message, which seem
      acme> similar to the problem described here:
      acme>
      acme> From  Nathan Chancellor <>
      acme> Subject	[PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO
      acme>
      acme> https://lkml.org/lkml/2020/9/1/135
      acme>
      acme> So perhaps in this case its better to disable that
      acme> -Werror,-Wcompound-token-split-by-macro when building with clang?
      
      Yes, I think that is probably the best solution. As far as I can tell,
      at least in this file and context, the warning appears harmless, as the
      "create a GNU C statement expression from two different macros" is very
      much intentional, based on the presence of PERL_USE_GCC_BRACE_GROUPS.
      The warning is fixed in upstream Perl by just avoiding creating GNU C
      statement expressions using STMT_START and STMT_END:
      
        https://github.com/Perl/perl5/issues/18780
        https://github.com/Perl/perl5/pull/18984
      
      If I am reading the source code correctly, an alternative to disabling
      the warning would be specifying -DPERL_GCC_BRACE_GROUPS_FORBIDDEN but it
      seems like that might end up impacting more than just this site,
      according to the issue discussion above.
      </quote>
      Based-on-a-patch-by: NSedat Dilek <sedat.dilek@gmail.com>
      Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # Debian/Selfmade LLVM-14 (x86-64)
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Keeping <john@metanate.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Link: http://lore.kernel.org/lkml/YkxWcYzph5pC1EK8@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      41caff45
    • A
      tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts · 541f695c
      Arnaldo Carvalho de Melo 提交于
      Just like its done for ldopts and for both in tools/perf/Makefile.config.
      
      Using `` to initialize PERL_EMBED_CCOPTS somehow precludes using:
      
        $(filter-out SOMETHING_TO_FILTER,$(PERL_EMBED_CCOPTS))
      
      And we need to do it to allow for building with versions of clang where
      some gcc options selected by distros are not available.
      
      Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # Debian/Selfmade LLVM-14 (x86-64)
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Keeping <john@metanate.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Link: http://lore.kernel.org/lkml/YktYX2OnLtyobRYD@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      541f695c
    • A
      tools include UAPI: Sync linux/vhost.h with the kernel sources · 940442de
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
        b04d910a ("vdpa: support exposing the count of vqs to userspace")
        a61280dd ("vdpa: support exposing the config size to userspace")
      
      Silencing this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/vhost.h' differs from latest version at 'include/uapi/linux/vhost.h'
        diff -u tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h
      
        $ diff -u tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h
        --- tools/include/uapi/linux/vhost.h	2021-07-15 16:17:01.840818309 -0300
        +++ include/uapi/linux/vhost.h	2022-04-02 18:55:05.702522387 -0300
        @@ -150,4 +150,11 @@
         /* Get the valid iova range */
         #define VHOST_VDPA_GET_IOVA_RANGE	_IOR(VHOST_VIRTIO, 0x78, \
         					     struct vhost_vdpa_iova_range)
        +
        +/* Get the config size */
        +#define VHOST_VDPA_GET_CONFIG_SIZE	_IOR(VHOST_VIRTIO, 0x79, __u32)
        +
        +/* Get the count of all virtqueues */
        +#define VHOST_VDPA_GET_VQS_COUNT	_IOR(VHOST_VIRTIO, 0x80, __u32)
        +
         #endif
        $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > before
        $ cp include/uapi/linux/vhost.h tools/include/uapi/linux/vhost.h
        $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > after
        $ diff -u before after
        --- before	2022-04-04 14:52:25.036375145 -0300
        +++ after	2022-04-04 14:52:31.906549976 -0300
        @@ -38,4 +38,6 @@
         	[0x73] = "VDPA_GET_CONFIG",
         	[0x76] = "VDPA_GET_VRING_NUM",
         	[0x78] = "VDPA_GET_IOVA_RANGE",
        +	[0x79] = "VDPA_GET_CONFIG_SIZE",
        +	[0x80] = "VDPA_GET_VQS_COUNT",
         };
        $
      
      Cc: Longpeng <longpeng2@huawei.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Link: https://lore.kernel.org/lkml/YksxoFcOARk%2Fldev@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      940442de
    • A
      KVM: selftests: riscv: Fix alignment of the guest_hang() function · ebdef0de
      Anup Patel 提交于
      The guest_hang() function is used as the default exception handler
      for various KVM selftests applications by setting it's address in
      the vstvec CSR. The vstvec CSR requires exception handler base address
      to be at least 4-byte aligned so this patch fixes alignment of the
      guest_hang() function.
      
      Fixes: 3e06cdf1 ("KVM: selftests: Add initial support for RISC-V
      64-bit")
      Signed-off-by: NAnup Patel <apatel@ventanamicro.com>
      Tested-by: NMayuresh Chitale <mchitale@ventanamicro.com>
      Signed-off-by: NAnup Patel <anup@brainfault.org>
      ebdef0de
    • A
      KVM: selftests: riscv: Set PTE A and D bits in VS-stage page table · fac37253
      Anup Patel 提交于
      Supporting hardware updates of PTE A and D bits is optional for any
      RISC-V implementation so current software strategy is to always set
      these bits in both G-stage (hypervisor) and VS-stage (guest kernel).
      
      If PTE A and D bits are not set by software (hypervisor or guest)
      then RISC-V implementations not supporting hardware updates of these
      bits will cause traps even for perfectly valid PTEs.
      
      Based on above explanation, the VS-stage page table created by various
      KVM selftest applications is not correct because PTE A and D bits are
      not set. This patch fixes VS-stage page table programming of PTE A and
      D bits for KVM selftests.
      
      Fixes: 3e06cdf1 ("KVM: selftests: Add initial support for RISC-V
      64-bit")
      Signed-off-by: NAnup Patel <apatel@ventanamicro.com>
      Tested-by: NMayuresh Chitale <mchitale@ventanamicro.com>
      Signed-off-by: NAnup Patel <anup@brainfault.org>
      fac37253
    • D
      tools/testing/nvdimm: Fix security_init() symbol collision · e8cf229e
      Dan Williams 提交于
      Starting with the new perf-event support in the nvdimm core, the
      nfit_test mock module stops compiling. Rename its security_init() to
      nfit_security_init().
      
      tools/testing/nvdimm/test/nfit.c:1845:13: error: conflicting types for ‘security_init’; have ‘void(struct nfit_test *)’
       1845 | static void security_init(struct nfit_test *t)
            |             ^~~~~~~~~~~~~
      In file included from ./include/linux/perf_event.h:61,
                       from ./include/linux/nd.h:11,
                       from ./drivers/nvdimm/nd-core.h:11,
                       from tools/testing/nvdimm/test/nfit.c:19:
      
      Fixes: 9a61d083 ("drivers/nvdimm: Add nvdimm pmu structure")
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Reviewed-by: NKajol Jain <kjain@linux.ibm.com>
      Reviewed-by: NVishal Verma <vishal.l.verma@intel.com>
      Link: https://lore.kernel.org/r/164904238610.1330275.1889212115373993727.stgit@dwillia2-desk3.amr.corp.intel.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      e8cf229e
  7. 07 4月, 2022 4 次提交
  8. 06 4月, 2022 1 次提交
  9. 05 4月, 2022 7 次提交