12 Feb, 2019

6 commits


18 Oct, 2018

1 commit

  • commit ca2b497253ad01c80061a1f3ee9eb91b5d54a849 upstream.

    It doesn't make sense for a perf event to be configured as a CHAIN event
    in isolation, so extend the arm_pmu structure with a ->filter_match()
    function to allow the backend PMU implementation to reject CHAIN events
    early.

    Cc:
    Reviewed-by: Suzuki K Poulose
    Signed-off-by: Will Deacon
    Signed-off-by: Greg Kroah-Hartman

    Will Deacon
     

24 Aug, 2018

1 commit

  • [ Upstream commit a45fc268db20ecd859bb61e25045912b3194b5e6 ]

    This patch fixes the below parser error of the IOB SLOW PMU.

    # perf stat -a -e iob-slow0/cycle-count/ sleep 1
    evenf syntax error: 'iob-slow0/cycle-count/'
    \___ parser error

    It replaces the "-" character by "_" character inside the PMU name.

    Signed-off-by: Hoan Tran
    Signed-off-by: Will Deacon
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hoan Tran
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

22 Sep, 2017

1 commit


09 Aug, 2017

1 commit


08 Aug, 2017

1 commit

  • Managed resources in the driver should be automatically cleaned up on
    driver detach. It's unnecessary to manually free/unmmap these resources.
    One of the manual cleanup causes static checkers to complain.
    The bug is reported by Dan Carpenter in [1]

    [1] https://www.spinics.net/lists/arm-kernel/msg593012.html

    This patch gets rid of all the unnecessary manual cleanup and properly
    unregister all the registered PMU devices by the driver on driver detach.

    Signed-off-by: Tai Nguyen
    Signed-off-by: Will Deacon

    Tai Nguyen
     

27 Jul, 2017

1 commit

  • 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: 3cf7ee98b848 ("drivers/perf: arm_pmu: move irq request/free into probe")
    Cc: Mark Rutland
    Cc: Linus Walleij
    Signed-off-by: Will Deacon

    Will Deacon
     

26 Jul, 2017

1 commit

  • The check for column exclusion did not verify that the event being
    checked was an L2 event, and not a software event.
    Software events should not be checked for column exclusion.
    This resulted in a group with both software and L2 events sometimes
    incorrectly rejecting the L2 event for column exclusion and
    not counting it.

    Add a check for PMU type before applying column exclusion logic.

    Fixes: 21bdbb7102edeaeb ("perf: add qcom l2 cache perf events driver")
    Acked-by: Mark Rutland
    Signed-off-by: Neil Leeder
    Signed-off-by: Will Deacon

    Neil Leeder
     

20 Jul, 2017

1 commit

  • Now that we have a custom printf format specifier, convert users of
    full_name to use %pOF instead. This is preparation to remove storing
    of the full path string for each node.

    Signed-off-by: Rob Herring
    Cc: Will Deacon
    Cc: Mark Rutland
    Cc: linux-arm-kernel@lists.infradead.org
    Signed-off-by: Will Deacon

    Rob Herring
     

26 Jun, 2017

1 commit


23 Jun, 2017

3 commits


15 Jun, 2017

1 commit


30 May, 2017

1 commit

  • 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] [] enable_percpu_irq+0xdc/0xe4
    [ 4.071192] [] arm_perf_starting_cpu+0x108/0x10c
    [ 4.072200] [] cpuhp_invoke_callback+0x14c/0x4ac
    [ 4.073210] [] cpuhp_thread_fun+0xd4/0x11c
    [ 4.074132] [] smpboot_thread_fn+0x1b4/0x1c4
    [ 4.075081] [] kthread+0x10c/0x138
    [ 4.075921] [] ret_from_fork+0x10/0x50
    [ 4.076947] genirq: Setting trigger mode 4 for irq 43 failed
    (gic_set_type+0x0/0x74)

    Signed-off-by: Wei Huang
    [will: add comment justifying deviation from ACPI spec, removed redundant hunk]
    Signed-off-by: Will Deacon
    Signed-off-by: Catalin Marinas

    Wei Huang
     

11 Apr, 2017

11 commits

  • This patch adds framework code to handle parsing PMU data out of the
    MADT, sanity checking this, and managing the association of CPUs (and
    their interrupts) with appropriate logical PMUs.

    For the time being, we expect that only one PMU driver (PMUv3) will make
    use of this, and we simply pass in a single probe function.

    This is based on an earlier patch from Jeremy Linton.

    Signed-off-by: Mark Rutland
    Tested-by: Jeremy Linton
    Cc: Will Deacon
    Signed-off-by: Will Deacon

    Mark Rutland
     
  • Now that we've split the pdev and DT probing logic from the runtime
    management, let's move the former into its own file. We gain a few lines
    due to the copyright header and includes, but this should keep the logic
    clearly separated, and paves the way for adding ACPI support in a
    similar fashion.

    Signed-off-by: Mark Rutland
    Tested-by: Jeremy Linton
    [will: rename nr_irqs to avoid conflict with global variable]
    Signed-off-by: Will Deacon

    Mark Rutland
     
  • Currently we request (and potentially free) all IRQs for a given PMU in
    cpu_pmu_init(). This works for platform/DT probing today, but it doesn't
    fit ACPI well as we don't have all our affinity data up-front.

    In preparation for ACPI support, fold the IRQ request/free into
    arm_pmu_device_probe(), which will remain specific to platform/DT
    probing.

    Signed-off-by: Mark Rutland
    Tested-by: Jeremy Linton
    Cc: Will Deacon
    Signed-off-by: Will Deacon

    Mark Rutland
     
  • Currently we have functions to request/free all IRQs for a given PMU.
    While this works today, this won't work for ACPI, where we don't know
    the full set of IRQs up front, and need to request them separately.

    To enable supporting ACPI, this patch splits out the cpu-local
    request/free into new functions, allowing us to request/free individual
    IRQs.

    As this makes it possible/necessary to request a PPI once per cpu, an
    additional check is added to detect mismatched PPIs. This shouldn't
    matter for the DT / platform case, as we check this when parsing.

    Signed-off-by: Mark Rutland
    Tested-by: Jeremy Linton
    Cc: Will Deacon
    Signed-off-by: Will Deacon

    Mark Rutland
     
  • For historical reasons, portions of the arm_pmu code use a cpu_pmu_
    prefix rather than an armpmu_ prefix. While a minor annoyance, this
    hasn't been a problem thusfar.

    However, to enable ACPI support, we'll need to expose a few things in
    header files, and we should aim to keep those consistently namespaced.
    In preparation for exporting our IRQ request/free functions, rename
    these to have an armpmu_ prefix. For consistency, the 'cpu_pmu'
    parameter is also renamed to 'armpmu'.

    Signed-off-by: Mark Rutland
    Tested-by: Jeremy Linton
    Cc: Will Deacon
    Signed-off-by: Will Deacon

    Mark Rutland
     
  • In armpmu_dispatch_irq() we look at arm_pmu::plat_device to acquire
    platdata, so that we can defer to platform-specific IRQ handling,
    required on some 32-bit parts. With the advent of ACPI we won't always
    have a platform_device, and so we must avoid trying to dereference
    fields from it.

    This patch fixes up armpmu_dispatch_irq() to avoid doing so, introducing
    a new armpmu_get_platdata() helper.

    Signed-off-by: Mark Rutland
    Tested-by: Jeremy Linton
    Cc: Will Deacon
    Signed-off-by: Will Deacon

    Mark Rutland
     
  • The ARM PMU framework code always uses armpmu_dispatch_irq as its common
    IRQ handler. Passing this down from cpu_pmu_init() is somewhat
    pointless, and gets in the way of refactoring.

    This patch makes cpu_pmu_request_irqs() always use armpmu_dispatch_irq
    as the handler when requesting IRQs, and removes the handler parameter
    from its prototype.

    Signed-off-by: Mark Rutland
    Tested-by: Jeremy Linton
    Cc: Will Deacon
    Signed-off-by: Will Deacon

    Mark Rutland
     
  • Currently arm_pmu_device_probe contains probing logic specific to the
    platform_device infrastructure, and some logic required to safely
    register the PMU with various systems.

    This patch factors out the logic relating to the registration of the
    PMU. This makes arm_pmu_device_probe a little easier to read, and will
    make it easier to reuse the logic for an ACPI-specific probing
    mechanism.

    Signed-off-by: Mark Rutland
    Tested-by: Jeremy Linton
    Cc: Will Deacon
    Signed-off-by: Will Deacon

    Mark Rutland
     
  • Given we always want to initialise common fields on an allocated PMU,
    this patch folds this common initialisation into armpmu_alloc(). This
    will make it simpler to reuse this code for an ACPI-specific probe path.

    Signed-off-by: Mark Rutland
    Tested-by: Jeremy Linton
    Cc: Will Deacon
    Signed-off-by: Will Deacon

    Mark Rutland
     
  • We expect an ARM PMU's init function to have a particular prototype,
    which we open-code in a few places. This is less than ideal, considering
    that we cast a void value to this type in one location, and a mismatch
    could easily be missed.

    Add a typedef so that we can ensure this is consistent.

    Signed-off-by: Mark Rutland
    Tested-by: Jeremy Linton
    Cc: Will Deacon
    Signed-off-by: Will Deacon

    Mark Rutland
     
  • We currently disable the PMU temporarily in armpmu_add(). We may have
    required this historically, but the perf core always disables an event's
    PMU when calling event::pmu::add(), so this is not necessary.

    We don't do similarly in armpmu_del(), or elsewhere, so this is
    unnecessary and inconsistent, and only serves to confuse the reader.

    Remove the pointless disable, simplifying armpmu_add() in the process.

    Signed-off-by: Mark Rutland
    Tested-by: Jeremy Linton
    Cc: Will Deacon
    Signed-off-by: Will Deacon

    Mark Rutland
     

04 Apr, 2017

1 commit

  • 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: Mark Rutland
    Signed-off-by: Agustin Vega-Frias
    [will: fixed sparse issues]
    Signed-off-by: Will Deacon

    Agustin Vega-Frias
     

01 Apr, 2017

3 commits

  • 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: Mark Rutland
    [will: make armpmu_get_cpu_irq static]
    Signed-off-by: Will Deacon

    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: Mark Rutland
    [will: rename local nr_irqs variable to avoid conflict with global]
    Signed-off-by: Will Deacon

    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: Mark Rutland
    [will: make armpmu_{alloc,free} static
    Signed-off-by: Will Deacon

    Mark Rutland
     

02 Mar, 2017

1 commit


09 Feb, 2017

1 commit

  • Adds perf events support for L2 cache PMU.

    The L2 cache PMU driver is named 'l2cache_0' and can be used
    with perf events to profile L2 events such as cache hits
    and misses on Qualcomm Technologies processors.

    Reviewed-by: Mark Rutland
    Signed-off-by: Neil Leeder
    [will: minimise nesting in l2_cache_associate_cpu_with_cluster]
    [will: use kstrtoul for unsigned long, remove redunant .owner setting]
    Signed-off-by: Will Deacon

    Neil Leeder
     

04 Feb, 2017

1 commit

  • 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: Tai Nguyen
    Signed-off-by: Stephen Boyd
    Signed-off-by: Will Deacon

    Stephen Boyd
     

25 Dec, 2016

1 commit

  • When the state names got added a script was used to add the extra argument
    to the calls. The script basically converted the state constant to a
    string, but the cleanup to convert these strings into meaningful ones did
    not happen.

    Replace all the useless strings with 'subsys/xxx/yyy:state' strings which
    are used in all the other places already.

    Signed-off-by: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc: Sebastian Siewior
    Link: http://lkml.kernel.org/r/20161221192112.085444152@linutronix.de
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner