Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756805AbZFHVS1 (ORCPT ); Mon, 8 Jun 2009 17:18:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755445AbZFHVSJ (ORCPT ); Mon, 8 Jun 2009 17:18:09 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:38918 "EHLO e9.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755970AbZFHVSI (ORCPT ); Mon, 8 Jun 2009 17:18:08 -0400 Message-ID: <4A2D8011.9050502@linux.vnet.ibm.com> Date: Mon, 08 Jun 2009 14:18:09 -0700 From: Corey Ashford User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Peter Zijlstra CC: Ingo Molnar , Paul Mackerras , Arnaldo Carvalho de Melo , Thomas Gleixner , linux-kernel Subject: Re: [PATCH] perf_counter: extensible perf_counter_attr References: <1244481941.13761.9119.camel@twins> <4A2D6041.4050309@linux.vnet.ibm.com> <1244490680.6691.1.camel@laptop> In-Reply-To: <1244490680.6691.1.camel@laptop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2067 Lines: 68 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 >>> --- >>> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/