Re: [PATCH] perf, ibs: Check syscall attribute flags

From: Robert Richter
Date: Fri Sep 07 2012 - 13:18:47 EST


On 07.09.12 18:56:27, Peter Zijlstra wrote:

> > + .exclude_user = 1,
> > + .exclude_kernel = 1,
> > + .exclude_hv = 1,
> > + .exclude_idle = 1,
> > + .exclude_host = 1,
> > + .exclude_guest = 1,
>
> Ideally we'd grow support for those using SVM entry/exit hooks though.

Yes, I will look at this too. This patch is inteded for stable and
urgent.

> > +#define perf_flags(attr) (*(&(attr)->read_format + 1))
>
>
> Another anonymous union shouldn't hurt..
>
> ---
> include/linux/perf_event.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index cc5e2cd..5df37a0 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -236,7 +236,9 @@ struct perf_event_attr {
> __u64 sample_type;
> __u64 read_format;
>
> - __u64 disabled : 1, /* off by default */
> + union {
> + __u64 flags;
> + __u64 disabled : 1, /* off by default */
> inherit : 1, /* children inherit it */
> pinned : 1, /* must always be on PMU */
> exclusive : 1, /* only group on PMU */
> @@ -272,6 +274,7 @@ struct perf_event_attr {
> exclude_callchain_user : 1, /* exclude user callchains */
>
> __reserved_1 : 41;
> + };
>
> union {
> __u32 wakeup_events; /* wakeup every n events */

I was thinking of this too. But this breaks existing code to compile
since static initialization of struct perf_event_attr fails, e.g.:

builtin-test.c:469:3: error: unknown field âwatermarkâ specified in initializer

-Robert

--
Advanced Micro Devices, Inc.
Operating System Research Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/