lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <002201cf8714$d933cca0$8b9b65e0$@net>
Date:	Fri, 13 Jun 2014 07:36:21 -0700
From:	"Doug Smythies" <dsmythies@...us.net>
To:	"'Dirk Brandewie'" <dirk.brandewie@...il.com>,
	"'Rafael J. Wysocki'" <rjw@...ysocki.net>,
	"'Stratos Karafotis'" <stratosk@...aphore.gr>
Cc:	<viresh.kumar@...aro.org>, <dirk.j.brandewie@...el.com>,
	<linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] cpufreq: intel_pstate: Fix rounding of core_pct


On 2014.06.12 06:49 Dirk Brandewie wrote:
> On 06/12/2014 01:03 PM, Rafael J. Wysocki wrote:
>> On Thursday, June 12, 2014 05:35:59 PM Stratos Karafotis wrote:
>>> On 12/06/2014 12:15 πμ, Doug Smythies wrote:

>>>>> Could you please elaborate a little bit more what we need these 2 lines below?
>>>>>

> Sorry for being MIA on this thread I have been up to my eyeballs.

>>>>         if ((rem << 1) >= int_tofp(sample->mperf))
>>>>                 core_pct += 1;

> The rounding should have been
>        core_pct += (1 << (FRAC_BITS-1));
> Since core_pct is is in fixeded point notation at this point. Adding .5 to
> core_pct to round up.

> As Stratos pointed out the the current code only adds 1/256 to core_pct

> Since core_pct_busy stays in fixed point through out the rest of the
> calculations ans we only do the rounding when the PID is returning an
> int I think we can safely remove these two lines.

Absolutely, no.

That code was doing exactly what I wanted it to do.
But, as and I have already admitted, it was overkill, and yes the entire thing
can be changed to use div_64 instead.

We do not want to add 1/2 to core percent here at this spot.
You would just be bringing back the arbitrary and incorrect biasing
of core_pct upwards that used to be there in two spots before.

You would add 1/2 when you want to convert to an integer, not before (and we don't right now, for the call to trace_pstate_sample).

... Doug


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ