• James Clark's avatar
    perf evsel: Add error message for unsupported branch stack cases · 8f431a28
    James Clark authored
    EOPNOTSUPP is a possible return value when branch stacks are requested
    but they aren't enabled in the kernel or hardware. It's also returned if
    they aren't supported on the specific event type. The currently printed
    error message about sampling/overflow-interrupts is not correct in this
    case.
    
    Add a check for branch stacks before sample_period is checked because
    sample_period is also set (to the default value) when using branch
    stacks.
    
    Before this change (when branch stacks aren't supported):
    
      perf record -j any
      Error:
      cycles: PMU Hardware doesn't support sampling/overflow-interrupts. Try 'perf stat'
    
    After this change:
    
      perf record -j any
      Error:
      cycles: PMU Hardware or event type doesn't support branch stack sampling.
    Signed-off-by: default avatarJames Clark <james.clark@arm.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Anshuman Khandual <anshuman.khandual@arm.com>
    Cc: German Gomez <german.gomez@arm.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Leo Yan <leo.yan@linaro.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Link: https://lore.kernel.org/r/20220307171917.2555829-2-james.clark@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    8f431a28
evsel.c 77.6 KB