From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Jean Pihet <jpihet@mvista.com>
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 18:46:33 +0100 [thread overview]
Message-ID: <20090629174633.GD9042@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <200906291858.41151.jpihet@mvista.com>
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.
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.
> 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. I see no reason for a workqueue to be
involved anywhere near the oprofile sample code.
> 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.
I really think that the only option here is to just accept that oprofile
is crucified by this errata.
next prev parent reply other threads:[~2009-06-29 17:47 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 [this message]
2009-06-29 17:57 ` Jean Pihet
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=20090629174633.GD9042@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=jpihet@mvista.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-omap@vger.kernel.org \
--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