perf/amd/ibs: Make IBS a core pmu
authorRavi Bangoria <ravi.bangoria@amd.com>
Tue, 15 Nov 2022 09:39:04 +0000 (15:09 +0530)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 24 Nov 2022 10:09:19 +0000 (11:09 +0100)
So far, only one pmu was allowed to be registered as core pmu and thus
IBS pmus were being registered as uncore. However, with the event context
rewrite, that limitation no longer exists and thus IBS pmus can also be
registered as core pmu. This makes IBS much more usable, for ex, user
will be able to do per-process precise monitoring on AMD:

Before patch:
  $ sudo perf record -e cycles:pp ls
  Error:
  Invalid event (cycles:pp) in per-thread mode, enable system wide with '-a'

After patch:
  $ sudo perf record -e cycles:pp ls
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.017 MB perf.data (33 samples) ]

Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Ian Rogers <irogers@google.com>
Link: https://lkml.kernel.org/r/20221115093904.1799-1-ravi.bangoria@amd.com
arch/x86/events/amd/ibs.c

index 3271735f00702de86cfcc95fa95adfdb98083667..fbc2ce86f4b81525c2e8ed71683c2705e8ac80e7 100644 (file)
@@ -631,7 +631,7 @@ static const struct attribute_group *op_attr_update[] = {
 
 static struct perf_ibs perf_ibs_fetch = {
        .pmu = {
-               .task_ctx_nr    = perf_invalid_context,
+               .task_ctx_nr    = perf_hw_context,
 
                .event_init     = perf_ibs_init,
                .add            = perf_ibs_add,
@@ -655,7 +655,7 @@ static struct perf_ibs perf_ibs_fetch = {
 
 static struct perf_ibs perf_ibs_op = {
        .pmu = {
-               .task_ctx_nr    = perf_invalid_context,
+               .task_ctx_nr    = perf_hw_context,
 
                .event_init     = perf_ibs_init,
                .add            = perf_ibs_add,