Skip to content

Commit c719f56

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
perf: Fix and clean up initialization of pmu::event_idx
Andy reported that the current state of event_idx is rather confused. So remove all but the x86_pmu implementation and change the default to return 0 (the safe option). Reported-by: Andy Lutomirski <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Cody P Schafer <[email protected]> Cc: Cody P Schafer <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Hendrik Brueckner <[email protected]> Cc: Himangi Saraogi <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Paul Gortmaker <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: [email protected] <[email protected]> Cc: Thomas Huth <[email protected]> Cc: Vince Weaver <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 65d71fe commit c719f56

File tree

5 files changed

+1
-39
lines changed

5 files changed

+1
-39
lines changed

arch/powerpc/perf/hv-24x7.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,6 @@ static int h_24x7_event_add(struct perf_event *event, int flags)
417417
return 0;
418418
}
419419

420-
static int h_24x7_event_idx(struct perf_event *event)
421-
{
422-
return 0;
423-
}
424-
425420
static struct pmu h_24x7_pmu = {
426421
.task_ctx_nr = perf_invalid_context,
427422

@@ -433,7 +428,6 @@ static struct pmu h_24x7_pmu = {
433428
.start = h_24x7_event_start,
434429
.stop = h_24x7_event_stop,
435430
.read = h_24x7_event_update,
436-
.event_idx = h_24x7_event_idx,
437431
};
438432

439433
static int hv_24x7_init(void)

arch/powerpc/perf/hv-gpci.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,6 @@ static int h_gpci_event_init(struct perf_event *event)
246246
return 0;
247247
}
248248

249-
static int h_gpci_event_idx(struct perf_event *event)
250-
{
251-
return 0;
252-
}
253-
254249
static struct pmu h_gpci_pmu = {
255250
.task_ctx_nr = perf_invalid_context,
256251

@@ -262,7 +257,6 @@ static struct pmu h_gpci_pmu = {
262257
.start = h_gpci_event_start,
263258
.stop = h_gpci_event_stop,
264259
.read = h_gpci_event_update,
265-
.event_idx = h_gpci_event_idx,
266260
};
267261

268262
static int hv_gpci_init(void)

arch/s390/kernel/perf_cpum_sf.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,11 +1411,6 @@ static void cpumsf_pmu_del(struct perf_event *event, int flags)
14111411
perf_pmu_enable(event->pmu);
14121412
}
14131413

1414-
static int cpumsf_pmu_event_idx(struct perf_event *event)
1415-
{
1416-
return event->hw.idx;
1417-
}
1418-
14191414
CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF);
14201415
CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG);
14211416

@@ -1458,7 +1453,6 @@ static struct pmu cpumf_sampling = {
14581453
.stop = cpumsf_pmu_stop,
14591454
.read = cpumsf_pmu_read,
14601455

1461-
.event_idx = cpumsf_pmu_event_idx,
14621456
.attr_groups = cpumsf_pmu_attr_groups,
14631457
};
14641458

kernel/events/core.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6071,11 +6071,6 @@ static int perf_swevent_init(struct perf_event *event)
60716071
return 0;
60726072
}
60736073

6074-
static int perf_swevent_event_idx(struct perf_event *event)
6075-
{
6076-
return 0;
6077-
}
6078-
60796074
static struct pmu perf_swevent = {
60806075
.task_ctx_nr = perf_sw_context,
60816076

@@ -6085,8 +6080,6 @@ static struct pmu perf_swevent = {
60856080
.start = perf_swevent_start,
60866081
.stop = perf_swevent_stop,
60876082
.read = perf_swevent_read,
6088-
6089-
.event_idx = perf_swevent_event_idx,
60906083
};
60916084

60926085
#ifdef CONFIG_EVENT_TRACING
@@ -6204,8 +6197,6 @@ static struct pmu perf_tracepoint = {
62046197
.start = perf_swevent_start,
62056198
.stop = perf_swevent_stop,
62066199
.read = perf_swevent_read,
6207-
6208-
.event_idx = perf_swevent_event_idx,
62096200
};
62106201

62116202
static inline void perf_tp_register(void)
@@ -6431,8 +6422,6 @@ static struct pmu perf_cpu_clock = {
64316422
.start = cpu_clock_event_start,
64326423
.stop = cpu_clock_event_stop,
64336424
.read = cpu_clock_event_read,
6434-
6435-
.event_idx = perf_swevent_event_idx,
64366425
};
64376426

64386427
/*
@@ -6511,8 +6500,6 @@ static struct pmu perf_task_clock = {
65116500
.start = task_clock_event_start,
65126501
.stop = task_clock_event_stop,
65136502
.read = task_clock_event_read,
6514-
6515-
.event_idx = perf_swevent_event_idx,
65166503
};
65176504

65186505
static void perf_pmu_nop_void(struct pmu *pmu)
@@ -6542,7 +6529,7 @@ static void perf_pmu_cancel_txn(struct pmu *pmu)
65426529

65436530
static int perf_event_idx_default(struct perf_event *event)
65446531
{
6545-
return event->hw.idx + 1;
6532+
return 0;
65466533
}
65476534

65486535
/*

kernel/events/hw_breakpoint.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -605,11 +605,6 @@ static void hw_breakpoint_stop(struct perf_event *bp, int flags)
605605
bp->hw.state = PERF_HES_STOPPED;
606606
}
607607

608-
static int hw_breakpoint_event_idx(struct perf_event *bp)
609-
{
610-
return 0;
611-
}
612-
613608
static struct pmu perf_breakpoint = {
614609
.task_ctx_nr = perf_sw_context, /* could eventually get its own */
615610

@@ -619,8 +614,6 @@ static struct pmu perf_breakpoint = {
619614
.start = hw_breakpoint_start,
620615
.stop = hw_breakpoint_stop,
621616
.read = hw_breakpoint_pmu_read,
622-
623-
.event_idx = hw_breakpoint_event_idx,
624617
};
625618

626619
int __init init_hw_breakpoint(void)

0 commit comments

Comments
 (0)