perf: Move mmap page data_head offset assertion out of header
authorJiri Olsa <jolsa@redhat.com>
Fri, 23 Mar 2012 14:41:20 +0000 (15:41 +0100)
committerIngo Molnar <mingo@kernel.org>
Sat, 24 Mar 2012 07:46:59 +0000 (08:46 +0100)
Having the build time assertion in header is making the perf
build fail on x86 with:

  ../../include/linux/perf_event.h:411:32: error: variably modified \
‘__assert_mmap_data_head_offset’ at file scope [-Werror]

I'm moving the build time validation out of the header, because
I think it's better than to lessen the perf build warn/error
check.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: acme@redhat.com
Cc: a.p.zijlstra@chello.nl
Cc: paulus@samba.org
Cc: cjashfor@linux.vnet.ibm.com
Cc: fweisbec@gmail.com
Link: http://lkml.kernel.org/r/1332513680-7870-1-git-send-email-jolsa@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/perf_event.h
kernel/events/core.c

index ca9ed4e6a286710720285b368d73dbc62c09c4c4..ddbb6a901f653b7880ed293ee2f67db17a01b850 100644 (file)
@@ -403,13 +403,6 @@ struct perf_event_mmap_page {
        __u64   data_tail;              /* user-space written tail */
 };
 
-/*
- * Build time assertion that we keep the data_head at the intended location.
- * IOW, validation we got the __reserved[] size right.
- */
-extern char __assert_mmap_data_head_offset
-       [1 - 2*!!(offsetof(struct perf_event_mmap_page, data_head) != 1024)];
-
 #define PERF_RECORD_MISC_CPUMODE_MASK          (7 << 0)
 #define PERF_RECORD_MISC_CPUMODE_UNKNOWN       (0 << 0)
 #define PERF_RECORD_MISC_KERNEL                        (1 << 0)
index dc3b05272511b6d5095d1584982240d63c30bfae..3f92a19aa11efaa192976b8c543e60758ee8db9d 100644 (file)
@@ -7116,6 +7116,13 @@ void __init perf_event_init(void)
 
        /* do not patch jump label more than once per second */
        jump_label_rate_limit(&perf_sched_events, HZ);
+
+       /*
+        * Build time assertion that we keep the data_head at the intended
+        * location.  IOW, validation we got the __reserved[] size right.
+        */
+       BUILD_BUG_ON((offsetof(struct perf_event_mmap_page, data_head))
+                    != 1024);
 }
 
 static int __init perf_event_sysfs_init(void)