aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-11-08 13:22:38 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-11-08 13:22:38 -0500
commitaf3e48ffce029a191f1bc4b8550e8571303233d5 (patch)
treea3d342da1b1b4904351e7e0378df2ace3fb04759
parentd8af8582c321414087ed46512ffe5ce4f5c9c5da (diff)
parent01aab518b084a547940ed6ff334e9a7721c7dc71 (diff)
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
-rw-r--r--arch/Kconfig2
-rw-r--r--arch/x86/oprofile/op_model_ppro.c9
-rw-r--r--drivers/oprofile/event_buffer.c6
3 files changed, 8 insertions, 9 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index e6ab550bceb3..8977d99987cb 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -21,7 +21,7 @@ config OPROFILE_IBS
21 Instruction-Based Sampling (IBS) is a new profiling 21 Instruction-Based Sampling (IBS) is a new profiling
22 technique that provides rich, precise program performance 22 technique that provides rich, precise program performance
23 information. IBS is introduced by AMD Family10h processors 23 information. IBS is introduced by AMD Family10h processors
24 (AMD Opteron Quad-Core processor Barcelona) to overcome 24 (AMD Opteron Quad-Core processor "Barcelona") to overcome
25 the limitations of conventional performance counter 25 the limitations of conventional performance counter
26 sampling. 26 sampling.
27 27
diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
index 0620d6d45f7d..3f1b81a83e2e 100644
--- a/arch/x86/oprofile/op_model_ppro.c
+++ b/arch/x86/oprofile/op_model_ppro.c
@@ -27,8 +27,7 @@ static int num_counters = 2;
27static int counter_width = 32; 27static int counter_width = 32;
28 28
29#define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0) 29#define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0)
30#define CTR_READ(l, h, msrs, c) do {rdmsr(msrs->counters[(c)].addr, (l), (h)); } while (0) 30#define CTR_OVERFLOWED(n) (!((n) & (1ULL<<(counter_width-1))))
31#define CTR_OVERFLOWED(n) (!((n) & (1U<<(counter_width-1))))
32 31
33#define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0) 32#define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0)
34#define CTRL_READ(l, h, msrs, c) do {rdmsr((msrs->controls[(c)].addr), (l), (h)); } while (0) 33#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)
124static int ppro_check_ctrs(struct pt_regs * const regs, 123static int ppro_check_ctrs(struct pt_regs * const regs,
125 struct op_msrs const * const msrs) 124 struct op_msrs const * const msrs)
126{ 125{
127 unsigned int low, high; 126 u64 val;
128 int i; 127 int i;
129 128
130 for (i = 0 ; i < num_counters; ++i) { 129 for (i = 0 ; i < num_counters; ++i) {
131 if (!reset_value[i]) 130 if (!reset_value[i])
132 continue; 131 continue;
133 CTR_READ(low, high, msrs, i); 132 rdmsrl(msrs->counters[i].addr, val);
134 if (CTR_OVERFLOWED(low)) { 133 if (CTR_OVERFLOWED(val)) {
135 oprofile_add_sample(regs, i); 134 oprofile_add_sample(regs, i);
136 wrmsrl(msrs->counters[i].addr, -reset_value[i]); 135 wrmsrl(msrs->counters[i].addr, -reset_value[i]);
137 } 136 }
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c
index d962ba0dd87a..191a3202cecc 100644
--- a/drivers/oprofile/event_buffer.c
+++ b/drivers/oprofile/event_buffer.c
@@ -105,7 +105,7 @@ static int event_buffer_open(struct inode *inode, struct file *file)
105 if (!capable(CAP_SYS_ADMIN)) 105 if (!capable(CAP_SYS_ADMIN))
106 return -EPERM; 106 return -EPERM;
107 107
108 if (test_and_set_bit(0, &buffer_opened)) 108 if (test_and_set_bit_lock(0, &buffer_opened))
109 return -EBUSY; 109 return -EBUSY;
110 110
111 /* Register as a user of dcookies 111 /* Register as a user of dcookies
@@ -129,7 +129,7 @@ static int event_buffer_open(struct inode *inode, struct file *file)
129fail: 129fail:
130 dcookie_unregister(file->private_data); 130 dcookie_unregister(file->private_data);
131out: 131out:
132 clear_bit(0, &buffer_opened); 132 __clear_bit_unlock(0, &buffer_opened);
133 return err; 133 return err;
134} 134}
135 135
@@ -141,7 +141,7 @@ static int event_buffer_release(struct inode *inode, struct file *file)
141 dcookie_unregister(file->private_data); 141 dcookie_unregister(file->private_data);
142 buffer_pos = 0; 142 buffer_pos = 0;
143 atomic_set(&buffer_ready, 0); 143 atomic_set(&buffer_ready, 0);
144 clear_bit(0, &buffer_opened); 144 __clear_bit_unlock(0, &buffer_opened);
145 return 0; 145 return 0;
146} 146}
147 147