Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158306
b: refs/heads/master
c: 747b50a
h: refs/heads/master
v: v3
  • Loading branch information
markus.t.metzger@intel.com authored and Ingo Molnar committed Sep 4, 2009
1 parent 5ccb3bb commit 3ac1c2a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 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: dc86cabe4b242446ea9aa8492c727e1220817898
refs/heads/master: 747b50aaf728987732e6ff3ba10aba4acc4e0277
25 changes: 11 additions & 14 deletions trunk/arch/x86/kernel/cpu/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ static int reserve_bts_hardware(void)
int cpu, err = 0;

if (!bts_available())
return -EOPNOTSUPP;
return 0;

get_online_cpus();

Expand Down Expand Up @@ -914,7 +914,7 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
if (!reserve_pmc_hardware())
err = -EBUSY;
else
reserve_bts_hardware();
err = reserve_bts_hardware();
}
if (!err)
atomic_inc(&active_counters);
Expand Down Expand Up @@ -979,6 +979,13 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
if (config == -1LL)
return -EINVAL;

/*
* Branch tracing:
*/
if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) &&
(hwc->sample_period == 1) && !bts_available())
return -EOPNOTSUPP;

hwc->config |= config;

return 0;
Expand Down Expand Up @@ -1355,19 +1362,9 @@ static int x86_pmu_enable(struct perf_counter *counter)

idx = fixed_mode_idx(counter, hwc);
if (idx == X86_PMC_IDX_FIXED_BTS) {
/*
* Try to use BTS for branch tracing. If that is not
* available, try to get a generic counter.
*/
if (unlikely(!cpuc->ds))
goto try_generic;

/*
* Try to get the fixed counter, if that is already taken
* then try to get a generic counter:
*/
/* BTS is already occupied. */
if (test_and_set_bit(idx, cpuc->used_mask))
goto try_generic;
return -EAGAIN;

hwc->config_base = 0;
hwc->counter_base = 0;
Expand Down

0 comments on commit 3ac1c2a

Please sign in to comment.