Commit Graph

6 Commits

Author SHA1 Message Date
Michael Petlan 365e5eba01 Reapply "perf util: Make util its own library"
JIRA: https://issues.redhat.com/browse/RHEL-79032
Upstream Status: RHEL-only

This reverts commit d1630cc5a2.

Testing has found out that d1630cc5a2
(which is a revert of b04cbd7054) has
broken the perf python module shipped in python3-perf package:

    [root@machine ~]# echo "import sys ; sys.path.insert(0, 'python'); import perf" | '/usr/bin/python3'
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      ImportError: /usr/lib64/python3.9/site-packages/perf.cpython-39-x86_64-linux-gnu.so: undefined symbol: verbose

Revert that revert.

The original problem needs to be solved by moving python3-perf to
AppStream, so that it does not break the dependency rule that no
BaseOS packages may depend on AppStream packages.

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
2025-03-25 13:17:42 +01:00
Michael Petlan d1630cc5a2 Revert "perf util: Make util its own library"
JIRA: https://issues.redhat.com/browse/RHEL-65742
Upstream Status: RHEL-only

This reverts commit b04cbd7054.

Conflicts:
==========
Revert is not straightforward, because the following backported patches
changed the context:
  ea59b70a8418 ("perf bpf: Move BPF disassembly routines to separate file to avoid clash with capstone bpf headers")
  564e5cbcfdf5 ("perf tool: Move fill defaults into tool.c")
  8db5cabcf1b6 ("perf stat: Fork and launch 'perf record' when 'perf stat' needs to get retire latency value for a metric.")
  c3f8644c21df ("perf report: Support LLVM for addr2line()")
Thus we need to adjust the changes manually.

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
2025-01-27 22:20:15 +01:00
Michael Petlan b04cbd7054 perf util: Make util its own library
JIRA: https://issues.redhat.com/browse/RHEL-29795

upstream
========
commit e467705a9fb37f51595aa6deaca085ccb4005454
Author: Ian Rogers <irogers@google.com>
Date: Tue Jun 25 14:41:15 2024 -0700

description
===========
Make the util directory into its own library. This is done to avoid
compiling code twice, once for the perf tool and once for the perf
python module. For convenience:
  arch/common.c
  scripts/perl/Perf-Trace-Util/Context.c
  scripts/python/Perf-Trace-Util/Context.c
are made part of this library.

    Signed-off-by: Ian Rogers <irogers@google.com>
    Reviewed-by: James Clark <james.clark@arm.com>
    Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Palmer Dabbelt <palmer@dabbelt.com>
    Cc: Albert Ou <aou@eecs.berkeley.edu>
    Cc: Nick Terrell <terrelln@fb.com>
    Cc: Gary Guo <gary@garyguo.net>
    Cc: Alex Gaynor <alex.gaynor@gmail.com>
    Cc: Boqun Feng <boqun.feng@gmail.com>
    Cc: Wedson Almeida Filho <wedsonaf@gmail.com>
    Cc: Ze Gao <zegao2021@gmail.com>
    Cc: Alice Ryhl <aliceryhl@google.com>
    Cc: Andrei Vagin <avagin@google.com>
    Cc: Yicong Yang <yangyicong@hisilicon.com>
    Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
    Cc: Guo Ren <guoren@kernel.org>
    Cc: Miguel Ojeda <ojeda@kernel.org>
    Cc: Will Deacon <will@kernel.org>
    Cc: Mike Leach <mike.leach@linaro.org>
    Cc: Leo Yan <leo.yan@linux.dev>
    Cc: Oliver Upton <oliver.upton@linux.dev>
    Cc: John Garry <john.g.garry@oracle.com>
    Cc: Benno Lossin <benno.lossin@proton.me>
    Cc: Björn Roy Baron <bjorn3_gh@protonmail.com>
    Cc: Andreas Hindborg <a.hindborg@samsung.com>
    Cc: Paul Walmsley <paul.walmsley@sifive.com>
    Signed-off-by: Namhyung Kim <namhyung@kernel.org>
    Link: https://lore.kernel.org/r/20240625214117.953777-7-irogers@google.com

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
2024-10-14 13:02:59 +02:00
Michael Petlan 6402c5ed9e perf script python: Cope with declarations after statements found in Python.h
JIRA: https://issues.redhat.com/browse/RHEL-15009

upstream
========
commit c43888e739bbf184eb95018188215a5487cc0b15
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Wed Aug 2 10:33:42 2023 -0300

description
===========
With -Werror the build was failing on fedora rawhide:

  [perfbuilder@27cfe44d67ed perf-6.5.0-rc2]$ gcc -v
  Using built-in specs.
  COLLECT_GCC=gcc
  COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/13/lto-wrapper
  OFFLOAD_TARGET_NAMES=nvptx-none
  OFFLOAD_TARGET_DEFAULT=1
  Target: x86_64-redhat-linux
  Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-13.2.1-20230728/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --enable-offload-defaulted --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
  Thread model: posix
  Supported LTO compression algorithms: zlib zstd
  gcc version 13.2.1 20230728 (Red Hat 13.2.1-1) (GCC)
  [perfbuilder@27cfe44d67ed perf-6.5.0-rc2]$

  In file included from /usr/include/python3.12/Python.h:44,
                   from scripts/python/Perf-Trace-Util/Context.c:14:
  /usr/include/python3.12/object.h: In function 'Py_SIZE':
  /usr/include/python3.12/object.h:217:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
    217 |     PyVarObject *var_ob = _PyVarObject_CAST(ob);
        |     ^~~~~~~~~~~
  In file included from /usr/include/python3.12/Python.h:53:
  /usr/include/python3.12/cpython/longintrepr.h: In function '_PyLong_CompactValue':
  /usr/include/python3.12/cpython/longintrepr.h:121:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
    121 |     Py_ssize_t sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
        |     ^~~~~~~~~~
  <SNIP>
  In file included from /usr/include/python3.12/Python.h:44,
                   from util/scripting-engines/trace-event-python.c:22:
  /usr/include/python3.12/object.h: In function 'Py_SIZE':
  /usr/include/python3.12/object.h:217:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
    217 |     PyVarObject *var_ob = _PyVarObject_CAST(ob);
        |     ^~~~~~~~~~~
    CC      /tmp/build/perf/util/units.o
    CC      /tmp/build/perf/util/time-utils.o
  In file included from /usr/include/python3.12/Python.h:53:
  /usr/include/python3.12/cpython/longintrepr.h: In function '_PyLong_CompactValue':
  /usr/include/python3.12/cpython/longintrepr.h:121:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
    121 |     Py_ssize_t sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
        |     ^~~~~~~~~~

So add -Wno-declaration-after-statement to the python scripting CFLAGS.

    Reviewed-by: Ian Rogers <irogers@google.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Link: https://lore.kernel.org/lkml/ZMpdKeO8gU%2FcWDqH@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
2023-11-13 11:21:46 +01:00
Jiri Olsa 5ff328836d perf tools: Rename build libperf to perf
Rename build libperf to perf, because it's used to build perf.

The libperf build object name will be used for libperf library.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190213123246.4015-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-14 15:18:08 -03:00
Jiri Olsa c7355f842b perf build: Add scripts objects building
Move the scripts objects building under build framework to be included
in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Tested-by: Will Deacon <will.deacon@arm.com>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-ry8pd41ahwpq9h46i8te33c7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-02-12 11:49:53 -03:00