All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Matthijs van Duin <matthijsvanduin@gmail.com>
Cc: Grazvydas Ignotas <notasas@gmail.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	Nishanth Menon <nm@ti.com>,
	Santosh Shilimkar <ssantosh@kernel.org>,
	Will Deacon <will.deacon@arm.com>
Subject: Re: Enabling DBGEN signal in GP OMAP3
Date: Wed, 18 Feb 2015 14:56:40 -0800	[thread overview]
Message-ID: <20150218225639.GD32521@atomide.com> (raw)
In-Reply-To: <CAALWOA-P0vov1HHR3Wh-B_xz_X1WNgVQGOHD_gvaf3NPWsNu_w@mail.gmail.com>

* Matthijs van Duin <matthijsvanduin@gmail.com> [150218 10:32]:
> On 18 February 2015 at 15:54, Tony Lindgren <tony@atomide.com> wrote:
> > From memory.. I believe the issue was that for anything needing to
> > set the counter and rely on the counter interrupt things would fail
> > as the counter interrupts would not always happen.
> 
> Correct, but the interrupt is just used to indicate when counters
> overflow, intended to be used to correctly keep track of the counters
> when they exceed 2^32 (which can happen easily when measuring across a
> timespan of more than a few seconds).
> 
> However, no performance counter can increment more than twice per cpu
> cycle, which means it takes at least 2^31 cpu cycles to completely
> wrap a counter around.  If you make sure you update local copies
> (untested code below) more often than once per 2^31 cycles they should
> therefore keep accurate track.
> 
> void update_perf_counters( u64 ctr[4] )
> {
>         for( int i = 0; i < 4; i++ ) {
>                 u32 val;
>                 asm volatile( "mcr p15, 0, %0, c9, c12, 5" :: "r"(i) );
>                 asm volatile( "mrc p15, 0, %0, c9, c13, 2" : "=r"(val) );
>                 ctr[i] += (u32)( val - ctr[i] );
>         }
> }

Hmm yeah maybe oprofile/perf whatever has maximum value that can be
specified for the counter length that allows working around it.

Regards,

Tony

  reply	other threads:[~2015-02-18 23:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-15 21:30 Enabling DBGEN signal in GP OMAP3 Grazvydas Ignotas
2015-02-16 17:58 ` Tony Lindgren
2015-02-16 20:09   ` Matthijs van Duin
2015-02-17 23:37     ` Grazvydas Ignotas
2015-02-18  3:00       ` Matthijs van Duin
2015-02-19  2:16         ` Grazvydas Ignotas
2015-02-19  9:56           ` Matthijs van Duin
2015-02-23 11:52             ` Matthijs van Duin
2015-02-26  1:09               ` Grazvydas Ignotas
2015-02-26  3:14                 ` Matthijs van Duin
2015-02-26  4:01                 ` Matthijs van Duin
2015-03-01  0:03                   ` Grazvydas Ignotas
2015-03-01  1:52                     ` Matthijs van Duin
2015-02-18 14:54     ` Tony Lindgren
2015-02-18 18:28       ` Matthijs van Duin
2015-02-18 22:56         ` Tony Lindgren [this message]
2015-02-16 18:43 ` Matthijs van Duin

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=20150218225639.GD32521@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=matthijsvanduin@gmail.com \
    --cc=nm@ti.com \
    --cc=notasas@gmail.com \
    --cc=ssantosh@kernel.org \
    --cc=will.deacon@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.