aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/oprofile/op_model_loongson2.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/oprofile/op_model_loongson2.c')
-rw-r--r--arch/mips/oprofile/op_model_loongson2.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/arch/mips/oprofile/op_model_loongson2.c b/arch/mips/oprofile/op_model_loongson2.c
index 575cd1473475..fa3bf661ae29 100644
--- a/arch/mips/oprofile/op_model_loongson2.c
+++ b/arch/mips/oprofile/op_model_loongson2.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * Loongson2 performance counter driver for oprofile 2 * Loongson2 performance counter driver for oprofile
3 * 3 *
4 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology 4 * Copyright (C) 2009 Lemote Inc.
5 * Author: Yanhua <yanh@lemote.com> 5 * Author: Yanhua <yanh@lemote.com>
6 * Author: Wu Zhangjin <wuzj@lemote.com> 6 * Author: Wu Zhangjin <wuzhangjin@gmail.com>
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -47,8 +47,6 @@ static struct loongson2_register_config {
47 int cnt1_enabled, cnt2_enabled; 47 int cnt1_enabled, cnt2_enabled;
48} reg; 48} reg;
49 49
50DEFINE_SPINLOCK(sample_lock);
51
52static char *oprofid = "LoongsonPerf"; 50static char *oprofid = "LoongsonPerf";
53static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id); 51static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id);
54/* Compute all of the registers in preparation for enabling profiling. */ 52/* Compute all of the registers in preparation for enabling profiling. */
@@ -115,7 +113,6 @@ static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id)
115 uint64_t counter, counter1, counter2; 113 uint64_t counter, counter1, counter2;
116 struct pt_regs *regs = get_irq_regs(); 114 struct pt_regs *regs = get_irq_regs();
117 int enabled; 115 int enabled;
118 unsigned long flags;
119 116
120 /* 117 /*
121 * LOONGSON2 defines two 32-bit performance counters. 118 * LOONGSON2 defines two 32-bit performance counters.
@@ -125,6 +122,9 @@ static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id)
125 */ 122 */
126 123
127 /* Check whether the irq belongs to me */ 124 /* Check whether the irq belongs to me */
125 enabled = read_c0_perfctrl() & LOONGSON2_PERFCNT_INT_EN;
126 if (!enabled)
127 return IRQ_NONE;
128 enabled = reg.cnt1_enabled | reg.cnt2_enabled; 128 enabled = reg.cnt1_enabled | reg.cnt2_enabled;
129 if (!enabled) 129 if (!enabled)
130 return IRQ_NONE; 130 return IRQ_NONE;
@@ -133,8 +133,6 @@ static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id)
133 counter1 = counter & 0xffffffff; 133 counter1 = counter & 0xffffffff;
134 counter2 = counter >> 32; 134 counter2 = counter >> 32;
135 135
136 spin_lock_irqsave(&sample_lock, flags);
137
138 if (counter1 & LOONGSON2_PERFCNT_OVERFLOW) { 136 if (counter1 & LOONGSON2_PERFCNT_OVERFLOW) {
139 if (reg.cnt1_enabled) 137 if (reg.cnt1_enabled)
140 oprofile_add_sample(regs, 0); 138 oprofile_add_sample(regs, 0);
@@ -146,8 +144,6 @@ static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id)
146 counter2 = reg.reset_counter2; 144 counter2 = reg.reset_counter2;
147 } 145 }
148 146
149 spin_unlock_irqrestore(&sample_lock, flags);
150
151 write_c0_perfcnt((counter2 << 32) | counter1); 147 write_c0_perfcnt((counter2 << 32) | counter1);
152 148
153 return IRQ_HANDLED; 149 return IRQ_HANDLED;