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: <aa941c67-1dec-5363-7bd7-5e9d8d324110@nvidia.com>
Date:   Tue, 14 Jul 2020 08:26:39 +0100
From:   Jon Hunter <jonathanh@...dia.com>
To:     Viresh Kumar <viresh.kumar@...aro.org>
CC:     Thierry Reding <thierry.reding@...il.com>,
        "Rafael J . Wysocki" <rjw@...ysocki.net>,
        <linux-tegra@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] cpufreq: tegra186: Fix initial frequency


On 14/07/2020 04:46, Viresh Kumar wrote:
> On 13-07-20, 17:37, Jon Hunter wrote:
>>
>> On 13/07/2020 04:25, Viresh Kumar wrote:
>>> On 12-07-20, 11:06, Jon Hunter wrote:
>>>> Commit 6cc3d0e9a097 ("cpufreq: tegra186: add
>>>> CPUFREQ_NEED_INITIAL_FREQ_CHECK flag") fixed CPUFREQ support for
>>>> Tegra186 but as a consequence the following warnings are now seen on
>>>> boot ...
>>>>
>>>>  cpufreq: cpufreq_online: CPU0: Running at unlisted freq: 0 KHz
>>>>  cpufreq: cpufreq_online: CPU0: Unlisted initial frequency changed to: 2035200 KHz
>>>>  cpufreq: cpufreq_online: CPU1: Running at unlisted freq: 0 KHz
>>>>  cpufreq: cpufreq_online: CPU1: Unlisted initial frequency changed to: 2035200 KHz
>>>>  cpufreq: cpufreq_online: CPU2: Running at unlisted freq: 0 KHz
>>>>  cpufreq: cpufreq_online: CPU2: Unlisted initial frequency changed to: 2035200 KHz
>>>>  cpufreq: cpufreq_online: CPU3: Running at unlisted freq: 0 KHz
>>>>  cpufreq: cpufreq_online: CPU3: Unlisted initial frequency changed to: 2035200 KHz
>>>>  cpufreq: cpufreq_online: CPU4: Running at unlisted freq: 0 KHz
>>>>  cpufreq: cpufreq_online: CPU4: Unlisted initial frequency changed to: 2035200 KHz
>>>>  cpufreq: cpufreq_online: CPU5: Running at unlisted freq: 0 KHz
>>>>  cpufreq: cpufreq_online: CPU5: Unlisted initial frequency changed to: 2035200 KHz
>>>>
>>>> Although we could fix this by adding a 'get' operator for the Tegra186
>>>> CPUFREQ driver, there is really little point because the CPUFREQ on
>>>> Tegra186 is set by writing a value stored in the frequency table to a
>>>> register and we just need to set the initial frequency.
>>>
>>> The hardware still runs at the frequency requested by cpufreq core here, right ?
>>
>> Yes.
>>
>>> It is better to provide the get() callback as it is also used to show the
>>> current frequency in userspace.
>>
>> I looked at that and I saw that if the get() callback is not provided,
>> the current frequency showed by userspace is policy->cur. For this
>> device, policy->cur is accurate and so if we added the get() callback we
>> essentially just going to return policy->cur. Therefore, given that we
>> already know policy->cur, I did not see the point in adding a device
>> specific handler to do the same thing.
> 
> The get() callback is supposed to read the frequency from hardware and
> return it, no cached value here. policy->cur may end up being wrong in
> case there is a bug.

OK, I can add a get callback. However, there are a few other drivers
that set the current frequency in the init() and don't implement a get()
callback ...

drivers/cpufreq/pasemi-cpufreq.c
drivers/cpufreq/ppc_cbe_cpufreq.c
drivers/cpufreq/intel_pstate.c

Jon

-- 
nvpublic

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ