[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b782526-b130-77f2-6d9a-15839e12e065@mips.com>
Date: Thu, 19 Oct 2017 14:21:23 +0100
From: Matt Redfearn <matt.redfearn@...s.com>
To: Thomas Gleixner <tglx@...utronix.de>
CC: Daniel Lezcano <daniel.lezcano@...aro.org>,
James Hogan <james.hogan@...s.com>,
<linux-mips@...ux-mips.org>, James Hogan <jhogan@...nel.org>,
Martin Schwidefsky <schwidefsky@...ibm.com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] clockevents: Retry programming min delta up to 10
times
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
Powered by blists - more mailing lists