1. 02 9月, 2020 1 次提交
  2. 12 10月, 2018 1 次提交
  3. 11 7月, 2018 3 次提交
  4. 22 5月, 2018 1 次提交
    • M
      arm_pmu: simplify arm_pmu::handle_irq · 0788f1e9
      Mark Rutland 提交于
      The arm_pmu::handle_irq() callback has the same prototype as a generic
      IRQ handler, taking the IRQ number and a void pointer argument which it
      must convert to an arm_pmu pointer.
      
      This means that all arm_pmu::handle_irq() take an IRQ number they never
      use, and all must explicitly cast the void pointer to an arm_pmu
      pointer.
      
      Instead, let's change arm_pmu::handle_irq to take an arm_pmu pointer,
      allowing these casts to be removed. The redundant IRQ number parameter
      is also removed.
      Suggested-by: NHoeun Ryu <hoeun.ryu@lge.com>
      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>
      0788f1e9
  5. 20 2月, 2018 5 次提交
  6. 27 7月, 2017 1 次提交
    • W
      drivers/perf: arm_pmu: Request PMU SPIs with IRQF_PER_CPU · a3287c41
      Will Deacon 提交于
      Since the PMU register interface is banked per CPU, CPU PMU interrrupts
      cannot be handled by a CPU other than the one with the PMU asserting the
      interrupt. This means that migrating PMU SPIs, as we do during a CPU
      hotplug operation doesn't make any sense and can lead to the IRQ being
      disabled entirely if we route a spurious IRQ to the new affinity target.
      
      This has been observed in practice on AMD Seattle, where CPUs on the
      non-boot cluster appear to take a spurious PMU IRQ when coming online,
      which is routed to CPU0 where it cannot be handled.
      
      This patch passes IRQF_PERCPU for PMU SPIs and forcefully sets their
      affinity prior to requesting them, ensuring that they cannot
      be migrated during hotplug events. This interacts badly with the DB8500
      erratum workaround that ping-pongs the interrupt affinity from the handler,
      so we avoid passing IRQF_PERCPU in that case by allowing the IRQ flags
      to be overridden in the platdata.
      
      Fixes: 3cf7ee98 ("drivers/perf: arm_pmu: move irq request/free into probe")
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      a3287c41
  7. 11 4月, 2017 3 次提交
  8. 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
  9. 17 9月, 2016 1 次提交
  10. 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
  11. 03 9月, 2016 1 次提交
  12. 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
  13. 15 7月, 2016 1 次提交
  14. 25 4月, 2016 1 次提交
  15. 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
  16. 26 1月, 2016 1 次提交
  17. 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
  18. 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
  19. 28 5月, 2015 2 次提交
  20. 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
  21. 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
  22. 30 10月, 2014 5 次提交
  23. 02 7月, 2014 2 次提交
  24. 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