From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754879AbcB2MX2 (ORCPT ); Mon, 29 Feb 2016 07:23:28 -0500 Received: from casper.infradead.org ([85.118.1.10]:58255 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754628AbcB2MX1 (ORCPT ); Mon, 29 Feb 2016 07:23:27 -0500 Date: Mon, 29 Feb 2016 13:23:20 +0100 From: Peter Zijlstra To: "Liang, Kan" Cc: "linux-kernel@vger.kernel.org" , "ak@linux.intel.com" , "eranian@google.com" , "vincent.weaver@maine.edu" , "tglx@linutronix.de" , "mingo@kernel.org" , "acme@redhat.com" , "jolsa@redhat.com" , "ying.huang@linux.intel.com" , "alexander.shishkin@linux.intel.com" Subject: Re: [PATCH 1/1] perf/core: find auxiliary events in running pmus list Message-ID: <20160229122320.GL6356@twins.programming.kicks-ass.net> References: <1456348836-6163-1-git-send-email-kan.liang@intel.com> <20160226103658.GL6344@twins.programming.kicks-ass.net> <37D7C6CF3E00A74B8858931C1DB2F0770589E368@SHSMSX103.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37D7C6CF3E00A74B8858931C1DB2F0770589E368@SHSMSX103.ccr.corp.intel.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 28, 2016 at 04:31:49PM +0000, Liang, Kan wrote: > > static void account_pmu_sb_event(struct perf_event *event) { > > if (event->parent) > > return; > > > > if (event->attach & ATTACH_TASK) > > return; ^^^^ this > > if (event->attr.mmap || event->attr.mmap_data || event->attr.mmap2) > > attach_sb_event(event, sb_mmap); > > > > if (event->attr.comm || event->attr.comm_exec) > > attach_sb_event(event, sb_comm); > > > > if (event->attr.task) > > attach_sb_event(event, sb_task); > > > > if (event->attr.context_switch) > > attach_sb_event(event, sb_switch); > > } > > And then you can replace the whole global part of perf_event_aux (which I > > would rename to perf_event_sb), with this. > > > > You still have to do something like: > > > > for_each_task_context_nr(ctxn) { > > ctx = rcu_dereference(current->perf_event_ctxp[ctxn]); > > if (!ctx) > > continue; > > perf_event_sb_ctx(ctx, output, data); > > } > > > > I'm not sure why we need something like for_each_task_context_nr(ctxn) in > perf_event_aux/perf_event_sb. > Isn't perf_event_sb_mask enough? > It looks perf_event_sb_mask will go through all possible interested events > (includes both per cpu and per task events). See sites marked "^^^ this" This stuff explicitly does not handle task events, because of the below: > > To get at the per task events, because I don't think we want to go update > > more global state on context switch, nor am I entirely sure its worth it to > > keep per sb ctx->event_list[]s. ^^^ this