Skip to contentSkip to conversation

perf intel-pt: Fix packet decoding of CYC packets

PATCH Applied Adrian Hunter 3 participants 3 messages Jun 7, 2018 – Jun 26, 2018 perf events

lore
Share & tools
lore

Adrian Hunter

author reviewer
#0 lore raw

PATCH 1/1 perf intel-pt: Fix packet decoding of CYC packets

Use a 64-bit type so that the cycle count is not limited to 32-bits.

---
 tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +1 -1
index ba4c9dd18643..d426761a549d 100644
@@ -366,7 +366,7 @@ static int intel_pt_get_cyc(unsigned int byte, const unsigned char *buf,
 		if (len < offs)
 			return INTEL_PT_NEED_MORE_BYTES;
 		byte = buf[offs++];
-		payload |= (byte >> 1) << shift;
+		payload |= ((uint64_t)byte >> 1) << shift;
 	}
 
 	packet->type = INTEL_PT_CYC;
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw

Em Thu, Jun 07, 2018 at 02:30:02PM +0300, Adrian Hunter escreveu:

Quoted 4 lines

Use a 64-bit type so that the cycle count is not limited to 32-bits.

Thanks, applied.

- Arnaldo

Quoted 19 lines
---
 tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +1 -1
index ba4c9dd18643..d426761a549d 100644
@@ -366,7 +366,7 @@ static int intel_pt_get_cyc(unsigned int byte, const unsigned char *buf,
 		if (len < offs)
 			return INTEL_PT_NEED_MORE_BYTES;
 		byte = buf[offs++];
-		payload |= (byte >> 1) << shift;
+		payload |= ((uint64_t)byte >> 1) << shift;
 	}
 
 	packet->type = INTEL_PT_CYC;
Signature · 1 line
1.9.1
#2 lore raw
In reply to Adrian Hunter
perf intel-pt: Fix packet decoding of CYC packets
Commit-ID:  621a5a327c1e36ffd7bb567f44a559f64f76358f
Gitweb:     https://git.kernel.org/tip/621a5a327c1e36ffd7bb567f44a559f64f76358f
Author:     Adrian Hunter <[email protected]>
AuthorDate: Thu, 7 Jun 2018 14:30:02 +0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 25 Jun 2018 11:59:36 -0300

perf intel-pt: Fix packet decoding of CYC packets

Use a 64-bit type so that the cycle count is not limited to 32-bits.

---
 tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +1 -1
index ba4c9dd18643..d426761a549d 100644
@@ -366,7 +366,7 @@ static int intel_pt_get_cyc(unsigned int byte, const unsigned char *buf,
 		if (len < offs)
 			return INTEL_PT_NEED_MORE_BYTES;
 		byte = buf[offs++];
-		payload |= (byte >> 1) << shift;
+		payload |= ((uint64_t)byte >> 1) << shift;
 	}
 
 	packet->type = INTEL_PT_CYC;