All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corey Ashford <cjashfor@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>, Paul Mackerras <paulus@samba.org>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] perf_counter: extensible perf_counter_attr
Date: Mon, 08 Jun 2009 14:18:09 -0700	[thread overview]
Message-ID: <4A2D8011.9050502@linux.vnet.ibm.com> (raw)
In-Reply-To: <1244490680.6691.1.camel@laptop>

Peter Zijlstra wrote:
> On Mon, 2009-06-08 at 12:02 -0700, Corey Ashford wrote:
>> Hi Peter,
>>
>> Peter Zijlstra wrote:
>>> Allow extending the perf_counter_attr structure by linking extended
>>> structures to it.
>>>
>>> Also, should we grow the directly reserved space in the structure a
>>> little more?
>>>
>>> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
>>> ---
>>>  include/linux/perf_counter.h |    7 +++++++
>>>  kernel/perf_counter.c        |    1 +
>>>  2 files changed, 8 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
>>> index 3586df8..781d8ce 100644
>>> --- a/include/linux/perf_counter.h
>>> +++ b/include/linux/perf_counter.h
>>> @@ -175,6 +175,13 @@ struct perf_counter_attr {
>>>  	__u32			__reserved_3;
>>>
>>>  	__u64			__reserved_4;
>>> +
>>> +	struct perf_counter_attr_ext *ext_attrs;
>>> +};
>>> +
>>> +struct perf_counter_attr_ext {
>>> +	struct perf_counter_attr_ext 	*next;
>>> +	__u64				perf_attr_ext_type;
>>>  };
>> Let's say I want to extend the attributes by four 64-bit quantities... from the 
>> above definition, I'd need four additional records chained together, right?  How 
>> about something like this instead:
> 
> Ah, the idea was to do something like:
> 
> struct perf_counter_attr_feature {
> 	struct perf_counter_attr_ext	head;
> 	... more stuff ...
> };
> 
> and set head.perf_attr_ext_type = PERF_ATTR_EXT_FEATURE


So you'd do something like this then when assigning to the perf_counter_attr struct:

struct perf_counter_attr pca;
...
struct perf_counter_attr_feature feature;

...
pca.ext_attrs = (struct perf_counter_attr_ext *)&feature;
-or-
pca.ext_attrs = &feature.head; /* secretly know that there's data that lies past 
the attr struct header */

Am I understanding this correctly?

- Corey


  reply	other threads:[~2009-06-08 21:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08 17:25 [PATCH] perf_counter: extensible perf_counter_attr Peter Zijlstra
2009-06-08 19:02 ` Corey Ashford
2009-06-08 19:51   ` Peter Zijlstra
2009-06-08 21:18     ` Corey Ashford [this message]
2009-06-08 21:23       ` Peter Zijlstra
2009-06-08 21:29         ` Corey Ashford
2009-06-08 21:50           ` Ingo Molnar
2009-06-09  0:50             ` Corey Ashford
2009-06-09  6:51               ` Ingo Molnar
2009-06-09  8:13                 ` Corey Ashford
2009-06-09 11:53                   ` Ingo Molnar
2009-06-09 16:44                     ` Corey Ashford
2009-06-09 22:00                       ` Ingo Molnar
2009-06-09 23:16                         ` Corey Ashford
2009-06-10  0:14                           ` Paul Mackerras
2009-06-10 22:06                             ` Corey Ashford
2009-06-09  4:17 ` Paul Mackerras
2009-06-09  6:53   ` Ingo Molnar
2009-06-09  9:58     ` Paul Mackerras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A2D8011.9050502@linux.vnet.ibm.com \
    --to=cjashfor@linux.vnet.ibm.com \
    --cc=acme@ghostprotocols.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.