Skip to contentSkip to conversation

perf tools: Update OpenCSD to v1.0.0

PATCH Applied James Clark 4 participants 4 messages Jan 8, 2021 – Jan 15, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tools: Update OpenCSD to v1.0.0

Replace the OCSD_INSTR switch statement with an if to fix compilation error about unhandled values and avoid this issue again in the future.

Add new OCSD_GEN_TRC_ELEM_SYNC_MARKER and OCSD_GEN_TRC_ELEM_MEMTRANS enum values to fix unhandled value compilation error. Currently they are ignored.

Increase the minimum version number to v1.0.0 now that new enum values are used that are only present in this version.

Cc John Garry <[email protected]>
Cc Will Deacon <[email protected]>
Cc Mathieu Poirier <[email protected]>
Cc Leo Yan <[email protected]>
Cc Suzuki K Poulose <[email protected]>
Cc Mike Leach <[email protected]>
Cc Al Grant <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/build/feature/test-libopencsd.c           |  4 ++--
 tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 15 ++++-----------
 2 files changed, 6 insertions(+), 13 deletions(-)
tools/build/feature/test-libopencsd.c +2 -2
index 1547bc2c0950..52c790b0317b 100644
@@ -4,9 +4,9 @@
 /*
  * Check OpenCSD library version is sufficient to provide required features
  */
-#define OCSD_MIN_VER ((0 << 16) | (14 << 8) | (0))
+#define OCSD_MIN_VER ((1 << 16) | (0 << 8) | (0))
 #if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER)
-#error "OpenCSD >= 0.14.0 is required"
+#error "OpenCSD >= 1.0.0 is required"
 #endif
 
 int main(void)
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +4 -11
index cd007cc9c283..3f4bc4050477 100644
@@ -419,19 +419,10 @@ cs_etm_decoder__buffer_range(struct cs_etm_queue *etmq,
 	packet->last_instr_subtype = elem->last_i_subtype;
 	packet->last_instr_cond = elem->last_instr_cond;
 
-	switch (elem->last_i_type) {
-	case OCSD_INSTR_BR:
-	case OCSD_INSTR_BR_INDIRECT:
+	if (elem->last_i_type == OCSD_INSTR_BR || elem->last_i_type == OCSD_INSTR_BR_INDIRECT)
 		packet->last_instr_taken_branch = elem->last_instr_exec;
-		break;
-	case OCSD_INSTR_ISB:
-	case OCSD_INSTR_DSB_DMB:
-	case OCSD_INSTR_WFI_WFE:
-	case OCSD_INSTR_OTHER:
-	default:
+	else
 		packet->last_instr_taken_branch = false;
-		break;
-	}
 
 	packet->last_instr_size = elem->last_instr_sz;
 
@@ -572,6 +563,8 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
 	case OCSD_GEN_TRC_ELEM_EVENT:
 	case OCSD_GEN_TRC_ELEM_SWTRACE:
 	case OCSD_GEN_TRC_ELEM_CUSTOM:
+	case OCSD_GEN_TRC_ELEM_SYNC_MARKER:
+	case OCSD_GEN_TRC_ELEM_MEMTRANS:
 	default:
 		break;
 	}
Signature · 1 line
2.28.0
Reviewed-by Tested-by on v1 1/1
#1 lore raw

Hi James,

I have tested this with OpenCSD v1.0.0 + Linux 5.11-rc2.

Quoted 85 lines · James Clark

Replace the OCSD_INSTR switch statement with an if to fix compilation error about unhandled values and avoid this issue again in the future.

Add new OCSD_GEN_TRC_ELEM_SYNC_MARKER and OCSD_GEN_TRC_ELEM_MEMTRANS enum values to fix unhandled value compilation error. Currently they are ignored.

Increase the minimum version number to v1.0.0 now that new enum values are used that are only present in this version.

Cc John Garry <[email protected]>
Cc Will Deacon <[email protected]>
Cc Mathieu Poirier <[email protected]>
Cc Leo Yan <[email protected]>
Cc Suzuki K Poulose <[email protected]>
Cc Mike Leach <[email protected]>
Cc Al Grant <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/build/feature/test-libopencsd.c           |  4 ++--
 tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 15 ++++-----------
 2 files changed, 6 insertions(+), 13 deletions(-)
tools/build/feature/test-libopencsd.c +2 -2
index 1547bc2c0950..52c790b0317b 100644
@@ -4,9 +4,9 @@
 /*
  * Check OpenCSD library version is sufficient to provide required features
  */
-#define OCSD_MIN_VER ((0 << 16) | (14 << 8) | (0))
+#define OCSD_MIN_VER ((1 << 16) | (0 << 8) | (0))
 #if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER)
-#error "OpenCSD >= 0.14.0 is required"
+#error "OpenCSD >= 1.0.0 is required"
 #endif
 
 int main(void)
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +4 -12
index cd007cc9c283..3f4bc4050477 100644
@@ -419,19 +419,10 @@ cs_etm_decoder__buffer_range(struct cs_etm_queue *etmq,
        packet->last_instr_subtype = elem->last_i_subtype;
        packet->last_instr_cond = elem->last_instr_cond;
 
-       switch (elem->last_i_type) {
-       case OCSD_INSTR_BR:
-       case OCSD_INSTR_BR_INDIRECT:
+       if (elem->last_i_type == OCSD_INSTR_BR || elem->last_i_type == OCSD_INSTR_BR_INDIRECT)
                packet->last_instr_taken_branch = elem->last_instr_exec;
-               break;
-       case OCSD_INSTR_ISB:
-       case OCSD_INSTR_DSB_DMB:
-       case OCSD_INSTR_WFI_WFE:
-       case OCSD_INSTR_OTHER:
-       default:
+       else
                packet->last_instr_taken_branch = false;
-               break;
-       }
 
        packet->last_instr_size = elem->last_instr_sz;
 
@@ -572,6 +563,8 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
        case OCSD_GEN_TRC_ELEM_EVENT:
        case OCSD_GEN_TRC_ELEM_SWTRACE:
        case OCSD_GEN_TRC_ELEM_CUSTOM:
+       case OCSD_GEN_TRC_ELEM_SYNC_MARKER:
+       case OCSD_GEN_TRC_ELEM_MEMTRANS:
        default:
                break;
        }
--
Quoted 2 lines

2.28.0

--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK

Reviewed-by on v1 1/1
#2 lore raw
In reply to James Clark
Quoted 75 lines · James Clark

Replace the OCSD_INSTR switch statement with an if to fix compilation error about unhandled values and avoid this issue again in the future.

Add new OCSD_GEN_TRC_ELEM_SYNC_MARKER and OCSD_GEN_TRC_ELEM_MEMTRANS enum values to fix unhandled value compilation error. Currently they are ignored.

Increase the minimum version number to v1.0.0 now that new enum values are used that are only present in this version.

Cc John Garry <[email protected]>
Cc Will Deacon <[email protected]>
Cc Mathieu Poirier <[email protected]>
Cc Leo Yan <[email protected]>
Cc Suzuki K Poulose <[email protected]>
Cc Mike Leach <[email protected]>
Cc Al Grant <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/build/feature/test-libopencsd.c           |  4 ++--
 tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 15 ++++-----------
 2 files changed, 6 insertions(+), 13 deletions(-)
tools/build/feature/test-libopencsd.c +2 -2
index 1547bc2c0950..52c790b0317b 100644
@@ -4,9 +4,9 @@
 /*
  * Check OpenCSD library version is sufficient to provide required features
  */
-#define OCSD_MIN_VER ((0 << 16) | (14 << 8) | (0))
+#define OCSD_MIN_VER ((1 << 16) | (0 << 8) | (0))
 #if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER)
-#error "OpenCSD >= 0.14.0 is required"
+#error "OpenCSD >= 1.0.0 is required"
 #endif
 
 int main(void)
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +2 -11
index cd007cc9c283..3f4bc4050477 100644
@@ -419,19 +419,10 @@ cs_etm_decoder__buffer_range(struct cs_etm_queue *etmq,
 	packet->last_instr_subtype = elem->last_i_subtype;
 	packet->last_instr_cond = elem->last_instr_cond;
 
-	switch (elem->last_i_type) {
-	case OCSD_INSTR_BR:
-	case OCSD_INSTR_BR_INDIRECT:
+	if (elem->last_i_type == OCSD_INSTR_BR || elem->last_i_type == OCSD_INSTR_BR_INDIRECT)
 		packet->last_instr_taken_branch = elem->last_instr_exec;
-		break;
-	case OCSD_INSTR_ISB:
-	case OCSD_INSTR_DSB_DMB:
-	case OCSD_INSTR_WFI_WFE:
-	case OCSD_INSTR_OTHER:
-	default:
+	else
 		packet->last_instr_taken_branch = false;
-		break;
-	}
 
 	packet->last_instr_size = elem->last_instr_sz;
 

tools/perf/util/cs-etm-decoder/cs-etm-decoder.c static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer( · line 569

Quoted 7 lines
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +2 -0
@@ -572,6 +563,8 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
 	case OCSD_GEN_TRC_ELEM_EVENT:
 	case OCSD_GEN_TRC_ELEM_SWTRACE:
 	case OCSD_GEN_TRC_ELEM_CUSTOM:
+	case OCSD_GEN_TRC_ELEM_SYNC_MARKER:
+	case OCSD_GEN_TRC_ELEM_MEMTRANS:
 	default:
 		break;

Arnaldo please consider.

Thanks,
Mathieu

Quoted 4 lines
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +0 -0
 	}
Signature · 1 line
2.28.0
maintainer Applied
#3 lore raw

Em Mon, Jan 11, 2021 at 09:56:04AM -0700, Mathieu Poirier escreveu:

Quoted 86 lines · James Clark
Quoted 75 lines

Replace the OCSD_INSTR switch statement with an if to fix compilation error about unhandled values and avoid this issue again in the future.

Add new OCSD_GEN_TRC_ELEM_SYNC_MARKER and OCSD_GEN_TRC_ELEM_MEMTRANS enum values to fix unhandled value compilation error. Currently they are ignored.

Increase the minimum version number to v1.0.0 now that new enum values are used that are only present in this version.

Cc John Garry <[email protected]>
Cc Will Deacon <[email protected]>
Cc Mathieu Poirier <[email protected]>
Cc Leo Yan <[email protected]>
Cc Suzuki K Poulose <[email protected]>
Cc Mike Leach <[email protected]>
Cc Al Grant <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/build/feature/test-libopencsd.c           |  4 ++--
 tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 15 ++++-----------
 2 files changed, 6 insertions(+), 13 deletions(-)
tools/build/feature/test-libopencsd.c +2 -2
index 1547bc2c0950..52c790b0317b 100644
@@ -4,9 +4,9 @@
 /*
  * Check OpenCSD library version is sufficient to provide required features
  */
-#define OCSD_MIN_VER ((0 << 16) | (14 << 8) | (0))
+#define OCSD_MIN_VER ((1 << 16) | (0 << 8) | (0))
 #if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER)
-#error "OpenCSD >= 0.14.0 is required"
+#error "OpenCSD >= 1.0.0 is required"
 #endif
 
 int main(void)
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +2 -11
index cd007cc9c283..3f4bc4050477 100644
@@ -419,19 +419,10 @@ cs_etm_decoder__buffer_range(struct cs_etm_queue *etmq,
 	packet->last_instr_subtype = elem->last_i_subtype;
 	packet->last_instr_cond = elem->last_instr_cond;
 
-	switch (elem->last_i_type) {
-	case OCSD_INSTR_BR:
-	case OCSD_INSTR_BR_INDIRECT:
+	if (elem->last_i_type == OCSD_INSTR_BR || elem->last_i_type == OCSD_INSTR_BR_INDIRECT)
 		packet->last_instr_taken_branch = elem->last_instr_exec;
-		break;
-	case OCSD_INSTR_ISB:
-	case OCSD_INSTR_DSB_DMB:
-	case OCSD_INSTR_WFI_WFE:
-	case OCSD_INSTR_OTHER:
-	default:
+	else
 		packet->last_instr_taken_branch = false;
-		break;
-	}
 
 	packet->last_instr_size = elem->last_instr_sz;
 

tools/perf/util/cs-etm-decoder/cs-etm-decoder.c static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer( · line 569

Quoted 7 lines
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +2 -0
@@ -572,6 +563,8 @@ static ocsd_datapath_resp_t cs_etm_decoder__gen_trace_elem_printer(
 	case OCSD_GEN_TRC_ELEM_EVENT:
 	case OCSD_GEN_TRC_ELEM_SWTRACE:
 	case OCSD_GEN_TRC_ELEM_CUSTOM:
+	case OCSD_GEN_TRC_ELEM_SYNC_MARKER:
+	case OCSD_GEN_TRC_ELEM_MEMTRANS:
 	default:
 		break;
Quoted 1 line

Arnaldo please consider.

Thanks, applied.

- Arnaldo