From: roman.sudarikov@linux.intel.com
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@redhat.com, namhyung@kernel.org,
linux-kernel@vger.kernel.org, eranian@google.com,
bgregg@netflix.com, ak@linux.intel.com,
kan.liang@linux.intel.com
Cc: alexander.antonov@intel.com, roman.sudarikov@linux.intel.com
Subject: [PATCH 5/6] perf tools: Add feature check for libpci
Date: Tue, 26 Nov 2019 19:36:29 +0300 [thread overview]
Message-ID: <20191126163630.17300-6-roman.sudarikov@linux.intel.com> (raw)
In-Reply-To: <20191126163630.17300-5-roman.sudarikov@linux.intel.com>
From: Roman Sudarikov <roman.sudarikov@linux.intel.com>
Add feature check for libpci to show device name in --iiostat mode.
libpci support allows device name to b:d:f notion.
Signed-off-by: Roman Sudarikov <roman.sudarikov@linux.intel.com>
Co-developed-by: Alexander Antonov <alexander.antonov@intel.com>
Signed-off-by: Alexander Antonov <alexander.antonov@intel.com>
---
tools/build/Makefile.feature | 2 ++
tools/build/feature/Makefile | 4 ++++
tools/build/feature/test-all.c | 5 +++++
tools/build/feature/test-libpci.c | 10 ++++++++++
tools/perf/Makefile.config | 10 ++++++++++
tools/perf/builtin-version.c | 1 +
tools/perf/tests/make | 1 +
7 files changed, 33 insertions(+)
create mode 100644 tools/build/feature/test-libpci.c
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 8a19753cc26a..bebdfb99607c 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -50,6 +50,7 @@ FEATURE_TESTS_BASIC := \
libelf-mmap \
libnuma \
numa_num_possible_cpus \
+ libpci \
libperl \
libpython \
libpython-version \
@@ -115,6 +116,7 @@ FEATURE_DISPLAY ?= \
libelf \
libnuma \
numa_num_possible_cpus \
+ libpci \
libperl \
libpython \
libcrypto \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 8499385365c0..f0d5f886602d 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -28,6 +28,7 @@ FILES= \
test-libelf-mmap.bin \
test-libnuma.bin \
test-numa_num_possible_cpus.bin \
+ test-libpci.bin \
test-libperl.bin \
test-libpython.bin \
test-libpython-version.bin \
@@ -210,6 +211,9 @@ PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
+$(OUTPUT)test-libpci.bin:
+ $(BUILD) -lpci
+
$(OUTPUT)test-libperl.bin:
$(BUILD) $(FLAGS_PERL_EMBED)
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index 88145e8cde1a..c61d34804a06 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -74,6 +74,10 @@
# include "test-libunwind.c"
#undef main
+#define main main_test_libpci
+# include "test-libpci.c"
+#undef
+
#define main main_test_libaudit
# include "test-libaudit.c"
#undef main
@@ -210,6 +214,7 @@ int main(int argc, char *argv[])
main_test_libunwind();
main_test_libaudit();
main_test_libslang();
+ main_test_libpci();
main_test_gtk2(argc, argv);
main_test_gtk2_infobar(argc, argv);
main_test_libbfd();
diff --git a/tools/build/feature/test-libpci.c b/tools/build/feature/test-libpci.c
new file mode 100644
index 000000000000..4bbeb9ffd687
--- /dev/null
+++ b/tools/build/feature/test-libpci.c
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "pci/pci.h"
+
+int main(void)
+{
+ struct pci_access *pacc = pci_alloc();
+
+ pci_cleanup(pacc);
+ return 0;
+}
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 46f7fba2306c..1b9d341492c8 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -839,6 +839,16 @@ ifndef NO_LIBCAP
endif
endif
+ifndef NO_PCILIB
+ ifeq ($(feature-libpci), 1)
+ CFLAGS += -DHAVE_LIBPCI_SUPPORT
+ EXTLIBS += -lpci
+ else
+ msg := $(warning No libpci found, show pci devices without names in iiostat mode, please install libpci-dev/pciutils-devel);
+ NO_PCILIB := 1
+ endif
+endif
+
ifndef NO_BACKTRACE
ifeq ($(feature-backtrace), 1)
CFLAGS += -DHAVE_BACKTRACE_SUPPORT
diff --git a/tools/perf/builtin-version.c b/tools/perf/builtin-version.c
index 05cf2af9e2c2..ec4e0eb07825 100644
--- a/tools/perf/builtin-version.c
+++ b/tools/perf/builtin-version.c
@@ -76,6 +76,7 @@ static void library_status(void)
STATUS(HAVE_LIBUNWIND_SUPPORT, libunwind);
STATUS(HAVE_DWARF_SUPPORT, libdw-dwarf-unwind);
STATUS(HAVE_ZLIB_SUPPORT, zlib);
+ STATUS(HAVE_LIBPCI_SUPPORT, libpci);
STATUS(HAVE_LZMA_SUPPORT, lzma);
STATUS(HAVE_AUXTRACE_SUPPORT, get_cpuid);
STATUS(HAVE_LIBBPF_SUPPORT, bpf);
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index c850d1664c56..0b78cf6e8377 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -109,6 +109,7 @@ make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1
make_minimal += NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1
make_minimal += NO_LIBCAP=1
+make_minimal += NO_LIBPCI=1
# $(run) contains all available tests
run := make_pure
--
2.19.1
next prev parent reply other threads:[~2019-11-26 16:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-26 16:36 [PATCH 0/6] perf x86: Exposing IO stack to IO PMON mapping through sysfs roman.sudarikov
2019-11-26 16:36 ` [PATCH 1/6] perf x86: Infrastructure for exposing an Uncore unit to PMON mapping roman.sudarikov
2019-11-26 16:36 ` [PATCH 2/6] perf tools: Helper functions to enumerate and probe PCI devices roman.sudarikov
2019-11-26 16:36 ` [PATCH 3/6] perf stat: Helper functions for list of IIO devices roman.sudarikov
2019-11-26 16:36 ` [PATCH 4/6] perf stat: New --iiostat mode to provide I/O performance metrics roman.sudarikov
2019-11-26 16:36 ` roman.sudarikov [this message]
2019-11-26 16:36 ` [PATCH 6/6] perf stat: Add PCI device name to --iiostat output roman.sudarikov
2019-12-02 14:00 ` [PATCH 1/6] perf x86: Infrastructure for exposing an Uncore unit to PMON mapping Peter Zijlstra
2019-12-02 19:47 ` Stephane Eranian
2019-12-03 3:00 ` Andi Kleen
2019-12-04 18:48 ` Sudarikov, Roman
2019-12-05 18:02 ` Stephane Eranian
2019-12-05 22:28 ` Andi Kleen
2019-12-06 16:08 ` Sudarikov, Roman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191126163630.17300-6-roman.sudarikov@linux.intel.com \
--to=roman.sudarikov@linux.intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.antonov@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=bgregg@netflix.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®