linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Jens Axboe <axboe@kernel.dk>, Hannes Reinecke <hare@suse.com>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH 3/3] irq: Compute the periodic interval for interrupts
Date: Thu, 22 Jun 2017 17:25:56 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1706221647370.1885@nanos> (raw)
In-Reply-To: <1497994139-19816-3-git-send-email-daniel.lezcano@linaro.org>

On Tue, 20 Jun 2017, Daniel Lezcano wrote:
>  struct irq_timings {
>  	u64 values[IRQ_TIMINGS_SIZE]; /* our circular buffer */
> -	unsigned int count; /* Number of interruptions since last inspection */
> +	int count; /* Number of interruptions since last inspection */

WTF?

> +	ret = irq_timings_alloc(irq);
> +	if (ret) {
> +		pr_warn("Failed to allocate irq timing stats for irq%d (%d)",
> +			irq, ret);

That error code is -ENOMEM always, right?

> @@ -19,6 +25,18 @@ DEFINE_STATIC_KEY_FALSE(irq_timing_enabled);
>  
>  DEFINE_PER_CPU(struct irq_timings, irq_timings);
>  
> +struct irqt_stat {
> +	u64 ne;         /* next event                               */

Kernel doc format for struct documentation please. And with proper struct
member names you can spare that whole documentation.

What the heck is wrong with next_evt, last_ts, nr_samples or such ?

> +	u64 lts;	/* last timestamp                           */
> +	u64 variance;	/* variance                                 */
> +	u32 avg;	/* mean value                               */
> +	u32 count;      /* number of samples                        */
> +	int anomalies;  /* number of consecutives anomalies         */
> +	int valid;      /* behaviour of the interrupt               */
> +};

That would be too intuitive and spare a permanent lookup of the fricking
acronyms, right?

> +/**
> + * irqs_update - update the irq timing statistics with a new timestamp
> + *
> + * @irqs: an irqt_stat struct pointer
> + * @ts: the new timestamp
> + *
> + * ** This function must be called with the local irq disabled **

No need to yell here. And if you really fear that it's called with
interrupts enabled, then add a proper debug check.

Also instead of making mandatory statements it's better to explain WHY.

> +/**
> + * irq_timings_next_event - Return when the next event is supposed to arrive
> + *
> + * *** This function must be called with the local irq disabled ***

Idem.

> +void irq_timings_free(int irq)
> +{
> +	struct irqt_stat __percpu *s;
> +
> +	s = idr_find(&irqt_stats, irq);
> +	if (s) {
> +		free_percpu(s);
> +		idr_remove(&irqt_stats, irq);
> +	}
> +}
> +
> +int irq_timings_alloc(int irq)
> +{
> +	int id;
> +	struct irqt_stat __percpu *s;

	struct irqt_stat __percpu *s;
	int id;

Please ...

Don't bother to offer me a git tree, I'm going to apply that manually
anyway.

Thanks,

	tglx

  reply	other threads:[~2017-06-22 15:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20 21:26 [GIT PULL V11] irq: next irq tracking Daniel Lezcano
2017-06-20 21:28 ` [PATCH 1/3] irq: Allow to pass the IRQF_TIMER flag with percpu irq request Daniel Lezcano
2017-06-20 21:28   ` [PATCH 2/3] irq: Track the interrupt timings Daniel Lezcano
2017-06-22 14:47     ` Thomas Gleixner
2017-06-22 14:55       ` Daniel Lezcano
2017-06-20 21:28   ` [PATCH 3/3] irq: Compute the periodic interval for interrupts Daniel Lezcano
2017-06-22 15:25     ` Thomas Gleixner [this message]
2017-06-22 16:35       ` Daniel Lezcano
2017-06-22  9:31   ` [PATCH 1/3] irq: Allow to pass the IRQF_TIMER flag with percpu irq request Mark Rutland
2017-06-22 10:36     ` Daniel Lezcano
2017-06-20 22:04 ` [GIT PULL V11] irq: next irq tracking Thomas Gleixner
2017-06-21 10:57   ` Daniel Lezcano
2017-07-06 12:29   ` [PATCH V11] irq: Allow to pass the IRQF_TIMER flag with percpu irq request Daniel Lezcano
2017-07-06 21:21     ` [tip:irq/urgent] genirq: " tip-bot for Daniel Lezcano

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.DEB.2.20.1706221647370.1885@nanos \
    --to=tglx@linutronix.de \
    --cc=axboe@kernel.dk \
    --cc=bhelgaas@google.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=hare@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --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).