public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: will.deacon@arm•com (Will Deacon)
To: linux-arm-kernel@lists•infradead.org
Subject: [RFC PATCH 2/2] arm64: kernel: perf: add pmu CPU PM notifier
Date: Tue, 17 Mar 2015 17:24:18 +0000	[thread overview]
Message-ID: <20150317172418.GX8399@arm.com> (raw)
In-Reply-To: <7hd24cpj8m.fsf@deeprootsystems.com>

On Fri, Mar 13, 2015 at 11:31:37PM +0000, Kevin Hilman wrote:
> Lorenzo Pieralisi <lorenzo.pieralisi@arm•com> writes:
> 
> > On Thu, Mar 12, 2015 at 01:18:54PM +0000, Ashwin Chaugule wrote:
> >> On 11 March 2015 at 12:02, Kevin Hilman <khilman@kernel•org> wrote:
> >> > Lorenzo Pieralisi <lorenzo.pieralisi@arm•com> writes:
> >> >
> >> >> When a CPU is being profiled through PMU events and it enters suspend
> >> >> or idle states, the PMU registers content can be lost, which means that
> >> >> counters that were relied upon on power down entry are reset on power
> >> >> up to values that are incosistent with the profile session.
> >> >>
> >> >> This patch adds a CPU PM notifier to arm64 perf code, that detects
> >> >> on entry if events are being monitored, and if so, it returns
> >> >> failure to the CPU PM notification chain, causing the suspend
> >> >> thread or the idle thread to abort power down, therefore preventing
> >> >> registers content loss.
> >> >>
> >> >> By triggering CPU PM notification failure this patch prevents
> >> >> suspending a system if the suspend thread is being profiled and
> >> >> it also prevents entering idle deep states on cores that have profile
> >> >> events in use, somehow limiting power management capabilities when
> >> >> there are active perf sessions.
> >> >
> >> > I guess that's one choice.  Couldn't you also stop the PMU and
> >> > save/restore it's context in the notifiers? so that you wouldn't affect
> >> > PM capabilities?
> >> >
> >> > That would imply that you lose the ability to profile after a certain
> >> > point in suspend/idle, but maybe that's a better trade off than having
> >> > profiling disable certain PM features?
> >> 
> >> I had something like that a few years ago on the Kraits and Scorpions [1].
> >
> > That's another option, but the point is understanding how we want to
> > tackle the issue, by preventing power down or by restoring the
> > PMU registers.
> 
> Personally, I think the save/restore approach is preferred.  IMO, it's
> more intuitive from the perspective of a user who doesn't understand all
> the mechanics and also actually allows you to profile most of the
> low-power paths and still actually hit the low power states.

I agree that save/restore is the nicest thing to do, but until we have a
generic description of the power-domains in device-tree I really don't want
PMU-specific hacks in the arch code to deal with this (since many platforms
do not lose PMU state over suspend).

What Lorenzo is proposing is a stop-gap to prevent perf silently losing its
state on platforms where the register contents is lost.

Will

  reply	other threads:[~2015-03-17 17:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10 17:31 [RFC PATCH 1/2] arm64: kernel: perf: add cpu hotplug notifier Lorenzo Pieralisi
2015-03-10 17:31 ` [RFC PATCH 2/2] arm64: kernel: perf: add pmu CPU PM notifier Lorenzo Pieralisi
2015-03-11 16:02   ` Kevin Hilman
2015-03-12 10:27     ` Lorenzo Pieralisi
2015-03-12 13:18     ` Ashwin Chaugule
2015-03-13 17:40       ` Lorenzo Pieralisi
2015-03-13 23:31         ` Kevin Hilman
2015-03-17 17:24           ` Will Deacon [this message]
2015-03-30 17:45             ` Lorenzo Pieralisi
2015-03-31 16:35               ` Kevin Hilman

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=20150317172418.GX8399@arm.com \
    --to=will.deacon@arm$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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