* [PATCH 0/2] perf tools: optional compile time test_attr__* depenency for perf-sys.h
@ 2019-10-01 11:33 Björn Töpel
2019-10-01 11:33 ` [PATCH 1/2] perf tools: Make usage of test_attr__* optional " Björn Töpel
2019-10-01 11:33 ` [PATCH 2/2] samples/bpf: fix build by setting HAVE_ATTR_TEST to zero Björn Töpel
0 siblings, 2 replies; 10+ messages in thread
From: Björn Töpel @ 2019-10-01 11:33 UTC (permalink / raw)
To: linux-kernel, acme
Cc: Björn Töpel, netdev, bpf, ast, daniel, adrian.hunter,
jolsa, namhyung
This mini series makes it possible to disable the use of test_attr__*
for perf-sys.h users outside perf. E.g., samples/bpf/ uses perf-sys.h
as a syscall wrapper.
Now a user can define HAVE_ATTR_TEST to zero to avoid this, and as a
nice side-effect it also fixes the samples/bpf/ build. ;-)
Björn Töpel (2):
perf tools: Make usage of test_attr__* optional for perf-sys.h
samples/bpf: fix build by setting HAVE_ATTR_TEST to zero
samples/bpf/Makefile | 1 +
tools/perf/perf-sys.h | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] perf tools: Make usage of test_attr__* optional for perf-sys.h
2019-10-01 11:33 [PATCH 0/2] perf tools: optional compile time test_attr__* depenency for perf-sys.h Björn Töpel
@ 2019-10-01 11:33 ` Björn Töpel
2019-10-02 21:00 ` Song Liu
` (2 more replies)
2019-10-01 11:33 ` [PATCH 2/2] samples/bpf: fix build by setting HAVE_ATTR_TEST to zero Björn Töpel
1 sibling, 3 replies; 10+ messages in thread
From: Björn Töpel @ 2019-10-01 11:33 UTC (permalink / raw)
To: linux-kernel, acme
Cc: Björn Töpel, netdev, bpf, ast, daniel, adrian.hunter,
jolsa, namhyung
From: Björn Töpel <bjorn.topel@intel.com>
For users of perf-sys.h outside perf, e.g. samples/bpf/bpf_load.c,
it's convenient not to depend on test_attr__*.
After commit 91854f9a077e ("perf tools: Move everything related to
sys_perf_event_open() to perf-sys.h"), all users of perf-sys.h will
depend on test_attr__enabled and test_attr__open.
This commit enables a user to define HAVE_ATTR_TEST to zero in order
to omit the test dependency.
Fixes: 91854f9a077e ("perf tools: Move everything related to sys_perf_event_open() to perf-sys.h")
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
---
tools/perf/perf-sys.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
index 63e4349a772a..15e458e150bd 100644
--- a/tools/perf/perf-sys.h
+++ b/tools/perf/perf-sys.h
@@ -15,7 +15,9 @@ void test_attr__init(void);
void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
int fd, int group_fd, unsigned long flags);
-#define HAVE_ATTR_TEST
+#ifndef HAVE_ATTR_TEST
+#define HAVE_ATTR_TEST 1
+#endif
static inline int
sys_perf_event_open(struct perf_event_attr *attr,
@@ -27,7 +29,7 @@ sys_perf_event_open(struct perf_event_attr *attr,
fd = syscall(__NR_perf_event_open, attr, pid, cpu,
group_fd, flags);
-#ifdef HAVE_ATTR_TEST
+#if HAVE_ATTR_TEST
if (unlikely(test_attr__enabled))
test_attr__open(attr, pid, cpu, fd, group_fd, flags);
#endif
--
2.20.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] samples/bpf: fix build by setting HAVE_ATTR_TEST to zero
2019-10-01 11:33 [PATCH 0/2] perf tools: optional compile time test_attr__* depenency for perf-sys.h Björn Töpel
2019-10-01 11:33 ` [PATCH 1/2] perf tools: Make usage of test_attr__* optional " Björn Töpel
@ 2019-10-01 11:33 ` Björn Töpel
2019-10-02 21:00 ` Song Liu
2019-10-15 5:31 ` [tip: perf/core] " tip-bot2 for Björn Töpel
1 sibling, 2 replies; 10+ messages in thread
From: Björn Töpel @ 2019-10-01 11:33 UTC (permalink / raw)
To: linux-kernel, acme
Cc: Björn Töpel, netdev, bpf, ast, daniel, adrian.hunter,
jolsa, namhyung
From: Björn Töpel <bjorn.topel@intel.com>
To remove that test_attr__{enabled/open} are used by perf-sys.h, we
set HAVE_ATTR_TEST to zero.
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
---
samples/bpf/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 1d9be26b4edd..42b571cde177 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -176,6 +176,7 @@ KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/bpf/
KBUILD_HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/
KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include
KBUILD_HOSTCFLAGS += -I$(srctree)/tools/perf
+KBUILD_HOSTCFLAGS += -DHAVE_ATTR_TEST=0
HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable
--
2.20.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] perf tools: Make usage of test_attr__* optional for perf-sys.h
2019-10-01 11:33 ` [PATCH 1/2] perf tools: Make usage of test_attr__* optional " Björn Töpel
@ 2019-10-02 21:00 ` Song Liu
2019-10-03 13:50 ` Arnaldo Carvalho de Melo
2019-10-15 5:31 ` [tip: perf/core] " tip-bot2 for Björn Töpel
2 siblings, 0 replies; 10+ messages in thread
From: Song Liu @ 2019-10-02 21:00 UTC (permalink / raw)
To: Björn Töpel
Cc: open list, Arnaldo Carvalho de Melo, Björn Töpel,
Networking, bpf, Alexei Starovoitov, Daniel Borkmann,
adrian.hunter, Jiri Olsa, Namhyung Kim
On Tue, Oct 1, 2019 at 4:35 AM Björn Töpel <bjorn.topel@gmail.com> wrote:
>
> From: Björn Töpel <bjorn.topel@intel.com>
>
> For users of perf-sys.h outside perf, e.g. samples/bpf/bpf_load.c,
> it's convenient not to depend on test_attr__*.
>
> After commit 91854f9a077e ("perf tools: Move everything related to
> sys_perf_event_open() to perf-sys.h"), all users of perf-sys.h will
> depend on test_attr__enabled and test_attr__open.
>
> This commit enables a user to define HAVE_ATTR_TEST to zero in order
> to omit the test dependency.
>
> Fixes: 91854f9a077e ("perf tools: Move everything related to sys_perf_event_open() to perf-sys.h")
> Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Acked-by: Song Liu <songliubraving@fb.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] samples/bpf: fix build by setting HAVE_ATTR_TEST to zero
2019-10-01 11:33 ` [PATCH 2/2] samples/bpf: fix build by setting HAVE_ATTR_TEST to zero Björn Töpel
@ 2019-10-02 21:00 ` Song Liu
2019-10-03 0:19 ` KP Singh
2019-10-15 5:31 ` [tip: perf/core] " tip-bot2 for Björn Töpel
1 sibling, 1 reply; 10+ messages in thread
From: Song Liu @ 2019-10-02 21:00 UTC (permalink / raw)
To: Björn Töpel
Cc: open list, Arnaldo Carvalho de Melo, Björn Töpel,
Networking, bpf, Alexei Starovoitov, Daniel Borkmann,
adrian.hunter, Jiri Olsa, Namhyung Kim
On Tue, Oct 1, 2019 at 4:36 AM Björn Töpel <bjorn.topel@gmail.com> wrote:
>
> From: Björn Töpel <bjorn.topel@intel.com>
>
> To remove that test_attr__{enabled/open} are used by perf-sys.h, we
> set HAVE_ATTR_TEST to zero.
>
> Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Acked-by: Song Liu <songliubraving@fb.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] samples/bpf: fix build by setting HAVE_ATTR_TEST to zero
2019-10-02 21:00 ` Song Liu
@ 2019-10-03 0:19 ` KP Singh
2019-10-03 13:53 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 10+ messages in thread
From: KP Singh @ 2019-10-03 0:19 UTC (permalink / raw)
To: Song Liu
Cc: Björn Töpel, open list, Arnaldo Carvalho de Melo,
Björn Töpel, Networking, bpf, Alexei Starovoitov,
Daniel Borkmann, adrian.hunter, Jiri Olsa, Namhyung Kim
Tested-by: KP Singh <kpsingh@google.com>
I can confirm that samples/bpf are building for me now (x86_64,
clang-8) after applying this series and:
* https://lore.kernel.org/bpf/CAPhsuW5c9v0OnU4g+eYkPjBCuNMjC_69pFhzr=nTfDMAy4bK6w@mail.gmail.com
* https://lore.kernel.org/bpf/20191002191652.11432-1-kpsingh@chromium.org/
on the current bpf-next/master.
- KP
On Wed, Oct 2, 2019 at 11:00 PM Song Liu <liu.song.a23@gmail.com> wrote:
>
> On Tue, Oct 1, 2019 at 4:36 AM Björn Töpel <bjorn.topel@gmail.com> wrote:
> >
> > From: Björn Töpel <bjorn.topel@intel.com>
> >
> > To remove that test_attr__{enabled/open} are used by perf-sys.h, we
> > set HAVE_ATTR_TEST to zero.
> >
> > Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
>
> Acked-by: Song Liu <songliubraving@fb.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] perf tools: Make usage of test_attr__* optional for perf-sys.h
2019-10-01 11:33 ` [PATCH 1/2] perf tools: Make usage of test_attr__* optional " Björn Töpel
2019-10-02 21:00 ` Song Liu
@ 2019-10-03 13:50 ` Arnaldo Carvalho de Melo
2019-10-15 5:31 ` [tip: perf/core] " tip-bot2 for Björn Töpel
2 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-10-03 13:50 UTC (permalink / raw)
To: Björn Töpel
Cc: linux-kernel, Björn Töpel, netdev, bpf, ast, daniel,
adrian.hunter, jolsa, namhyung
Em Tue, Oct 01, 2019 at 01:33:06PM +0200, Björn Töpel escreveu:
> From: Björn Töpel <bjorn.topel@intel.com>
>
> For users of perf-sys.h outside perf, e.g. samples/bpf/bpf_load.c,
> it's convenient not to depend on test_attr__*.
>
> After commit 91854f9a077e ("perf tools: Move everything related to
> sys_perf_event_open() to perf-sys.h"), all users of perf-sys.h will
> depend on test_attr__enabled and test_attr__open.
>
> This commit enables a user to define HAVE_ATTR_TEST to zero in order
> to omit the test dependency.
Woah, I wasn't expecting tools/perf/ stuff to be included from outside
tools/perf/, so thanks for fixing that odd user.
Applied.
- Arnaldo
> Fixes: 91854f9a077e ("perf tools: Move everything related to sys_perf_event_open() to perf-sys.h")
> Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
> ---
> tools/perf/perf-sys.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
> index 63e4349a772a..15e458e150bd 100644
> --- a/tools/perf/perf-sys.h
> +++ b/tools/perf/perf-sys.h
> @@ -15,7 +15,9 @@ void test_attr__init(void);
> void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
> int fd, int group_fd, unsigned long flags);
>
> -#define HAVE_ATTR_TEST
> +#ifndef HAVE_ATTR_TEST
> +#define HAVE_ATTR_TEST 1
> +#endif
>
> static inline int
> sys_perf_event_open(struct perf_event_attr *attr,
> @@ -27,7 +29,7 @@ sys_perf_event_open(struct perf_event_attr *attr,
> fd = syscall(__NR_perf_event_open, attr, pid, cpu,
> group_fd, flags);
>
> -#ifdef HAVE_ATTR_TEST
> +#if HAVE_ATTR_TEST
> if (unlikely(test_attr__enabled))
> test_attr__open(attr, pid, cpu, fd, group_fd, flags);
> #endif
> --
> 2.20.1
--
- Arnaldo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] samples/bpf: fix build by setting HAVE_ATTR_TEST to zero
2019-10-03 0:19 ` KP Singh
@ 2019-10-03 13:53 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-10-03 13:53 UTC (permalink / raw)
To: KP Singh
Cc: Song Liu, Björn Töpel, open list,
Björn Töpel, Networking, bpf, Alexei Starovoitov,
Daniel Borkmann, adrian.hunter, Jiri Olsa, Namhyung Kim
Em Thu, Oct 03, 2019 at 02:19:42AM +0200, KP Singh escreveu:
> Tested-by: KP Singh <kpsingh@google.com>
>
> I can confirm that samples/bpf are building for me now (x86_64,
> clang-8) after applying this series and:
>
> * https://lore.kernel.org/bpf/CAPhsuW5c9v0OnU4g+eYkPjBCuNMjC_69pFhzr=nTfDMAy4bK6w@mail.gmail.com
> * https://lore.kernel.org/bpf/20191002191652.11432-1-kpsingh@chromium.org/
>
> on the current bpf-next/master.
>
>
> - KP
>
> On Wed, Oct 2, 2019 at 11:00 PM Song Liu <liu.song.a23@gmail.com> wrote:
> >
> > On Tue, Oct 1, 2019 at 4:36 AM Björn Töpel <bjorn.topel@gmail.com> wrote:
> > >
> > > From: Björn Töpel <bjorn.topel@intel.com>
> > >
> > > To remove that test_attr__{enabled/open} are used by perf-sys.h, we
> > > set HAVE_ATTR_TEST to zero.
> > >
> > > Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
> >
> > Acked-by: Song Liu <songliubraving@fb.com>
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 10+ messages in thread
* [tip: perf/core] samples/bpf: fix build by setting HAVE_ATTR_TEST to zero
2019-10-01 11:33 ` [PATCH 2/2] samples/bpf: fix build by setting HAVE_ATTR_TEST to zero Björn Töpel
2019-10-02 21:00 ` Song Liu
@ 2019-10-15 5:31 ` tip-bot2 for Björn Töpel
1 sibling, 0 replies; 10+ messages in thread
From: tip-bot2 for Björn Töpel @ 2019-10-15 5:31 UTC (permalink / raw)
To: linux-tip-commits
Cc: Björn Töpel, KP Singh, Song Liu, Adrian Hunter,
Alexei Starovoitov, Daniel Borkmann, Jiri Olsa, Namhyung Kim,
bpf, netdev, Arnaldo Carvalho de Melo, Ingo Molnar,
Borislav Petkov, linux-kernel
The following commit has been merged into the perf/core branch of tip:
Commit-ID: fce9501aec6bdda45ef3a5e365a5e0de7de7fe2d
Gitweb: https://git.kernel.org/tip/fce9501aec6bdda45ef3a5e365a5e0de7de7fe2d
Author: Björn Töpel <bjorn.topel@intel.com>
AuthorDate: Tue, 01 Oct 2019 13:33:07 +02:00
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Mon, 07 Oct 2019 12:22:18 -03:00
samples/bpf: fix build by setting HAVE_ATTR_TEST to zero
To remove that test_attr__{enabled/open} are used by perf-sys.h, we
set HAVE_ATTR_TEST to zero.
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Tested-by: KP Singh <kpsingh@google.com>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: bpf@vger.kernel.org
Cc: netdev@vger.kernel.org
Link: http://lore.kernel.org/lkml/20191001113307.27796-3-bjorn.topel@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
samples/bpf/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 1d9be26..42b571c 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -176,6 +176,7 @@ KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/bpf/
KBUILD_HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/
KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include
KBUILD_HOSTCFLAGS += -I$(srctree)/tools/perf
+KBUILD_HOSTCFLAGS += -DHAVE_ATTR_TEST=0
HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [tip: perf/core] perf tools: Make usage of test_attr__* optional for perf-sys.h
2019-10-01 11:33 ` [PATCH 1/2] perf tools: Make usage of test_attr__* optional " Björn Töpel
2019-10-02 21:00 ` Song Liu
2019-10-03 13:50 ` Arnaldo Carvalho de Melo
@ 2019-10-15 5:31 ` tip-bot2 for Björn Töpel
2 siblings, 0 replies; 10+ messages in thread
From: tip-bot2 for Björn Töpel @ 2019-10-15 5:31 UTC (permalink / raw)
To: linux-tip-commits
Cc: Björn Töpel, Song Liu, Adrian Hunter,
Alexei Starovoitov, Daniel Borkmann, Jiri Olsa, Namhyung Kim,
bpf, netdev, Arnaldo Carvalho de Melo, Ingo Molnar,
Borislav Petkov, linux-kernel
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 06f84d1989b7e58d56fa2e448664585749d41221
Gitweb: https://git.kernel.org/tip/06f84d1989b7e58d56fa2e448664585749d41221
Author: Björn Töpel <bjorn.topel@intel.com>
AuthorDate: Tue, 01 Oct 2019 13:33:06 +02:00
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Mon, 07 Oct 2019 12:22:17 -03:00
perf tools: Make usage of test_attr__* optional for perf-sys.h
For users of perf-sys.h outside perf, e.g. samples/bpf/bpf_load.c, it's
convenient not to depend on test_attr__*.
After commit 91854f9a077e ("perf tools: Move everything related to
sys_perf_event_open() to perf-sys.h"), all users of perf-sys.h will
depend on test_attr__enabled and test_attr__open.
This commit enables a user to define HAVE_ATTR_TEST to zero in order
to omit the test dependency.
Fixes: 91854f9a077e ("perf tools: Move everything related to sys_perf_event_open() to perf-sys.h")
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: bpf@vger.kernel.org
Cc: netdev@vger.kernel.org
Link: http://lore.kernel.org/lkml/20191001113307.27796-2-bjorn.topel@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/perf-sys.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
index 63e4349..15e458e 100644
--- a/tools/perf/perf-sys.h
+++ b/tools/perf/perf-sys.h
@@ -15,7 +15,9 @@ void test_attr__init(void);
void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
int fd, int group_fd, unsigned long flags);
-#define HAVE_ATTR_TEST
+#ifndef HAVE_ATTR_TEST
+#define HAVE_ATTR_TEST 1
+#endif
static inline int
sys_perf_event_open(struct perf_event_attr *attr,
@@ -27,7 +29,7 @@ sys_perf_event_open(struct perf_event_attr *attr,
fd = syscall(__NR_perf_event_open, attr, pid, cpu,
group_fd, flags);
-#ifdef HAVE_ATTR_TEST
+#if HAVE_ATTR_TEST
if (unlikely(test_attr__enabled))
test_attr__open(attr, pid, cpu, fd, group_fd, flags);
#endif
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-10-15 5:33 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 11:33 [PATCH 0/2] perf tools: optional compile time test_attr__* depenency for perf-sys.h Björn Töpel
2019-10-01 11:33 ` [PATCH 1/2] perf tools: Make usage of test_attr__* optional " Björn Töpel
2019-10-02 21:00 ` Song Liu
2019-10-03 13:50 ` Arnaldo Carvalho de Melo
2019-10-15 5:31 ` [tip: perf/core] " tip-bot2 for Björn Töpel
2019-10-01 11:33 ` [PATCH 2/2] samples/bpf: fix build by setting HAVE_ATTR_TEST to zero Björn Töpel
2019-10-02 21:00 ` Song Liu
2019-10-03 0:19 ` KP Singh
2019-10-03 13:53 ` Arnaldo Carvalho de Melo
2019-10-15 5:31 ` [tip: perf/core] " tip-bot2 for Björn Töpel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).