1. 08 8月, 2017 1 次提交
  2. 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
  3. 26 7月, 2017 1 次提交
  4. 20 7月, 2017 1 次提交
  5. 23 6月, 2017 3 次提交
  6. 15 6月, 2017 1 次提交
  7. 30 5月, 2017 1 次提交
    • W
      drivers/perf: arm_pmu_acpi: avoid perf IRQ init when guest PMU is off · 477c50e8
      Wei Huang 提交于
      We saw perf IRQ init failures when running Linux kernel in an ACPI
      guest without PMU (i.e. pmu=off). This is because perf IRQ is not
      present when pmu=off, but arm_pmu_acpi still tries to register
      or unregister GSI. This patch addresses the problem by checking
      gicc->performance_interrupt. If it is 0, which is the value set
      by qemu when pmu=off, we skip the IRQ register/unregister process.
      
      [    4.069470] bc00: 0000000000040b00 ffff0000089db190
      [    4.070267] [<ffff000008134f80>] enable_percpu_irq+0xdc/0xe4
      [    4.071192] [<ffff000008667cc4>] arm_perf_starting_cpu+0x108/0x10c
      [    4.072200] [<ffff0000080cbdd4>] cpuhp_invoke_callback+0x14c/0x4ac
      [    4.073210] [<ffff0000080ccd3c>] cpuhp_thread_fun+0xd4/0x11c
      [    4.074132] [<ffff0000080f1394>] smpboot_thread_fn+0x1b4/0x1c4
      [    4.075081] [<ffff0000080ec90c>] kthread+0x10c/0x138
      [    4.075921] [<ffff0000080833c0>] ret_from_fork+0x10/0x50
      [    4.076947] genirq: Setting trigger mode 4 for irq 43 failed
      (gic_set_type+0x0/0x74)
      Signed-off-by: NWei Huang <wei@redhat.com>
      [will: add comment justifying deviation from ACPI spec, removed redundant hunk]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      477c50e8
  8. 11 4月, 2017 11 次提交
  9. 04 4月, 2017 1 次提交
    • A
      perf: qcom: Add L3 cache PMU driver · 3071f13d
      Agustin Vega-Frias 提交于
      This adds a new dynamic PMU to the Perf Events framework to program
      and control the L3 cache PMUs in some Qualcomm Technologies SOCs.
      
      The driver supports a distributed cache architecture where the overall
      cache for a socket is comprised of multiple slices each with its own PMU.
      Access to each individual PMU is provided even though all CPUs share all
      the slices. User space needs to aggregate to individual counts to provide
      a global picture.
      
      The driver exports formatting and event information to sysfs so it can
      be used by the perf user space tools with the syntaxes:
         perf stat -a -e l3cache_0_0/read-miss/
         perf stat -a -e l3cache_0_0/event=0x21/
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NAgustin Vega-Frias <agustinv@codeaurora.org>
      [will: fixed sparse issues]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      3071f13d
  10. 01 4月, 2017 3 次提交
    • 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
    • M
      drivers/perf: arm_pmu: rework per-cpu allocation · 2681f018
      Mark Rutland 提交于
      For historical reasons, we allocate per-cpu data associated with a PMU
      rather late, in cpu_pmu_init, after we've parsed whatever hardware
      information we were provided with.
      
      In order to allow use to store some per-cpu data early in the probe
      path, we need to allocate (and initialise) the per-cpu data earlier.
      This patch reworks the way we allocate the pmu and associated per-cpu
      data in order to make that possible.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      [will: make armpmu_{alloc,free} static
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      2681f018
  11. 02 3月, 2017 1 次提交
  12. 09 2月, 2017 1 次提交
  13. 04 2月, 2017 1 次提交
    • S
      perf: xgene: Include module.h · c0bfc549
      Stephen Boyd 提交于
      I ran into a build error when I disabled CONFIG_ACPI and tried to
      compile this driver:
      
      drivers/perf/xgene_pmu.c:1242:1: warning: data definition has no type or storage class
       MODULE_DEVICE_TABLE(of, xgene_pmu_of_match);
       ^
      drivers/perf/xgene_pmu.c:1242:1: error: type defaults to 'int' in declaration of 'MODULE_DEVICE_TABLE' [-Werror=implicit-int]
      
      Include module.h for the MODULE_DEVICE_TABLE macro that's
      implicitly included through ACPI.
      Tested-by: NTai Nguyen <ttnguyen@apm.com>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      c0bfc549
  14. 25 12月, 2016 1 次提交
  15. 17 10月, 2016 1 次提交
  16. 17 9月, 2016 1 次提交
  17. 16 9月, 2016 1 次提交
  18. 09 9月, 2016 3 次提交
    • 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: only use common attr_groups · 1589680d
      Mark Rutland 提交于
      Now that the 32-bit and 64-bit perf backends use the common groups
      directly, remove the fallback and no longer allow the groups array to be
      overridden.
      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>
      1589680d
    • 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
  19. 07 9月, 2016 1 次提交
  20. 03 9月, 2016 3 次提交
  21. 10 8月, 2016 2 次提交
    • M
      drivers/perf: arm-pmu: Fix handling of SPI lacking "interrupt-affinity" property · 7f1d642f
      Marc Zyngier 提交于
      Patch 19a469a5 ("drivers/perf: arm-pmu: Handle per-interrupt
      affinity mask") added support for partitionned PPI setups, but
      inadvertently broke setups using SPIs without the "interrupt-affinity"
      property (which is the case for UP platforms).
      
      This patch restore the broken functionnality by testing whether the
      interrupt is percpu or not instead of relying on the using_spi flag
      that really means "SPI *and* interrupt-affinity property".
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Reported-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Tested-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Fixes: 19a469a5 ("drivers/perf: arm-pmu: Handle per-interrupt affinity mask")
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      7f1d642f
    • S
      drivers/perf: arm-pmu: convert arm_pmu_mutex to spinlock · a026bb12
      Sudeep Holla 提交于
      arm_pmu_mutex is never held long and we don't want to sleep while the
      lock is being held as it's executed in the context of hotplug notifiers.
      So it can be converted to a simple spinlock instead.
      
      Without this patch we get the following warning:
      
      BUG: sleeping function called from invalid context at kernel/locking/mutex.c:620
      in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/2
      no locks held by swapper/2/0.
      irq event stamp: 381314
      hardirqs last  enabled at (381313): _raw_spin_unlock_irqrestore+0x7c/0x88
      hardirqs last disabled at (381314): cpu_die+0x28/0x48
      softirqs last  enabled at (381294): _local_bh_enable+0x28/0x50
      softirqs last disabled at (381293): irq_enter+0x58/0x78
      CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.7.0 #12
      Call trace:
       dump_backtrace+0x0/0x220
       show_stack+0x24/0x30
       dump_stack+0xb4/0xf0
       ___might_sleep+0x1d8/0x1f0
       __might_sleep+0x5c/0x98
       mutex_lock_nested+0x54/0x400
       arm_perf_starting_cpu+0x34/0xb0
       cpuhp_invoke_callback+0x88/0x3d8
       notify_cpu_starting+0x78/0x98
       secondary_start_kernel+0x108/0x1a8
      
      This patch converts the mutex to spinlock to eliminate the above
      warnings. This constraints pmu->reset to be non-blocking call which is
      the case with all the ARM PMU backends.
      
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Fixes: 37b502f1 ("arm/perf: Fix hotplug state machine conversion")
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      a026bb12