From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755863AbbGVFzQ (ORCPT ); Wed, 22 Jul 2015 01:55:16 -0400 Received: from casper.infradead.org ([85.118.1.10]:44886 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753138AbbGVFzO (ORCPT ); Wed, 22 Jul 2015 01:55:14 -0400 Date: Wed, 22 Jul 2015 07:55:03 +0200 From: Peter Zijlstra To: Sukadev Bhattiprolu Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Michael Ellerman , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org Subject: Re: [PATCH v3 7/8] perf: Define PMU_TXN_READ interface Message-ID: <20150722055503.GO25159@twins.programming.kicks-ass.net> References: <1436929315-28520-1-git-send-email-sukadev@linux.vnet.ibm.com> <1436929315-28520-8-git-send-email-sukadev@linux.vnet.ibm.com> <20150716222015.GO3644@twins.programming.kicks-ass.net> <20150722015045.GA24420@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150722015045.GA24420@us.ibm.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 Tue, Jul 21, 2015 at 06:50:45PM -0700, Sukadev Bhattiprolu wrote: > We are trying to use the following interface: > > start_txn(pmu, PERF_PMU_TXN_READ); > > perf_event_read(leader); > list_for_each(sibling, &leader->sibling_list, group_entry) > perf_event_read(sibling) > > pmu->commit_txn(pmu); > > with the idea that the PMU driver would save the type of transaction in > ->start_txn() and use in ->read() and ->commit_txn(). > > But since ->start_txn() and the ->read() operations could happen on different > CPUs (perf_event_read() uses the event->oncpu to schedule a call), the PMU > driver cannot use a per-cpu variable to save the state in ->start_txn(). > or is there better way? I've not woken up yet, and not actually fully read the email, but can you stuff the entire above chunk inside the IPI? I think you could then actually optimize __perf_event_read() as well, because all these events should be on the same context, so no point in calling update_*time*() for every event or so.