perf cs-etm: Use new OpenCSD consistency checksPreviously when the incorrect binary was used for decode, Perf wouldsilently continue to generate incorrect samples. With OpenCSD 1.5.4 wecan enable
perf cs-etm: Use new OpenCSD consistency checksPreviously when the incorrect binary was used for decode, Perf wouldsilently continue to generate incorrect samples. With OpenCSD 1.5.4 wecan enable consistency checks that do a best effort to detect a mismatchin the image. When one is detected a warning is printed and samplegeneration stops until the trace resynchronizes with a good part of theimage.Reported-by: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>Closes: https://lore.kernel.org/all/20240719092619.274730-1-gankulkarni@os.amperecomputing.com/Reviewed-by: Leo Yan <leo.yan@arm.com>Signed-off-by: James Clark <james.clark@linaro.org>Tested-by: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>Cc: Ben Gainey <ben.gainey@arm.com>Cc: Suzuki K Poulose <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Cc: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Mike Leach <mike.leach@linaro.org>Cc: Ruidong Tian <tianruidong@linux.alibaba.com>Cc: Leo Yan <leo.yan@linux.dev>Cc: Benjamin Gray <bgray@linux.ibm.com>Cc: linux-arm-kernel@lists.infradead.orgCc: coresight@lists.linaro.orgCc: John Garry <john.g.garry@oracle.com>Cc: scclevenger@os.amperecomputing.comLink: https://lore.kernel.org/r/20240916135743.1490403-3-james.clark@linaro.orgSigned-off-by: Namhyung Kim <namhyung@kernel.org>
show more ...
perf: cs-etm: Print queue number in raw trace dumpNow that we have overlapping trace IDs it's also useful to know what thequeue number is to be able to distinguish the source of the trace soprint
perf: cs-etm: Print queue number in raw trace dumpNow that we have overlapping trace IDs it's also useful to know what thequeue number is to be able to distinguish the source of the trace soprint it inline. Hide it behind the -v option because it might not beobvious to users what the queue number is.Reviewed-by: Mike Leach <mike.leach@linaro.org>Signed-off-by: James Clark <james.clark@arm.com>Cc: Adrian Hunter <adrian.hunter@intel.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>Cc: Anshuman Khandual <anshuman.khandual@arm.com>Cc: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>Cc: Ian Rogers <irogers@google.com>Cc: Ingo Molnar <mingo@redhat.com>Cc: Jiri Olsa <jolsa@kernel.org>Cc: John Garry <john.g.garry@oracle.com>Cc: Kan Liang <kan.liang@linux.intel.com>Cc: Leo Yan <leo.yan@linux.dev>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Link: https://lore.kernel.org/r/20240722101202.26915-8-james.clark@linaro.orgSigned-off-by: James Clark <james.clark@linaro.org>Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf: cs-etm: Create decoders based on the trace ID mappingsNow that each queue has a unique set of trace ID mappings, use thislist to create the decoders. In unformatted mode just add a singlema
perf: cs-etm: Create decoders based on the trace ID mappingsNow that each queue has a unique set of trace ID mappings, use thislist to create the decoders. In unformatted mode just add a singlemapping so only one decoder is made.Previously each queue would have a decoder created for each traced CPUon the system but this won't work anymore because CPUs can haveoverlapping trace IDs.This also means that the CORESIGHT_TRACE_ID_UNUSED_FLAG isn't neededany more. If mappings aren't added then decoders aren't created, ratherthan needing a flag to suppress creation.Reviewed-by: Mike Leach <mike.leach@linaro.org>Signed-off-by: James Clark <james.clark@arm.com>Cc: Adrian Hunter <adrian.hunter@intel.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>Cc: Anshuman Khandual <anshuman.khandual@arm.com>Cc: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>Cc: Ian Rogers <irogers@google.com>Cc: Ingo Molnar <mingo@redhat.com>Cc: Jiri Olsa <jolsa@kernel.org>Cc: John Garry <john.g.garry@oracle.com>Cc: Kan Liang <kan.liang@linux.intel.com>Cc: Leo Yan <leo.yan@linux.dev>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Link: https://lore.kernel.org/r/20240722101202.26915-5-james.clark@linaro.orgSigned-off-by: James Clark <james.clark@linaro.org>Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf: cs-etm: Move traceid_list to each queueThe global list won't work for per-sink trace ID allocations, so put alist in each queue where the IDs will be unique to that queue.To keep the same
perf: cs-etm: Move traceid_list to each queueThe global list won't work for per-sink trace ID allocations, so put alist in each queue where the IDs will be unique to that queue.To keep the same behavior as before, for version 0 of the HW_ID packets,copy all the HW_ID mappings into all queues.This change doesn't effect the decoders, only trace ID lookups on thePerf side. The decoders are still created with global mappings whichwill be fixed in a later commit.Reviewed-by: Mike Leach <mike.leach@linaro.org>Signed-off-by: James Clark <james.clark@arm.com>Cc: Adrian Hunter <adrian.hunter@intel.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>Cc: Anshuman Khandual <anshuman.khandual@arm.com>Cc: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>Cc: Ian Rogers <irogers@google.com>Cc: Ingo Molnar <mingo@redhat.com>Cc: Jiri Olsa <jolsa@kernel.org>Cc: John Garry <john.g.garry@oracle.com>Cc: Kan Liang <kan.liang@linux.intel.com>Cc: Leo Yan <leo.yan@linux.dev>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Link: https://lore.kernel.org/r/20240722101202.26915-4-james.clark@linaro.orgSigned-off-by: James Clark <james.clark@linaro.org>Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf util: Make util its own libraryMake the util directory into its own library. This is done to avoidcompiling code twice, once for the perf tool and once for the perfpython module. For conveni
perf util: Make util its own libraryMake the util directory into its own library. This is done to avoidcompiling code twice, once for the perf tool and once for the perfpython module. For convenience: arch/common.c scripts/perl/Perf-Trace-Util/Context.c scripts/python/Perf-Trace-Util/Context.care made part of this library.Signed-off-by: Ian Rogers <irogers@google.com>Reviewed-by: James Clark <james.clark@arm.com>Cc: Suzuki K Poulose <suzuki.poulose@arm.com>Cc: Kees Cook <keescook@chromium.org>Cc: Palmer Dabbelt <palmer@dabbelt.com>Cc: Albert Ou <aou@eecs.berkeley.edu>Cc: Nick Terrell <terrelln@fb.com>Cc: Gary Guo <gary@garyguo.net>Cc: Alex Gaynor <alex.gaynor@gmail.com>Cc: Boqun Feng <boqun.feng@gmail.com>Cc: Wedson Almeida Filho <wedsonaf@gmail.com>Cc: Ze Gao <zegao2021@gmail.com>Cc: Alice Ryhl <aliceryhl@google.com>Cc: Andrei Vagin <avagin@google.com>Cc: Yicong Yang <yangyicong@hisilicon.com>Cc: Jonathan Cameron <jonathan.cameron@huawei.com>Cc: Guo Ren <guoren@kernel.org>Cc: Miguel Ojeda <ojeda@kernel.org>Cc: Will Deacon <will@kernel.org>Cc: Mike Leach <mike.leach@linaro.org>Cc: Leo Yan <leo.yan@linux.dev>Cc: Oliver Upton <oliver.upton@linux.dev>Cc: John Garry <john.g.garry@oracle.com>Cc: Benno Lossin <benno.lossin@proton.me>Cc: Björn Roy Baron <bjorn3_gh@protonmail.com>Cc: Andreas Hindborg <a.hindborg@samsung.com>Cc: Paul Walmsley <paul.walmsley@sifive.com>Signed-off-by: Namhyung Kim <namhyung@kernel.org>Link: https://lore.kernel.org/r/20240625214117.953777-7-irogers@google.com
perf cs-etm: Add exception level consistency checkAssert that our own tracking of the exception level matches whatOpenCSD provides. OpenCSD doesn't distinguish between EL0 and EL1 in thememory ac
perf cs-etm: Add exception level consistency checkAssert that our own tracking of the exception level matches whatOpenCSD provides. OpenCSD doesn't distinguish between EL0 and EL1 in thememory access callback so the extra tracking was required. But a roughassert can still be done.Signed-off-by: James Clark <james.clark@arm.com>Cc: Adrian Hunter <adrian.hunter@intel.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Ian Rogers <irogers@google.com>Cc: Ingo Molnar <mingo@redhat.com>Cc: Jiri Olsa <jolsa@kernel.org>Cc: John Garry <john.g.garry@oracle.com>Cc: Leo Yan <leo.yan@linaro.org>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https://lore.kernel.org/r/20230612111403.100613-6-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Track exception levelCurrently we assume all trace belongs to the host machine so whenthe decoder should be looking at the guest kernel maps it can crashbecause it looks at the host
perf cs-etm: Track exception levelCurrently we assume all trace belongs to the host machine so whenthe decoder should be looking at the guest kernel maps it can crashbecause it looks at the host ones instead.Avoid one scenario (guest kernel running at EL1) by assigning thedefault guest machine to this trace. For userspace trace it's still notpossible to determine guest vs host, but the PIDs should help in thiscase.Committer notes:Fixed up conflict with: perf addr_location: Add init/exit/copy functionsThat was only on tmp.perf-tools-next.Reviewed-by: Leo Yan <leo.yan@linaro.org>Signed-off-by: James Clark <james.clark@arm.com>Cc: Adrian Hunter <adrian.hunter@intel.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Ian Rogers <irogers@google.com>Cc: Ingo Molnar <mingo@redhat.com>Cc: Jiri Olsa <jolsa@kernel.org>Cc: John Garry <john.g.garry@oracle.com>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https://lore.kernel.org/r/20230612111403.100613-5-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Make PID format accessible from struct cs_etm_auxtraceTo avoid every user of PID format having to use their own staticlocal variable, cache it on initialisation and change the accesso
perf cs-etm: Make PID format accessible from struct cs_etm_auxtraceTo avoid every user of PID format having to use their own staticlocal variable, cache it on initialisation and change the accessor totake struct cs_etm_auxtrace.Reviewed-by: Leo Yan <leo.yan@linaro.org>Signed-off-by: James Clark <james.clark@arm.com>Cc: Adrian Hunter <adrian.hunter@intel.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Ian Rogers <irogers@google.com>Cc: Ingo Molnar <mingo@redhat.com>Cc: Jiri Olsa <jolsa@kernel.org>Cc: John Garry <john.g.garry@oracle.com>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https://lore.kernel.org/r/20230612111403.100613-4-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Use bool type for boolean valuesUsing u8 for boolean values makes the code a bit more difficult to readso be more explicit by using bool.Signed-off-by: James Clark <james.clark@arm.
perf cs-etm: Use bool type for boolean valuesUsing u8 for boolean values makes the code a bit more difficult to readso be more explicit by using bool.Signed-off-by: James Clark <james.clark@arm.com>Cc: Adrian Hunter <adrian.hunter@intel.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Denis Nikitin <denik@google.com>Cc: Ian Rogers <irogers@google.com>Cc: Ingo Molnar <mingo@redhat.com>Cc: Jiri Olsa <jolsa@kernel.org>Cc: John Garry <john.g.garry@oracle.com>Cc: Leo Yan <leo.yan@linaro.org>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Cc: Yang Shi <shy828301@gmail.com>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https://lore.kernel.org/r/20230424134748.228137-7-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Handle PERF_RECORD_AUX_OUTPUT_HW_ID packetWhen using dynamically assigned CoreSight trace IDs the drivers can outputthe ID / CPU association as a PERF_RECORD_AUX_OUTPUT_HW_ID packet.
perf cs-etm: Handle PERF_RECORD_AUX_OUTPUT_HW_ID packetWhen using dynamically assigned CoreSight trace IDs the drivers can outputthe ID / CPU association as a PERF_RECORD_AUX_OUTPUT_HW_ID packet.Update cs-etm decoder to handle this packet by setting the CPU/Trace IDmapping.Reviewed-by: James Clark <james.clark@arm.com>Signed-off-by: Mike Leach <mike.leach@linaro.org>Acked-by: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Darren Hart <darren@os.amperecomputing.com>Cc: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>Cc: Ingo Molnar <mingo@redhat.com>Cc: Jiri Olsa <jolsa@kernel.org>Cc: Leo Yan <leo.yan@linaro.org>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https://lore.kernel.org/r/20230331055645.26918-2-mike.leach@linaro.orgSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Update decoder code for OpenCSD version 1.4OpenCSD version 1.4 is released with support for FEAT_ITE.This adds a new packet type, with associated output element ID in thepacket type
perf cs-etm: Update decoder code for OpenCSD version 1.4OpenCSD version 1.4 is released with support for FEAT_ITE.This adds a new packet type, with associated output element ID in thepacket type enum - OCSD_GEN_TRC_ELEM_INSTRUMENTATION.As we just ignore this packet in perf, add to the switch statement toavoid the "enum not handled in switch error", but conditionally so asnot to break the perf build for older OpenCSD installations.Reviewed-by: James Clark <james.clark@arm.com>Signed-off-by: Mike Leach <mike.leach@linaro.org>Acked-by: Ian Rogers <irogers@google.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Ingo Molnar <mingo@redhat.com>Cc: Jiri Olsa <jolsa@kernel.org>Cc: Leo Yan <leo.yan@linaro.org>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https://lore.kernel.org/r/20230120153706.20388-1-mike.leach@linaro.orgSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Ensure that Coresight timestamps don't go backwardsThere are some edge cases around estimated timestamps that can resultin them going backwards.One is that after a discontinuity, th
perf cs-etm: Ensure that Coresight timestamps don't go backwardsThere are some edge cases around estimated timestamps that can resultin them going backwards.One is that after a discontinuity, the last used timestamp is set to 0.The duration of the next range is then subtracted which could result inan earlier timestamp than the last instruction. Fix this by notresetting the last timestamp used on a discontinuity, and make sure thatnew estimated timestamps are clamped to be later than that.Another case is that estimated timestamps could compound over time toend up being more than the next real timestamp in the trace. Fix this byclamping the estimates in cs_etm_decoder__do_soft_timestamp() to be nolater than it.cs_etm_decoder__do_soft_timestamp() also updated next_cs_timestamp,which meant that the next real timestamp was lost and not storedanywhere. Fix that by only updating cs_timestamp for estimates and keepnext_cs_timestamp untouched.Finally, use next_cs_timestamp to signify if a timestamp has beenreceived previously. Because cs_timestamp has the first rangesubtracted, it could technically go to 0 which would break the logic.Testing=======It can be verified that timestamps don't go backwards when tracing on asingle core with the following commands. Across multiple cores it'sexpected that timestamps are interleaved: $ perf record -e cs_etm/@tmc_etr0/k -C 4 taskset -c 4 sleep 1 $ perf script --itrace=i1ns --ns -Fcomm,tid,pid,time,cpu,event,ip,sym,addr,symoff,flags,callindent > itrace $ sed 's/://g' itrace | awk -F ' ' ' { print $4 } ' | awk '{ if ($1 < prev) { print "line:" NR " " $0 } {prev=$1}}'Reported-by: Tanmay Jagdale <tanmay@marvell.com>Signed-off-by: James Clark <james.clark@arm.com>Acked-by: Suzuki Poulouse <suzuki.poulose@arm.com>Tested-by: Tanmay Jagdale <tanmay@marvell.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Bharat Bhushan <bbhushan2@marvell.com>Cc: George Cherian <gcherian@marvell.com>Cc: Ingo Molnar <mingo@redhat.com>Cc: Jiri Olsa <jolsa@kernel.org>Cc: John Garry <john.g.garry@oracle.com>Cc: Leo Yan <leo.yan@linaro.org>Cc: Linu Cherian <lcherian@marvell.com>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Sunil Kovvuri Goutham <sgoutham@marvell.com>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https://lore.kernel.org/r/20230120143702.4035046-9-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs_etm: Set the time field in the synthetic samplesIf virtual timestamps are detected, set sample time field accordingly,otherwise warn the user that the samples will not include accuratetim
perf cs_etm: Set the time field in the synthetic samplesIf virtual timestamps are detected, set sample time field accordingly,otherwise warn the user that the samples will not include accuratetime data. | Test notes (FEAT_TRF platform) | | $ ./perf record -e cs_etm//u -a -- sleep 4 | $ ./perf script --fields +time | perf 422 [000] 163.375100: 1 branches:uH: 0 [unknown] ([unknown]) | perf 422 [000] 163.375100: 1 branches:uH: ffffb8009544 ioctl+0x14 (/lib/aarch64-linux-gnu/libc-2.27.so) | perf 422 [000] 163.375100: 1 branches:uH: aaaaab6bebf4 perf_evsel__run_ioctl+0x90 (/home/german/linux/tools/perf/perf) | [...] | perf 422 [000] 167.393100: 1 branches:uH: aaaaab6bda00 __xyarray__entry+0x74 (/home/german/linux/tools/perf/perf) | perf 422 [000] 167.393099: 1 branches:uH: aaaaab6bda0c __xyarray__entry+0x80 (/home/german/linux/tools/perf/perf) | perf 422 [000] 167.393099: 1 branches:uH: ffffb8009538 ioctl+0x8 (/lib/aarch64-linux-gnu/libc-2.27.so) | | The time from the first sample to the last sample is 4 secondsNow that times are converted to nanoseconds, also try to estimate thetimestamps more accurately be dividing by some fixed value forinstructions per ns. This prevents long ranges from being estimatedtoo far in the past than would be realistic.Signed-off-by: German Gomez <german.gomez@arm.com>Acked-by: Suzuki Poulouse <suzuki.poulose@arm.com>Tested-by: Tanmay Jagdale <tanmay@marvell.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Bharat Bhushan <bbhushan2@marvell.com>Cc: George Cherian <gcherian@marvell.com>Cc: Ingo Molnar <mingo@redhat.com>Cc: Jiri Olsa <jolsa@kernel.org>Cc: John Garry <john.g.garry@oracle.com>Cc: Leo Yan <leo.yan@linaro.org>Cc: Linu Cherian <lcherian@marvell.com>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Peter Zijlstra <peterz@infradead.org>Cc: Sunil Kovvuri Goutham <sgoutham@marvell.com>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https://lore.kernel.org/r/20230120143702.4035046-8-james.clark@arm.comSigned-off-by: James Clark <james.clark@arm.com>Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Print the decoder nameUse the real name of the decoder instead of hard-coding "ETM" to avoidconfusion when the trace is ETE. This also now distinguishes betweenETMv3 and ETMv4.Revi
perf cs-etm: Print the decoder nameUse the real name of the decoder instead of hard-coding "ETM" to avoidconfusion when the trace is ETE. This also now distinguishes betweenETMv3 and ETMv4.Reviewed-by: Leo Yan <leo.yan@linaro.org>Reviewed-by: Suzuki Poulouse <suzuki.poulose@arm.com>Signed-off-by: James Clark <james.clark@arm.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Jiri Olsa <jolsa@redhat.com>Cc: John Garry <john.garry@huawei.com>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https //lore.kernel.org/r/20210806134109.1182235-9-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Create ETE decoderIf the magic number indicates ETE instantiate a OCSD_BUILTIN_DCD_ETEdecoder instead of OCSD_BUILTIN_DCD_ETMV4I. ETE is the new trace featurefor Armv9.Testing perf
perf cs-etm: Create ETE decoderIf the magic number indicates ETE instantiate a OCSD_BUILTIN_DCD_ETEdecoder instead of OCSD_BUILTIN_DCD_ETMV4I. ETE is the new trace featurefor Armv9.Testing performed=================* Old files with v0 and v1 headers for ETMv4 still open correctly* New files with new magic number open on new versions of perf* New files with new magic number fail to open on old versions of perf* Decoding with the ETE decoder results in the same output as the ETMv4 decoder as long as there are no new ETE packet typesReviewed-by: Leo Yan <leo.yan@linaro.org>Signed-off-by: James Clark <james.clark@arm.com>Acked-by: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Jiri Olsa <jolsa@redhat.com>Cc: John Garry <john.garry@huawei.com>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https //lore.kernel.org/r/20210806134109.1182235-8-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Update OpenCSD decoder for ETEOpenCSD v1.1.1 has a bug fix for the installation of the ETE decoderheaders. This also means that including headers separately for eachdecoder is unnece
perf cs-etm: Update OpenCSD decoder for ETEOpenCSD v1.1.1 has a bug fix for the installation of the ETE decoderheaders. This also means that including headers separately for eachdecoder is unnecessary so remove these.Reviewed-by: Leo Yan <leo.yan@linaro.org>Signed-off-by: James Clark <james.clark@arm.com>Acked-by: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Jiri Olsa <jolsa@redhat.com>Cc: John Garry <john.garry@huawei.com>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https //lore.kernel.org/r/20210806134109.1182235-7-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Initialise architecture based on TRCIDR1Currently the architecture is hard coded as ARCH_V8, but from ETMv4.4onwards this should be ARCH_AA64.Reviewed-by: Leo Yan <leo.yan@linaro.or
perf cs-etm: Initialise architecture based on TRCIDR1Currently the architecture is hard coded as ARCH_V8, but from ETMv4.4onwards this should be ARCH_AA64.Reviewed-by: Leo Yan <leo.yan@linaro.org>Signed-off-by: James Clark <james.clark@arm.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Jiri Olsa <jolsa@redhat.com>Cc: John Garry <john.garry@huawei.com>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https //lore.kernel.org/r/20210806134109.1182235-3-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Refactor initialisation of decoder params.The initialisation of the decoder params is duplicated betweencreation of the packet printer and packet decoder. Put them bothinto one funct
perf cs-etm: Refactor initialisation of decoder params.The initialisation of the decoder params is duplicated betweencreation of the packet printer and packet decoder. Put them bothinto one function so that future changes only need to be made in oneplace.Reviewed-by: Leo Yan <leo.yan@linaro.org>Signed-off-by: James Clark <james.clark@arm.com>Acked-by: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Jiri Olsa <jolsa@redhat.com>Cc: John Garry <john.garry@huawei.com>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https //lore.kernel.org/r/20210806134109.1182235-2-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Improve Coresight zero timestamp warningOnly show the warning if the user hasn't already set timeless mode andimprove the text because there was ambiguity around the meaning of '...'
perf cs-etm: Improve Coresight zero timestamp warningOnly show the warning if the user hasn't already set timeless mode andimprove the text because there was ambiguity around the meaning of '...'Change the warning to a UI warning instead of printing straight tostderr because this corrupts the UI when perf report TUI is used. The UIwarning function also handles printing to stderr when in perf scriptmode.Suggested-by: Leo Yan <leo.yan@linaro.org>Signed-off-by: James Clark <james.clark@arm.com>Reviewed-by: Leo Yan <leo.yan@linaro.org>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Jiri Olsa <jolsa@redhat.com>Cc: John Garry <john.garry@huawei.com>Cc: Leo Yan <leo.yan@linaro.org>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: http://lore.kernel.org/lkml/20210729155805.2830-6-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Pass unformatted flag to decoderThe TRBE (Trace Buffer Extension) feature allows a separate trace bufferfor each trace source, therefore the trace wouldn't need to beformatted. The d
perf cs-etm: Pass unformatted flag to decoderThe TRBE (Trace Buffer Extension) feature allows a separate trace bufferfor each trace source, therefore the trace wouldn't need to beformatted. The driver was introduced in commit 3fbf7f011f24("coresight: sink: Add TRBE driver").The formatted/unformatted mode is encoded in one of the flags of theAUX record. The first AUX record encountered for each event is used todetermine the mode, and this will persist for the remaining trace thatis either decoded or dumped.Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>Signed-off-by: James Clark <james.clark@arm.com>Cc: Al Grant <al.grant@arm.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Anshuman Khandual <anshuman.khandual@arm.com>Cc: Arnaldo Carvalho de Melo <acme@kernel.org>Cc: Jiri Olsa <jolsa@redhat.com>Cc: John Garry <john.garry@huawei.com>Cc: Leo Yan <leo.yan@linaro.org>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https //lore.kernel.org/r/20210721150202.32065-7-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Suppress printing when resetting decoderThe decoder is quite noisy when being reset. In a future commit,dump-raw-trace will use a code path that resets the decoder rather thancreatin
perf cs-etm: Suppress printing when resetting decoderThe decoder is quite noisy when being reset. In a future commit,dump-raw-trace will use a code path that resets the decoder rather thancreating a new one, so printing has to be suppressed to not flood theoutput.Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>Signed-off-by: James Clark <james.clark@arm.com>Cc: Al Grant <al.grant@arm.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Anshuman Khandual <anshuman.khandual@arm.com>Cc: Arnaldo Carvalho de Melo <acme@kernel.org>Cc: Jiri Olsa <jolsa@redhat.com>Cc: John Garry <john.garry@huawei.com>Cc: Leo Yan <leo.yan@linaro.org>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: https //lore.kernel.org/r/20210721150202.32065-5-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Prevent and warn on underflows during timestamp calculation.When a zero timestamp is encountered, warn once. This is to makehardware or configuration issues visible. Also suggest that
perf cs-etm: Prevent and warn on underflows during timestamp calculation.When a zero timestamp is encountered, warn once. This is to makehardware or configuration issues visible. Also suggest that the issuecan be worked around with the --itrace=Z option.When an underflow with a non-zero timestamp occurs, warn every time.This is an unexpected scenario, and with increasing timestamps, it'sunlikely that it would occur more than once, therefore it should beok to warn every time.Only try to calculate the timestamp by subtracting the instructioncount if neither of the above cases are true. This makes attemptingto decode files with zero timestamps in non-timeless modemore consistent. Currently it can half work if the timestamp wrapsaround and becomes non-zero, although the behavior is undefined andunpredictable.Signed-off-by: James Clark <james.clark@arm.com>Reviewed-by: Leo Yan <leo.yan@linaro.org>Cc: Al Grant <al.grant@arm.com>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Anshuman Khandual <anshuman.khandual@arm.com>Cc: Branislav Rankov <branislav.rankov@arm.com>Cc: Denis Nikitin <denik@chromium.org>Cc: Jiri Olsa <jolsa@redhat.com>Cc: John Garry <john.garry@huawei.com>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Cc: coresight@lists.linaro.orgCc: linux-arm-kernel@lists.infradead.orgLink: http://lore.kernel.org/lkml/20210517131741.3027-4-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Refactor timestamp variable namesRemove ambiguity in variable names relating to timestamps.A later commit will save the sample kernel timestamp in one of the etmstructs, so name all
perf cs-etm: Refactor timestamp variable namesRemove ambiguity in variable names relating to timestamps.A later commit will save the sample kernel timestamp in one of the etmstructs, so name all elements appropriately to avoid confusion.This is also removes some ambiguity arising from the fact that the--timestamp argument to perf record refers to sample kernel timestamps,and the /timestamp/ event modifier refers to CS timestamps, so the termis overloaded.Signed-off-by: James Clark <james.clark@arm.com>Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>Cc: Al Grant <al.grant@arm.com>Cc: Anshuman Khandual <anshuman.khandual@arm.com>Cc: Branislav Rankov <branislav.rankov@arm.com>Cc: Denis Nikitin <denik@chromium.org>Cc: Jiri Olsa <jolsa@redhat.com>Cc: John Garry <john.garry@huawei.com>Cc: Leo Yan <leo.yan@linaro.org>Cc: Mark Rutland <mark.rutland@arm.com>Cc: Mike Leach <mike.leach@linaro.org>Cc: Namhyung Kim <namhyung@kernel.org>Cc: Suzuki Poulouse <suzuki.poulose@arm.com>Cc: Will Deacon <will@kernel.org>Cc: linux-arm-kernel@lists.infradead.orgCc: coresight@lists.linaro.orgLink: https://lore.kernel.org/r/20210510143248.27423-2-james.clark@arm.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf tools: Fix various typos in commentsFix ~124 single-word typos and a few spelling errors in the perf tooling code,accumulated over the years.Signed-off-by: Ingo Molnar <mingo@kernel.org>Cc
perf tools: Fix various typos in commentsFix ~124 single-word typos and a few spelling errors in the perf tooling code,accumulated over the years.Signed-off-by: Ingo Molnar <mingo@kernel.org>Cc: Peter Zijlstra <peterz@infradead.org>Link: https://lore.kernel.org/r/20210321113734.GA248990@gmail.comLink: http://lore.kernel.org/lkml/20210323160915.GA61903@gmail.comSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
perf cs-etm: Detect pid in VMID for kernel running at EL2The PID of the task could be traced as VMID when the kernel is runningat EL2. Teach the decoder to look for VMID when the CONTEXTIDR (Arm3
perf cs-etm: Detect pid in VMID for kernel running at EL2The PID of the task could be traced as VMID when the kernel is runningat EL2. Teach the decoder to look for VMID when the CONTEXTIDR (Arm32)or CONTEXTIDR_EL1 (Arm64) is invalid but we have a valid VMID.Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>Co-developed-by: Leo Yan <leo.yan@linaro.org>Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>Cc: Al Grant <al.grant@arm.com>Cc: Mike Leach <mike.leach@linaro.org>Link: https://lore.kernel.org/r/20210213113220.292229-6-leo.yan@linaro.orgLink: https://lore.kernel.org/r/20210224164835.3497311-7-mathieu.poirier@linaro.orgSigned-off-by: Leo Yan <leo.yan@linaro.org>Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
123