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: <55edd1a1-0120-0f5e-5105-050a4f93e713@puri.sm>
Date:   Mon, 5 Aug 2019 09:40:01 +0200
From:   Martin Kepplinger <martin.kepplinger@...i.sm>
To:     Daniel Lezcano <daniel.lezcano@...aro.org>,
        viresh.kumar@...aro.org, kevin.wangtao@...aro.org,
        leo.yan@...aro.org, edubezval@...il.com,
        vincent.guittot@...aro.org, javi.merino@...nel.org,
        rui.zhang@...el.com, daniel.thompson@...aro.org
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 6/7] thermal/drivers/cpu_cooling: Introduce the cpu
 idle cooling driver

On 05.08.19 09:37, Daniel Lezcano wrote:
> On 05/08/2019 07:11, Martin Kepplinger wrote:
>> ---
> 
> [ ... ]
> 
>>> +static s64 cpuidle_cooling_runtime(struct cpuidle_cooling_device *idle_cdev)
>>> +{
>>> +	s64 next_wakeup;
>>> +	unsigned long state = idle_cdev->state;
>>> +
>>> +	/*
>>> +	 * The function should not be called when there is no
>>> +	 * mitigation because:
>>> +	 * - that does not make sense
>>> +	 * - we end up with a division by zero
>>> +	 */
>>> +	if (!state)
>>> +		return 0;
>>> +
>>> +	next_wakeup = (s64)((idle_cdev->idle_cycle * 100) / state) -
>>> +		idle_cdev->idle_cycle;
>>> +
>>> +	return next_wakeup * NSEC_PER_USEC;
>>> +}
>>> +
>>
>> There is a bug in your calculation formula here when "state" becomes 100.
>> You return 0 for the injection rate, which is the same as "rate" being 0,
>> which is dangerous. You stop cooling when it's most necessary :)
> 
> Right, thanks for spotting this.
> 
>> I'm not sure how much sense really being 100% idle makes, so I, when testing
>> this, just say if (state == 100) { state = 99 }. Anyways, just don't return 0.
>>
>> Daniel, thanks a lot for these additions! Could you send an update of this?
> 
> Yes, I'm working on a new version.

great.

> 
>> btw, that's what I'm referring to:
>> https://lore.kernel.org/linux-pm/1522945005-7165-1-git-send-email-daniel.lezcano@linaro.org/
>> I know it's a little old already, but it seems like there hasn't been any
>> equivalent solution in the meantime, has it?
>>
>> Using cpuidle for cooling is way more effective than cpufreq (which often
>> hardly is).
> 
> On which platform that happens?
> 
> 

I'm running this on imx8mq.

thanks,

                                    martin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ