From: Jean Pihet <jpihet@mvista.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Siarhei Siamashka <siarhei.siamashka@nokia.com>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
"linux-arm-kernel@lists.arm.linux.org.uk"
<linux-arm-kernel@lists.arm.linux.org.uk>,
"oprofile-list@lists.sourceforge.net"
<oprofile-list@lists.sourceforge.net>
Subject: Re: get_irq_regs() from soft IRQ
Date: Mon, 29 Jun 2009 19:57:34 +0200 [thread overview]
Message-ID: <200906291957.34392.jpihet@mvista.com> (raw)
In-Reply-To: <20090629174633.GD9042@n2100.arm.linux.org.uk>
On Monday 29 June 2009 19:46:33 Russell King - ARM Linux wrote:
> On Mon, Jun 29, 2009 at 06:58:41PM +0200, Jean Pihet wrote:
> > I am trying to get a different approach, starting from the errata
> > description. The idea is to avoid the counters from overflowing,
> > which could cause a PMNC unit reset or lock-up (or both).
>
> But this can't work.
>
> Oprofile essentially works as follows:
>
> You set the number (N) of events you wish to occur between each sample.
> When N events have occured, you record the stacktrace and reset the
> counter so it fires after another N events.
>
> Now, you could start the counters at zero every time, and then poll them
> via a timer. When the counter value is larger than N, you could log a
> stacktrace and zero the counter.
>
> However, this suffers one very serious problem - if you're wanting to
> measure something at an interval which occurs faster than your timer,
> you're going to get misleading results.
The counters are 32-bit wide and the maximum counting frequency is 2 events
per cycle (cf. errata). That means you get plenty of time before the counters
overflow.
> You could set the timer to fire at a high rate, but then that's going
> to upset things like cache miss, cache hit, etc measurements.
Correct.
You need a tradeoff for the timer period.
> > Here are the implementation details:
> > - use a timer to read and reset the counters, then fire a work queue
> > - in the work queue the counters values are converted to oprofile samples
> > - the proper locking is used to avoid some races between the various
> > tasks
>
> This sounds over complicated.
It is ;p
> I see no reason for a workqueue to be
> involved anywhere near the oprofile sample code.
Got it.
> > I am nearly done with it but I am now running into problems with PM
> > (suspend/resume) and get_irq_regs().
>
> You really really really can't use get_irq_regs() outside of IRQ context.
> The stored registers just do not exist anymore - they've been overwritten
> by whatever exception or system call you're currently in.
>
> You can't create a copy of them - copies will be overwritten on the very
> next (nested) interrupt. You don't know which interrupt is the first
> interrupt to occur.
Doh!
> I really think that the only option here is to just accept that oprofile
> is crucified by this errata.
Amen!
Thanks,
Jean
next prev parent reply other threads:[~2009-06-29 17:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-29 14:31 get_irq_regs() from soft IRQ Jean Pihet
2009-06-29 15:19 ` Russell King - ARM Linux
2009-06-29 15:35 ` Jean Pihet
2009-06-29 16:07 ` Russell King - ARM Linux
2009-06-29 16:12 ` Jean Pihet
2009-06-29 16:36 ` Siarhei Siamashka
2009-06-29 16:58 ` Jean Pihet
2009-06-29 17:46 ` Russell King - ARM Linux
2009-06-29 17:57 ` Jean Pihet [this message]
2009-06-29 17:54 ` Siarhei Siamashka
2009-06-29 18:08 ` Jean Pihet
2009-06-29 17:37 ` Russell King - ARM Linux
2009-06-29 17:52 ` Jean Pihet
2009-06-29 18:38 ` Siarhei Siamashka
2009-06-29 18:49 ` Jean Pihet
2009-06-29 19:45 ` Siarhei Siamashka
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=200906291957.34392.jpihet@mvista.com \
--to=jpihet@mvista.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=oprofile-list@lists.sourceforge.net \
--cc=siarhei.siamashka@nokia.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