linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libperf: Remove reference to non-uapi header
@ 2022-10-06 16:29 Vitaly Chikunov
  2022-10-06 20:43 ` Dmitry V. Levin
  2022-10-14 13:44 ` Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 3+ messages in thread
From: Vitaly Chikunov @ 2022-10-06 16:29 UTC (permalink / raw)
  To: Jiri Olsa, Arnaldo Carvalho de Melo, Ian Rogers, linux-perf-users,
	linux-kernel
  Cc: ldv, Vitaly Chikunov, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo

Fix build with libperf:

  $ gcc ./tools/lib/perf/Documentation/examples/counting.c -lperf
  In file included from ./tools/lib/perf/Documentation/examples/counting.c:8:
  /usr/include/perf/event.h:9:10: fatal error: linux/compiler.h: No such file or directory
      9 | #include <linux/compiler.h>
        |          ^~~~~~~~~~~~~~~~~~
  compilation terminated.

Fixes: b2f10cd4e805 ("perf cpumap: Fix alignment for masks in event encoding")
Cc: Ian Rogers <irogers@google.com>
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
---
 tools/lib/perf/include/perf/event.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/lib/perf/include/perf/event.h b/tools/lib/perf/include/perf/event.h
index 93bf93a59c99..4f6d658bf27c 100644
--- a/tools/lib/perf/include/perf/event.h
+++ b/tools/lib/perf/include/perf/event.h
@@ -6,7 +6,6 @@
 #include <linux/types.h>
 #include <linux/limits.h>
 #include <linux/bpf.h>
-#include <linux/compiler.h>
 #include <sys/types.h> /* pid_t */
 
 #define event_contains(obj, mem) ((obj).header.size > offsetof(typeof(obj), mem))
@@ -195,7 +194,7 @@ struct perf_record_mask_cpu_map64 {
 #pragma GCC diagnostic ignored "-Wpacked"
 #pragma GCC diagnostic ignored "-Wattributes"
 
-struct __packed perf_record_cpu_map_data {
+struct perf_record_cpu_map_data {
 	__u16			 type;
 	union {
 		/* Used when type == PERF_CPU_MAP__CPUS. */
@@ -205,7 +204,7 @@ struct __packed perf_record_cpu_map_data {
 		/* Used when type == PERF_CPU_MAP__MASK and long_size == 8. */
 		struct perf_record_mask_cpu_map64 mask64_data;
 	};
-};
+} __attribute__ ((__packed__));
 
 #pragma GCC diagnostic pop
 
-- 
2.33.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] libperf: Remove reference to non-uapi header
  2022-10-06 16:29 [PATCH] libperf: Remove reference to non-uapi header Vitaly Chikunov
@ 2022-10-06 20:43 ` Dmitry V. Levin
  2022-10-14 13:44 ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry V. Levin @ 2022-10-06 20:43 UTC (permalink / raw)
  To: Vitaly Chikunov, Jiri Olsa, Arnaldo Carvalho de Melo, Ian Rogers
  Cc: linux-perf-users, linux-kernel, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo

On Thu, Oct 06, 2022 at 07:29:19PM +0300, Vitaly Chikunov wrote:
> Fix build with libperf:
> 
>   $ gcc ./tools/lib/perf/Documentation/examples/counting.c -lperf
>   In file included from ./tools/lib/perf/Documentation/examples/counting.c:8:
>   /usr/include/perf/event.h:9:10: fatal error: linux/compiler.h: No such file or directory
>       9 | #include <linux/compiler.h>
>         |          ^~~~~~~~~~~~~~~~~~
>   compilation terminated.
> 
> Fixes: b2f10cd4e805 ("perf cpumap: Fix alignment for masks in event encoding")
> Cc: Ian Rogers <irogers@google.com>
> Signed-off-by: Vitaly Chikunov <vt@altlinux.org>

Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>


-- 
ldv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libperf: Remove reference to non-uapi header
  2022-10-06 16:29 [PATCH] libperf: Remove reference to non-uapi header Vitaly Chikunov
  2022-10-06 20:43 ` Dmitry V. Levin
@ 2022-10-14 13:44 ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-10-14 13:44 UTC (permalink / raw)
  To: Vitaly Chikunov
  Cc: Jiri Olsa, Arnaldo Carvalho de Melo, Ian Rogers, linux-perf-users,
	linux-kernel, ldv, Peter Zijlstra, Ingo Molnar, Adrian Hunter,
	Namhyung Kim

Em Thu, Oct 06, 2022 at 07:29:19PM +0300, Vitaly Chikunov escreveu:
> Fix build with libperf:
> 
>   $ gcc ./tools/lib/perf/Documentation/examples/counting.c -lperf
>   In file included from ./tools/lib/perf/Documentation/examples/counting.c:8:
>   /usr/include/perf/event.h:9:10: fatal error: linux/compiler.h: No such file or directory
>       9 | #include <linux/compiler.h>
>         |          ^~~~~~~~~~~~~~~~~~
>   compilation terminated.
> 
> Fixes: b2f10cd4e805 ("perf cpumap: Fix alignment for masks in event encoding")
> Cc: Ian Rogers <irogers@google.com>
> Signed-off-by: Vitaly Chikunov <vt@altlinux.org>

So I'm applying this one instead after re-reading the thread:

From 49b4ee0b20274812198b1ee7840055740d7981a4 Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Fri, 14 Oct 2022 10:39:21 -0300
Subject: [PATCH 1/1] libperf: Do not include non-UAPI linux/compiler.h header

Its just for that __packed define, so use it expanded as __attribute__((packed)),
like the other files in /usr/include do.

This was problem was preventing building the libperf examples on ALT
Linux and Fedora 35, fix it.

Reported-by: Vitaly Chikunov <vt@altlinux.org>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Dmitry Levin <ldv@altlinux.org
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/perf/include/perf/event.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/lib/perf/include/perf/event.h b/tools/lib/perf/include/perf/event.h
index e282faf8fd75b6a8..ad47d7b31046c7c9 100644
--- a/tools/lib/perf/include/perf/event.h
+++ b/tools/lib/perf/include/perf/event.h
@@ -6,7 +6,6 @@
 #include <linux/types.h>
 #include <linux/limits.h>
 #include <linux/bpf.h>
-#include <linux/compiler.h>
 #include <sys/types.h> /* pid_t */
 
 #define event_contains(obj, mem) ((obj).header.size > offsetof(typeof(obj), mem))
@@ -207,7 +206,7 @@ struct perf_record_range_cpu_map {
 	__u16 end_cpu;
 };
 
-struct __packed perf_record_cpu_map_data {
+struct perf_record_cpu_map_data {
 	__u16			 type;
 	union {
 		/* Used when type == PERF_CPU_MAP__CPUS. */
@@ -219,7 +218,7 @@ struct __packed perf_record_cpu_map_data {
 		/* Used when type == PERF_CPU_MAP__RANGE_CPUS. */
 		struct perf_record_range_cpu_map range_cpu_data;
 	};
-};
+} __attribute__((packed));
 
 #pragma GCC diagnostic pop
 
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-14 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-06 16:29 [PATCH] libperf: Remove reference to non-uapi header Vitaly Chikunov
2022-10-06 20:43 ` Dmitry V. Levin
2022-10-14 13:44 ` Arnaldo Carvalho de Melo

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).