Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158195
b: refs/heads/master
c: 9063759
h: refs/heads/master
i:
  158193: 5ee89d3
  158191: 470f0a4
v: v3
  • Loading branch information
Robert Richter committed Jun 11, 2009
1 parent 99a7920 commit cfc3ebd
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 35 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: fecfe6320ba71eed6d16849683298f0894aa60de
refs/heads/master: 9063759540daac40cc1f402f83a3be6b489f8583
80 changes: 46 additions & 34 deletions trunk/arch/x86/oprofile/op_model_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,50 @@ op_amd_handle_ibs(struct pt_regs * const regs,
return 1;
}

static inline void op_amd_start_ibs(void)
{
unsigned int low, high;
if (has_ibs && ibs_config.fetch_enabled) {
low = (ibs_config.max_cnt_fetch >> 4) & 0xFFFF;
high = ((ibs_config.rand_en & 0x1) << 25) /* bit 57 */
+ IBS_FETCH_HIGH_ENABLE;
wrmsr(MSR_AMD64_IBSFETCHCTL, low, high);
}

if (has_ibs && ibs_config.op_enabled) {
low = ((ibs_config.max_cnt_op >> 4) & 0xFFFF)
+ ((ibs_config.dispatched_ops & 0x1) << 19) /* bit 19 */
+ IBS_OP_LOW_ENABLE;
high = 0;
wrmsr(MSR_AMD64_IBSOPCTL, low, high);
}
}

static void op_amd_stop_ibs(void)
{
unsigned int low, high;
if (has_ibs && ibs_config.fetch_enabled) {
/* clear max count and enable */
low = 0;
high = 0;
wrmsr(MSR_AMD64_IBSFETCHCTL, low, high);
}

if (has_ibs && ibs_config.op_enabled) {
/* clear max count and enable */
low = 0;
high = 0;
wrmsr(MSR_AMD64_IBSOPCTL, low, high);
}
}

#else

static inline int op_amd_handle_ibs(struct pt_regs * const regs,
struct op_msrs const * const msrs) { }
static inline void op_amd_start_ibs(void) { }
static inline void op_amd_stop_ibs(void) { }

#endif

static int op_amd_check_ctrs(struct pt_regs * const regs,
Expand All @@ -238,9 +282,7 @@ static int op_amd_check_ctrs(struct pt_regs * const regs,
}
}

#ifdef CONFIG_OPROFILE_IBS
op_amd_handle_ibs(regs, msrs);
#endif

/* See op_model_ppro.c */
return 1;
Expand All @@ -258,25 +300,9 @@ static void op_amd_start(struct op_msrs const * const msrs)
}
}

#ifdef CONFIG_OPROFILE_IBS
if (has_ibs && ibs_config.fetch_enabled) {
low = (ibs_config.max_cnt_fetch >> 4) & 0xFFFF;
high = ((ibs_config.rand_en & 0x1) << 25) /* bit 57 */
+ IBS_FETCH_HIGH_ENABLE;
wrmsr(MSR_AMD64_IBSFETCHCTL, low, high);
}

if (has_ibs && ibs_config.op_enabled) {
low = ((ibs_config.max_cnt_op >> 4) & 0xFFFF)
+ ((ibs_config.dispatched_ops & 0x1) << 19) /* bit 19 */
+ IBS_OP_LOW_ENABLE;
high = 0;
wrmsr(MSR_AMD64_IBSOPCTL, low, high);
}
#endif
op_amd_start_ibs();
}


static void op_amd_stop(struct op_msrs const * const msrs)
{
unsigned int low, high;
Expand All @@ -294,21 +320,7 @@ static void op_amd_stop(struct op_msrs const * const msrs)
CTRL_WRITE(low, high, msrs, i);
}

#ifdef CONFIG_OPROFILE_IBS
if (has_ibs && ibs_config.fetch_enabled) {
/* clear max count and enable */
low = 0;
high = 0;
wrmsr(MSR_AMD64_IBSFETCHCTL, low, high);
}

if (has_ibs && ibs_config.op_enabled) {
/* clear max count and enable */
low = 0;
high = 0;
wrmsr(MSR_AMD64_IBSOPCTL, low, high);
}
#endif
op_amd_stop_ibs();
}

static void op_amd_shutdown(struct op_msrs const * const msrs)
Expand Down

0 comments on commit cfc3ebd

Please sign in to comment.