Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 284776
b: refs/heads/master
c: 266623b
h: refs/heads/master
v: v3
  • Loading branch information
Deng-Cheng Zhu authored and Ralf Baechle committed Dec 7, 2011
1 parent b141944 commit 7191b63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 74653ccf231a3100dd03e16e7a4178868a37332e
refs/heads/master: 266623b7597c97e6ff987b45719540b227751420
18 changes: 3 additions & 15 deletions trunk/arch/mips/kernel/perf_event_mipsxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,34 +707,22 @@ static const struct mips_perf_event *mipspmu_map_cache_event(u64 config)

}

static int validate_event(struct cpu_hw_events *cpuc,
struct perf_event *event)
{
struct hw_perf_event fake_hwc = event->hw;

/* Allow mixed event group. So return 1 to pass validation. */
if (event->pmu != &pmu || event->state <= PERF_EVENT_STATE_OFF)
return 1;

return mipsxx_pmu_alloc_counter(cpuc, &fake_hwc) >= 0;
}

static int validate_group(struct perf_event *event)
{
struct perf_event *sibling, *leader = event->group_leader;
struct cpu_hw_events fake_cpuc;

memset(&fake_cpuc, 0, sizeof(fake_cpuc));

if (!validate_event(&fake_cpuc, leader))
if (mipsxx_pmu_alloc_counter(&fake_cpuc, &leader->hw) < 0)
return -ENOSPC;

list_for_each_entry(sibling, &leader->sibling_list, group_entry) {
if (!validate_event(&fake_cpuc, sibling))
if (mipsxx_pmu_alloc_counter(&fake_cpuc, &sibling->hw) < 0)
return -ENOSPC;
}

if (!validate_event(&fake_cpuc, event))
if (mipsxx_pmu_alloc_counter(&fake_cpuc, &event->hw) < 0)
return -ENOSPC;

return 0;
Expand Down

0 comments on commit 7191b63

Please sign in to comment.