Commit 596da17f authored by markus.t.metzger@intel.com's avatar markus.t.metzger@intel.com Committed by Ingo Molnar

x86, perf_counter, bts: Correct pointer-to-u64 casts

On 32bit, pointers in the DS AREA configuration are cast to
u64. The current (long) cast to avoid compiler warnings results
in a signed 64bit address.
Signed-off-by: default avatarMarkus Metzger <markus.t.metzger@intel.com>
Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20090902140615.305889000@intel.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 747b50aa
...@@ -726,7 +726,8 @@ static inline void init_debug_store_on_cpu(int cpu) ...@@ -726,7 +726,8 @@ static inline void init_debug_store_on_cpu(int cpu)
return; return;
wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA, wrmsr_on_cpu(cpu, MSR_IA32_DS_AREA,
(u32)((u64)(long)ds), (u32)((u64)(long)ds >> 32)); (u32)((u64)(unsigned long)ds),
(u32)((u64)(unsigned long)ds >> 32));
} }
static inline void fini_debug_store_on_cpu(int cpu) static inline void fini_debug_store_on_cpu(int cpu)
...@@ -757,7 +758,7 @@ static void release_bts_hardware(void) ...@@ -757,7 +758,7 @@ static void release_bts_hardware(void)
per_cpu(cpu_hw_counters, cpu).ds = NULL; per_cpu(cpu_hw_counters, cpu).ds = NULL;
kfree((void *)(long)ds->bts_buffer_base); kfree((void *)(unsigned long)ds->bts_buffer_base);
kfree(ds); kfree(ds);
} }
...@@ -788,7 +789,7 @@ static int reserve_bts_hardware(void) ...@@ -788,7 +789,7 @@ static int reserve_bts_hardware(void)
break; break;
} }
ds->bts_buffer_base = (u64)(long)buffer; ds->bts_buffer_base = (u64)(unsigned long)buffer;
ds->bts_index = ds->bts_buffer_base; ds->bts_index = ds->bts_buffer_base;
ds->bts_absolute_maximum = ds->bts_absolute_maximum =
ds->bts_buffer_base + BTS_BUFFER_SIZE; ds->bts_buffer_base + BTS_BUFFER_SIZE;
...@@ -1491,7 +1492,7 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_counters *cpuc, ...@@ -1491,7 +1492,7 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_counters *cpuc,
}; };
struct perf_counter *counter = cpuc->counters[X86_PMC_IDX_FIXED_BTS]; struct perf_counter *counter = cpuc->counters[X86_PMC_IDX_FIXED_BTS];
unsigned long orig_ip = data->regs->ip; unsigned long orig_ip = data->regs->ip;
u64 at; struct bts_record *at, *top;
if (!counter) if (!counter)
return; return;
...@@ -1499,19 +1500,18 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_counters *cpuc, ...@@ -1499,19 +1500,18 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_counters *cpuc,
if (!ds) if (!ds)
return; return;
for (at = ds->bts_buffer_base; at = (struct bts_record *)(unsigned long)ds->bts_buffer_base;
at < ds->bts_index; top = (struct bts_record *)(unsigned long)ds->bts_index;
at += sizeof(struct bts_record)) {
struct bts_record *rec = (struct bts_record *)(long)at;
data->regs->ip = rec->from; ds->bts_index = ds->bts_buffer_base;
data->addr = rec->to;
for (; at < top; at++) {
data->regs->ip = at->from;
data->addr = at->to;
perf_counter_output(counter, 1, data); perf_counter_output(counter, 1, data);
} }
ds->bts_index = ds->bts_buffer_base;
data->regs->ip = orig_ip; data->regs->ip = orig_ip;
data->addr = 0; data->addr = 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