linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	shreyas@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
	peterz@infradead.org, rafael@kernel.org,
	vincent.guittot@linaro.org
Subject: Re: [PATCH V4] irq: Track the interrupt timings
Date: Fri, 10 Jun 2016 11:29:52 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.20.1606101128180.1714@knanqh.ubzr> (raw)
In-Reply-To: <alpine.DEB.2.11.1606101716530.5839@nanos>

On Fri, 10 Jun 2016, Thomas Gleixner wrote:

> On Fri, 10 Jun 2016, Nicolas Pitre wrote:
> > On Fri, 10 Jun 2016, Thomas Gleixner wrote:
> > > > +	diff = now - prev;
> > > > +
> > > > +	/*
> > > > +	 * microsec (actually 1024th of a milisec) precision is good
> > > > +	 * enough for our purpose.
> > > > +	 */
> > > > +	diff >>= 10;
> > > 
> > > And that shift instruction is required because of the following?
> > > 
> > > >   	 * Otherwise we know the magnitude of diff is
> > > > +	 * well within 32 bits.
> > > 
> > > AFAICT that's pointless. You are not saving anything because NSEC_PER_SEC is
> > > smaller than 2^32 and your 8 values are not going to overflow 64 bit in the
> > > sum.
> > 
> > Those values are squared later, so we really want 32 bits here.
> 
> Well, you can do sum >> 10 exaclty once when you calculate stuff.

Given your later argument I agree.

> > > > +	 */
> > > > +	if (unlikely(diff > USEC_PER_SEC)) {
> > > > +		memset(timings, 0, sizeof(*timings));
> > > > +		timings->timestamp = now;
> > > 
> > > Redundant store.
> > 
> > We just trashed all our data with the memset so the current timestamp 
> > needs to be restored.
> 
> So why doing a full memset and not only on the array ?

Go figure.  This code has come a long way.

> > > Now the real question is whether you really need all that math, checks and
> > > memsets in the irq hotpath. If you make the storage slightly larger then you
> > > can just store the values unconditionally in the circular buffer and do all
> > > the computational stuff when you really it.
> > 
> > Well... given that you need an IRQ everytime you come out of idle that 
> > means there will always be more IRQs than entries into idle, so you're 
> > probably right.
> 
> Glad you agree.
> 
> Thanks,
> 
> 	tglx
> 

  reply	other threads:[~2016-06-10 15:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 11:05 [PATCH V4] irq: Track the interrupt timings Daniel Lezcano
2016-04-22 18:21 ` Daniel Lezcano
2016-05-03 13:44 ` Daniel Lezcano
2016-06-10 14:52 ` Thomas Gleixner
2016-06-10 15:11   ` Nicolas Pitre
2016-06-10 15:20     ` Thomas Gleixner
2016-06-10 15:29       ` Nicolas Pitre [this message]
2016-06-14 13:36   ` Daniel Lezcano
2016-06-14 15:10     ` Nicolas Pitre
2016-06-14 15:38       ` Daniel Lezcano
2016-06-14 16:36       ` Thomas Gleixner

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=alpine.LFD.2.20.1606101128180.1714@knanqh.ubzr \
    --to=nicolas.pitre@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=shreyas@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.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).