Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304886
b: refs/heads/master
c: 6accb9c
h: refs/heads/master
v: v3
  • Loading branch information
Robert Richter authored and Ingo Molnar committed May 9, 2012
1 parent 7be0f58 commit 4fc9355
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 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: 7bf352384fda3f678a283928c6c5b2cd9da877e4
refs/heads/master: 6accb9cf76080422d400a641d9068b6b2a2c216f
18 changes: 16 additions & 2 deletions trunk/arch/x86/kernel/cpu/perf_event_amd_ibs.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,16 @@ static int perf_ibs_init(struct perf_event *event)
if (config & perf_ibs->cnt_mask)
/* raw max_cnt may not be set */
return -EINVAL;
if (hwc->sample_period & 0x0f)
/* lower 4 bits can not be set in ibs max cnt */
if (!event->attr.sample_freq && hwc->sample_period & 0x0f)
/*
* lower 4 bits can not be set in ibs max cnt,
* but allowing it in case we adjust the
* sample period to set a frequency.
*/
return -EINVAL;
hwc->sample_period &= ~0x0FULL;
if (!hwc->sample_period)
hwc->sample_period = 0x10;
} else {
max_cnt = config & perf_ibs->cnt_mask;
config &= ~perf_ibs->cnt_mask;
Expand All @@ -175,6 +182,13 @@ static int perf_ibs_init(struct perf_event *event)
if (!hwc->sample_period)
return -EINVAL;

/*
* If we modify hwc->sample_period, we also need to update
* hwc->last_period and hwc->period_left.
*/
hwc->last_period = hwc->sample_period;
local64_set(&hwc->period_left, hwc->sample_period);

hwc->config_base = perf_ibs->msr;
hwc->config = config;

Expand Down

0 comments on commit 4fc9355

Please sign in to comment.