This patch seris adds support for sample flags so can facilitate perf to print sample flags for branch instruction.
Patch 0001 is used to save last branch information in packet structure, this includes instruction type, subtype and condition flag to help making decision for which branch instruction it is. It passes related information from decoder layer to cs-etm.c, so we use cs-etm.c as a central place to set sample flags.
Patch 0002 is used to set sample flags for instruction range packet.
Patch 0003 is used to set sample flags for trace discontinuity packet.
Patch 0004 addes exception number in packet, so this is preparation for patch 0005 to set sample flags for exception packet; patch 0005 support ETMv3/ETMv4 exception packet together.
The patch series is based on OpenCSD v0.10.0 and later versions (so far the latest version is v0.10.1 when wrote this patch series).
This patch series is applied on the acme's perf core branch [1] with the with latest commit aaab25f03e9e ("perf trace: Allow selecting use the use of the ordered_events code") and has dependency on patch series 'perf cs-etm: Correct packets handling' [2].
After applying the dependency patches and this patch series, we can verify sample flags with below command:
# perf script -F,-time,+flags,+ip,+sym,+dso,+addr,+symoff -k vmlinux
Changes from v1: * Addressed Mathieu's suggestion to split one big patch to 3 small patches for setting sample flags, one is for instruction range packet, one is for discontinuity packet and one is for exception packet. * Added supporting for ETMv3 exception packet. * Followed Mathieu's suggestion to move all sample flags handling from decoder layer to cs-etm.c, thus it has enough info to set flags based on trace context in single place.
Changes from v1: * Moved exception packets handling patches into patch series 'perf cs-etm: Correct packets handling'. * Added sample flags fixing up for TRACE_OFF packet. * Created a new function which is used to maintain flags fixing up.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/c... [2] https://lkml.org/lkml/2018/12/11/73
Leo Yan (5): perf cs-etm: Add last instruction information in packet perf cs-etm: Set sample flags for instruction range packet perf cs-etm: Set sample flags for trace discontinuity perf cs-etm: Add exception number in exception packet perf cs-etm: Set sample flags for exception packet
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 29 ++- tools/perf/util/cs-etm-decoder/cs-etm-decoder.h | 5 + tools/perf/util/cs-etm.c | 227 +++++++++++++++++++++++- tools/perf/util/cs-etm.h | 36 ++++ 4 files changed, 291 insertions(+), 6 deletions(-)