From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: perf: ensure counter delta is limited to 32-bits
Date: Fri, 2 Jul 2010 14:22:09 +0100 [thread overview]
Message-ID: <004301cb19e9$9314a830$b93df890$@deacon@arm.com> (raw)
In-Reply-To: <20100702180503.GF2357@wear.picochip.com>
Hi Jamie,
> Well spotted! I think this may have actually been a typo when porting to ARM
> from the sparc and x86 code, and this should address it so we do the same:
>
> diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
> index 9e70f20..6c0f3ca 100644
> --- a/arch/arm/kernel/perf_event.c
> +++ b/arch/arm/kernel/perf_event.c
> @@ -164,7 +164,7 @@ armpmu_event_update(struct perf_event *event,
> int idx)
> {
> int shift = 64 - 32;
> - s64 prev_raw_count, new_raw_count;
> + u64 prev_raw_count, new_raw_count;
> s64 delta;
>
> again:
I wondered about this approach, but I couldn't convince myself it was
correct. When armpmu_event_set_period updates hwc->prev_count, it sets
the top 32-bits to 1. When we do the cmpxchg in armpmu_event_update, we
will only be writing the bottom 32-bits. This means that prev_count
alternates between s64 and u64 and I'm not sure what the rest of the perf
framework will do in that case.
Tell you what, I'll make the change and see what happens to the numbers...
Will
next prev parent reply other threads:[~2010-07-02 13:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-02 12:44 [PATCH] ARM: perf: ensure counter delta is limited to 32-bits Will Deacon
2010-07-02 18:05 ` Jamie Iles
2010-07-02 13:22 ` Will Deacon [this message]
2010-07-02 13:38 ` Will Deacon
2010-07-02 18:48 ` Jamie Iles
2010-07-02 14:17 ` Will Deacon
2010-07-02 20:04 ` Jamie Iles
2010-07-02 15:36 ` Will Deacon
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='004301cb19e9$9314a830$b93df890$@deacon@arm.com' \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).