From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753427AbdEPRm2 (ORCPT ); Tue, 16 May 2017 13:42:28 -0400 Received: from mga04.intel.com ([192.55.52.120]:15655 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752262AbdEPRm0 (ORCPT ); Tue, 16 May 2017 13:42:26 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,350,1491289200"; d="scan'208";a="102823363" Date: Tue, 16 May 2017 10:42:25 -0700 From: "Luck, Tony" To: Arnaldo Carvalho de Melo Cc: Vikas Shivappa , Stephane Eranian , David Carrillo-Cisneros , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Alexander Shishkin , linux-kernel@vger.kernel.org Subject: Re: [RFC] perf: Add "-f" and "-F" flags to watch a "/sys" style file Message-ID: <20170516174225.gx3xate4dbg2zgqj@intel.com> References: <20170515192703.23746-1-tony.luck@intel.com> <20170516004558.GE3741@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170516004558.GE3741@kernel.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 15, 2017 at 09:45:58PM -0300, Arnaldo Carvalho de Melo wrote: > I haven't been following the discussion about the resctrl fs discussion > to understand why those values couldn't be read via > sys_perf_event_open(), so can't comment on that, but the implementation > on the tools/ classes look nice, i.e. -e will get perf_evsel instances > that interface with the kernel via sys_perf_event_open(), -f/-F will get > perf_evsel instances that read values via the rsctrl file system, clean. It's kind of tortuous to connect the dots from these events to sys_perf_event_open(). That has a strong connection to a specific task, and/or a specific CPU. But these events count for a group of tasks and the resource is shared typically at the socket level. E.g. we might have three "jobs" (each consisting of several processes/threads). We run them all in a shared restricted cache allocation environment, but wanto to measure how each is performing: # cd /sys/fs/resctrl # mkdir cg1 # echo $$ > cg1/tasks # # echo "L3:0=ff000;1=ff000" > cg1/schemata # mkdir cg1/mon_tasks/j1 cg1/mon_tasks/j2 cg1/mon_tasks/j3 # # echo $$ > cg1/mon_tasks/j1/tasks # job1 & # echo $$ > cg1/mon_tasks/j2/tasks # job2 & # echo $$ > cg1/mon_tasks/j3/tasks # job3 & Now we can view the cache occupancy for each of job1, job2, and job3 via some files[*] in each of these directories. Or see the summary cache occupancy for all three jobs via files in the control group (/sys/fs/resctrl/cg1) For me, I can easily see how to use "-f" options to look at the right files to get the information I want. Offline we've talked at the white board level of either over-loading the "-G" flag used for Cgroups, or adding a new "-R" flag for resctrl groups and then having our internal kernel code respond to sys_perf_event_open() with a file descriptor that behaves like other "perf" file descriptors. Maybe someone will work out the syntax wrinkles to express that on the perf command line. Perhaps something like: # perf stat -e intel/llc_occupancy -R /sys/fs/resctrl/cg1/mon_tasks/j1 ... The "intel/llc_occupancy" event would need some special attributes so that perf would know that it requires "-R" option(s) too, and doesn't work with other options like "-C". > P.S. I may be slow to reply because I'm on vacation till the end of this > month. Thanks for looking at this while on vacation. Now exit e-mail and enjoy your time off :-) -Tony [*] exact names still in flux, and will probably change again when we post patches and people who are better at choosing names begin to review then.