OSDN Git Service

perf cs-etm: Remove duplicate and incorrect aux size checks
authorJames Clark <james.clark@arm.com>
Wed, 8 Dec 2021 11:54:35 +0000 (11:54 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 16 Dec 2021 15:18:12 +0000 (12:18 -0300)
There are two checks, one is for size when running without admin, but
this one is covered by the driver and reported on in more detail here
(builtin-record.c):

  pr_err("Permission error mapping pages.\n"
         "Consider increasing "
         "/proc/sys/kernel/perf_event_mlock_kb,\n"
         "or try again with a smaller value of -m/--mmap_pages.\n"
         "(current value: %u,%u)\n",

This had the effect of artificially limiting the aux buffer size to a
value smaller than what was allowed because perf_event_mlock_kb wasn't
taken into account.

The second is to check for a power of two, but this is covered here
(evlist.c):

  pr_info("rounding mmap pages size to %s (%lu pages)\n",
          buf, pages);

Reviewed-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20211208115435.610101-1-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/arm/util/cs-etm.c

index 293a23b..8a3d54a 100644 (file)
@@ -407,25 +407,6 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
 
        }
 
-       /* Validate auxtrace_mmap_pages provided by user */
-       if (opts->auxtrace_mmap_pages) {
-               unsigned int max_page = (KiB(128) / page_size);
-               size_t sz = opts->auxtrace_mmap_pages * (size_t)page_size;
-
-               if (!privileged &&
-                   opts->auxtrace_mmap_pages > max_page) {
-                       opts->auxtrace_mmap_pages = max_page;
-                       pr_err("auxtrace too big, truncating to %d\n",
-                              max_page);
-               }
-
-               if (!is_power_of_2(sz)) {
-                       pr_err("Invalid mmap size for %s: must be a power of 2\n",
-                              CORESIGHT_ETM_PMU_NAME);
-                       return -EINVAL;
-               }
-       }
-
        if (opts->auxtrace_snapshot_mode)
                pr_debug2("%s snapshot size: %zu\n", CORESIGHT_ETM_PMU_NAME,
                          opts->auxtrace_snapshot_size);