mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Redfearn <matt.redfearn@mips.com>
To: Thomas Gleixner <tglx@linutronix.de>
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:21:23 +0100	[thread overview]
Message-ID: <5b782526-b130-77f2-6d9a-15839e12e065@mips.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1710191435280.1971@nanos>



On 19/10/17 13:43, Thomas Gleixner wrote:
> 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?

Sure, can make it like that.

>> +		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?

That will set the target time to increasing multiples of min_delta_ns in 
the future, right? Sure, it should make it succeed faster - I'll make it 
like that. Are you OK with the arbitrarily chosen 10 retries?

Thanks,
Matt

>
> Thanks,
>
> 	tglx

  reply	other threads:[~2017-10-19 13:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 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 13:31   ` Daniel Lezcano
2017-10-19 12:43 ` [PATCH 1/3] clockevents: Retry programming min delta up to 10 times Thomas Gleixner
2017-10-19 13:21   ` Matt Redfearn [this message]
2017-10-19 13:29     ` Thomas Gleixner
2017-10-19 14:17       ` [PATCH v2] " Matt Redfearn
2017-10-19 15:45         ` [tip:timers/core] " tip-bot for James Hogan
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=5b782526-b130-77f2-6d9a-15839e12e065@mips.com \
    --to=matt.redfearn@mips.com \
    --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=schwidefsky@de.ibm.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®