perf intel-pt: Add reserved byte to CBR packet payload
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 26 May 2017 08:17:15 +0000 (11:17 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 21 Jun 2017 14:35:50 +0000 (11:35 -0300)
Future proof CBR packet decoding by passing through also the undefined
'reserved' byte in the packet payload.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1495786658-18063-15-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c

index e42804d100012fae0fc17c1a3b25643b080005c7..96bf8d8e83c08a8b63e6ac1449ca183e5ed0f62f 100644 (file)
@@ -1444,7 +1444,7 @@ static void intel_pt_calc_mtc_timestamp(struct intel_pt_decoder *decoder)
 
 static void intel_pt_calc_cbr(struct intel_pt_decoder *decoder)
 {
-       unsigned int cbr = decoder->packet.payload;
+       unsigned int cbr = decoder->packet.payload & 0xff;
 
        if (decoder->cbr == cbr)
                return;
index accdb646a03d9bb44de2bcc317037c2d4a0717e5..ba4c9dd186434a33c8c33a59ab8884fd7c679dd3 100644 (file)
@@ -130,7 +130,7 @@ static int intel_pt_get_cbr(const unsigned char *buf, size_t len,
        if (len < 4)
                return INTEL_PT_NEED_MORE_BYTES;
        packet->type = INTEL_PT_CBR;
-       packet->payload = buf[2];
+       packet->payload = le16_to_cpu(*(uint16_t *)(buf + 2));
        return 4;
 }