Commit af3e48ff authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'oprofile-fixes-for-linus' of...

Merge branch 'oprofile-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'oprofile-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  oprofile: Fix p6 counter overflow check
  Cell OProfile: Incorrect local array size in activate spu profiling function
  Revert "Cell OProfile: Incorrect local array size in activate spu profiling function"
  oprofile: fix memory ordering
  Cell OProfile: Incorrect local array size in activate spu profiling function
  Change UTF8 chars in Kconfig help text about Oprofile AMD barcelona
parents d8af8582 01aab518
...@@ -21,7 +21,7 @@ config OPROFILE_IBS ...@@ -21,7 +21,7 @@ config OPROFILE_IBS
Instruction-Based Sampling (IBS) is a new profiling Instruction-Based Sampling (IBS) is a new profiling
technique that provides rich, precise program performance technique that provides rich, precise program performance
information. IBS is introduced by AMD Family10h processors information. IBS is introduced by AMD Family10h processors
(AMD Opteron Quad-Core processor “Barcelona”) to overcome (AMD Opteron Quad-Core processor "Barcelona") to overcome
the limitations of conventional performance counter the limitations of conventional performance counter
sampling. sampling.
......
...@@ -27,8 +27,7 @@ static int num_counters = 2; ...@@ -27,8 +27,7 @@ static int num_counters = 2;
static int counter_width = 32; static int counter_width = 32;
#define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0) #define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0)
#define CTR_READ(l, h, msrs, c) do {rdmsr(msrs->counters[(c)].addr, (l), (h)); } while (0) #define CTR_OVERFLOWED(n) (!((n) & (1ULL<<(counter_width-1))))
#define CTR_OVERFLOWED(n) (!((n) & (1U<<(counter_width-1))))
#define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0) #define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0)
#define CTRL_READ(l, h, msrs, c) do {rdmsr((msrs->controls[(c)].addr), (l), (h)); } while (0) #define CTRL_READ(l, h, msrs, c) do {rdmsr((msrs->controls[(c)].addr), (l), (h)); } while (0)
...@@ -124,14 +123,14 @@ static void ppro_setup_ctrs(struct op_msrs const * const msrs) ...@@ -124,14 +123,14 @@ static void ppro_setup_ctrs(struct op_msrs const * const msrs)
static int ppro_check_ctrs(struct pt_regs * const regs, static int ppro_check_ctrs(struct pt_regs * const regs,
struct op_msrs const * const msrs) struct op_msrs const * const msrs)
{ {
unsigned int low, high; u64 val;
int i; int i;
for (i = 0 ; i < num_counters; ++i) { for (i = 0 ; i < num_counters; ++i) {
if (!reset_value[i]) if (!reset_value[i])
continue; continue;
CTR_READ(low, high, msrs, i); rdmsrl(msrs->counters[i].addr, val);
if (CTR_OVERFLOWED(low)) { if (CTR_OVERFLOWED(val)) {
oprofile_add_sample(regs, i); oprofile_add_sample(regs, i);
wrmsrl(msrs->counters[i].addr, -reset_value[i]); wrmsrl(msrs->counters[i].addr, -reset_value[i]);
} }
......
...@@ -105,7 +105,7 @@ static int event_buffer_open(struct inode *inode, struct file *file) ...@@ -105,7 +105,7 @@ static int event_buffer_open(struct inode *inode, struct file *file)
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (test_and_set_bit(0, &buffer_opened)) if (test_and_set_bit_lock(0, &buffer_opened))
return -EBUSY; return -EBUSY;
/* Register as a user of dcookies /* Register as a user of dcookies
...@@ -129,7 +129,7 @@ static int event_buffer_open(struct inode *inode, struct file *file) ...@@ -129,7 +129,7 @@ static int event_buffer_open(struct inode *inode, struct file *file)
fail: fail:
dcookie_unregister(file->private_data); dcookie_unregister(file->private_data);
out: out:
clear_bit(0, &buffer_opened); __clear_bit_unlock(0, &buffer_opened);
return err; return err;
} }
...@@ -141,7 +141,7 @@ static int event_buffer_release(struct inode *inode, struct file *file) ...@@ -141,7 +141,7 @@ static int event_buffer_release(struct inode *inode, struct file *file)
dcookie_unregister(file->private_data); dcookie_unregister(file->private_data);
buffer_pos = 0; buffer_pos = 0;
atomic_set(&buffer_ready, 0); atomic_set(&buffer_ready, 0);
clear_bit(0, &buffer_opened); __clear_bit_unlock(0, &buffer_opened);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment