[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090910184621.GC6421@nowhere>
Date: Thu, 10 Sep 2009 20:46:22 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: Paul Mackerras <paulus@...ba.org>
Cc: Ingo Molnar <mingo@...e.hu>, LKML <linux-kernel@...r.kernel.org>,
Prasad <prasad@...ux.vnet.ibm.com>,
Alan Stern <stern@...land.harvard.edu>,
Peter Zijlstra <peterz@...radead.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>,
Jan Kiszka <jan.kiszka@...mens.com>,
Jiri Slaby <jirislaby@...il.com>,
Li Zefan <lizf@...fujitsu.com>, Avi Kivity <avi@...hat.com>,
Mike Galbraith <efault@....de>,
Masami Hiramatsu <mhiramat@...hat.com>
Subject: Re: [PATCH 1/5] perf_counter: Add open/close pmu callbacks
On Thu, Sep 10, 2009 at 09:22:02PM +1000, Paul Mackerras wrote:
> Frederic Weisbecker writes:
>
> > Add the open() and close() callback to the pmu structure.
> > Open is called when a counter is initialized just after it's allocation
> > and close is called when the counter is about to be released.
> >
> > These callbacks are useful for example when a pmu has to deal with
> > several registers and needs to maintain an internal list of counters
> > using them. Given such list, the pmu is able to check if the the number
> > of physical registers are still sufficient for the new created counter
> > and then accept or refuse this counter.
>
> We already do that sort of thing on powerpc for hardware counters.
>
> It looks to me that you can easily do that stuff in the appropriate
> xxx_perf_counter_init function, since pmu->open() is only called
> immediately on return from one the various xxx_perf_counter_init
> functions, and xxx_perf_counter_init is what says what pmu struct to
> use.
>
> As for ->close(), that's what counter->destroy is there for. On
> powerpc, hw_perf_counter_init sets counter->destroy to an appropriate
> destructor function, as does tp_perf_counter_init. So if you need a
> destructor for breakpoint counters, just make bp_perf_counter_init set
> counter->destroy appropriately.
>
> Paul.
Right. pmu->open/close is basically a mirror of *_perf_counter_init()
and counter->destroy() but in the pmu layer.
As you prefer I can indeed remove that, the end-result looks a bit
confusing to me too.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists