From: Balbir Singh <bsingharora@gmail.com>
To: Gautham R Shenoy <ego@linux.vnet.ibm.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Stewart Smith <stewart@linux.vnet.ibm.com>,
Michael Neuling <mikey@neuling.org>,
Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>,
Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>,
Nicholas Piggin <npiggin@gmail.com>,
"open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)"
<linuxppc-dev@lists.ozlabs.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-pm@vger.kernel.org
Subject: Re: [PATCH] cpuidle:powernv: Make the snooze timeout dynamic.
Date: Sat, 2 Jun 2018 10:16:45 +1000 [thread overview]
Message-ID: <CAKTCnznToaF_b9-Z6dH95DQOAu19q3otQc8ugAYXeQj76a5SHA@mail.gmail.com> (raw)
In-Reply-To: <20180601045433.GA17425@in.ibm.com>
On Fri, Jun 1, 2018 at 2:54 PM, Gautham R Shenoy <ego@linux.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.
next prev parent reply other threads:[~2018-06-02 0:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-31 12:15 [PATCH] cpuidle:powernv: Make the snooze timeout dynamic Gautham R. Shenoy
2018-05-31 14:51 ` Balbir Singh
2018-06-01 4:54 ` Gautham R Shenoy
2018-06-02 0:16 ` Balbir Singh [this message]
2018-06-04 11:27 ` Michael Ellerman
2018-06-05 3:47 ` Stewart Smith
2018-06-05 8:45 ` Gautham R Shenoy
2018-06-05 12:18 ` Michael Ellerman
2018-06-05 15:19 ` Michael Ellerman
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=CAKTCnznToaF_b9-Z6dH95DQOAu19q3otQc8ugAYXeQj76a5SHA@mail.gmail.com \
--to=bsingharora@gmail.com \
--cc=akshay.adiga@linux.vnet.ibm.com \
--cc=daniel.lezcano@linaro.org \
--cc=ego@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=rjw@rjwysocki.net \
--cc=shilpa.bhat@linux.vnet.ibm.com \
--cc=stewart@linux.vnet.ibm.com \
--cc=svaidy@linux.vnet.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;
as well as URLs for NNTP newsgroup(s).