From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755170AbbDPR2J (ORCPT ); Thu, 16 Apr 2015 13:28:09 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:56956 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754783AbbDPR1m (ORCPT ); Thu, 16 Apr 2015 13:27:42 -0400 Date: Wed, 8 Apr 2015 08:40:54 -0700 From: Sukadev Bhattiprolu To: Peter Zijlstra Cc: Paul Mackerras , Arnaldo Carvalho de Melo , mingo@redhat.com, Michael Ellerman , dev@codyps.com, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2 1/5] perf: Add a flags parameter to pmu txn interfaces Message-ID: <20150408154054.GA3525@us.ibm.com> References: <1428453299-19121-1-git-send-email-sukadev@linux.vnet.ibm.com> <1428453299-19121-2-git-send-email-sukadev@linux.vnet.ibm.com> <20150408121923.GD23123@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150408121923.GD23123@twins.programming.kicks-ass.net> X-Operating-System: Linux 2.0.32 on an i486 User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15041617-0009-0000-0000-00000A28BDCD Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra [peterz@infradead.org] wrote: | On Tue, Apr 07, 2015 at 05:34:55PM -0700, Sukadev Bhattiprolu wrote: | > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h | > index 2b62198..4dc3d70 100644 | > --- a/include/linux/perf_event.h | > +++ b/include/linux/perf_event.h | > @@ -240,20 +240,27 @@ struct pmu { | > * | > * Start the transaction, after this ->add() doesn't need to | > * do schedulability tests. | > + * | > + * Optional. | > */ | > - void (*start_txn) (struct pmu *pmu); /* optional */ | > +#define PERF_PMU_TXN_ADD 0x1 /* txn to add/schedule event on PMU */ | | Please do not interleave these flags in the structure. Maybe place it | near PERF_EVENT_TXN. Ok. | | > + void (*start_txn) (struct pmu *pmu, int flags); | > /* | > * If ->start_txn() disabled the ->add() schedulability test | > * then ->commit_txn() is required to perform one. On success | > * the transaction is closed. On error the transaction is kept | > * open until ->cancel_txn() is called. | > + * | > + * Optional. | > */ | > - int (*commit_txn) (struct pmu *pmu); /* optional */ | > + int (*commit_txn) (struct pmu *pmu, int flags); | > /* | > * Will cancel the transaction, assumes ->del() is called | > * for each successful ->add() during the transaction. | > + * | > + * Optional. | > */ | > - void (*cancel_txn) (struct pmu *pmu); /* optional */ | > + void (*cancel_txn) (struct pmu *pmu, int flags); | > | > /* | > * Will return the value for perf_event_mmap_page::index for this event, | | So (again), why also pass the flags to cancel/commit ? | | The transaction state _has_ to already record it, otherwise it doesn't | know if add/read are part of one. I had replied to your earlier mail and added a Note to this patch description. I was hesitating making more intrusive changes to PMUs that don't care about the new txn type. But, I agree, it is better to go ahead and update all PMUs to save the state and check. Will do that in the next version. Sukadev