Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932693Ab3IMOY7 (ORCPT ); Fri, 13 Sep 2013 10:24:59 -0400 Received: from mail-ve0-f180.google.com ([209.85.128.180]:40105 "EHLO mail-ve0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932249Ab3IMOY5 (ORCPT ); Fri, 13 Sep 2013 10:24:57 -0400 Date: Fri, 13 Sep 2013 10:31:59 -0400 (EDT) From: Vince Weaver To: Peter Zijlstra cc: Ingo Molnar , Andi Kleen , Vince Weaver , Andi Kleen , acme@infradead.org, linux-kernel@vger.kernel.org, Stephane Eranian , torvalds@linux-foundation.org, trinity@vger.kernel.org, Thomas Gleixner , =?ISO-8859-15?Q?Fr=E9d=E9ric_Weisbecker?= , Jiri Olsa , Namhyung Kim Subject: Re: [PATCH 1/2] tools, perf: Add a precise event qualifier v2 In-Reply-To: <20130913112956.GA21832@twins.programming.kicks-ass.net> Message-ID: References: <1374501138-13496-1-git-send-email-andi@firstfloor.org> <20130723060108.GA18396@tassilo.jf.intel.com> <20130723225150.GT6123@two.firstfloor.org> <20130912165733.GA23698@gmail.com> <20130912173617.GI18242@two.firstfloor.org> <20130913085654.GI31370@twins.programming.kicks-ass.net> <20130913095057.GB11611@gmail.com> <20130913112956.GA21832@twins.programming.kicks-ass.net> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2308 Lines: 58 On Fri, 13 Sep 2013, Peter Zijlstra wrote: > On Fri, Sep 13, 2013 at 11:50:57AM +0200, Ingo Molnar wrote: > > For example if we added 'type' as well we could expose the generic, > > hardware-independent events via sysfs as well. > > Type is already fully implied by where you'll find the event in sysfs: > > /sys/bus/event_sources/devices/$PMU/events/ > > needs > > perf_event_attr::type := /sys/bus/event_sources/devices/$PMU/type OK, fine, another question then. Is there any reason these values have to be human-readable? The only reason you are using this crazy format I can see is because it makes maintaining your personal userspace implementation (perf) easier at the expense of everyone else who want to use this interface. Honestly, an interface like cat /sys/bus/event_sources/devices/$PMU/events/new_event size=320,0xdeadbeef,0xcafef00d,....,0x000000 when you just set up an array, copy in the values, then memcpy() it into place on top of a struct attr is a million times easier than what you are propsing: 1. A huge complicated LEX/YACC parser 2. The parser has to read in many different files under ../format/.. and build up a tree of names and shift/masks 3. The event is read in and then text has to be parsed, values read, and then shifting-masking to get a value for each register 4. A mapping has to be in the code of the various (of the over 40+) fields in the struct perf_attr field, and each value has to be put at the proper offset 5. If ever a new field is added to struct perf_attr, then any event using it breaks until your parser is updated with all the info about this field. It's huge, takes up non-swappable kernel mem with lots of individual sysfs files, requires a complex parser for what should be just a simple config setup, and is fragile when new fields are added. But of course since perf is tightly coupled into the kernel source tree you can get away with it. I guess I should just be glad you aren't exporting it as XML or something. Vince -- 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/