]> git.baikalelectronics.ru Git - kernel.git/commit
perf arm-spe: Fix packet length handling
authorLeo Yan <leo.yan@linaro.org>
Wed, 11 Nov 2020 07:11:32 +0000 (15:11 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 11 Nov 2020 17:45:05 +0000 (14:45 -0300)
commit5ee024e21d87b26dad93bb1792b450285b748022
tree8090fbee5337bc2c7f2149bb33f34d58f7c88b4d
parent74e945394627ef6cef0f3694c25e88549377c47d
perf arm-spe: Fix packet length handling

When processing address packet and counter packet, if the packet
contains extended header, it misses to account the extra one byte for
header length calculation, thus returns the wrong packet length.

To correct the packet length calculation, one possible fixing is simply
to plus extra 1 for extended header, but will spread some duplicate code
in the flows for processing address packet and counter packet.
Alternatively, we can refine the function arm_spe_get_payload() to not
only support short header and allow it to support extended header, and
rely on it for the packet length calculation.

So this patch refactors function arm_spe_get_payload() with a new
argument 'ext_hdr' for support extended header; the packet processing
flows can invoke this function to unify the packet length calculation.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Link: https://lore.kernel.org/r/20201111071149.815-6-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/arm-spe-decoder/arm-spe-pkt-decoder.c