1. 13 Apr, 2021 6 commits
  2. 11 Apr, 2021 2 commits
  3. 09 Apr, 2021 2 commits
  4. 08 Apr, 2021 1 commit
  5. 07 Apr, 2021 6 commits
  6. 06 Apr, 2021 17 commits
  7. 05 Apr, 2021 4 commits
    • Anshuman Khandual's avatar
      arm64: Add TRBE definitions · 3f9b72f6
      Anshuman Khandual authored
      This adds TRBE related registers and corresponding feature macros.
      
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Reviewed-by: default avatarMike Leach <mike.leach@linaro.org>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20210405164307.1720226-5-suzuki.poulose@arm.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      3f9b72f6
    • Suzuki K Poulose's avatar
      arm64: Add support for trace synchronization barrier · be968269
      Suzuki K Poulose authored
      tsb csync synchronizes the trace operation of instructions.
      The instruction is a nop when FEAT_TRF is not implemented.
      
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20210405164307.1720226-4-suzuki.poulose@arm.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      be968269
    • Suzuki K Poulose's avatar
      perf: aux: Add CoreSight PMU buffer formats · 7dde5176
      Suzuki K Poulose authored
      CoreSight PMU supports aux-buffer for the ETM tracing. The trace
      generated by the ETM (associated with individual CPUs, like Intel PT)
      is captured by a separate IP (CoreSight TMC-ETR/ETF until now).
      
      The TMC-ETR applies formatting of the raw ETM trace data, as it
      can collect traces from multiple ETMs, with the TraceID to indicate
      the source of a given trace packet.
      
      Arm Trace Buffer Extension is new "sink" IP, attached to individual
      CPUs and thus do not provide additional formatting, like TMC-ETR.
      
      Additionally, a system could have both TRBE *and* TMC-ETR for
      the trace collection. e.g, TMC-ETR could be used as a single
      trace buffer to collect data from multiple ETMs to correlate
      the traces from different CPUs. It is possible to have a
      perf session where some events end up collecting the trace
      in TMC-ETR while the others in TRBE. Thus we need a way
      to identify the type of the trace for each AUX record.
      
      Define the trace formats exported by the CoreSight PMU.
      We don't define the flags following the "ETM" as this
      information is available to the user when issuing
      the session. What is missing is the additional
      formatting applied by the "sink" which is decided
      at the runtime and the user may not have a control on.
      
      So we define :
       - CORESIGHT format (indicates the Frame format)
       - RAW format (indicates the format of the source)
      
      The default value is CORESIGHT format for all the records
      (i,e == 0). Add the RAW format for others that use
      raw format.
      
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Reviewed-by: default avatarMike Leach <mike.leach@linaro.org>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20210405164307.1720226-3-suzuki.poulose@arm.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      7dde5176
    • Suzuki K Poulose's avatar
      perf: aux: Add flags for the buffer format · 547b6098
      Suzuki K Poulose authored
      Allocate a byte for advertising the PMU specific format type
      of the given AUX record. A PMU could end up providing hardware
      trace data in multiple format in a single session.
      
      e.g, The format of hardware buffer produced by CoreSight ETM
      PMU depends on the type of the "sink" device used for collection
      for an event (Traditional TMC-ETR/Bs with formatting or
      TRBEs without any formatting).
      
       # Boring story of why this is needed. Goto The_End_of_Story for skipping.
      
      CoreSight ETM trace allows instruction level tracing of Arm CPUs.
      The ETM generates the CPU excecution trace and pumps it into CoreSight
      AMBA Trace Bus and is collected by a different CoreSight component
      (traditionally CoreSight TMC-ETR /ETB/ETF), called "sink".
      Important to note that there is no guarantee that every CPU has
      a dedicated sink.  Thus multiple ETMs could pump the trace data
      into the same "sink" and thus they apply additional formatting
      of the trace data for the user to decode it properly and attribute
      the trace data to the corresponding ETM.
      
      However, with the introduction of Arm Trace buffer Extensions (TRBE),
      we now have a dedicated per-CPU architected sink for collecting the
      trace. Since the TRBE is always per-CPU, it doesn't apply any formatting
      of the trace. The support for this driver is under review [1].
      
      Now a system could have a per-cpu TRBE and one or more shared
      TMC-ETRs on the system. A user could choose a "specific" sink
      for a perf session (e.g, a TMC-ETR) or the driver could automatically
      select the nearest sink for a given ETM. It is possible that
      some ETMs could end up using TMC-ETR (e.g, if the TRBE is not
      usable on the CPU) while the others using TRBE in a single
      perf session. Thus we now have "formatted" trace collected
      from TMC-ETR and "unformatted" trace collected from TRBE.
      However, we don't get into a situation where a single event
      could end up using TMC-ETR & TRBE. i.e, any AUX buffer is
      guaranteed to be either RAW or FORMATTED, but not a mix
      of both.
      
      As for perf decoding, we need to know the type of the data
      in the individual AUX buffers, so that it can set up the
      "OpenCSD" (library for decoding CoreSight trace) decoder
      instance appropriately. Thus the perf.data file must conatin
      the hints for the tool to decode the data correctly.
      
      Since this is a runtime variable, and perf tool doesn't have
      a control on what sink gets used (in case of automatic sink
      selection), we need this information made available from
      the PMU driver for each AUX record.
      
       # The_End_of_Story
      
      Cc: Peter Ziljstra <peterz@infradead.org>
      Cc: alexander.shishkin@linux.intel.com
      Cc: mingo@redhat.com
      Cc: will@kernel.org
      Cc: mark.rutland@arm.com
      Cc: mike.leach@linaro.org
      Cc: acme@kernel.org
      Cc: jolsa@redhat.com
      Cc: Mathieu Poirier <mathieu.poirer@linaro.org>
      Reviewed by: Mike Leach <mike.leach@linaro.org>
      Acked-by: default avatarPeter Ziljstra <peterz@infradead.org>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20210405164307.1720226-2-suzuki.poulose@arm.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      547b6098
  8. 01 Apr, 2021 2 commits
    • Andrew Scull's avatar
      KVM: arm64: Log source when panicking from nVHE hyp · aec0fae6
      Andrew Scull authored
      To aid with debugging, add details of the source of a panic from nVHE
      hyp. This is done by having nVHE hyp exit to nvhe_hyp_panic_handler()
      rather than directly to panic(). The handler will then add the extra
      details for debugging before panicking the kernel.
      
      If the panic was due to a BUG(), look up the metadata to log the file
      and line, if available, otherwise log an address that can be looked up
      in vmlinux. The hyp offset is also logged to allow other hyp VAs to be
      converted, similar to how the kernel offset is logged during a panic.
      
      __hyp_panic_string is now inlined since it no longer needs to be
      referenced as a symbol and the message is free to diverge between VHE
      and nVHE.
      
      The following is an example of the logs generated by a BUG in nVHE hyp.
      
      [   46.754840] kvm [307]: nVHE hyp BUG at: arch/arm64/kvm/hyp/nvhe/switch.c:242!
      [   46.755357] kvm [307]: Hyp Offset: 0xfffea6c58e1e0000
      [   46.755824] Kernel panic - not syncing: HYP panic:
      [   46.755824] PS:400003c9 PC:0000d93a82c705ac ESR:f2000800
      [   46.755824] FAR:0000000080080000 HPFAR:0000000000800800 PAR:0000000000000000
      [   46.755824] VCPU:0000d93a880d0000
      [   46.756960] CPU: 3 PID: 307 Comm: kvm-vcpu-0 Not tainted 5.12.0-rc3-00005-gc572b99cf65b-dirty #133
      [   46.757459] Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
      [   46.758366] Call trace:
      [   46.758601]  dump_backtrace+0x0/0x1b0
      [   46.758856]  show_stack+0x18/0x70
      [   46.759057]  dump_stack+0xd0/0x12c
      [   46.759236]  panic+0x16c/0x334
      [   46.759426]  arm64_kernel_unmapped_at_el0+0x0/0x30
      [   46.759661]  kvm_arch_vcpu_ioctl_run+0x134/0x750
      [   46.759936]  kvm_vcpu_ioctl+0x2f0/0x970
      [   46.760156]  __arm64_sys_ioctl+0xa8/0xec
      [   46.760379]  el0_svc_common.constprop.0+0x60/0x120
      [   46.760627]  do_el0_svc+0x24/0x90
      [   46.760766]  el0_svc+0x2c/0x54
      [   46.760915]  el0_sync_handler+0x1a4/0x1b0
      [   46.761146]  el0_sync+0x170/0x180
      [   46.761889] SMP: stopping secondary CPUs
      [   46.762786] Kernel Offset: 0x3e1cd2820000 from 0xffff800010000000
      [   46.763142] PHYS_OFFSET: 0xffffa9f680000000
      [   46.763359] CPU features: 0x00240022,61806008
      [   46.763651] Memory Limit: none
      [   46.813867] ---[ end Kernel panic - not syncing: HYP panic:
      [   46.813867] PS:400003c9 PC:0000d93a82c705ac ESR:f2000800
      [   46.813867] FAR:0000000080080000 HPFAR:0000000000800800 PAR:0000000000000000
      [   46.813867] VCPU:0000d93a880d0000 ]---
      Signed-off-by: default avatarAndrew Scull <ascull@google.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20210318143311.839894-6-ascull@google.com
      aec0fae6
    • Andrew Scull's avatar
      KVM: arm64: Use BUG and BUG_ON in nVHE hyp · f79e616f
      Andrew Scull authored
      hyp_panic() reports the address of the panic by using ELR_EL2, but this
      isn't a useful address when hyp_panic() is called directly. Replace such
      direct calls with BUG() and BUG_ON() which use BRK to trigger an
      exception that then goes to hyp_panic() with the correct address. Also
      remove the hyp_panic() declaration from the header file to avoid
      accidental misuse.
      Signed-off-by: default avatarAndrew Scull <ascull@google.com>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20210318143311.839894-5-ascull@google.com
      f79e616f