1. 11 3月, 2022 1 次提交
  2. 19 8月, 2021 2 次提交
  3. 07 4月, 2021 1 次提交
    • A
      coresight: core: Add support for dedicated percpu sinks · 2cd87a7b
      Anshuman Khandual 提交于
      Add support for dedicated sinks that are bound to individual CPUs. (e.g,
      TRBE). To allow quicker access to the sink for a given CPU bound source,
      keep a percpu array of the sink devices. Also, add support for building
      a path to the CPU local sink from the ETM.
      
      This adds a new percpu sink type CORESIGHT_DEV_SUBTYPE_SINK_PERCPU_SYSMEM.
      This new sink type is exclusively available and can only work with percpu
      source type device CORESIGHT_DEV_SUBTYPE_SOURCE_PROC.
      
      This defines a percpu structure that accommodates a single coresight_device
      which can be used to store an initialized instance from a sink driver. As
      these sinks are exclusively linked and dependent on corresponding percpu
      sources devices, they should also be the default sink device during a perf
      session.
      
      Outwards device connections are scanned while establishing paths between a
      source and a sink device. But such connections are not present for certain
      percpu source and sink devices which are exclusively linked and dependent.
      Build the path directly and skip connection scanning for such devices.
      
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Tested-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Reviewed-by: NMike Leach <mike.leach@linaro.org>
      Signed-off-by: NAnshuman Khandual <anshuman.khandual@arm.com>
      [Moved the set/get percpu sink APIs from TRBE patch to here
       Fixed build break on arm32]
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20210405164307.1720226-17-suzuki.poulose@arm.comSigned-off-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      2cd87a7b
  4. 05 2月, 2021 3 次提交
  5. 29 9月, 2020 2 次提交
  6. 21 7月, 2020 2 次提交
  7. 19 5月, 2020 3 次提交
    • S
      coresight: Fix support for sparsely populated ports · d375b356
      Suzuki K Poulose 提交于
      On some systems the firmware may not describe all the ports
      connected to a component (e.g, for security reasons). This
      could be especially problematic for "funnels" where we could
      end up in modifying memory beyond the allocated space for
      refcounts.
      
      e.g, for a funnel with input ports listed 0, 3, 5, nr_inport = 3.
      However the we could access refcnts[5] while checking for
      references, like :
      
       [  526.110401] ==================================================================
       [  526.117988] BUG: KASAN: slab-out-of-bounds in funnel_enable+0x54/0x1b0
       [  526.124706] Read of size 4 at addr ffffff8135f9549c by task bash/1114
       [  526.131324]
       [  526.132886] CPU: 3 PID: 1114 Comm: bash Tainted: G S                5.4.25 #232
       [  526.140397] Hardware name: Qualcomm Technologies, Inc. SC7180 IDP (DT)
       [  526.147113] Call trace:
       [  526.149653]  dump_backtrace+0x0/0x188
       [  526.153431]  show_stack+0x20/0x2c
       [  526.156852]  dump_stack+0xdc/0x144
       [  526.160370]  print_address_description+0x3c/0x494
       [  526.165211]  __kasan_report+0x144/0x168
       [  526.169170]  kasan_report+0x10/0x18
       [  526.172769]  check_memory_region+0x1a4/0x1b4
       [  526.177164]  __kasan_check_read+0x18/0x24
       [  526.181292]  funnel_enable+0x54/0x1b0
       [  526.185072]  coresight_enable_path+0x104/0x198
       [  526.189649]  coresight_enable+0x118/0x26c
      
        ...
      
       [  526.237782] Allocated by task 280:
       [  526.241298]  __kasan_kmalloc+0xf0/0x1ac
       [  526.245249]  kasan_kmalloc+0xc/0x14
       [  526.248849]  __kmalloc+0x28c/0x3b4
       [  526.252361]  coresight_register+0x88/0x250
       [  526.256587]  funnel_probe+0x15c/0x228
       [  526.260365]  dynamic_funnel_probe+0x20/0x2c
       [  526.264679]  amba_probe+0xbc/0x158
       [  526.268193]  really_probe+0x144/0x408
       [  526.271970]  driver_probe_device+0x70/0x140
      
       ...
      
       [  526.316810]
       [  526.318364] Freed by task 0:
       [  526.321344] (stack is not available)
       [  526.325024]
       [  526.326580] The buggy address belongs to the object at ffffff8135f95480
       [  526.326580]  which belongs to the cache kmalloc-128 of size 128
       [  526.339439] The buggy address is located 28 bytes inside of
       [  526.339439]  128-byte region [ffffff8135f95480, ffffff8135f95500)
       [  526.351399] The buggy address belongs to the page:
       [  526.356342] page:ffffffff04b7e500 refcount:1 mapcount:0 mapping:ffffff814b00c380 index:0x0 compound_mapcount: 0
       [  526.366711] flags: 0x4000000000010200(slab|head)
       [  526.371475] raw: 4000000000010200 ffffffff05034008 ffffffff0501eb08 ffffff814b00c380
       [  526.379435] raw: 0000000000000000 0000000000190019 00000001ffffffff 0000000000000000
       [  526.387393] page dumped because: kasan: bad access detected
       [  526.393128]
       [  526.394681] Memory state around the buggy address:
       [  526.399619]  ffffff8135f95380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       [  526.407046]  ffffff8135f95400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       [  526.414473] >ffffff8135f95480: 04 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       [  526.421900]                             ^
       [  526.426029]  ffffff8135f95500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       [  526.433456]  ffffff8135f95580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       [  526.440883] ==================================================================
      
      To keep the code simple, we now track the maximum number of
      possible input/output connections to/from this component
      @ nr_inport and nr_outport in platform_data, respectively.
      Thus the output connections could be sparse and code is
      adjusted to skip the unspecified connections.
      
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Reported-by: NSai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
      Tested-by: NSai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
      Tested-by: NStephen Boyd <swboyd@chromium.org>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Link: https://lore.kernel.org/r/20200518180242.7916-13-mathieu.poirier@linaro.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d375b356
    • S
      coresight: Expose device connections via sysfs · 8a7365c2
      Suzuki K Poulose 提交于
      Coresight device connections are a bit complicated and is not
      exposed currently to the user. One has to look at the platform
      descriptions (DT bindings or ACPI bindings) to make an understanding.
      Given the new naming scheme, it will be helpful to have this information
      to choose the appropriate devices for tracing. This patch exposes
      the device connections via links in the sysfs directories.
      
      e.g, for a connection devA[OutputPort_X] -> devB[InputPort_Y]
      is represented as two symlinks:
      
        /sys/bus/coresight/.../devA/out:X -> /sys/bus/coresight/.../devB
        /sys/bus/coresight/.../devB/in:Y  -> /sys/bus/coresight/.../devA
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      [Revised to use the generic sysfs links functions & link structures.
      Provides a connections sysfs group in each device to hold the links.]
      Co-developed-by: NMike Leach <mike.leach@linaro.org>
      Signed-off-by: NMike Leach <mike.leach@linaro.org>
      Signed-off-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Link: https://lore.kernel.org/r/20200518180242.7916-5-mathieu.poirier@linaro.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8a7365c2
    • M
      coresight: Add generic sysfs link creation functions · 80961525
      Mike Leach 提交于
      To allow the connections between coresight components to be represented
      in sysfs, generic methods for creating sysfs links between two coresight
      devices are added.
      Signed-off-by: NMike Leach <mike.leach@linaro.org>
      Reviewed-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Link: https://lore.kernel.org/r/20200518180242.7916-4-mathieu.poirier@linaro.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      80961525
  8. 21 3月, 2020 2 次提交
  9. 05 11月, 2019 1 次提交
  10. 20 6月, 2019 7 次提交
  11. 26 4月, 2019 2 次提交
  12. 08 2月, 2019 1 次提交
  13. 06 2月, 2019 1 次提交
    • M
      coresight: perf: Add "sinks" group to PMU directory · bb8e370b
      Mathieu Poirier 提交于
      Add a "sinks" directory entry so that users can see all the sinks
      available in the system in a single place.  Individual sink are added
      as they are registered with the coresight bus.
      
      Committer tests:
      
      Test built on a ubuntu 18.04 container with a cross build environment to
      arm64, the new field is there, need to find a machine with this feature
      to do further testing in the future.
      
        root@d15263e5734a:/git/perf# grep CORESIGHT /tmp/build/v5.0-rc2+/.config
        CONFIG_CORESIGHT=y
        CONFIG_CORESIGHT_LINKS_AND_SINKS=y
        CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y
        CONFIG_CORESIGHT_CATU=y
        CONFIG_CORESIGHT_SINK_TPIU=y
        CONFIG_CORESIGHT_SINK_ETBV10=y
        CONFIG_CORESIGHT_SOURCE_ETM4X=y
        CONFIG_CORESIGHT_DYNAMIC_REPLICATOR=y
        CONFIG_CORESIGHT_STM=y
        CONFIG_CORESIGHT_CPU_DEBUG=m
        root@d15263e5734a:/git/perf#
        root@d15263e5734a:/git/perf# file /tmp/build/v5.0-rc2+/drivers/hwtracing/coresight/*.o
        .../coresight/coresight-catu.o:               ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-cpu-debug.mod.o:      ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-cpu-debug.o:          ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-dynamic-replicator.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-etb10.o:              ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-etm-perf.o:           ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-etm4x-sysfs.o:        ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-etm4x.o:              ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-funnel.o:             ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-replicator.o:         ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-stm.o:                ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-tmc-etf.o:            ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-tmc-etr.o:            ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-tmc.o:                ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight-tpiu.o:               ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/coresight.o:                    ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        .../coresight/of_coresight.o:                 ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
        root@d15263e5734a:/git/perf#
      
        root@d15263e5734a:/git/perf# pahole -C coresight_device /tmp/build/v5.0-rc2+/drivers/hwtracing/coresight/coresight.o
        struct coresight_device {
                struct coresight_connection * conns;             /*     0     8 */
                int                        nr_inport;            /*     8     4 */
                int                        nr_outport;           /*    12     4 */
                enum coresight_dev_type    type;                 /*    16     4 */
                union coresight_dev_subtype subtype;             /*    20     8 */
      
                /* XXX 4 bytes hole, try to pack */
      
                const struct coresight_ops  * ops;               /*    32     8 */
                struct device              dev;                  /*    40  1408 */
      
                /* XXX last struct has 7 bytes of padding */
      
                /* --- cacheline 22 boundary (1408 bytes) was 40 bytes ago --- */
                atomic_t *                 refcnt;               /*  1448     8 */
                bool                       orphan;               /*  1456     1 */
                bool                       enable;               /*  1457     1 */
                bool                       activated;            /*  1458     1 */
      
                /* XXX 5 bytes hole, try to pack */
      
                struct dev_ext_attribute * ea;                   /*  1464     8 */
      
                /* size: 1472, cachelines: 23, members: 12 */
                /* sum members: 1463, holes: 2, sum holes: 9 */
                /* paddings: 1, sum paddings: 7 */
        };
        root@d15263e5734a:/git/perf#
      Signed-off-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Reviewed-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-s390@vger.kernel.org
      Link: http://lkml.kernel.org/r/20190131184714.20388-3-mathieu.poirier@linaro.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bb8e370b
  14. 26 9月, 2018 4 次提交
  15. 15 7月, 2018 5 次提交
  16. 14 5月, 2018 1 次提交
  17. 09 6月, 2017 2 次提交