From: Ingo Molnar <mingo@elte.hu>
To: Paul Mundt <lethal@linux-sh.org>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>
Subject: Re: register_timer_hook use in arch/sh/oprofile
Date: Wed, 24 Jun 2009 14:37:55 +0200 [thread overview]
Message-ID: <20090624123755.GA32306@elte.hu> (raw)
In-Reply-To: <20090624122533.GA9510@linux-sh.org>
* Paul Mundt <lethal@linux-sh.org> wrote:
> On Wed, Jun 24, 2009 at 02:17:50PM +0200, Ingo Molnar wrote:
> >
> > * Paul Mundt <lethal@linux-sh.org> wrote:
> >
> > > In practice oprofile has never been a good fit for these sorts of
> > > counters, so this has fairly limited use. If there's a way to
> > > wiggle these types of counters in to the new perf_counter API,
> > > then I'll convert that over and just kill the old oprofile driver
> > > off completely. Barring that, I'll just end up converting it over
> > > to hrtimers as well, so don't let that stop you from ripping out
> > > the timer hook bits.
> > >
> > > Most of this code predates hrtimers anyways, and it also predates
> > > the timer hook, which is only something that we converted to some
> > > years back.
> >
> > Note, the current initial upstream SH support for perfcounters:
> >
> > arch/sh/include/asm/perf_counter.h:#define set_perf_counter_pending() do { } while (0)
> > arch/sh/include/asm/unistd_32.h:#define __NR_perf_counter_open 336
> > arch/sh/include/asm/unistd_64.h:#define __NR_perf_counter_open 364
> > arch/sh/kernel/syscalls_32.S: .long sys_perf_counter_open
> > arch/sh/kernel/syscalls_64.S: .long sys_perf_counter_open
> >
> > Should already give you hrtimers straight away.
> >
> > To test it, could you try to run 'perf top' after:
> >
> > cd tools/perf/
> > make install
> >
> > It should display a hrtimer driven kernel profile already. You can
> > increase/decrease the frequency of sampling by using -F option - say
> > 'perf top -F 10000' should sample at 10 KHz.
> >
> > Please let me know if any of this does not work as expected.
>
> Yes, that all works fine. [...]
Great! :)
> [...] My comment was more in reference to the hardware performance
> counters that don't have IRQs of their own, which still need to be
> tied in to the perf_counter API.
Yeah. Note that you dont have to implement explicit interrupts
support for that (especially if it's non-existent in the hardware):
just implement the enable/disable and read methods, and then you can
sample based on that counter by using it together in a counter-group
with a sampling software-counter.
Each software-counter IRQ (hrtimer driven) will cause a sample of
the hw counter to be emitted too.
This would work here and today.
A step further would be to librarize this in kernel/perf_counter.c
and allow architectures to offer such 'hw backed' counters to
user-space as a single item, under the generic enumeration:
PERF_COUNT_HW_CPU_CYCLES = 0,
PERF_COUNT_HW_INSTRUCTIONS = 1,
PERF_COUNT_HW_CACHE_REFERENCES = 2,
PERF_COUNT_HW_CACHE_MISSES = 3,
PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
PERF_COUNT_HW_BRANCH_MISSES = 5,
Note that with the latest tools it does not skew the results or
profiles if the 'period metric' is not the hardware counter itself,
but an independent hrtimer. All the tooling/reporting (perf top and
perf report) is using event weights, so the period is an invariant.
(and especially with self-tuning auto-freq counters the period is
never truly constant anyway)
So for all tooling and analysis purposes such counters would be
fully equivalent to 'real' hw counters that can generate interrupts.
Ingo
next prev parent reply other threads:[~2009-06-24 12:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-24 11:11 register_timer_hook use in arch/sh/oprofile Martin Schwidefsky
2009-06-24 11:29 ` Paul Mundt
2009-06-24 12:17 ` Ingo Molnar
2009-06-24 12:25 ` Paul Mundt
2009-06-24 12:37 ` Ingo Molnar [this message]
2009-06-24 12:40 ` Paul Mackerras
2009-06-24 12:47 ` Ingo Molnar
2009-06-24 12:28 ` Martin Schwidefsky
2009-06-24 12:34 ` Paul Mundt
2009-06-24 12:45 ` Ingo Molnar
2009-06-24 13:14 ` Paul Mundt
2009-06-24 13:24 ` Ingo Molnar
2009-06-26 7:01 ` Peter Zijlstra
2009-06-26 7:23 ` Ingo Molnar
2009-06-26 7:26 ` Paul Mundt
2009-06-26 7:36 ` Peter Zijlstra
2009-06-24 12:54 ` Martin Schwidefsky
2009-12-16 4:52 ` Paul Mundt
2009-12-16 7:21 ` Ingo Molnar
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=20090624123755.GA32306@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=schwidefsky@de.ibm.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