fix(telemetry): fix perfmon issues on Arm 47/42047/7
authorJay Wang <[email protected]>
Wed, 18 Dec 2024 16:07:31 +0000 (16:07 +0000)
committerJay Wang <[email protected]>
Sun, 5 Jan 2025 10:59:15 +0000 (10:59 +0000)
To enable perfmon plugin on AArch64, users have to set
kernel/perf_user_access to 1 to allow userspace applications to directly
access PMU counters. Additionally, replace bundle cache-hierarchy with
bundle cache-data as it is the correct bundle name on AArch64.

Signed-off-by: Jay Wang <[email protected]>
Change-Id: I67b86e255c8e62d3672a8f52db88eed3daf6ff59

resources/libraries/python/TelemetryUtil.py
resources/libraries/robot/performance/performance_actions.robot
resources/templates/telemetry/vppctl_runtime_arm.yaml [new file with mode: 0644]

index 63d0bf6..1dbb2d4 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2022 Cisco and/or its affiliates.
+# Copyright (c) 2025 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
@@ -16,7 +16,8 @@
 from resources.libraries.python.model.ExportResult import append_telemetry
 from resources.libraries.python.Constants import Constants
 from resources.libraries.python.ssh import exec_cmd_no_error
-from resources.libraries.python.topology import NodeType
+from resources.libraries.python.topology import Topology, NodeType
+from resources.libraries.python.SysctlUtil import SysctlUtil
 
 __all__ = ["TelemetryUtil"]
 
@@ -51,6 +52,10 @@ class TelemetryUtil:
         cd_cmd += f"sh -c \"cd {Constants.REMOTE_FW_DIR}/"
         cd_cmd += f"{Constants.RESOURCES_TOOLS}"
 
+        # Allow userspace to directly access perf counters on aarch64
+        if Topology.get_node_arch(node) == u"aarch64":
+            SysctlUtil.set_sysctl_value(node, u"kernel/perf_user_access", 1)
+
         if spath:
             bin_cmd = f"python3 -m telemetry --config {config} --hook {spath}\""
         else:
index d588bc9..df520e0 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2025 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
 | | ${transaction_scale} = | Get Transaction Scale
 | | ${transaction_type} = | Get Transaction Type
 | | ${use_latency} = | Get Use Latency
+| | ${node_arch} = | Get Node Arch | ${nodes[u'DUT1']}
+| | ${profile} = | Set Variable If | "${node_arch}" == "aarch64"
+| | ... | vppctl_runtime_arm.yaml | vppctl_runtime.yaml
 | | Send traffic on tg
 | | ... | duration=${-1}
 | | ... | rate=${runtime_rate}
 | | ... | ramp_up_duration=${ramp_up_duration}
 | | ... | ramp_up_rate=${ramp_up_rate}
 | | Run Telemetry On All DUTs
-| | ... | ${nodes} | profile=vppctl_runtime.yaml
+| | ... | ${nodes} | profile=${profile}
 | | ... | rate=${telemetry_rate} | export=${telemetry_export}
 | | Stop traffic on tg
 
 | | ... | See documentation of the called keyword for required test variables.
 | |
 | | ${runtime_duration} = | Get Runtime Duration
+| | ${node_arch} = | Get Node Arch | ${nodes['${iperf_server_node}']}
+| | ${profile} = | Set Variable If | "${node_arch}" == "aarch64"
+| | ... | vppctl_runtime_arm.yaml | vppctl_runtime.yaml
 | | ${pids}= | iPerf Client Start Remote Exec
 | | | ... | ${nodes['${iperf_client_node}']}
 | | | ... | duration=${-1}
 | | | ... | bind=${iperf_client_bind}
 | | | ... | affinity=${iperf_client_affinity}
 | | Run Telemetry On All DUTs
-| | ... | ${nodes} | profile=vppctl_runtime.yaml
+| | ... | ${nodes} | profile=${profile}
 | | ... | rate=${telemetry_rate} | export=${telemetry_export}
 | | iPerf Client Stop Remote Exec | ${nodes['${iperf_client_node}']} | ${pids}
 
diff --git a/resources/templates/telemetry/vppctl_runtime_arm.yaml b/resources/templates/telemetry/vppctl_runtime_arm.yaml
new file mode 100644 (file)
index 0000000..620439c
--- /dev/null
@@ -0,0 +1,209 @@
+---
+logging:
+  version: 1
+  formatters:
+    console_stdout:
+      format: '%(asctime)s - %(name)s - %(message)s'
+    console_stderr:
+      format: '%(message)s'
+    prom:
+      format: '%(message)s'
+  handlers:
+    console_stdout:
+      class: logging.StreamHandler
+      level: INFO
+      formatter: console_stdout
+      stream: ext://sys.stdout
+    console_stderr:
+      class: logging.StreamHandler
+      level: ERROR
+      formatter: console_stderr
+      stream: ext://sys.stderr
+    prom:
+      class: logging.handlers.RotatingFileHandler
+      level: INFO
+      formatter: prom
+      filename: /tmp/metric.prom
+      mode: w
+  loggers:
+    prom:
+      handlers: [prom]
+      level: INFO
+      propagate: False
+  root:
+    level: INFO
+    handlers: [console_stdout, console_stderr]
+scheduler:
+  duration: 1
+programs:
+  - name: bundle_vppctl
+    metrics:
+      gauge:
+        - name: calls
+          documentation: Number of calls total
+          namespace: vpp
+          subsystem: runtime
+          labelnames:
+            - node_name
+            - state
+            - thread_name
+            - thread_id
+            - thread_lcore
+        - name: vectors
+          documentation: Number of vectors total
+          namespace: vpp
+          subsystem: runtime
+          labelnames:
+            - node_name
+            - state
+            - thread_name
+            - thread_id
+            - thread_lcore
+        - name: suspends
+          documentation: Number of suspends total
+          namespace: vpp
+          subsystem: runtime
+          labelnames:
+            - node_name
+            - state
+            - thread_name
+            - thread_id
+            - thread_lcore
+        - name: clocks
+          documentation: Number of clocks total
+          namespace: vpp
+          subsystem: runtime
+          labelnames:
+            - node_name
+            - state
+            - thread_name
+            - thread_id
+            - thread_lcore
+        - name: vectors_calls
+          documentation: Number of vectors per call
+          namespace: vpp
+          subsystem: runtime
+          labelnames:
+            - node_name
+            - state
+            - thread_name
+            - thread_id
+            - thread_lcore
+    code: |
+      vppctl -s {socket} clear runtime
+      sleep {duration}
+      vppctl -s {socket} show runtime
+  - name: bundle_vppctl
+    metrics:
+      gauge:
+        - name: calls
+          documentation: Instructions/packet, cycles/packet and IPC (calls)
+          namespace: vpp
+          subsystem: inst_and_clock
+          labelnames:
+            - node_name
+            - thread_name
+            - thread_id
+        - name: packets
+          documentation: Instructions/packet, cycles/packet and IPC (packets)
+          namespace: vpp
+          subsystem: inst_and_clock
+          labelnames:
+            - node_name
+            - thread_name
+            - thread_id
+        - name: packets_per_call
+          documentation: Instructions/packet, cycles/packet and IPC (packets/call)
+          namespace: vpp
+          subsystem: inst_and_clock
+          labelnames:
+            - node_name
+            - thread_name
+            - thread_id
+        - name: clocks_per_packets
+          documentation: Instructions/packet, cycles/packet and IPC (clocks/packets)
+          namespace: vpp
+          subsystem: inst_and_clock
+          labelnames:
+            - node_name
+            - thread_name
+            - thread_id
+        - name: instructions_per_packets
+          documentation: Instructions/packet, cycles/packet and IPC (clocks/packets)
+          namespace: vpp
+          subsystem: inst_and_clock
+          labelnames:
+            - node_name
+            - thread_name
+            - thread_id
+        - name: ipc
+          documentation: Instructions/packet, cycles/packet and IPC (clocks/packets)
+          namespace: vpp
+          subsystem: inst_and_clock
+          labelnames:
+            - node_name
+            - thread_name
+            - thread_id
+    code: |
+      vppctl -s {socket} perfmon reset
+      vppctl -s {socket} perfmon start bundle inst-and-clock
+      sleep {duration}
+      vppctl -s {socket} perfmon stop
+      vppctl -s {socket} show perfmon statistics
+  - name: bundle_vppctl
+    metrics:
+      gauge:
+        - name: l1d_access
+          documentation:  L1D data cache accesses
+          namespace: vpp
+          subsystem: cache_data
+          labelnames:
+            - node_name
+            - thread_name
+            - thread_id
+        - name: l1d_refill
+          documentation:  L1D data cache refills
+          namespace: vpp
+          subsystem: cache_data
+          labelnames:
+            - node_name
+            - thread_name
+            - thread_id
+        - name: l2d_access
+          documentation:  L2D data cache accesses
+          namespace: vpp
+          subsystem: cache_data
+          labelnames:
+            - node_name
+            - thread_name
+            - thread_id
+        - name: l2d_refill
+          documentation:  L2D data cache refills
+          namespace: vpp
+          subsystem: cache_data
+          labelnames:
+            - node_name
+            - thread_name
+            - thread_id
+        - name: l3d_access
+          documentation:  L3D data cache accesses
+          namespace: vpp
+          subsystem: cache_data
+          labelnames:
+            - node_name
+            - thread_name
+            - thread_id
+        - name: l3d_refill
+          documentation:  L3D data cache refills
+          namespace: vpp
+          subsystem: cache_data
+          labelnames:
+            - node_name
+            - thread_name
+            - thread_id
+    code: |
+      vppctl -s {socket} perfmon reset
+      vppctl -s {socket} perfmon start bundle cache-data
+      sleep {duration}
+      vppctl -s {socket} perfmon stop
+      vppctl -s {socket} show perfmon statistics