Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Matt Redfearn <matt.redfearn@mips.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	James Hogan <james.hogan@mips.com>,
	linux-mips@linux-mips.org, James Hogan <jhogan@kernel.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] clockevents: Retry programming min delta up to 10 times
Date: Thu, 19 Oct 2017 14:43:25 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1710191435280.1971@nanos> (raw)
In-Reply-To: <1508414135-29123-1-git-send-email-matt.redfearn@mips.com>

On Thu, 19 Oct 2017, Matt Redfearn wrote:
>  	unsigned long long clc;
>  	int64_t delta;
> +	int i;
>  
> -	delta = dev->min_delta_ns;
> -	dev->next_event = ktime_add_ns(ktime_get(), delta);
> +	for (i = 0;;) {

Bah. What's wrong with

	for (i = 0; i < 10; i++) {

	    	....
		if (!(dev->set_next_event((unsigned long) clc, dev))
			return 0;
	}
	return -ETIME;

Hmm?

> +		delta = dev->min_delta_ns;
> +		dev->next_event = ktime_add_ns(ktime_get(), delta);
>  
> -	if (clockevent_state_shutdown(dev))
> -		return 0;
> +		if (clockevent_state_shutdown(dev))
> +			return 0;
>  
> -	dev->retries++;
> -	clc = ((unsigned long long) delta * dev->mult) >> dev->shift;
> -	return dev->set_next_event((unsigned long) clc, dev);
> +		dev->retries++;
> +		clc = ((unsigned long long) delta * dev->mult) >> dev->shift;

I'd rather make that:

	delta = 0;
	for (i = 0; i < 10; i++) {
		delta += dev->min_delta_ns;
		dev->next_event = ktime_add_ns(ktime_get(), delta);
		clc = .....
	   	.....

That makes it more likely to succeed fast. Hmm?

Thanks,

	tglx

  parent reply	other threads:[~2017-10-19 12:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19 11:55 [PATCH 1/3] clockevents: Retry programming min delta up to 10 times Matt Redfearn
2017-10-19 11:55 ` Matt Redfearn
2017-10-19 11:55 ` [PATCH 2/3] clocksource/mips-gic-timer: Remove pointless irq_save,restore Matt Redfearn
2017-10-19 11:55   ` Matt Redfearn
2017-10-19 13:23   ` Daniel Lezcano
2017-10-19 21:57     ` Daniel Lezcano
2017-10-19 11:55 ` [PATCH V2 3/3] clocksource: mips-gic-timer: Add fastpath for local timer updates Matt Redfearn
2017-10-19 11:55   ` Matt Redfearn
2017-10-19 13:31   ` Daniel Lezcano
2017-10-19 12:43 ` Thomas Gleixner [this message]
2017-10-19 13:21   ` [PATCH 1/3] clockevents: Retry programming min delta up to 10 times Matt Redfearn
2017-10-19 13:21     ` Matt Redfearn
2017-10-19 13:29     ` Thomas Gleixner
2017-10-19 14:17       ` [PATCH v2] " Matt Redfearn
2017-10-19 14:17         ` Matt Redfearn
2017-10-19 15:04       ` [PATCH 1/3] " Martin Schwidefsky
2017-10-19 15:11         ` 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.DEB.2.20.1710191435280.1971@nanos \
    --to=tglx@linutronix.de \
    --cc=daniel.lezcano@linaro.org \
    --cc=james.hogan@mips.com \
    --cc=jhogan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=matt.redfearn@mips.com \
    --cc=schwidefsky@de.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox