1. 11 4月, 2017 1 次提交
  2. 01 4月, 2017 2 次提交
    • M
      drivers/perf: arm_pmu: split irq request from enable · c09adab0
      Mark Rutland 提交于
      For historical reasons, we lazily request and free interrupts in the
      arm pmu driver. This requires us to refcount use of the pmu (by way of
      counting the active events) in order to request/free interrupts at the
      correct times, which complicates the driver somewhat.
      
      The existing logic is flawed, as it only considers currently online CPUs
      when requesting, freeing, or managing the affinity of interrupts.
      Intervening hotplug events can result in erroneous IRQ affinity, online
      CPUs for which interrupts have not been requested, or offline CPUs whose
      interrupts are still requested.
      
      To fix this, this patch splits the requesting of interrupts from any
      per-cpu management (i.e. per-cpu enable/disable, and configuration of
      cpu affinity). We now request all interrupts up-front at probe time (and
      never free them, since we never unregister PMUs).
      
      The management of affinity, and per-cpu enable/disable now happens in
      our cpu hotplug callback, ensuring it occurs consistently. This means
      that we must now invoke the CPU hotplug callback at boot time in order
      to configure IRQs, and since the callback also resets the PMU hardware,
      we can remove the duplicate reset in the probe path.
      
      This rework renders our event refcounting unnecessary, so this is
      removed.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      [will: make armpmu_get_cpu_irq static]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      c09adab0
    • M
      drivers/perf: arm_pmu: manage interrupts per-cpu · 7ed98e01
      Mark Rutland 提交于
      When requesting or freeing interrupts, we use platform_get_irq() to find
      relevant irqs, backing this up with additional information in an
      optional irq_affinity table.
      
      This means that our irq request and free paths are tied to a
      platform_device, and our request path must jump through a number of
      hoops in order to determine the required affinity of each interrupt.
      
      Given that the affinity must be static, we can compute the affinity once
      up-front at probe time, simplifying the irq request and free paths. By
      recording interrupts in a per-cpu data structure, we simplify a few
      paths, and permit a subsequent rework of the request and free paths.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      [will: rename local nr_irqs variable to avoid conflict with global]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      7ed98e01
  3. 17 9月, 2016 1 次提交
  4. 09 9月, 2016 2 次提交
    • M
      drivers/perf: arm_pmu: expose a cpumask in sysfs · 48538b58
      Mark Rutland 提交于
      In systems with heterogeneous CPUs, there are multiple logical CPU PMUs,
      each of which covers a subset of CPUs in the system. In some cases
      userspace needs to know which CPUs a given logical PMU covers, so we'd
      like to expose a cpumask under sysfs, similar to what is done for uncore
      PMUs.
      
      Unfortunately, prior to commit 00e727bb ("perf stat: Balance
      opening and reading events"), perf stat only correctly handled a cpumask
      holding a single CPU, and only when profiling in system-wide mode. In
      other cases, the presence of a cpumask file could cause perf stat to
      behave erratically.
      
      Thus, exposing a cpumask file would break older perf binaries in cases
      where they would otherwise work.
      
      To avoid this issue while still providing userspace with the information
      it needs, this patch exposes a differently-named file (cpus) under
      sysfs. New tools can look for this and operate correctly, while older
      tools will not be adversely affected by its presence.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      48538b58
    • M
      drivers/perf: arm_pmu: add common attr group fields · 86cdd72a
      Mark Rutland 提交于
      In preparation for adding common attribute groups, add an array of
      attribute group pointers to arm_pmu, which will be used if the
      backend hasn't already set pmu::attr_groups.
      
      Subsequent patches will move backends over to using these, before adding
      common fields.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      86cdd72a
  5. 03 9月, 2016 1 次提交
  6. 20 7月, 2016 1 次提交
    • S
      arm/perf: Fix hotplug state machine conversion · 37b502f1
      Sebastian Andrzej Siewior 提交于
      Mark Rutland pointed out that this commit is incomplete:
      
        7d88eb69 ("arm/perf: Convert to hotplug state machine")
      
      The problem is that:
      
       > We may have multiple PMUs (e.g. two in big.LITTLE systems), and
       > __oprofile_cpu_pmu only contains one of these. So this conversion is not
       > correct.
       >
       > We were relying on the notifier list implicitly containing a list of
       > those PMUs. It seems like we need an explicit list here.
       >
       > We keep __oprofile_cpu_pmu around for legacy 32-bit users of OProfile
       > (on non-hetereogeneous systems), and that's all that the variable should
       > be used for.
      
      Introduce arm_pmu_list to correctly handle multiple PMUs in the system.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Anna-Maria Gleixner <anna-maria@linutronix.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-tip-commits@vger.kernel.org
      Cc: rt@linutronix.de
      Link: http://lkml.kernel.org/r/20160719111733.GA22911@linutronix.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
      37b502f1
  7. 15 7月, 2016 1 次提交
  8. 25 4月, 2016 1 次提交
  9. 26 2月, 2016 1 次提交
    • L
      drivers/perf: arm_pmu: implement CPU_PM notifier · da4e4f18
      Lorenzo Pieralisi 提交于
      When a CPU is suspended (either through suspend-to-RAM or CPUidle),
      its PMU registers content can be lost, which means that counters
      registers values that were initialized on power down entry have to be
      reprogrammed on power-up to make sure the counters set-up is preserved
      (ie on power-up registers take the reset values on Cold or Warm reset,
      which can be architecturally UNKNOWN).
      
      To guarantee seamless profiling conditions across a core power down
      this patch adds a CPU PM notifier to ARM pmus, that upon CPU PM
      entry/exit from low-power states saves/restores the pmu registers
      set-up (by using the ARM perf API), so that the power-down/up cycle does
      not affect the perf behaviour (apart from a black-out period between
      power-up/down CPU PM notifications that is unavoidable).
      
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Acked-by: NAshwin Chaugule <ashwin.chaugule@linaro.org>
      Acked-by: NKevin Hilman <khilman@baylibre.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      da4e4f18
  10. 26 1月, 2016 1 次提交
  11. 16 11月, 2015 1 次提交
    • M
      drivers/perf: kill armpmu_register · b916b785
      Mark Rutland 提交于
      Nothing outside of drivers/perf/arm_pmu.c should call armpmu_register
      any more, so it no longer needs to be in include/linux/perf/arm_pmu.h.
      Additionally, by folding it in to arm_pmu_device_probe we can allow
      drivers to override struct pmu fields without getting blatted by the
      armpmu code.
      
      This patch folds armpmu_register into arm_pmu_device_probe. The logging
      to the console is moved to after the PMU is successfully registered with
      the core perf code.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Suggested-by: NWill Deacon <will.deacon@arm.com>
      Cc: Drew Richardson <drew.richardson@arm.com>
      Cc: Pawel Moll <pawel.moll@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      b916b785
  12. 31 7月, 2015 1 次提交
    • M
      arm: perf: factor arm_pmu core out to drivers · fa8ad788
      Mark Rutland 提交于
      To enable sharing of the arm_pmu code with arm64, this patch factors it
      out to drivers/perf/. A new drivers/perf directory is added for
      performance monitor drivers to live under.
      
      MAINTAINERS is updated accordingly. Files added previously without a
      corresponsing MAINTAINERS update (perf_regs.c, perf_callchain.c, and
      perf_event.h) are also added.
      
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      [will: augmented Kconfig help slightly]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      fa8ad788
  13. 28 5月, 2015 2 次提交
  14. 27 5月, 2015 1 次提交
    • M
      arm: perf: treat PMUs as CPU affine · cc88116d
      Mark Rutland 提交于
      In multi-cluster systems, the PMUs can be different across clusters, and
      so our logical PMU may not be able to schedule events on all CPUs.
      
      This patch adds a cpumask to encode which CPUs a PMU driver supports
      controlling events for, and limits the driver to scheduling events on
      those CPUs, and enabling and disabling the physical PMUs on those CPUs.
      The cpumask is built based on the interrupt-affinity property, and in
      the absence of such a property a homogenous system is assumed.
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      cc88116d
  15. 24 3月, 2015 1 次提交
    • W
      ARM: pmu: add support for interrupt-affinity property · 9fd85eb5
      Will Deacon 提交于
      Historically, the PMU devicetree bindings have expected SPIs to be
      listed in order of *logical* CPU number. This is problematic for
      bootloaders, especially when the boot CPU (logical ID 0) isn't listed
      first in the devicetree.
      
      This patch adds a new optional property, interrupt-affinity, to the
      PMU node which allows the interrupt affinity to be described using
      a list of phandled to CPU nodes, with each entry in the list
      corresponding to the SPI at the same index in the interrupts property.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      9fd85eb5
  16. 30 10月, 2014 5 次提交
  17. 02 7月, 2014 2 次提交
  18. 21 2月, 2014 1 次提交
    • S
      ARM: perf: add hook for event index clearing · eab443ef
      Stephen Boyd 提交于
      On Krait processors we have a many-to-one relationship between
      raw CPU events and the event programmed into the PMNx counter.
      Two raw CPU events could map to the same value programmed in the
      PMNx counter. To avoid this problem, we check for collisions
      during the get_event_idx() callback by setting a bit in a bitmap
      whenever a certain event is used in a PMNx counter (see the next
      patch). Unfortunately, we don't have a hook to clear this bit in
      the bitmap when the event is deleted so let's add an optional
      clear_event_idx() callback for this purpose.
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      eab443ef
  19. 09 11月, 2012 2 次提交
  20. 23 8月, 2012 5 次提交
    • S
      ARM: perf: move irq registration into pmu implementation · 051f1b13
      Sudeep KarkadaNagesha 提交于
      This patch moves the CPU-specific IRQ registration and parsing code into
      the CPU PMU backend. This is required because a PMU may have more than
      one interrupt, which in turn can be either PPI (per-cpu) or SPI
      (requiring strict affinity setting at the interrupt distributor).
      Signed-off-by: NSudeep KarkadaNagesha <Sudeep.KarkadaNagesha@arm.com>
      [will: cosmetic edits and reworked interrupt dispatching]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      051f1b13
    • W
      ARM: perf: prepare for moving CPU PMU code into separate file · 6dbc0029
      Will Deacon 提交于
      The CPU PMU code is tightly coupled with generic ARM PMU handling code.
      This makes it cumbersome when trying to add support for other ARM PMUs
      (e.g. interconnect, L2 cache controller, bus) as the generic parts of
      the code are not readily reusable.
      
      This patch cleans up perf_event.c so that reusable code is exposed via
      header files to other potential PMU drivers. The CPU code is
      consistently named to identify it as such and also to prepare for moving
      it into a separate file.
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      6dbc0029
    • S
      ARM: pmu: remove arm_pmu_type enumeration · df3d17e0
      Sudeep KarkadaNagesha 提交于
      The arm_pmu_type enumeration was initially introduced to identify
      different PMU types in the system, the usual one being that on the CPU
      (ARM_PMU_DEVICE_CPU). With the removal of the PMU reservation code and
      the introduction of devicetree bindings for the CPU PMU, the enumeration
      is no longer required.
      
      This patch removes the enumeration and updates the various CPU PMU
      platform devices so that they no longer pass an .id field referring
      to identify the PMU type.
      
      Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Pawel Moll <pawel.moll@arm.com>
      Acked-by: NJon Hunter <jon-hunter@ti.com>
      Acked-by: NKukjin Kim <kgene.kim@samsung.com>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Acked-by: NJiandong Zheng <jdzheng@broadcom.com>
      Signed-off-by: NSudeep KarkadaNagesha <Sudeep.KarkadaNagesha@arm.com>
      [will: cosmetic edits and actual removal of the enum type]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      df3d17e0
    • W
      ARM: pmu: remove unused reservation mechanism · f0d1bc47
      Will Deacon 提交于
      The PMU reservation mechanism was originally intended to allow OProfile
      and perf-events to co-ordinate over access to the CPU PMU. Since then,
      OProfile for ARM has moved to using perf as its backend, so the
      reservation code is no longer used.
      
      This patch removes the reservation code for the CPU PMU on ARM.
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      f0d1bc47
    • J
      ARM: PMU: Add runtime PM Support · 7be2958e
      Jon Hunter 提交于
      Add runtime PM support to the ARM PMU driver so that devices such as OMAP
      supporting dynamic PM can use the platform->runtime_* hooks to initialise
      hardware at runtime. Without having these runtime PM hooks in place any
      configuration of the PMU hardware would be lost when low power states are
      entered and hence would prevent PMU from working.
      
      This change also replaces the PMU platform functions enable_irq and disable_irq
      added by Ming Lei with runtime_resume and runtime_suspend funtions. Ming had
      added the enable_irq and disable_irq functions as a method to configure the
      cross trigger interface on OMAP4 for routing the PMU interrupts. By adding
      runtime PM support, we can move the code called by enable_irq and disable_irq
      into the runtime PM callbacks runtime_resume and runtime_suspend.
      
      Cc: Ming Lei <ming.lei@canonical.com>
      Cc: Benoit Cousson <b-cousson@ti.com>
      Cc: Paul Walmsley <paul@pwsan.com>
      Cc: Kevin Hilman <khilman@ti.com>
      Signed-off-by: NJon Hunter <jon-hunter@ti.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      7be2958e
  21. 10 7月, 2012 1 次提交
    • W
      ARM: 7448/1: perf: remove arm_perf_pmu_ids global enumeration · 4295b898
      Will Deacon 提交于
      In order to provide PMU name strings compatible with the OProfile
      user ABI, an enumeration of all PMUs is currently used by perf to
      identify each PMU uniquely. Unfortunately, this does not scale well
      in the presence of multiple PMUs and creates a single, global namespace
      across all PMUs in the system.
      
      This patch removes the enumeration and instead uses the name string
      for the PMU to map onto the OProfile variant. perf_pmu_name is
      implemented for CPU PMUs, which is all that OProfile cares about anyway.
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      4295b898
  22. 07 3月, 2012 1 次提交
    • W
      ARM: 7354/1: perf: limit sample_period to half max_period in non-sampling mode · 57273471
      Will Deacon 提交于
      On ARM, the PMU does not stop counting after an overflow and therefore
      IRQ latency affects the new counter value read by the kernel. This is
      significant for non-sampling runs where it is possible for the new value
      to overtake the previous one, causing the delta to be out by up to
      max_period events.
      
      Commit a737823d ("ARM: 6835/1: perf: ensure overflows aren't missed due
      to IRQ latency") attempted to fix this problem by allowing interrupt
      handlers to pass an overflow flag to the event update function, causing
      the overflow calculation to assume that the counter passed through zero
      when going from prev to new. Unfortunately, this doesn't work when
      overflow occurs on the perf_task_tick path because we have the flag
      cleared and end up computing a large negative delta.
      
      This patch removes the overflow flag from armpmu_event_update and
      instead limits the sample_period to half of the max_period for
      non-sampling profiling runs.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      57273471
  23. 02 12月, 2011 1 次提交
  24. 16 11月, 2011 1 次提交
  25. 31 8月, 2011 2 次提交
  26. 12 8月, 2011 1 次提交