All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Lin Ming <ming.m.lin@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	"eranian@gmail.com" <eranian@gmail.com>,
	"Gary.Mohr@Bull.com" <Gary.Mohr@bull.com>,
	Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	"arjan@linux.intel.com" <arjan@linux.intel.com>,
	"Zhang, Yanmin" <yanmin_zhang@linux.intel.com>,
	Paul Mackerras <paulus@samba.org>,
	"David S. Miller" <davem@davemloft.net>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH 1/4] perf: core, add group scheduling transactional APIs
Date: Fri, 23 Apr 2010 04:12:01 +0200	[thread overview]
Message-ID: <20100423021159.GF5600@nowhere> (raw)
In-Reply-To: <1271988505.3412.20.camel@minggr.sh.intel.com>

On Fri, Apr 23, 2010 at 10:08:25AM +0800, Lin Ming wrote:
> On Fri, 2010-04-23 at 01:31 +0800, Frederic Weisbecker wrote:
> > On Thu, Apr 22, 2010 at 03:51:02PM +0800, Lin Ming wrote:
> > > Add group scheduling transactional APIs to struct pmu.
> > > These APIs will be implemented in arch code, based on Peter's idea as
> > > below.
> > > 
> > > > the idea behind hw_perf_group_sched_in() is to not perform
> > > > schedulability tests on each event in the group, but to add the group
> > > as
> > > > a whole and then perform one test.
> > > >
> > > > Of course, when that test fails, you'll have to roll-back the whole
> > > > group again.
> > > >
> > > > So start_txn (or a better name) would simply toggle a flag in the pmu
> > > > implementation that will make pmu::enable() not perform the
> > > > schedulablilty test.
> > > >
> > > > Then commit_txn() will perform the schedulability test (so note the
> > > > method has to have a !void return value, my mistake in the earlier
> > > > email).
> > > >
> > > > This will allow us to use the regular
> > > > kernel/perf_event.c::group_sched_in() and all the rollback code.
> > > > Currently each hw_perf_group_sched_in() implementation duplicates all
> > > > the rolllback code (with various bugs).
> > > 
> > > 
> > > Reviewed-by: Stephane Eranian <eranian@google.com>
> > > Reviewed-by: Peter Zijlstra <peterz@infradead.org>
> > > Signed-off-by: Lin Ming <ming.m.lin@intel.com>
> > > ---
> > >  include/linux/perf_event.h |    8 +++++---
> > >  kernel/perf_event.c        |   29 ++++++++++++++++-------------
> > >  2 files changed, 21 insertions(+), 16 deletions(-)
> > > 
> > > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> > > index ace31fb..b16cfba 100644
> > > --- a/include/linux/perf_event.h
> > > +++ b/include/linux/perf_event.h
> > > @@ -532,6 +532,8 @@ struct hw_perf_event {
> > >  
> > >  struct perf_event;
> > >  
> > > +#define PERF_EVENT_TRAN_STARTED 1
> > > +
> > >  /**
> > >   * struct pmu - generic performance monitoring unit
> > >   */
> > > @@ -542,6 +544,9 @@ struct pmu {
> > >  	void (*stop)			(struct perf_event *event);
> > >  	void (*read)			(struct perf_event *event);
> > >  	void (*unthrottle)		(struct perf_event *event);
> > > +	void (*start_txn)		(const struct pmu *pmu);
> > > +	void (*stop_txn)		(const struct pmu *pmu);
> > > +	int (*commit_txn)		(const struct pmu *pmu);
> > 
> > 
> > Please add a few comments that briefly explain what these
> > *_txn callbacks are supposed to mean.
> > 
> > Unless txn is an acronym that most kernel developers are used to.
> 
> How about below changes?
> 
> Thanks for review.
> 
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index b16cfba..bba4c60 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -544,9 +544,21 @@ struct pmu {
>  	void (*stop)			(struct perf_event *event);
>  	void (*read)			(struct perf_event *event);
>  	void (*unthrottle)		(struct perf_event *event);
> -	void (*start_txn)		(const struct pmu *pmu);
> -	void (*stop_txn)		(const struct pmu *pmu);
> -	int (*commit_txn)		(const struct pmu *pmu);
> +
> +	/*
> +	 * group events scheduling is treated as a transaction,
> +	 * add group events as a whole and perform one schedulability test.
> +	 * If test fails, roll back the whole group
> +	 */
> +
> +	/* start group events transaction  */
> +	void (*start_group_trans)	(const struct pmu *pmu);
> +
> +	/* stop group events transaction  */
> +	void (*stop_group_trans)	(const struct pmu *pmu);
> +
> +	/* commit group events transaction */
> +	int (*commit_group_trans)	(const struct pmu *pmu);
>  };


Looks good!

Thanks.


      reply	other threads:[~2010-04-23  2:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22  7:51 [RFC][PATCH 1/4] perf: core, add group scheduling transactional APIs Lin Ming
2010-04-22  8:24 ` Peter Zijlstra
2010-04-22  9:19   ` Lin Ming
2010-04-22 17:31 ` Frederic Weisbecker
2010-04-23  2:08   ` Lin Ming
2010-04-23  2:12     ` Frederic Weisbecker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100423021159.GF5600@nowhere \
    --to=fweisbec@gmail.com \
    --cc=Gary.Mohr@bull.com \
    --cc=arjan@linux.intel.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=yanmin_zhang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.