]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
perf record: Add a dummy event on hybrid systems to collect metadata records
authorKan Liang <kan.liang@linux.intel.com>
Thu, 8 Jul 2021 16:03:32 +0000 (09:03 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 9 Jul 2021 17:04:32 +0000 (14:04 -0300)
Some symbols may not be resolved if a user only monitors 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 metadata records, e.g., PERF_RECORD_COMM, which are
generated by the kernel, are required.

To decide whether to generate the metadata records, the kernel relies on
the event_filter_match() to filter the unrelated events.

On a hybrid system, 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 metadata records 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.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lore.kernel.org/lkml/1625760212-18441-1-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-record.c

index ee2a5cacbdfc81c5b7026b4f5d01b28afaf1cd8b..671a21c9ee4d7a5375bd433467dee1f0c813fe15 100644 (file)
@@ -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, 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. */