[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKTCnznToaF_b9-Z6dH95DQOAu19q3otQc8ugAYXeQj76a5SHA@mail.gmail.com>
Date: Sat, 2 Jun 2018 10:16:45 +1000
From: Balbir Singh <bsingharora@...il.com>
To: Gautham R Shenoy <ego@...ux.vnet.ibm.com>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Michael Ellerman <mpe@...erman.id.au>,
Stewart Smith <stewart@...ux.vnet.ibm.com>,
Michael Neuling <mikey@...ling.org>,
Vaidyanathan Srinivasan <svaidy@...ux.vnet.ibm.com>,
Shilpasri G Bhat <shilpa.bhat@...ux.vnet.ibm.com>,
Akshay Adiga <akshay.adiga@...ux.vnet.ibm.com>,
Nicholas Piggin <npiggin@...il.com>,
"open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)"
<linuxppc-dev@...ts.ozlabs.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
linux-pm@...r.kernel.org
Subject: Re: [PATCH] cpuidle:powernv: Make the snooze timeout dynamic.
On Fri, Jun 1, 2018 at 2:54 PM, Gautham R Shenoy <ego@...ux.vnet.ibm.com> wrote:
> Hi Balbir,
>
> Thanks for reviewing the patch!
>
> On Fri, Jun 01, 2018 at 12:51:05AM +1000, Balbir Singh wrote:
>> On Thu, May 31, 2018 at 10:15 PM, Gautham R. Shenoy
>
> [..snip..]
>> >
>> > +static u64 get_snooze_timeout(struct cpuidle_device *dev,
>> > + struct cpuidle_driver *drv,
>> > + int index)
>> > +{
>> > + int i;
>> > +
>> > + if (unlikely(!snooze_timeout_en))
>> > + return default_snooze_timeout;
>> > +
>> > + for (i = index + 1; i < drv->state_count; i++) {
>> > + struct cpuidle_state *s = &drv->states[i];
>> > + struct cpuidle_state_usage *su = &dev->states_usage[i];
>> > +
>> > + if (s->disabled || su->disable)
>> > + continue;
>> > +
>> > + return s->target_residency * tb_ticks_per_usec;
>>
>> Can we ensure this is not prone to overflow?
>
> s->target_residency is an "unsigned int" so can take a maximum value
> of UINT_MAX. tb_ticks_per_usec is an "unsigned long" with a value in
> the range of 100-1000. The return value is a u64. The product of
> s->target_residency and tb_ticks_per_usec should be contained in u64.
>
Fair enough, looks reasonable to me
Balbir Singh.
Powered by blists - more mailing lists