提交 1b2b53da 编写于 作者: J Julien Thierry 提交者: Xie XiuQi

armv7 remove pmu locking

hulk inclusion
category: feature
bugzilla: 12804
CVE: NA

-------------------------------------------------
Signed-off-by: NJulien Thierry <julien.thierry@arm.com>
Signed-off-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 2d772f3f
...@@ -882,10 +882,8 @@ static void armv7_pmnc_dump_regs(struct arm_pmu *cpu_pmu) ...@@ -882,10 +882,8 @@ static void armv7_pmnc_dump_regs(struct arm_pmu *cpu_pmu)
static void armv7pmu_enable_event(struct perf_event *event) static void armv7pmu_enable_event(struct perf_event *event)
{ {
unsigned long flags;
struct hw_perf_event *hwc = &event->hw; struct hw_perf_event *hwc = &event->hw;
struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
int idx = hwc->idx; int idx = hwc->idx;
if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) { if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) {
...@@ -898,7 +896,6 @@ static void armv7pmu_enable_event(struct perf_event *event) ...@@ -898,7 +896,6 @@ static void armv7pmu_enable_event(struct perf_event *event)
* Enable counter and interrupt, and set the counter to count * Enable counter and interrupt, and set the counter to count
* the event that we're interested in. * the event that we're interested in.
*/ */
raw_spin_lock_irqsave(&events->pmu_lock, flags);
/* /*
* Disable counter * Disable counter
...@@ -922,16 +919,12 @@ static void armv7pmu_enable_event(struct perf_event *event) ...@@ -922,16 +919,12 @@ static void armv7pmu_enable_event(struct perf_event *event)
* Enable counter * Enable counter
*/ */
armv7_pmnc_enable_counter(idx); armv7_pmnc_enable_counter(idx);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
} }
static void armv7pmu_disable_event(struct perf_event *event) static void armv7pmu_disable_event(struct perf_event *event)
{ {
unsigned long flags;
struct hw_perf_event *hwc = &event->hw; struct hw_perf_event *hwc = &event->hw;
struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
int idx = hwc->idx; int idx = hwc->idx;
if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) { if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) {
...@@ -940,11 +933,6 @@ static void armv7pmu_disable_event(struct perf_event *event) ...@@ -940,11 +933,6 @@ static void armv7pmu_disable_event(struct perf_event *event)
return; return;
} }
/*
* Disable counter and interrupt
*/
raw_spin_lock_irqsave(&events->pmu_lock, flags);
/* /*
* Disable counter * Disable counter
*/ */
...@@ -954,8 +942,6 @@ static void armv7pmu_disable_event(struct perf_event *event) ...@@ -954,8 +942,6 @@ static void armv7pmu_disable_event(struct perf_event *event)
* Disable interrupt for this counter * Disable interrupt for this counter
*/ */
armv7_pmnc_disable_intens(idx); armv7_pmnc_disable_intens(idx);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
} }
static irqreturn_t armv7pmu_handle_irq(struct arm_pmu *cpu_pmu) static irqreturn_t armv7pmu_handle_irq(struct arm_pmu *cpu_pmu)
...@@ -1026,24 +1012,18 @@ static irqreturn_t armv7pmu_handle_irq(struct arm_pmu *cpu_pmu) ...@@ -1026,24 +1012,18 @@ static irqreturn_t armv7pmu_handle_irq(struct arm_pmu *cpu_pmu)
static void armv7pmu_start(struct arm_pmu *cpu_pmu) static void armv7pmu_start(struct arm_pmu *cpu_pmu)
{ {
unsigned long flags; preempt_disable();
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
raw_spin_lock_irqsave(&events->pmu_lock, flags);
/* Enable all counters */ /* Enable all counters */
armv7_pmnc_write(armv7_pmnc_read() | ARMV7_PMNC_E); armv7_pmnc_write(armv7_pmnc_read() | ARMV7_PMNC_E);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags); preempt_enable();
} }
static void armv7pmu_stop(struct arm_pmu *cpu_pmu) static void armv7pmu_stop(struct arm_pmu *cpu_pmu)
{ {
unsigned long flags; preempt_disable();
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
raw_spin_lock_irqsave(&events->pmu_lock, flags);
/* Disable all counters */ /* Disable all counters */
armv7_pmnc_write(armv7_pmnc_read() & ~ARMV7_PMNC_E); armv7_pmnc_write(armv7_pmnc_read() & ~ARMV7_PMNC_E);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags); preempt_enable();
} }
static int armv7pmu_get_event_idx(struct pmu_hw_events *cpuc, static int armv7pmu_get_event_idx(struct pmu_hw_events *cpuc,
...@@ -1509,14 +1489,8 @@ static void krait_clearpmu(u32 config_base) ...@@ -1509,14 +1489,8 @@ static void krait_clearpmu(u32 config_base)
static void krait_pmu_disable_event(struct perf_event *event) static void krait_pmu_disable_event(struct perf_event *event)
{ {
unsigned long flags;
struct hw_perf_event *hwc = &event->hw; struct hw_perf_event *hwc = &event->hw;
int idx = hwc->idx; int idx = hwc->idx;
struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
/* Disable counter and interrupt */
raw_spin_lock_irqsave(&events->pmu_lock, flags);
/* Disable counter */ /* Disable counter */
armv7_pmnc_disable_counter(idx); armv7_pmnc_disable_counter(idx);
...@@ -1529,23 +1503,17 @@ static void krait_pmu_disable_event(struct perf_event *event) ...@@ -1529,23 +1503,17 @@ static void krait_pmu_disable_event(struct perf_event *event)
/* Disable interrupt for this counter */ /* Disable interrupt for this counter */
armv7_pmnc_disable_intens(idx); armv7_pmnc_disable_intens(idx);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
} }
static void krait_pmu_enable_event(struct perf_event *event) static void krait_pmu_enable_event(struct perf_event *event)
{ {
unsigned long flags;
struct hw_perf_event *hwc = &event->hw; struct hw_perf_event *hwc = &event->hw;
int idx = hwc->idx; int idx = hwc->idx;
struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
/* /*
* Enable counter and interrupt, and set the counter to count * Enable counter and interrupt, and set the counter to count
* the event that we're interested in. * the event that we're interested in.
*/ */
raw_spin_lock_irqsave(&events->pmu_lock, flags);
/* Disable counter */ /* Disable counter */
armv7_pmnc_disable_counter(idx); armv7_pmnc_disable_counter(idx);
...@@ -1565,8 +1533,6 @@ static void krait_pmu_enable_event(struct perf_event *event) ...@@ -1565,8 +1533,6 @@ static void krait_pmu_enable_event(struct perf_event *event)
/* Enable counter */ /* Enable counter */
armv7_pmnc_enable_counter(idx); armv7_pmnc_enable_counter(idx);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
} }
static void krait_pmu_reset(void *info) static void krait_pmu_reset(void *info)
...@@ -1842,14 +1808,8 @@ static void scorpion_clearpmu(u32 config_base) ...@@ -1842,14 +1808,8 @@ static void scorpion_clearpmu(u32 config_base)
static void scorpion_pmu_disable_event(struct perf_event *event) static void scorpion_pmu_disable_event(struct perf_event *event)
{ {
unsigned long flags;
struct hw_perf_event *hwc = &event->hw; struct hw_perf_event *hwc = &event->hw;
int idx = hwc->idx; int idx = hwc->idx;
struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
/* Disable counter and interrupt */
raw_spin_lock_irqsave(&events->pmu_lock, flags);
/* Disable counter */ /* Disable counter */
armv7_pmnc_disable_counter(idx); armv7_pmnc_disable_counter(idx);
...@@ -1862,23 +1822,17 @@ static void scorpion_pmu_disable_event(struct perf_event *event) ...@@ -1862,23 +1822,17 @@ static void scorpion_pmu_disable_event(struct perf_event *event)
/* Disable interrupt for this counter */ /* Disable interrupt for this counter */
armv7_pmnc_disable_intens(idx); armv7_pmnc_disable_intens(idx);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
} }
static void scorpion_pmu_enable_event(struct perf_event *event) static void scorpion_pmu_enable_event(struct perf_event *event)
{ {
unsigned long flags;
struct hw_perf_event *hwc = &event->hw; struct hw_perf_event *hwc = &event->hw;
int idx = hwc->idx; int idx = hwc->idx;
struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
/* /*
* Enable counter and interrupt, and set the counter to count * Enable counter and interrupt, and set the counter to count
* the event that we're interested in. * the event that we're interested in.
*/ */
raw_spin_lock_irqsave(&events->pmu_lock, flags);
/* Disable counter */ /* Disable counter */
armv7_pmnc_disable_counter(idx); armv7_pmnc_disable_counter(idx);
...@@ -1898,8 +1852,6 @@ static void scorpion_pmu_enable_event(struct perf_event *event) ...@@ -1898,8 +1852,6 @@ static void scorpion_pmu_enable_event(struct perf_event *event)
/* Enable counter */ /* Enable counter */
armv7_pmnc_enable_counter(idx); armv7_pmnc_enable_counter(idx);
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
} }
static void scorpion_pmu_reset(void *info) static void scorpion_pmu_reset(void *info)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册