1. 16 Mar, 2018 2 commits
  2. 12 Mar, 2018 1 commit
    • Peter Zijlstra's avatar
      perf/core: Remove perf_event::group_entry · 8343aae6
      Peter Zijlstra authored
      Now that all the grouping is done with RB trees, we no longer need
      group_entry and can replace the whole thing with sibling_list.
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Carrillo-Cisneros <davidcc@google.com>
      Cc: Dmitri Prokhorov <Dmitry.Prohorov@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Valery Cherepennikov <valery.cherepennikov@intel.com>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
  3. 04 Dec, 2017 5 commits
    • Kim Phillips's avatar
      bus: arm-ccn: fix module unloading Error: Removing state 147 which has instances left. · b69f63eb
      Kim Phillips authored
      Unregistering the driver before calling cpuhp_remove_multi_state() removes
      any remaining hotplug cpu instances so __cpuhp_remove_state_cpuslocked()
      doesn't emit this warning:
      [  268.748362] Error: Removing state 147 which has instances left.
      [  268.748373] ------------[ cut here ]------------
      [  268.748386] WARNING: CPU: 2 PID: 5476 at kernel/cpu.c:1734 __cpuhp_remove_state_cpuslocked+0x454/0x4f0
      [  268.748389] Modules linked in: arm_ccn(-) [last unloaded: arm_ccn]
      [  268.748403] CPU: 2 PID: 5476 Comm: rmmod Tainted: G        W       4.14.0-rc4+ #3
      [  268.748406] Hardware name: AMD Seattle/Seattle, BIOS 10:18:39 Dec  8 2016
      [  268.748410] task: ffff8001a18ca000 task.stack: ffff80019c120000
      [  268.748416] PC is at __cpuhp_remove_state_cpuslocked+0x454/0x4f0
      [  268.748421] LR is at __cpuhp_remove_state_cpuslocked+0x448/0x4f0
      [  268.748425] pc : [<ffff2000081729ec>] lr : [<ffff2000081729e0>] pstate: 60000145
      [  268.748427] sp : ffff80019c127d30
      [  268.748430] x29: ffff80019c127d30 x28: ffff8001a18ca000
      [  268.748437] x27: ffff20000c2cb000 x26: 1fffe4000042d490
      [  268.748443] x25: ffff20000216a480 x24: 0000000000000000
      [  268.748449] x23: ffff20000b08e000 x22: 0000000000000001
      [  268.748455] x21: 0000000000000093 x20: 00000000000016f8
      [  268.748460] x19: ffff20000c2cbb80 x18: 0000ffffb5fe7c58
      [  268.748466] x17: 00000000004402d0 x16: 1fffe40001864f01
      [  268.748472] x15: ffff20000c4bf8b0 x14: 0000000000000000
      [  268.748477] x13: 0000000000007032 x12: ffff20000829ae48
      [  268.748483] x11: ffff20000c4bf000 x10: 0000000000000004
      [  268.748488] x9 : 0000000000006fbc x8 : ffff20000c318a40
      [  268.748494] x7 : 0000000000000000 x6 : ffff040001864f02
      [  268.748500] x5 : 0000000000000000 x4 : 0000000000000000
      [  268.748505] x3 : 0000000000000007 x2 : dfff200000000000
      [  268.748510] x1 : 000000000000ad3d x0 : 00000000000001f0
      [  268.748516] Call trace:
      [  268.748521] Exception stack(0xffff80019c127bf0 to 0xffff80019c127d30)
      [  268.748526] 7be0:                                   00000000000001f0 000000000000ad3d
      [  268.748531] 7c00: dfff200000000000 0000000000000007 0000000000000000 0000000000000000
      [  268.748535] 7c20: ffff040001864f02 0000000000000000 ffff20000c318a40 0000000000006fbc
      [  268.748539] 7c40: 0000000000000004 ffff20000c4bf000 ffff20000829ae48 0000000000007032
      [  268.748544] 7c60: 0000000000000000 ffff20000c4bf8b0 1fffe40001864f01 00000000004402d0
      [  268.748548] 7c80: 0000ffffb5fe7c58 ffff20000c2cbb80 00000000000016f8 0000000000000093
      [  268.748553] 7ca0: 0000000000000001 ffff20000b08e000 0000000000000000 ffff20000216a480
      [  268.748557] 7cc0: 1fffe4000042d490 ffff20000c2cb000 ffff8001a18ca000 ffff80019c127d30
      [  268.748562] 7ce0: ffff2000081729e0 ffff80019c127d30 ffff2000081729ec 0000000060000145
      [  268.748566] 7d00: 00000000000001f0 0000000000000000 0001000000000000 0000000000000000
      [  268.748569] 7d20: ffff80019c127d30 ffff2000081729ec
      [  268.748575] [<ffff2000081729ec>] __cpuhp_remove_state_cpuslocked+0x454/0x4f0
      [  268.748580] [<ffff200008172adc>] __cpuhp_remove_state+0x54/0x80
      [  268.748597] [<ffff20000215dd84>] arm_ccn_exit+0x2c/0x70 [arm_ccn]
      [  268.748604] [<ffff20000834cfbc>] SyS_delete_module+0x5a4/0x708
      [  268.748607] Exception stack(0xffff80019c127ec0 to 0xffff80019c128000)
      [  268.748612] 7ec0: 0000000019bb7258 0000000000000800 ba64d0fb3d26a800 00000000000000da
      [  268.748616] 7ee0: 0000ffffb6144e28 0000ffffcd95b409 fefefefefefefeff 7f7f7f7f7f7f7f7f
      [  268.748621] 7f00: 000000000000006a 1999999999999999 0000ffffb6179000 0000000000bbcc6d
      [  268.748625] 7f20: 0000ffffb6176b98 0000ffffcd95c2d0 0000ffffb5fe7b58 0000ffffb6163000
      [  268.748630] 7f40: 0000ffffb60ad3e0 00000000004402d0 0000ffffb5fe7c58 0000000019bb71f0
      [  268.748634] 7f60: 0000ffffcd95c740 0000000000000000 0000000019bb71f0 0000000000416700
      [  268.748639] 7f80: 0000000000000000 00000000004402e8 0000000019bb6010 0000ffffcd95c748
      [  268.748643] 7fa0: 0000000000000000 0000ffffcd95c460 00000000004113a8 0000ffffcd95c460
      [  268.748648] 7fc0: 0000ffffb60ad3e8 0000000080000000 0000000019bb7258 000000000000006a
      [  268.748652] 7fe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
      [  268.748657] [<ffff200008084f9c>] __sys_trace_return+0x0/0x4
      [  268.748661] ---[ end trace a996d358dcaa7f9c ]---
      Fixes: 8df03872
       ("bus/arm-ccn: Use cpu-hp's multi instance support instead custom list")
      Signed-off-by: default avatarKim Phillips <kim.phillips@arm.com>
      Acked-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: stable@vger.kernel.org # 4.8+
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Marc Zyngier's avatar
      bus: arm-ccn: Fix use of smp_processor_id() in preemptible context · b18c2b94
      Marc Zyngier authored
      Booting a DEBUG_PREEMPT enabled kernel on a CCN-based system
      results in the following splat:
      arm-ccn e8000000.ccn: No access to interrupts, using timer.
      BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
      caller is debug_smp_processor_id+0x1c/0x28
      CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.13.0 #6111
      Hardware name: AMD Seattle/Seattle, BIOS 17:08:23 Jun 26 2017
      Call trace:
      [<ffff000008089e78>] dump_backtrace+0x0/0x278
      [<ffff00000808a22c>] show_stack+0x24/0x30
      [<ffff000008bc3bc4>] dump_stack+0x8c/0xb0
      [<ffff00000852b534>] check_preemption_disabled+0xfc/0x100
      [<ffff00000852b554>] debug_smp_processor_id+0x1c/0x28
      [<ffff000008551bd8>] arm_ccn_probe+0x358/0x4f0
      as we use smp_processor_id() in the wrong context.
      Turn this into a get_cpu()/put_cpu() that extends over the CPU hotplug
      registration, making sure that we don't race against a CPU down operation.
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: stable@vger.kernel.org # 4.2+
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Christophe JAILLET's avatar
      bus: arm-ccn: Simplify code · 0f9afd36
      Christophe JAILLET authored
      Use 'devm_kasprintf()' to simplify the code.
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Acked-by: default avatarScott Branden <scott.branden@broadcom.com>
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Christophe JAILLET's avatar
      bus: arm-ccn: Check memory allocation failure · 24771179
      Christophe JAILLET authored
      Check memory allocation failures and return -ENOMEM in such cases
      This avoids a potential NULL pointer dereference.
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Acked-by: default avatarScott Branden <scott.branden@broadcom.com>
      Cc: stable@vger.kernel.org # 3.17+
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Arvind Yadav's avatar
      bus: arm-ccn: constify attribute_group structures. · 8a84bf45
      Arvind Yadav authored
      attribute_groups are not supposed to change at runtime. All functions
      working with attribute_groups provided by <linux/sysfs.h> work with const
      attribute_group. So mark the non-const structs as const.
      File size before:
         text	   data	    bss	    dec	    hex	filename
         9074	   5592	    416	  15082	   3aea	drivers/bus/arm-ccn.o
      File size After adding 'const':
         text	   data	    bss	    dec	    hex	filename
         9327	   5336	    416	  15079	   3ae7	drivers/bus/arm-ccn.o
      Signed-off-by: default avatarArvind Yadav <arvind.yadav.cs@gmail.com>
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
  4. 03 Nov, 2017 1 commit
  5. 23 Jun, 2017 3 commits
  6. 25 Dec, 2016 2 commits
  7. 02 Sep, 2016 1 commit
  8. 26 Aug, 2016 3 commits
    • Mark Rutland's avatar
      bus: arm-ccn: make event groups reliable · d662ed2e
      Mark Rutland authored
      The CCN PMU driver leaves the counting logic always enabled, and thus
      events are enabled while groups are manipulated. As each event is
      stopped and read individually, this leads to arbitrary skew across event
      groups, which can be seen if counting several identical events.
      To avoid this, implement pmu_{enable,disable} callbacks to stop and
      start all counters atomically around event manipulation. As the counters
      are now stopped, we cannot poll the cycle counter to wait for events to
      drain from the bus. However, as the counters are stopped and the events
      will not be read regardless, we can simply allow the bus to drain
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Mark Rutland's avatar
      bus: arm-ccn: fix hrtimer registration · 5b1e01f3
      Mark Rutland authored
      The CCN PMU driver has a single hrtimer, used to simulate a periodic
      interrupt on systems where the overflow interrupt is not possible to
      use. The hrtimer is started when any event is started, and cancelled when
      any event is stopped. Thus, stopping a single event is sufficient to
      disable to hrtimer, and overflows (of other events) may be lost.
      To avoid this, this patch reworks the hrtimer start/cancel to only occur
      when the first event is added to a PMU, and the last event removed,
      making use of the existing bitmap counting active events.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Mark Rutland's avatar
      bus: arm-ccn: fix PMU interrupt flags · 0811ef7e
      Mark Rutland authored
      Currently the IRQ core is permitted to make the CCN PMU IRQ handler
      threaded, and will allow userspace to change the CPU affinity of the
      interrupt behind our back. Both of these could violate our
      synchronisation requirements with the core perf code, which relies upon
      strict CPU affinity and disabling of interrupts to guarantee mutual
      exclusion in some cases.
      As with the CPU PMU drivers, we should request the interrupt with
      IRQF_NOBALANCING and IRQF_NO_THREAD, to avoid these issues.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Acked-by: default avatarPawel Moll <pawel.moll@arm.com>
      Reviewed-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
  9. 17 Aug, 2016 5 commits
    • Pawel Moll's avatar
      bus: arm-ccn: Add missing event attribute exclusions for host/guest · 3249bce4
      Pawel Moll authored
      CCN PMUs have no knowledge into VM-related origins of the memory
      traffic, therefore can't handle requests for host-only or guest-only
      Added appropriate exclusions (they should have been there from the
      beginning). This required changing the error code returned, as the
      userspace tool only re-negotiates the options (exclude_guest is true by
      default) only for EINVAL.
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Pawel Moll's avatar
      bus: arm-ccn: Correct required arguments for XP PMU events · 90d11e26
      Pawel Moll authored
      XP can provide events from two sources: watchpoints, observing traffic
      on device ports and PMU looking at internal buses.
      Unfortunately the sysfs definition of the PMU events was requiring
      port number (instead of bus number) and direction (the buses are
      unidirectional), as these fields were shared with the watchpoint event.
      Although it does not introduce a major problem (port can be used as
      bus alias and direction is simply ignored for XP PMU events), it's
      better to fix it now, before external tools start depending on this
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Pawel Moll's avatar
      bus: arm-ccn: Fix XP watchpoint settings bitmask · b928466b
      Pawel Moll authored
      The code setting XP watchpoint comparator and mask registers should, in
      order to be fully compliant with specification, zero one or more most
      significant bits of each field. In both L cases it means zeroing bit 63.
      The bitmask doing this was wrong, though, zeroing bit 60 instead.
      Fortunately, due to a lucky coincidence, this turned out to be fairly
      innocent with the existing hardware.
      Fixed now.
      Cc: stable@vger.kernel.org # 3.17+
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Pawel Moll's avatar
      bus: arm-ccn: Do not attempt to configure XPs for cycle counter · b7c1beb2
      Pawel Moll authored
      Fuzzing the CCN perf driver revealed a small but definitely dangerous
      mistake in the event setup code. When a cycle counter is requested, the
      driver should not reconfigure the events bus at all, otherwise it will
      corrupt (in most but the simplest cases) its configuration and may end
      up accessing XP array out of its bounds and corrupting control
      Reported-by: default avatarMark Rutland <mark.rutland@arm.com>
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Tested-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: stable@vger.kernel.org # 3.17+
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Pawel Moll's avatar
      bus: arm-ccn: Fix PMU handling of MN · 4e486cba
      Pawel Moll authored
      The "Miscellaneous Node" fell through cracks of node initialisation,
      as its ID is shared with HN-I.
      This patch treats MN as a special case (which it is), adding separate
      validation check for it and pre-defining the node ID in relevant events
      descriptions. That way one can simply run:
      	# perf stat -a -e ccn/mn_ecbarrier/ <workload>
      Additionally, direction in the MN pseudo-events XP watchpoint
      definitions is corrected to be "TX" (1) as they are defined from the
      crosspoint point of view (thus barriers are transmitted from XP to MN).
      Cc: stable@vger.kernel.org # 3.17+
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
  10. 14 Jul, 2016 1 commit
  11. 09 May, 2016 1 commit
    • Suzuki K Poulose's avatar
      arm-ccn: Enable building as module · 5420f9fd
      Suzuki K Poulose authored
      arm-ccn driver uses irq_set_affinity, which is not exported and
      hence cannot be built as a module, eventhough we have all the
      bits ready. This patch makes use of the exported helper
      irq_set_affinity_hint() instead. Also, the __free_irq expects
      the affinity_hint to be NULL when we free the irq. So set the
      affinity_hint to NULL at clean up.
      Now that we can build it as a module, update the Kconfig to
      reflect the change.
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Acked-by: default avatarPawel Moll <pawel.moll@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
  12. 15 Oct, 2015 2 commits
  13. 13 May, 2015 1 commit
    • Pawel Moll's avatar
      bus: arm-ccn: Use hrtimer_start() again · e532ffea
      Pawel Moll authored
      hrtimer_start() will no longer defer already expired timers to the
      softirq in 4.2, and the __hrtimer_start_range_ns() function is
      getting removed, causing build errors when both the tip tree and
      the arm-ccn changes are merged.
      This changes the code back to using hrtimer_start, which will
      do the right thing after this branch gets merged with the
      timers update from tip.
      As pointed out after a discussion on the mailing list, the result will
      not be worse than the what was there before you pulled my updates, as
      the code was using normal hrtimer_start(). It's just when I realised
      that it should be pinned I looked at what x86 uncore pmu is doing and
      shamelessly (and probably a bit mindlessly) copied the "do not wakeup"
      version from there.
      [arnd: update commit message]
      Reported-by: default avatarMark Brown <mark.brown@arm.com>
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
  14. 01 May, 2015 5 commits
    • Pawel Moll's avatar
      bus: arm-ccn: Allocate event when it is being added, not initialised · 57006d3e
      Pawel Moll authored
      To make events rotation possible, they should be allocated when event
      is being ->added(), not during initialisation. This patch moves the
      respective code.
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Pawel Moll's avatar
      bus: arm-ccn: Do not group CCN events with other PMUs · 9ce1aa86
      Pawel Moll authored
      Groups must not mix events from different PMUs (software events are
      allowed). Unfortunately the core does not ensures that, so it is
      necessary to validate the group at the PMU driver level.
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Pawel Moll's avatar
      bus: arm-ccn: Provide required event arguments · 8f06c51f
      Pawel Moll authored
      Since 688d4dfc
       "perf tools: Support
      parsing parameterized events" the perf userspace tools understands
      "argument=?" syntax in the events file, making sure that required
      arguments are provided by the user and not defaulting to 0, causing
      This patch adds the required arguments lists for CCN events.
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Pawel Moll's avatar
      bus: arm-ccn: cpumask attribute · ffa41524
      Pawel Moll authored
      This patch adds a "cpumask" attribute to CCN's event_source class sysfs
      directory. Perf user tool uses it to restrict events to the
      processor(s) enumerated in this mask.
      This patch provides a single CPU mask, making it possible to run "-a"
      perf session (previously it would request the same CCN event, for
      example cycle counter, on each available core and most likely fail).
      Initially the mask is set to the CPU that happened to probe the driver,
      but it will be changed when it is hot-un-plugged (active events are
      migrated to another CPU then).
       Performance counter stats for 'system wide':
      CPU0               2968148      cycles
      CPU1               2236736      cycles
      CPU2               1797968      cycles
      CPU3               1831715      cycles
      CPU1            1201850868      ccn/cycles/
             1.001241383 seconds time elapsed
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
    • Pawel Moll's avatar
      bus: arm-ccn: Fix node->XP config conversion · a18f8e97
      Pawel Moll authored
      Events defined as watchpoints on nodes must have their config values
      converted so that they apply to the respective node's XP. The
      function setting new values was using wrong mask for the "port" field,
      resulting in corrupted value. Fixed now.
      Cc: stable@vger.kernel.org # 3.17+
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
  15. 08 Oct, 2014 1 commit
  16. 05 Sep, 2014 1 commit
  17. 24 Aug, 2014 1 commit
  18. 01 Aug, 2014 1 commit
  19. 23 Jul, 2014 1 commit
    • Pawel Moll's avatar
      bus: ARM CCN PMU driver · a33b0daa
      Pawel Moll authored
      Driver providing perf backend for ARM Cache Coherent Network
      interconnect. Supports counting all hardware events and crosspoint
      Currently works with CCN-504 only, although there should be
      no changes required for CCN-508 (just impossible to test it now).
      Signed-off-by: default avatarPawel Moll <pawel.moll@arm.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>