Re: [PATCH V2 25/37] perf script: Add synthesized Intel PT power and ptwrite events

From: Arnaldo Carvalho de Melo
Date: Wed Jun 28 2017 - 09:04:52 EST


Em Fri, May 26, 2017 at 11:17:26AM +0300, Adrian Hunter escreveu:
> Add definitions for synthesized Intel PT events for power and ptwrite.

> +++ b/tools/perf/util/event.h
> +/*
> + * Raw data formats for synthesized events. Note that raw data plus the raw data
> + * size (4 bytes) must align to 8-bytes.
> + */
> +
> +struct perf_synth_intel_ptwrite {
> + union {
> + struct {
> + u32 ip : 1,
> + reserved : 31;
> + };
> + u32 flags;
> + };
> + u64 payload;
> +} __packed;


some versions of clang and gcc dislike this __packed here:

In file included from builtin-script.c:5:
In file included from /git/linux/tools/perf/util/debug.h:8:
/git/linux/tools/perf/util/event.h:274:2: error: packed attribute is unnecessary for (null) [-Werror,-Wpacked]
union {
^
/git/linux/tools/perf/util/event.h:285:6: error: packed attribute is unnecessary for 'reserved' [-Werror,-Wpacked]
u32 reserved;
^
/git/linux/tools/perf/util/event.h:298:6: error: packed attribute is unnecessary for 'reserved' [-Werror,-Wpacked]
u32 reserved;
^
/git/linux/tools/perf/util/event.h:322:6: error: packed attribute is unnecessary for 'reserved' [-Werror,-Wpacked]
u32 reserved;
^
4 errors generated.
mv: can't rename '/tmp/build/perf/.builtin-script.o.tmp': No such file or directory

/git/linux/tools/build/Makefile.build:101: recipe for target '/tmp/build/perf/builtin-script.o' failed

Failing in various distros:

[root@jouet ~]# waitp 3940 ; time dm
1 92.3684147260 alpine:3.4: FAIL
2 95.9136365930 alpine:3.5: FAIL
3 104.8328303770 alpine:3.6: FAIL
4 121.6584964930 alpine:edge: FAIL
5 37.2536373490 android-ndk:r12b-arm: Ok
6 83.9077612370 archlinux:latest: Ok
7 14.7094639200 centos:5: FAIL
8 16.6371634320 centos:6: FAIL

Investigating...

> +
> +struct perf_synth_intel_mwait {
> + u32 reserved;
> + union {
> + struct {
> + u64 hints : 8,
> + reserved1 : 24,
> + extensions : 2,
> + reserved2 : 30;
> + };
> + u64 payload;
> + };
> +} __packed;
> +
> +struct perf_synth_intel_pwre {
> + u32 reserved;
> + union {
> + struct {
> + u64 reserved1 : 7,
> + hw : 1,
> + subcstate : 4,
> + cstate : 4,
> + reserved2 : 48;
> + };
> + u64 payload;
> + };
> +} __packed;
> +
> +struct perf_synth_intel_exstop {
> + union {
> + struct {
> + u32 ip : 1,
> + reserved : 31;
> + };
> + u32 flags;
> + };
> +};
> +
> +struct perf_synth_intel_pwrx {
> + u32 reserved;
> + union {
> + struct {
> + u64 deepest_cstate : 4,
> + last_cstate : 4,
> + wake_reason : 4,
> + reserved1 : 52;
> + };
> + u64 payload;
> + };
> +} __packed;
> +
> +struct perf_synth_intel_cbr {
> + union {
> + struct {
> + u32 cbr : 8,
> + reserved1 : 8,
> + max_nonturbo : 8,
> + reserved2 : 8;
> + };
> + u32 flags;
> + };
> + u32 freq;
> + u32 reserved3;
> +};
> +
> /*
> * The kernel collects the number of events it couldn't send in a stretch and
> * when possible sends this number in a PERF_RECORD_LOST event. The number of
> --
> 1.9.1