diff options
Diffstat (limited to 'driver/gator_events_scorpion.c')
-rw-r--r-- | driver/gator_events_scorpion.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/driver/gator_events_scorpion.c b/driver/gator_events_scorpion.c index 477e7c9..ed0d8de 100644 --- a/driver/gator_events_scorpion.c +++ b/driver/gator_events_scorpion.c | |||
@@ -34,7 +34,6 @@ static unsigned long pmnc_enabled[CNTMAX]; | |||
34 | static unsigned long pmnc_event[CNTMAX]; | 34 | static unsigned long pmnc_event[CNTMAX]; |
35 | static unsigned long pmnc_key[CNTMAX]; | 35 | static unsigned long pmnc_key[CNTMAX]; |
36 | 36 | ||
37 | static DEFINE_PER_CPU(int[CNTMAX], perfPrev); | ||
38 | static DEFINE_PER_CPU(int[CNTMAX * 2], perfCnt); | 37 | static DEFINE_PER_CPU(int[CNTMAX * 2], perfCnt); |
39 | 38 | ||
40 | enum scorpion_perf_types { | 39 | enum scorpion_perf_types { |
@@ -538,8 +537,6 @@ static int gator_events_scorpion_online(int** buffer) | |||
538 | for (cnt = CCNT; cnt < CNTMAX; cnt++) { | 537 | for (cnt = CCNT; cnt < CNTMAX; cnt++) { |
539 | unsigned long event; | 538 | unsigned long event; |
540 | 539 | ||
541 | per_cpu(perfPrev, smp_processor_id())[cnt] = 0; | ||
542 | |||
543 | if (!pmnc_enabled[cnt]) | 540 | if (!pmnc_enabled[cnt]) |
544 | continue; | 541 | continue; |
545 | 542 | ||
@@ -574,7 +571,7 @@ static int gator_events_scorpion_online(int** buffer) | |||
574 | value = 0; | 571 | value = 0; |
575 | } | 572 | } |
576 | scorpion_pmnc_reset_counter(cnt); | 573 | scorpion_pmnc_reset_counter(cnt); |
577 | per_cpu(perfPrev, cpu)[cnt] = 0; | 574 | |
578 | per_cpu(perfCnt, cpu)[len++] = pmnc_key[cnt]; | 575 | per_cpu(perfCnt, cpu)[len++] = pmnc_key[cnt]; |
579 | per_cpu(perfCnt, cpu)[len++] = 0; | 576 | per_cpu(perfCnt, cpu)[len++] = 0; |
580 | } | 577 | } |
@@ -607,6 +604,11 @@ static int gator_events_scorpion_read(int **buffer) | |||
607 | int cnt, len = 0; | 604 | int cnt, len = 0; |
608 | int cpu = smp_processor_id(); | 605 | int cpu = smp_processor_id(); |
609 | 606 | ||
607 | // a context switch may occur before the online hotplug event, thus need to check that the pmu is enabled | ||
608 | if (!(scorpion_pmnc_read() & PMNC_E)) { | ||
609 | return 0; | ||
610 | } | ||
611 | |||
610 | for (cnt = 0; cnt < pmnc_counters; cnt++) { | 612 | for (cnt = 0; cnt < pmnc_counters; cnt++) { |
611 | if (pmnc_enabled[cnt]) { | 613 | if (pmnc_enabled[cnt]) { |
612 | int value; | 614 | int value; |
@@ -618,11 +620,9 @@ static int gator_events_scorpion_read(int **buffer) | |||
618 | value = 0; | 620 | value = 0; |
619 | } | 621 | } |
620 | scorpion_pmnc_reset_counter(cnt); | 622 | scorpion_pmnc_reset_counter(cnt); |
621 | if (value != per_cpu(perfPrev, cpu)[cnt]) { | 623 | |
622 | per_cpu(perfPrev, cpu)[cnt] = value; | 624 | per_cpu(perfCnt, cpu)[len++] = pmnc_key[cnt]; |
623 | per_cpu(perfCnt, cpu)[len++] = pmnc_key[cnt]; | 625 | per_cpu(perfCnt, cpu)[len++] = value; |
624 | per_cpu(perfCnt, cpu)[len++] = value; | ||
625 | } | ||
626 | } | 626 | } |
627 | } | 627 | } |
628 | 628 | ||