Skip to contentSkip to conversation

perf record: Add a dummy event for a hybrid system

PATCH Applied [email protected] 3 participants 3 messages Jul 8, 2021 – Jul 9, 2021 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf record: Add a dummy event for a hybrid system

From: Kan Liang <[email protected]>

Some symbols may not be resolved if a user only monitor one type of PMU.

 $ sudo perf record -e cpu_atom/branch-instructions/ ./big_small_workload
 $ sudo perf report –stdio
 # Overhead  Command    Shared Object      Symbol
 # ........  .........  .................
 # ......................................
 #
    28.02%  perf-exec  [unknown]          [.] 0x0000000000401cf6
    11.32%  perf-exec  [unknown]          [.] 0x0000000000401d04
    10.90%  perf-exec  [unknown]          [.] 0x0000000000401d11
    10.61%  perf-exec  [unknown]          [.] 0x0000000000401cfc

To parse symbols, the side-band events, e.g., COMM, which are generated by the kernel are required. To decide whether to generate the side-band event, the kernel relies on the event_filter_match() to filter the unrelated events. On a hybrid system, the event_filter_match() further checks the CPU mask of the current enabled PMU. If an event is collected on the CPU which doesn't have an enabled PMU, it's treated as an unrelated event.

The "big_small_workload" is created in a big core, but runs on a small core. The side-band events are filtered, because the user only monitors the PMU of the small core. The big core PMU is not enabled.

For a hybrid system, a dummy event is required to generate the complete side-band events.

---
 tools/perf/builtin-record.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tools/perf/builtin-record.c +5 -4
index 3337b5f..99607b9 100644
@@ -891,11 +891,12 @@ static int record__open(struct record *rec)
 	int rc = 0;
 
 	/*
-	 * For initial_delay or system wide, we need to add a dummy event so
-	 * that we can track PERF_RECORD_MMAP to cover the delay of waiting or
-	 * event synthesis.
+	 * For initial_delay or system wide or a hybrid system, we need to
+	 * add a dummy event so that we can track PERF_RECORD_MMAP to cover
+	 * the delay of waiting or event synthesis.
 	 */
-	if (opts->initial_delay || target__has_cpu(&opts->target)) {
+	if (opts->initial_delay || target__has_cpu(&opts->target) ||
+	    perf_pmu__has_hybrid()) {
 		pos = evlist__get_tracking_event(evlist);
 		if (!evsel__is_dummy_event(pos)) {
 			/* Set up dummy event. */
Signature · 1 line
2.7.4
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 24 lines · On Thu, Jul 8, 2021 at 9:05 AM <[email protected]> wrote:

From: Kan Liang <[email protected]>

Some symbols may not be resolved if a user only monitor one type of PMU.

 $ sudo perf record -e cpu_atom/branch-instructions/ ./big_small_workload
 $ sudo perf report –stdio
 # Overhead  Command    Shared Object      Symbol
 # ........  .........  .................
 # ......................................
 #
    28.02%  perf-exec  [unknown]          [.] 0x0000000000401cf6
    11.32%  perf-exec  [unknown]          [.] 0x0000000000401d04
    10.90%  perf-exec  [unknown]          [.] 0x0000000000401d11
    10.61%  perf-exec  [unknown]          [.] 0x0000000000401cfc

To parse symbols, the side-band events, e.g., COMM, which are generated by the kernel are required. To decide whether to generate the side-band event, the kernel relies on the event_filter_match() to filter the unrelated events. On a hybrid system, the event_filter_match() further checks the CPU mask of the current enabled PMU. If an event is collected on the CPU which doesn't have an enabled PMU, it's treated as an unrelated event.

Quoted 8 lines

The "big_small_workload" is created in a big core, but runs on a small core. The side-band events are filtered, because the user only monitors the PMU of the small core. The big core PMU is not enabled.

For a hybrid system, a dummy event is required to generate the complete side-band events.

Thanks,
Namhyung

Quoted 28 lines
---
 tools/perf/builtin-record.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tools/perf/builtin-record.c +5 -5
index 3337b5f..99607b9 100644
@@ -891,11 +891,12 @@ static int record__open(struct record *rec)
        int rc = 0;
 
        /*
-        * For initial_delay or system wide, we need to add a dummy event so
-        * that we can track PERF_RECORD_MMAP to cover the delay of waiting or
-        * event synthesis.
+        * For initial_delay or system wide or a hybrid system, we need to
+        * add a dummy event so that we can track PERF_RECORD_MMAP to cover
+        * the delay of waiting or event synthesis.
         */
-       if (opts->initial_delay || target__has_cpu(&opts->target)) {
+       if (opts->initial_delay || target__has_cpu(&opts->target) ||
+           perf_pmu__has_hybrid()) {
                pos = evlist__get_tracking_event(evlist);
                if (!evsel__is_dummy_event(pos)) {
                        /* Set up dummy event. */
--

2.7.4

maintainer Applied
#2 lore raw

Em Thu, Jul 08, 2021 at 10:32:13PM -0700, Namhyung Kim escreveu:

Quoted 29 lines · On Thu, Jul 8, 2021 at 9:05 AM <[email protected]> wrote:
Quoted 28 lines

From: Kan Liang <[email protected]>

Some symbols may not be resolved if a user only monitor one type of PMU.

 $ sudo perf record -e cpu_atom/branch-instructions/ ./big_small_workload
 $ sudo perf report –stdio
 # Overhead  Command    Shared Object      Symbol
 # ........  .........  .................
 # ......................................
 #
    28.02%  perf-exec  [unknown]          [.] 0x0000000000401cf6
    11.32%  perf-exec  [unknown]          [.] 0x0000000000401d04
    10.90%  perf-exec  [unknown]          [.] 0x0000000000401d11
    10.61%  perf-exec  [unknown]          [.] 0x0000000000401cfc

To parse symbols, the side-band events, e.g., COMM, which are generated by the kernel are required. To decide whether to generate the side-band event, the kernel relies on the event_filter_match() to filter the unrelated events. On a hybrid system, the event_filter_match() further checks the CPU mask of the current enabled PMU. If an event is collected on the CPU which doesn't have an enabled PMU, it's treated as an unrelated event.

The "big_small_workload" is created in a big core, but runs on a small core. The side-band events are filtered, because the user only monitors the PMU of the small core. The big core PMU is not enabled.

Quoted 6 lines
Quoted 4 lines

For a hybrid system, a dummy event is required to generate the complete side-band events.

Thanks, applied.

- Arnaldo