aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/perf_event_v7.c
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2010-12-02 12:01:49 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-12-04 06:18:08 -0500
commit961ec6daa7b14f376c30d447a830fa4783a2112c (patch)
treefd4952bd65fa9e991de7687eaef4b2e5af7a0e70 /arch/arm/kernel/perf_event_v7.c
parent4d6b7a779be34e1df296abc1dc555134a8cf34af (diff)
ARM: 6521/1: perf: use raw_spinlock_t for pmu_lock
For kernels built with PREEMPT_RT, critical sections protected by standard spinlocks are preemptible. This is not acceptable on perf as (a) we may be scheduled onto a different CPU whilst reading/writing banked PMU registers and (b) the latency when reading the PMU registers becomes unpredictable. This patch upgrades the pmu_lock spinlock to a raw_spinlock instead. Reported-by: Jamie Iles <jamie@jamieiles.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/perf_event_v7.c')
-rw-r--r--arch/arm/kernel/perf_event_v7.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index a68ff1c10dec..2e1402556fa0 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -689,7 +689,7 @@ static void armv7pmu_enable_event(struct hw_perf_event *hwc, int idx)
689 * Enable counter and interrupt, and set the counter to count 689 * Enable counter and interrupt, and set the counter to count
690 * the event that we're interested in. 690 * the event that we're interested in.
691 */ 691 */
692 spin_lock_irqsave(&pmu_lock, flags); 692 raw_spin_lock_irqsave(&pmu_lock, flags);
693 693
694 /* 694 /*
695 * Disable counter 695 * Disable counter
@@ -713,7 +713,7 @@ static void armv7pmu_enable_event(struct hw_perf_event *hwc, int idx)
713 */ 713 */
714 armv7_pmnc_enable_counter(idx); 714 armv7_pmnc_enable_counter(idx);
715 715
716 spin_unlock_irqrestore(&pmu_lock, flags); 716 raw_spin_unlock_irqrestore(&pmu_lock, flags);
717} 717}
718 718
719static void armv7pmu_disable_event(struct hw_perf_event *hwc, int idx) 719static void armv7pmu_disable_event(struct hw_perf_event *hwc, int idx)
@@ -723,7 +723,7 @@ static void armv7pmu_disable_event(struct hw_perf_event *hwc, int idx)
723 /* 723 /*
724 * Disable counter and interrupt 724 * Disable counter and interrupt
725 */ 725 */
726 spin_lock_irqsave(&pmu_lock, flags); 726 raw_spin_lock_irqsave(&pmu_lock, flags);
727 727
728 /* 728 /*
729 * Disable counter 729 * Disable counter
@@ -735,7 +735,7 @@ static void armv7pmu_disable_event(struct hw_perf_event *hwc, int idx)
735 */ 735 */
736 armv7_pmnc_disable_intens(idx); 736 armv7_pmnc_disable_intens(idx);
737 737
738 spin_unlock_irqrestore(&pmu_lock, flags); 738 raw_spin_unlock_irqrestore(&pmu_lock, flags);
739} 739}
740 740
741static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev) 741static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
@@ -805,20 +805,20 @@ static void armv7pmu_start(void)
805{ 805{
806 unsigned long flags; 806 unsigned long flags;
807 807
808 spin_lock_irqsave(&pmu_lock, flags); 808 raw_spin_lock_irqsave(&pmu_lock, flags);
809 /* Enable all counters */ 809 /* Enable all counters */
810 armv7_pmnc_write(armv7_pmnc_read() | ARMV7_PMNC_E); 810 armv7_pmnc_write(armv7_pmnc_read() | ARMV7_PMNC_E);
811 spin_unlock_irqrestore(&pmu_lock, flags); 811 raw_spin_unlock_irqrestore(&pmu_lock, flags);
812} 812}
813 813
814static void armv7pmu_stop(void) 814static void armv7pmu_stop(void)
815{ 815{
816 unsigned long flags; 816 unsigned long flags;
817 817
818 spin_lock_irqsave(&pmu_lock, flags); 818 raw_spin_lock_irqsave(&pmu_lock, flags);
819 /* Disable all counters */ 819 /* Disable all counters */
820 armv7_pmnc_write(armv7_pmnc_read() & ~ARMV7_PMNC_E); 820 armv7_pmnc_write(armv7_pmnc_read() & ~ARMV7_PMNC_E);
821 spin_unlock_irqrestore(&pmu_lock, flags); 821 raw_spin_unlock_irqrestore(&pmu_lock, flags);
822} 822}
823 823
824static int armv7pmu_get_event_idx(struct cpu_hw_events *cpuc, 824static int armv7pmu_get_event_idx(struct cpu_hw_events *cpuc,