* /usr/include/perf/event.h:9:10: fatal error: linux/compiler.h: No such file or directory
@ 2022-10-06 14:28 Vitaly Chikunov
2022-10-06 15:16 ` Vitaly Chikunov
0 siblings, 1 reply; 5+ messages in thread
From: Vitaly Chikunov @ 2022-10-06 14:28 UTC (permalink / raw)
To: linux-perf-users, Arnaldo Carvalho de Melo, Ian Rogers; +Cc: Dmitry V. Levin
Hi,
I noticed that perf examples do not compile anymore with v6.0 (first on ALT,
but on Fedora is the same). Fedora example for convenience:
# dnf install kernel libperf-devel gcc
# cc /usr/share/doc/libperf/examples/counting.c -lperf
In file included from /usr/share/doc/libperf/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.
I don't see compiler.h installed anywhere by the `make headers_install`.
Thanks,
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: /usr/include/perf/event.h:9:10: fatal error: linux/compiler.h: No such file or directory
2022-10-06 14:28 /usr/include/perf/event.h:9:10: fatal error: linux/compiler.h: No such file or directory Vitaly Chikunov
@ 2022-10-06 15:16 ` Vitaly Chikunov
2022-10-06 17:20 ` Ian Rogers
0 siblings, 1 reply; 5+ messages in thread
From: Vitaly Chikunov @ 2022-10-06 15:16 UTC (permalink / raw)
To: linux-perf-users, Arnaldo Carvalho de Melo, Ian Rogers; +Cc: Dmitry V. Levin
On Thu, Oct 06, 2022 at 05:28:53PM +0300, Vitaly Chikunov wrote:
> I noticed that perf examples do not compile anymore with v6.0 (first on ALT,
> but on Fedora is the same). Fedora example for convenience:
>
> # dnf install kernel libperf-devel gcc
> # cc /usr/share/doc/libperf/examples/counting.c -lperf
> In file included from /usr/share/doc/libperf/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.
This is introduced in b2f10cd4e805 ("perf cpumap: Fix alignment for
masks in event encoding") just (it seems) for `__packed'.
I am told that all uapi is using __attribute__ ((__packed__)) for that.
Thanks,
>
> I don't see compiler.h installed anywhere by the `make headers_install`.
>
> Thanks,
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: /usr/include/perf/event.h:9:10: fatal error: linux/compiler.h: No such file or directory
2022-10-06 15:16 ` Vitaly Chikunov
@ 2022-10-06 17:20 ` Ian Rogers
2022-10-06 19:36 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 5+ messages in thread
From: Ian Rogers @ 2022-10-06 17:20 UTC (permalink / raw)
To: Vitaly Chikunov, Arnaldo Carvalho de Melo
Cc: linux-perf-users, Dmitry V. Levin
On Thu, Oct 6, 2022 at 8:16 AM Vitaly Chikunov <vt@altlinux.org> wrote:
>
> On Thu, Oct 06, 2022 at 05:28:53PM +0300, Vitaly Chikunov wrote:
> > I noticed that perf examples do not compile anymore with v6.0 (first on ALT,
> > but on Fedora is the same). Fedora example for convenience:
> >
> > # dnf install kernel libperf-devel gcc
> > # cc /usr/share/doc/libperf/examples/counting.c -lperf
> > In file included from /usr/share/doc/libperf/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.
>
> This is introduced in b2f10cd4e805 ("perf cpumap: Fix alignment for
> masks in event encoding") just (it seems) for `__packed'.
> I am told that all uapi is using __attribute__ ((__packed__)) for that.
>
> Thanks,
Thanks for reporting the issue and sorry for the breakage. I'm not a
dependency/packaging expert. Arnaldo, what should be the next steps
here?
Thanks,
Ian
> >
> > I don't see compiler.h installed anywhere by the `make headers_install`.
> >
> > Thanks,
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: /usr/include/perf/event.h:9:10: fatal error: linux/compiler.h: No such file or directory
2022-10-06 17:20 ` Ian Rogers
@ 2022-10-06 19:36 ` Arnaldo Carvalho de Melo
2022-10-06 20:32 ` Ian Rogers
0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-10-06 19:36 UTC (permalink / raw)
To: Ian Rogers
Cc: Vitaly Chikunov, Arnaldo Carvalho de Melo, linux-perf-users,
Dmitry V. Levin
Em Thu, Oct 06, 2022 at 10:20:34AM -0700, Ian Rogers escreveu:
> On Thu, Oct 6, 2022 at 8:16 AM Vitaly Chikunov <vt@altlinux.org> wrote:
> >
> > On Thu, Oct 06, 2022 at 05:28:53PM +0300, Vitaly Chikunov wrote:
> > > I noticed that perf examples do not compile anymore with v6.0 (first on ALT,
> > > but on Fedora is the same). Fedora example for convenience:
> > >
> > > # dnf install kernel libperf-devel gcc
> > > # cc /usr/share/doc/libperf/examples/counting.c -lperf
> > > In file included from /usr/share/doc/libperf/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.
> >
> > This is introduced in b2f10cd4e805 ("perf cpumap: Fix alignment for
> > masks in event encoding") just (it seems) for `__packed'.
> > I am told that all uapi is using __attribute__ ((__packed__)) for that.
> >
> > Thanks,
>
> Thanks for reporting the issue and sorry for the breakage. I'm not a
> dependency/packaging expert. Arnaldo, what should be the next steps
> here?
I guess we should just use '__attribute__ ((__packed__))', as its what
we see when grepping for attribute on /usr/include/linux/
But t his patch seems to simple remove the packed, no? I.e. is that
packed really needed?
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: /usr/include/perf/event.h:9:10: fatal error: linux/compiler.h: No such file or directory
2022-10-06 19:36 ` Arnaldo Carvalho de Melo
@ 2022-10-06 20:32 ` Ian Rogers
0 siblings, 0 replies; 5+ messages in thread
From: Ian Rogers @ 2022-10-06 20:32 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Vitaly Chikunov, Arnaldo Carvalho de Melo, linux-perf-users,
Dmitry V. Levin
On Thu, Oct 6, 2022 at 12:36 PM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Thu, Oct 06, 2022 at 10:20:34AM -0700, Ian Rogers escreveu:
> > On Thu, Oct 6, 2022 at 8:16 AM Vitaly Chikunov <vt@altlinux.org> wrote:
> > >
> > > On Thu, Oct 06, 2022 at 05:28:53PM +0300, Vitaly Chikunov wrote:
> > > > I noticed that perf examples do not compile anymore with v6.0 (first on ALT,
> > > > but on Fedora is the same). Fedora example for convenience:
> > > >
> > > > # dnf install kernel libperf-devel gcc
> > > > # cc /usr/share/doc/libperf/examples/counting.c -lperf
> > > > In file included from /usr/share/doc/libperf/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.
> > >
> > > This is introduced in b2f10cd4e805 ("perf cpumap: Fix alignment for
> > > masks in event encoding") just (it seems) for `__packed'.
> > > I am told that all uapi is using __attribute__ ((__packed__)) for that.
> > >
> > > Thanks,
> >
> > Thanks for reporting the issue and sorry for the breakage. I'm not a
> > dependency/packaging expert. Arnaldo, what should be the next steps
> > here?
>
> I guess we should just use '__attribute__ ((__packed__))', as its what
> we see when grepping for attribute on /usr/include/linux/
>
> But t his patch seems to simple remove the packed, no? I.e. is that
> packed really needed?
The packed came from undefined behavior in the disk representation of
the cpu map (perf_record_cpu_map_data). Unfortunately there are
unaligned __u32 and __64 values in perf_record_cpu_map_data take for
example the case where bitmap entries are 32-bit (long_size == 4):
perf_record_cpu_map_data {
__u16 type
perf_record_mask_cpu_map32 {
__u16 nr;
__u16 long_size;
__u32 mask[];
}
}
when mask is accessed it is necessary that the compiler know it is
unaligned (2 rather than 4 byte aligned). Removing the packed would
mean that the alignment on mask would change and so would the disk
representation. This would break reading old perf.data files. The
previous code would pass __u32 pointers to mask even though it was
unaligned, triggering undefined behavior errors. The code now passes
around a pointer to perf_record_cpu_map_data as the compiler knows
from the packed attribute that the mask is going to be unaligned when
accessed.
Thanks,
Ian
> - Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-10-06 20:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06 14:28 /usr/include/perf/event.h:9:10: fatal error: linux/compiler.h: No such file or directory Vitaly Chikunov
2022-10-06 15:16 ` Vitaly Chikunov
2022-10-06 17:20 ` Ian Rogers
2022-10-06 19:36 ` Arnaldo Carvalho de Melo
2022-10-06 20:32 ` Ian Rogers
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.