Re: [RFC] perf: perf_event_attr anon unions and static initializer issue

2012-10-05 Thread Borislav Petkov
On Fri, Oct 05, 2012 at 01:49:44PM +0200, Stephane Eranian wrote:
> Yeah, unfortunately. I ended up creating a separate table for config1
> and initializing attr.config1 at runtime. That way it works regardless
> of the compiler

Did the same thing in the persistent events patches recently:

http://marc.info/?l=linux-kernel=134513917126309

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


Re: [RFC] perf: perf_event_attr anon unions and static initializer issue

2012-10-05 Thread Stephane Eranian
On Fri, Oct 5, 2012 at 1:01 PM, Peter Zijlstra  wrote:
> On Fri, 2012-10-05 at 12:36 +0200, Stephane Eranian wrote:
>
>> struct perf_event_attr attr = { .config = 0x1234, .config1 = 0x456 };
>
>> Does anyone have a better solution to propose?
>
>
>   struct perf_event_attr attr = {
> .config = 0x1234,
> { .config1 = 0x5678 },
>   };
>
> sometimes works, but apparently not in this case.. its a bit unfortunate
> indeed. EDG based compilers and the latest C std use your version --
> hence also 4.6 supporting it.
>
> Yeah, I'm afraid we're stuck with this until a future where modern C
> isn't modern anymore.

Yeah, unfortunately.
I ended up creating a separate table for config1 and initializing attr.config1
at runtime. That way it works regardless of the compiler
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] perf: perf_event_attr anon unions and static initializer issue

2012-10-05 Thread Peter Zijlstra
On Fri, 2012-10-05 at 12:36 +0200, Stephane Eranian wrote:

> struct perf_event_attr attr = { .config = 0x1234, .config1 = 0x456 };

> Does anyone have a better solution to propose?


  struct perf_event_attr attr = { 
.config = 0x1234, 
{ .config1 = 0x5678 },
  };

sometimes works, but apparently not in this case.. its a bit unfortunate
indeed. EDG based compilers and the latest C std use your version --
hence also 4.6 supporting it.

Yeah, I'm afraid we're stuck with this until a future where modern C
isn't modern anymore.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] perf: perf_event_attr anon unions and static initializer issue

2012-10-05 Thread Peter Zijlstra
On Fri, 2012-10-05 at 12:36 +0200, Stephane Eranian wrote:

 struct perf_event_attr attr = { .config = 0x1234, .config1 = 0x456 };

 Does anyone have a better solution to propose?


  struct perf_event_attr attr = { 
.config = 0x1234, 
{ .config1 = 0x5678 },
  };

sometimes works, but apparently not in this case.. its a bit unfortunate
indeed. EDG based compilers and the latest C std use your version --
hence also 4.6 supporting it.

Yeah, I'm afraid we're stuck with this until a future where modern C
isn't modern anymore.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] perf: perf_event_attr anon unions and static initializer issue

2012-10-05 Thread Stephane Eranian
On Fri, Oct 5, 2012 at 1:01 PM, Peter Zijlstra pet...@infradead.org wrote:
 On Fri, 2012-10-05 at 12:36 +0200, Stephane Eranian wrote:

 struct perf_event_attr attr = { .config = 0x1234, .config1 = 0x456 };

 Does anyone have a better solution to propose?


   struct perf_event_attr attr = {
 .config = 0x1234,
 { .config1 = 0x5678 },
   };

 sometimes works, but apparently not in this case.. its a bit unfortunate
 indeed. EDG based compilers and the latest C std use your version --
 hence also 4.6 supporting it.

 Yeah, I'm afraid we're stuck with this until a future where modern C
 isn't modern anymore.

Yeah, unfortunately.
I ended up creating a separate table for config1 and initializing attr.config1
at runtime. That way it works regardless of the compiler
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] perf: perf_event_attr anon unions and static initializer issue

2012-10-05 Thread Borislav Petkov
On Fri, Oct 05, 2012 at 01:49:44PM +0200, Stephane Eranian wrote:
 Yeah, unfortunately. I ended up creating a separate table for config1
 and initializing attr.config1 at runtime. That way it works regardless
 of the compiler

Did the same thing in the persistent events patches recently:

http://marc.info/?l=linux-kernelm=134513917126309

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