From: "tip-bot for markus.t.metzger@intel.com" <markus.t.metzger@intel.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
a.p.zijlstra@chello.nl, markus.t.metzger@intel.com,
tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perfcounters/core] x86, perf_counter, bts: Correct pointer-to-u64 casts
Date: Fri, 4 Sep 2009 07:58:31 GMT [thread overview]
Message-ID: <tip-596da17f94c103348ebe04129c00d536ea0e80e2@git.kernel.org> (raw)
In-Reply-To: <20090902140615.305889000@intel.com>
Commit-ID: 596da17f94c103348ebe04129c00d536ea0e80e2
Gitweb: http://git.kernel.org/tip/596da17f94c103348ebe04129c00d536ea0e80e2
Author: markus.t.metzger@intel.com <markus.t.metzger@intel.com>
AuthorDate: Wed, 2 Sep 2009 16:04:47 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 4 Sep 2009 09:26:39 +0200
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: Markus Metzger <markus.t.metzger@intel.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20090902140615.305889000@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/cpu/perf_counter.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 2f41874..3776b0b 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -726,7 +726,8 @@ static inline void init_debug_store_on_cpu(int cpu)
return;
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)
@@ -757,7 +758,7 @@ static void release_bts_hardware(void)
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);
}
@@ -788,7 +789,7 @@ static int reserve_bts_hardware(void)
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_absolute_maximum =
ds->bts_buffer_base + BTS_BUFFER_SIZE;
@@ -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];
unsigned long orig_ip = data->regs->ip;
- u64 at;
+ struct bts_record *at, *top;
if (!counter)
return;
@@ -1499,19 +1500,18 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_counters *cpuc,
if (!ds)
return;
- for (at = ds->bts_buffer_base;
- at < ds->bts_index;
- at += sizeof(struct bts_record)) {
- struct bts_record *rec = (struct bts_record *)(long)at;
+ at = (struct bts_record *)(unsigned long)ds->bts_buffer_base;
+ top = (struct bts_record *)(unsigned long)ds->bts_index;
- data->regs->ip = rec->from;
- data->addr = rec->to;
+ ds->bts_index = ds->bts_buffer_base;
+
+ for (; at < top; at++) {
+ data->regs->ip = at->from;
+ data->addr = at->to;
perf_counter_output(counter, 1, data);
}
- ds->bts_index = ds->bts_buffer_base;
-
data->regs->ip = orig_ip;
data->addr = 0;
next prev parent reply other threads:[~2009-09-04 7:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-02 14:04 [patch 0/3] x86, perf_counter, bts: incorporate review feedback and fix bugs markus.t.metzger
2009-09-02 14:04 ` [patch 1/3] x86, perf_counter, bts: fail if BTS is not available markus.t.metzger
2009-09-04 7:58 ` [tip:perfcounters/core] x86, perf_counter, bts: Fail " tip-bot for markus.t.metzger@intel.com
2009-09-02 14:04 ` [patch 2/3] x86, perf_counter, bts: correct pointer-to-u64 casts markus.t.metzger
2009-09-04 7:58 ` tip-bot for markus.t.metzger@intel.com [this message]
2009-09-02 14:04 ` [patch 3/3] x86, perf_counter, bts: do not allow kernel BTS tracing markus.t.metzger
2009-09-04 7:58 ` [tip:perfcounters/core] x86, perf_counter, bts: Do not allow kernel BTS tracing for now tip-bot for markus.t.metzger@intel.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-596da17f94c103348ebe04129c00d536ea0e80e2@git.kernel.org \
--to=markus.t.metzger@intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome