All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org,
	nicolas.pitre@linaro.org, rafael@kernel.org,
	vincent.guittot@linaro.org
Subject: Re: [PATCH V8 2/3] irq: Track the interrupt timings
Date: Thu, 23 Mar 2017 20:02:25 +0100	[thread overview]
Message-ID: <20170323190225.GB24630@mai> (raw)
In-Reply-To: <20170323183542.xfhc4zhjxbyxar57@hirez.programming.kicks-ass.net>

On Thu, Mar 23, 2017 at 07:35:42PM +0100, Peter Zijlstra wrote:
> On Thu, Mar 23, 2017 at 06:42:02PM +0100, Daniel Lezcano wrote:
> > +/*
> > + * The function record_irq_time is only called in one place in the
> > + * interrupts handler. We want this function always inline so the code
> > + * inside is embedded in the function and the static key branching
> > + * code can act at the higher level. Without the explicit
> > + * __always_inline we can end up with a function call and a small
> > + * overhead in the hotpath for nothing.
> > + */
> > +static __always_inline void record_irq_time(struct irq_desc *desc)
> > +{
> > +	if (static_key_enabled(&irq_timing_enabled)) {
> 
> I think you meant to have either static_branch_likely() or
> static_branch_unlikely() here. Those are runtime code patched,
> static_key_enabled() generates a regular load and test condition.
> 
> Also; if you do something like:
> 
> 	if (!static_branch_likely(&irq_timing_enabled))
> 		return;
> 
> you can save one level of indent.

Ok, thanks for the hint.

> > +		if (desc->istate & IRQS_TIMINGS) {
> > +			struct irq_timings *timings = this_cpu_ptr(&irq_timings);
> > +			unsigned int index = timings->count & IRQ_TIMINGS_MASK;
> > +
> > +			timings->values[index].ts = local_clock();
> > +			timings->values[index].irq = irq_desc_get_irq(desc);
> > +			timings->count++;
> > +		}
> > +	}
> > +}
> 
> 
> 
> > +DEFINE_STATIC_KEY_FALSE(irq_timing_enabled);
> > +
> > +DEFINE_PER_CPU(struct irq_timings, irq_timings);
> > +
> > +void irq_timings_enable(void)
> > +{
> > +	static_branch_inc(&irq_timing_enabled);
> 
> Do you really need counting, or do you want static_branch_enable() here?

I put counting in order to let several subsystem to use the irq timings if it
is needed.
 
> > +}
> > +
> > +void irq_timings_disable(void)
> > +{
> > +	static_branch_dec(&irq_timing_enabled);
> 
> idem.
> 
> > +}
> > -- 
> > 1.9.1
> > 

-- 

 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

  reply	other threads:[~2017-03-23 19:02 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23 17:42 [PATCH V8 1/3] irq: Add flags to request_percpu_irq function Daniel Lezcano
2017-03-23 17:42 ` Daniel Lezcano
2017-03-23 17:42 ` Daniel Lezcano
2017-03-23 17:42 ` [PATCH V8 2/3] irq: Track the interrupt timings Daniel Lezcano
2017-03-23 18:35   ` Peter Zijlstra
2017-03-23 19:02     ` Daniel Lezcano [this message]
2017-03-23 19:06       ` Nicolas Pitre
2017-03-23 19:14   ` Nicolas Pitre
2017-03-23 19:38     ` Thomas Gleixner
2017-03-23 19:50       ` Nicolas Pitre
2017-03-23 21:17         ` Thomas Gleixner
2017-03-23 17:42 ` [PATCH V8 3/3] irq: Compute the periodic interval for interrupts Daniel Lezcano
2017-03-23 19:40   ` Nicolas Pitre
2017-03-24 14:14     ` Daniel Lezcano
2017-03-23 18:34 ` [PATCH V8 1/3] irq: Add flags to request_percpu_irq function Vineet Gupta
2017-03-23 18:34 ` Vineet Gupta
2017-03-23 18:34   ` Vineet Gupta
2017-03-23 18:34   ` Vineet Gupta
2017-03-23 18:54 ` Mark Rutland
2017-03-23 18:54 ` Mark Rutland
2017-03-23 18:54   ` Mark Rutland
2017-03-23 18:54   ` Mark Rutland
2017-03-23 19:19   ` Daniel Lezcano
2017-03-23 19:19     ` Daniel Lezcano
2017-03-23 19:19     ` Daniel Lezcano
2017-03-23 19:19     ` Daniel Lezcano
2017-03-23 19:19   ` Daniel Lezcano
2017-03-27  8:44 ` Andrew Jones
2017-03-27  8:44   ` Andrew Jones
2017-03-27  8:44   ` Andrew Jones
2017-03-27  8:44   ` Andrew Jones
2017-03-27  8:44 ` Andrew Jones

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=20170323190225.GB24630@mai \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --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 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.