From: Peter Zijlstra <peterz@infradead.org>
To: Michael Cree <mcree@orcon.net.nz>
Cc: mingo@redhat.com, dengcheng.zhu@gmail.com,
yanmin_zhang@linux.intel.com, gorcunov@gmail.com,
fweisbec@gmail.com, robert.richter@amd.com, ming.m.lin@intel.com,
tglx@linutronix.de, hpa@zytor.com, paulus@samba.org,
linux-kernel@vger.kernel.org, eranian@googlemail.com,
will.deacon@arm.com, lethal@linux-sh.org, davem@davemloft.net,
mingo@elte.hu, linux-alpha@vger.kernel.org
Subject: Re: [tip:perf/core] perf: Rework the PMU methods
Date: Sat, 11 Sep 2010 11:40:35 +0200 [thread overview]
Message-ID: <1284198035.2251.29.camel@laptop> (raw)
In-Reply-To: <4C8B3AD3.5050309@orcon.net.nz>
On Sat, 2010-09-11 at 20:16 +1200, Michael Cree wrote:
> On 10/09/10 07:50, tip-bot for Peter Zijlstra wrote:
> > Commit-ID: a4eaf7f14675cb512d69f0c928055e73d0c6d252
> > Gitweb: http://git.kernel.org/tip/a4eaf7f14675cb512d69f0c928055e73d0c6d252
> > Author: Peter Zijlstra<a.p.zijlstra@chello.nl>
> > AuthorDate: Wed, 16 Jun 2010 14:37:10 +0200
> > Committer: Ingo Molnar<mingo@elte.hu>
> > CommitDate: Thu, 9 Sep 2010 20:46:30 +0200
> >
> > perf: Rework the PMU methods
> >
> > Replace pmu::{enable,disable,start,stop,unthrottle} with
> > pmu::{add,del,start,stop}, all of which take a flags argument.
>
> Regarding the new function alpha_pmu_stop() in
> arch/alpha/kernel/perf_event.c:
>
> > -static void alpha_pmu_unthrottle(struct perf_event *event)
> > +static void alpha_pmu_stop(struct perf_event *event, int flags)
> > {
> > struct hw_perf_event *hwc =&event->hw;
> > struct cpu_hw_events *cpuc =&__get_cpu_var(cpu_hw_events);
> >
> > + if (!(hwc->state& PERF_HES_STOPPED)) {
> > + cpuc->idx_mask&= !(1UL<<hwc->idx);
> ^
> Presumably ones complement (rather than logical not) is meant.
Yes, typo that, sorry.
>
> > + hwc->state |= PERF_HES_STOPPED;
> > + }
> > +
> > + if ((flags& PERF_EF_UPDATE)&& !(hwc->state& PERF_HES_UPTODATE)) {
> > + alpha_perf_event_update(event, hwc, hwc->idx, 0);
> > + hwc->state |= PERF_HES_UPTODATE;
> > + }
> > +
> > + if (cpuc->enabled)
> > + wrperfmon(PERFMON_CMD_ENABLE, (1UL<<hwc->idx));
>
> By the name of the function (alpha_pmu_stop) I assume that the intent is
> to stop the specific PMC here. The above fails to do that. When
> wrperfmon() is used with PERFMON_CMD_ENABLE it enables the PMCs with set
> bits in the second argument. It does not stop the others. To do that
> wrperfmon() must be called with PERFMON_CMD_DISABLE and the
> corresponding PMC bits set to disable the PMC.
Right, so ->add()/->del() schedule the event onto the pmu and deal with
any resource issues where needed. ->stop()/->start() simply leave the
event on the pmu with all resources in tact, but ensure it doesn't
actually count.
Depending on the PMU there's various ways of achieving that, some PMUs
can't disable counter, for those we simply take a counter reading and
disable the interrupt, and reset the counter to the previous value on
->start again and enable the interrupt.
Or when we can't even disable the interrupt, we program it to the
longest possible period, etc..
Apparently ALPHA can nicely disable things, except I seem to have
misunderstood the way how, I assumed it had an enable register, and
writing a 0 to the idx position would stop it.
Could you provide a patch that makes ALPHA work again, or would you like
me to take another stab at it?
next prev parent reply other threads:[~2010-09-11 9:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <new-submission>
[not found] ` <tip-a4eaf7f14675cb512d69f0c928055e73d0c6d252@git.kernel.org>
2010-09-11 8:16 ` [tip:perf/core] perf: Rework the PMU methods Michael Cree
2010-09-11 9:40 ` Peter Zijlstra [this message]
2010-09-12 5:33 ` Michael Cree
2010-09-12 5:37 ` [PATCH] alpha: Fix HW performance counters to be stopped properly Michael Cree
2010-09-13 12:15 ` [tip:perf/core] perf: Rework the PMU methods Peter Zijlstra
2010-09-13 13:18 ` Peter Zijlstra
2010-09-14 10:11 ` Michael Cree
2010-09-14 14:07 ` Peter Zijlstra
2010-09-15 20:25 ` Michael Cree
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=1284198035.2251.29.camel@laptop \
--to=peterz@infradead.org \
--cc=davem@davemloft.net \
--cc=dengcheng.zhu@gmail.com \
--cc=eranian@googlemail.com \
--cc=fweisbec@gmail.com \
--cc=gorcunov@gmail.com \
--cc=hpa@zytor.com \
--cc=lethal@linux-sh.org \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcree@orcon.net.nz \
--cc=ming.m.lin@intel.com \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=robert.richter@amd.com \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox