From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758262Ab0GTRuW (ORCPT ); Tue, 20 Jul 2010 13:50:22 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:41709 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750962Ab0GTRuV (ORCPT ); Tue, 20 Jul 2010 13:50:21 -0400 Message-ID: <4C45E1C9.6010402@linux.vnet.ibm.com> Date: Tue, 20 Jul 2010 10:50:01 -0700 From: Corey Ashford User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Thunderbird/3.0.5 MIME-Version: 1.0 To: Robert Richter CC: Lin Ming , Ingo Molnar , Johannes Berg , Peter Zijlstra , Greg KH , Frederic Weisbecker , Paul Mundt , "eranian@gmail.com" , "Gary.Mohr@Bull.com" , "arjan@linux.intel.com" , "Zhang, Yanmin" , Paul Mackerras , "David S. Miller" , Russell King , Arnaldo Carvalho de Melo , Will Deacon , Maynard Johnson , Carl Love , Kay Sievers , lkml , Thomas Gleixner , Steven Rostedt Subject: Re: [rfc] Describe events in a structured way via sysfs References: <20100624093625.GA26931@elte.hu> <1277396053.3870.16.camel@jlt3.sipsolutions.net> <20100624173315.GA30403@elte.hu> <1277792114.5400.5.camel@minggr.sh.intel.com> <20100629085532.GE22344@elte.hu> <1277803248.5400.16.camel@minggr.sh.intel.com> <20100629102656.GA25512@elte.hu> <1278057996.3841.26.camel@minggr.sh.intel.com> <4C40F750.4000607@linux.vnet.ibm.com> <1279604908.23815.21.camel@minggr.sh.intel.com> <20100720151920.GC21909@erda.amd.com> In-Reply-To: <20100720151920.GC21909@erda.amd.com> 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 On 07/20/2010 08:19 AM, Robert Richter wrote: > On 20.07.10 01:48:28, Lin Ming wrote: > The caller reads config and type and pass them into perf_event_attr. >> >> 1. Hardware events >> /sys/devices/system/cpu/cpu0...cpuN/events >> |-- L1-dcache-load-misses ===> event name >> | |-- config ===> config value for the event >> | `-- type ===> event type > > Wouldn't it be much easier to have a unique sysfs id (could be an > u64): > >> |-- L1-dcache-load-misses ===> event name >> | `-- id ===> event id > > ... and then extend the syscall to enable an event by its sysfs id: > > memset(&attr, 0, sizeof(attr)); > attr.type = PERF_TYPE_SYSFS; > attr.sysfs_id = sysfs_id; > attr.sample_type = PERF_SAMPLE_CPU | PERF_SAMPLE_RAW; > attr.config = config; > ... > > The kerrnel then knows which event is meant and the don't have to > provide event specific paramaters such as type/config that requires an > event specific setup. The advantage would be that we can open an event > file descriptor of every kind of event in a standardized way. Your example above still shows the .config member being set. Was that intentional? Maybe another way to accomplish this would be to reuse the .config field for the sysfs_id. We still need a way to deal with event attributes though, so something more than a single sysfs_id would be needed to specify the event completely. - Corey