aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2010-04-13 16:23:10 -0400
committerIngo Molnar <mingo@elte.hu>2010-05-07 05:30:59 -0400
commit4261e0e0efd9e04b6c69e0773c3cf4d6f337c416 (patch)
tree47651cefd3e6c89a7acdc2d16d40cc7d384d3231 /arch
parenta0507c84bf47dfd204299774f45fd16da33f0619 (diff)
perf, x86: Move perfctr init code to x86_setup_perfctr()
Split __hw_perf_event_init() to configure pmu events other than perfctrs. Perfctr code is moved to a separate function x86_setup_perfctr(). This and the following patches refactor the code. Split in multiple patches for better review. Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <1271190201-25705-2-git-send-email-robert.richter@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/cpu/perf_event.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 7de70613e6c3..801441a54245 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -426,6 +426,8 @@ set_ext_hw_attr(struct hw_perf_event *hwc, struct perf_event_attr *attr)
426 return 0; 426 return 0;
427} 427}
428 428
429static int x86_setup_perfctr(struct perf_event *event);
430
429static int x86_pmu_hw_config(struct perf_event *event) 431static int x86_pmu_hw_config(struct perf_event *event)
430{ 432{
431 /* 433 /*
@@ -453,9 +455,6 @@ static int x86_pmu_hw_config(struct perf_event *event)
453 */ 455 */
454static int __hw_perf_event_init(struct perf_event *event) 456static int __hw_perf_event_init(struct perf_event *event)
455{ 457{
456 struct perf_event_attr *attr = &event->attr;
457 struct hw_perf_event *hwc = &event->hw;
458 u64 config;
459 int err; 458 int err;
460 459
461 if (!x86_pmu_initialized()) 460 if (!x86_pmu_initialized())
@@ -482,15 +481,24 @@ static int __hw_perf_event_init(struct perf_event *event)
482 481
483 event->destroy = hw_perf_event_destroy; 482 event->destroy = hw_perf_event_destroy;
484 483
485 hwc->idx = -1; 484 event->hw.idx = -1;
486 hwc->last_cpu = -1; 485 event->hw.last_cpu = -1;
487 hwc->last_tag = ~0ULL; 486 event->hw.last_tag = ~0ULL;
488 487
489 /* Processor specifics */ 488 /* Processor specifics */
490 err = x86_pmu.hw_config(event); 489 err = x86_pmu.hw_config(event);
491 if (err) 490 if (err)
492 return err; 491 return err;
493 492
493 return x86_setup_perfctr(event);
494}
495
496static int x86_setup_perfctr(struct perf_event *event)
497{
498 struct perf_event_attr *attr = &event->attr;
499 struct hw_perf_event *hwc = &event->hw;
500 u64 config;
501
494 if (!hwc->sample_period) { 502 if (!hwc->sample_period) {
495 hwc->sample_period = x86_pmu.max_period; 503 hwc->sample_period = x86_pmu.max_period;
496 hwc->last_period = hwc->sample_period; 504 hwc->last_period = hwc->sample_period;