linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ashwinc@codeaurora.org (Ashwin Chaugule)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: perf: ensure overflows aren't missed due to IRQ latency
Date: Wed, 23 Mar 2011 14:35:22 -0400	[thread overview]
Message-ID: <4D8A3D6A.1000409@codeaurora.org> (raw)
In-Reply-To: <AANLkTimOKgtuAwYOrnx7anW1__wzQg-rPhqqRmC=qJcY@mail.gmail.com>

On 03/23/2011 02:28 PM, Jamie Iles wrote:
> Hmm, I'm not really sure I follow that and see how it works for an
> overflow when new < prev.  Why doesn't the naive:
> 
>        new_raw_count &= armpmu->max_period;
>        prev_raw_count &= armpmu->max_period;
>        if (overflow)
>                delta = (armpmu->max_period - prev_raw_count) +
>                        new_raw_count
>        else
>                delta = new_raw_count - prev_raw_count;
> 
> work?  I'm sure I'm missing something here!
> 
> Jamie

When new < prev, delta will be greater than 2^32. So we'll have accounted for the overflow condition anyway.

The naive solution you mention above is what we discussed earlier and works too.
I guess the additional:

>        new_raw_count &= armpmu->max_period;
>        prev_raw_count &= armpmu->max_period;

just makes it cleaner than the shifting to upper 32bits, subtracting and then shifting back again.

Cheers,
Ashwin
-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  parent reply	other threads:[~2011-03-23 18:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 15:52 [PATCH] ARM: perf: ensure overflows aren't missed due to IRQ latency Will Deacon
2011-03-23 18:13 ` Jamie Iles
     [not found]   ` <AANLkTimOKgtuAwYOrnx7anW1__wzQg-rPhqqRmC=qJcY@mail.gmail.com>
2011-03-23 18:35     ` Ashwin Chaugule [this message]
2011-03-23 18:44       ` 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=4D8A3D6A.1000409@codeaurora.org \
    --to=ashwinc@codeaurora.org \
    --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).