diff options
| author | Peter Zijlstra <peterz@infradead.org> | 2014-10-21 05:10:21 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2014-10-28 05:51:01 -0400 |
| commit | c719f56092add9b3d4192f57c64ce7af11105130 (patch) | |
| tree | e6082a4aeb6648e73273e3eddcf555100b6045b6 | |
| parent | 65d71fe1375b973083733294795bf2b09d45b3c2 (diff) | |
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 <luto@amacapital.net>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Cody P Schafer <cody@linux.vnet.ibm.com>
Cc: Cody P Schafer <dev@codyps.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Himangi Saraogi <himangi774@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: sukadev@linux.vnet.ibm.com <sukadev@linux.vnet.ibm.com>
Cc: Thomas Huth <thuth@linux.vnet.ibm.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: linux390@de.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-s390@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
| -rw-r--r-- | arch/powerpc/perf/hv-24x7.c | 6 | ||||
| -rw-r--r-- | arch/powerpc/perf/hv-gpci.c | 6 | ||||
| -rw-r--r-- | arch/s390/kernel/perf_cpum_sf.c | 6 | ||||
| -rw-r--r-- | kernel/events/core.c | 15 | ||||
| -rw-r--r-- | kernel/events/hw_breakpoint.c | 7 |
5 files changed, 1 insertions, 39 deletions
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 6c8710dd90c9..dba34088da28 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c | |||
| @@ -417,11 +417,6 @@ static int h_24x7_event_add(struct perf_event *event, int flags) | |||
| 417 | return 0; | 417 | return 0; |
| 418 | } | 418 | } |
| 419 | 419 | ||
| 420 | static int h_24x7_event_idx(struct perf_event *event) | ||
| 421 | { | ||
| 422 | return 0; | ||
| 423 | } | ||
| 424 | |||
| 425 | static struct pmu h_24x7_pmu = { | 420 | static struct pmu h_24x7_pmu = { |
| 426 | .task_ctx_nr = perf_invalid_context, | 421 | .task_ctx_nr = perf_invalid_context, |
| 427 | 422 | ||
| @@ -433,7 +428,6 @@ static struct pmu h_24x7_pmu = { | |||
| 433 | .start = h_24x7_event_start, | 428 | .start = h_24x7_event_start, |
| 434 | .stop = h_24x7_event_stop, | 429 | .stop = h_24x7_event_stop, |
| 435 | .read = h_24x7_event_update, | 430 | .read = h_24x7_event_update, |
| 436 | .event_idx = h_24x7_event_idx, | ||
| 437 | }; | 431 | }; |
| 438 | 432 | ||
| 439 | static int hv_24x7_init(void) | 433 | static int hv_24x7_init(void) |
diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c index 15fc76c93022..a051fe946c63 100644 --- a/arch/powerpc/perf/hv-gpci.c +++ b/arch/powerpc/perf/hv-gpci.c | |||
| @@ -246,11 +246,6 @@ static int h_gpci_event_init(struct perf_event *event) | |||
| 246 | return 0; | 246 | return 0; |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | static int h_gpci_event_idx(struct perf_event *event) | ||
| 250 | { | ||
| 251 | return 0; | ||
| 252 | } | ||
| 253 | |||
| 254 | static struct pmu h_gpci_pmu = { | 249 | static struct pmu h_gpci_pmu = { |
| 255 | .task_ctx_nr = perf_invalid_context, | 250 | .task_ctx_nr = perf_invalid_context, |
| 256 | 251 | ||
| @@ -262,7 +257,6 @@ static struct pmu h_gpci_pmu = { | |||
| 262 | .start = h_gpci_event_start, | 257 | .start = h_gpci_event_start, |
| 263 | .stop = h_gpci_event_stop, | 258 | .stop = h_gpci_event_stop, |
| 264 | .read = h_gpci_event_update, | 259 | .read = h_gpci_event_update, |
| 265 | .event_idx = h_gpci_event_idx, | ||
| 266 | }; | 260 | }; |
| 267 | 261 | ||
| 268 | static int hv_gpci_init(void) | 262 | static int hv_gpci_init(void) |
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index 08e761318c17..b878f12a9597 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c | |||
| @@ -1411,11 +1411,6 @@ static void cpumsf_pmu_del(struct perf_event *event, int flags) | |||
| 1411 | perf_pmu_enable(event->pmu); | 1411 | perf_pmu_enable(event->pmu); |
| 1412 | } | 1412 | } |
| 1413 | 1413 | ||
| 1414 | static int cpumsf_pmu_event_idx(struct perf_event *event) | ||
| 1415 | { | ||
| 1416 | return event->hw.idx; | ||
| 1417 | } | ||
| 1418 | |||
| 1419 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF); | 1414 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF); |
| 1420 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); | 1415 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); |
| 1421 | 1416 | ||
| @@ -1458,7 +1453,6 @@ static struct pmu cpumf_sampling = { | |||
| 1458 | .stop = cpumsf_pmu_stop, | 1453 | .stop = cpumsf_pmu_stop, |
| 1459 | .read = cpumsf_pmu_read, | 1454 | .read = cpumsf_pmu_read, |
| 1460 | 1455 | ||
| 1461 | .event_idx = cpumsf_pmu_event_idx, | ||
| 1462 | .attr_groups = cpumsf_pmu_attr_groups, | 1456 | .attr_groups = cpumsf_pmu_attr_groups, |
| 1463 | }; | 1457 | }; |
| 1464 | 1458 | ||
diff --git a/kernel/events/core.c b/kernel/events/core.c index 1425d07018de..2b02c9fda790 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
| @@ -6071,11 +6071,6 @@ static int perf_swevent_init(struct perf_event *event) | |||
| 6071 | return 0; | 6071 | return 0; |
| 6072 | } | 6072 | } |
| 6073 | 6073 | ||
| 6074 | static int perf_swevent_event_idx(struct perf_event *event) | ||
| 6075 | { | ||
| 6076 | return 0; | ||
| 6077 | } | ||
| 6078 | |||
| 6079 | static struct pmu perf_swevent = { | 6074 | static struct pmu perf_swevent = { |
| 6080 | .task_ctx_nr = perf_sw_context, | 6075 | .task_ctx_nr = perf_sw_context, |
| 6081 | 6076 | ||
| @@ -6085,8 +6080,6 @@ static struct pmu perf_swevent = { | |||
| 6085 | .start = perf_swevent_start, | 6080 | .start = perf_swevent_start, |
| 6086 | .stop = perf_swevent_stop, | 6081 | .stop = perf_swevent_stop, |
| 6087 | .read = perf_swevent_read, | 6082 | .read = perf_swevent_read, |
| 6088 | |||
| 6089 | .event_idx = perf_swevent_event_idx, | ||
| 6090 | }; | 6083 | }; |
| 6091 | 6084 | ||
| 6092 | #ifdef CONFIG_EVENT_TRACING | 6085 | #ifdef CONFIG_EVENT_TRACING |
| @@ -6204,8 +6197,6 @@ static struct pmu perf_tracepoint = { | |||
| 6204 | .start = perf_swevent_start, | 6197 | .start = perf_swevent_start, |
| 6205 | .stop = perf_swevent_stop, | 6198 | .stop = perf_swevent_stop, |
| 6206 | .read = perf_swevent_read, | 6199 | .read = perf_swevent_read, |
| 6207 | |||
| 6208 | .event_idx = perf_swevent_event_idx, | ||
| 6209 | }; | 6200 | }; |
| 6210 | 6201 | ||
| 6211 | static inline void perf_tp_register(void) | 6202 | static inline void perf_tp_register(void) |
| @@ -6431,8 +6422,6 @@ static struct pmu perf_cpu_clock = { | |||
| 6431 | .start = cpu_clock_event_start, | 6422 | .start = cpu_clock_event_start, |
| 6432 | .stop = cpu_clock_event_stop, | 6423 | .stop = cpu_clock_event_stop, |
| 6433 | .read = cpu_clock_event_read, | 6424 | .read = cpu_clock_event_read, |
| 6434 | |||
| 6435 | .event_idx = perf_swevent_event_idx, | ||
| 6436 | }; | 6425 | }; |
| 6437 | 6426 | ||
| 6438 | /* | 6427 | /* |
| @@ -6511,8 +6500,6 @@ static struct pmu perf_task_clock = { | |||
| 6511 | .start = task_clock_event_start, | 6500 | .start = task_clock_event_start, |
| 6512 | .stop = task_clock_event_stop, | 6501 | .stop = task_clock_event_stop, |
| 6513 | .read = task_clock_event_read, | 6502 | .read = task_clock_event_read, |
| 6514 | |||
| 6515 | .event_idx = perf_swevent_event_idx, | ||
| 6516 | }; | 6503 | }; |
| 6517 | 6504 | ||
| 6518 | static void perf_pmu_nop_void(struct pmu *pmu) | 6505 | static void perf_pmu_nop_void(struct pmu *pmu) |
| @@ -6542,7 +6529,7 @@ static void perf_pmu_cancel_txn(struct pmu *pmu) | |||
| 6542 | 6529 | ||
| 6543 | static int perf_event_idx_default(struct perf_event *event) | 6530 | static int perf_event_idx_default(struct perf_event *event) |
| 6544 | { | 6531 | { |
| 6545 | return event->hw.idx + 1; | 6532 | return 0; |
| 6546 | } | 6533 | } |
| 6547 | 6534 | ||
| 6548 | /* | 6535 | /* |
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c index 1559fb0b9296..9803a6600d49 100644 --- a/kernel/events/hw_breakpoint.c +++ b/kernel/events/hw_breakpoint.c | |||
| @@ -605,11 +605,6 @@ static void hw_breakpoint_stop(struct perf_event *bp, int flags) | |||
| 605 | bp->hw.state = PERF_HES_STOPPED; | 605 | bp->hw.state = PERF_HES_STOPPED; |
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | static int hw_breakpoint_event_idx(struct perf_event *bp) | ||
| 609 | { | ||
| 610 | return 0; | ||
| 611 | } | ||
| 612 | |||
| 613 | static struct pmu perf_breakpoint = { | 608 | static struct pmu perf_breakpoint = { |
| 614 | .task_ctx_nr = perf_sw_context, /* could eventually get its own */ | 609 | .task_ctx_nr = perf_sw_context, /* could eventually get its own */ |
| 615 | 610 | ||
| @@ -619,8 +614,6 @@ static struct pmu perf_breakpoint = { | |||
| 619 | .start = hw_breakpoint_start, | 614 | .start = hw_breakpoint_start, |
| 620 | .stop = hw_breakpoint_stop, | 615 | .stop = hw_breakpoint_stop, |
| 621 | .read = hw_breakpoint_pmu_read, | 616 | .read = hw_breakpoint_pmu_read, |
| 622 | |||
| 623 | .event_idx = hw_breakpoint_event_idx, | ||
| 624 | }; | 617 | }; |
| 625 | 618 | ||
| 626 | int __init init_hw_breakpoint(void) | 619 | int __init init_hw_breakpoint(void) |
