<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/opp, branch linux-5.11.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-5.11.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-5.11.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2021-03-17T16:11:35+00:00</updated>
<entry>
<title>opp: Don't drop extra references to OPPs accidentally</title>
<updated>2021-03-17T16:11:35+00:00</updated>
<author>
<name>Beata Michalska</name>
<email>beata.michalska@arm.com</email>
</author>
<published>2021-03-04T15:07:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=614b31a7409718fd792c11a7a96dc23617585fe5'/>
<id>urn:sha1:614b31a7409718fd792c11a7a96dc23617585fe5</id>
<content type='text'>
commit 606a5d4227e4610399c61086ac55c46068a90b03 upstream.

We are required to call dev_pm_opp_put() from outside of the
opp_table-&gt;lock as debugfs removal needs to happen lock-less to avoid
circular dependency issues.

commit cf1fac943c63 ("opp: Reduce the size of critical section in
_opp_kref_release()") tried to fix that introducing a new routine
_opp_get_next() which keeps returning OPPs that can be freed by the
callers and this routine shall be called without holding the
opp_table-&gt;lock.

Though the commit overlooked the fact that the OPPs can be referenced by
other users as well and this routine will end up dropping references
which were taken by other users and hence freeing the OPPs prematurely.

In effect, other users of the OPPs will end up having invalid pointers
at hand. We didn't see any crash reports earlier as the exact situation
never happened, though it is certainly possible.

We need a way to mark which OPPs are no longer referenced by the OPP
core, so we don't drop extra references to them accidentally.

This commit adds another OPP flag, "removed", which is used to track
this. And now we should never end up dropping extra references to the
OPPs.

Cc: v5.11+ &lt;stable@vger.kernel.org&gt; # v5.11+
Fixes: cf1fac943c63 ("opp: Reduce the size of critical section in _opp_kref_release()")
Signed-off-by: Beata Michalska &lt;beata.michalska@arm.com&gt;
[ Viresh: Almost rewrote entire patch, added new "removed" field,
	  rewrote commit log and added the correct Fixes tag. ]
Co-developed-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>opp: Correct debug message in _opp_add_static_v2()</title>
<updated>2021-03-04T11:13:46+00:00</updated>
<author>
<name>Dmitry Osipenko</name>
<email>digetx@gmail.com</email>
</author>
<published>2021-01-18T00:55:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ccec2a9596db43b3e576f4c7fdba8e6871a5856b'/>
<id>urn:sha1:ccec2a9596db43b3e576f4c7fdba8e6871a5856b</id>
<content type='text'>
[ Upstream commit d7b9d9b31a3e55dcc9b5c289abfafe31efa5b5c4 ]

The debug message always prints rate=0 instead of a proper value, fix it.

Fixes: 6c591eec67cb ("OPP: Add helpers for reading the binding properties")
Tested-by: Peter Geis &lt;pgwipeout@gmail.com&gt;
Tested-by: Nicolas Chauvet &lt;kwizart@gmail.com&gt;
Tested-by: Matt Merhar &lt;mattmerhar@protonmail.com&gt;
Signed-off-by: Dmitry Osipenko &lt;digetx@gmail.com&gt;
[ Viresh: Added Fixes tag ]
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>opp: Call the missing clk_put() on error</title>
<updated>2020-12-28T05:26:22+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2020-12-28T05:21:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0e1d9ca1766f5d95fb881f57b6c4a1ffa63d4648'/>
<id>urn:sha1:0e1d9ca1766f5d95fb881f57b6c4a1ffa63d4648</id>
<content type='text'>
Fix the clock reference counting by calling the missing clk_put() in the
error path.

Cc: v5.10 &lt;stable@vger.kernel.org&gt; # v5.10
Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>opp: fix memory leak in _allocate_opp_table</title>
<updated>2020-12-28T05:25:52+00:00</updated>
<author>
<name>Quanyang Wang</name>
<email>quanyang.wang@windriver.com</email>
</author>
<published>2020-12-24T10:49:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=976509bb310b913d30577f15b58bdd30effb0542'/>
<id>urn:sha1:976509bb310b913d30577f15b58bdd30effb0542</id>
<content type='text'>
In function _allocate_opp_table, opp_dev is allocated and referenced
by opp_table via _add_opp_dev. But in the case that the subsequent calls
return -EPROBE_DEFER, it will jump to err label and opp_table will be
freed. Then opp_dev becomes an unreferenced object to cause memory leak.
So let's call _remove_opp_dev to do the cleanup.

This fixes the following kmemleak report:

unreferenced object 0xffff000801524a00 (size 128):
  comm "swapper/0", pid 1, jiffies 4294892465 (age 84.616s)
  hex dump (first 32 bytes):
    40 00 56 01 08 00 ff ff 40 00 56 01 08 00 ff ff  @.V.....@.V.....
    b8 52 77 7f 08 00 ff ff 00 3c 4c 00 08 00 ff ff  .Rw......&lt;L.....
  backtrace:
    [&lt;00000000b1289fb1&gt;] kmemleak_alloc+0x30/0x40
    [&lt;0000000056da48f0&gt;] kmem_cache_alloc+0x3d4/0x588
    [&lt;00000000a84b3b0e&gt;] _add_opp_dev+0x2c/0x88
    [&lt;0000000062a380cd&gt;] _add_opp_table_indexed+0x124/0x268
    [&lt;000000008b4c8f1f&gt;] dev_pm_opp_of_add_table+0x20/0x1d8
    [&lt;00000000e5316798&gt;] dev_pm_opp_of_cpumask_add_table+0x48/0xf0
    [&lt;00000000db0a8ec2&gt;] dt_cpufreq_probe+0x20c/0x448
    [&lt;0000000030a3a26c&gt;] platform_probe+0x68/0xd8
    [&lt;00000000c618e78d&gt;] really_probe+0xd0/0x3a0
    [&lt;00000000642e856f&gt;] driver_probe_device+0x58/0xb8
    [&lt;00000000f10f5307&gt;] device_driver_attach+0x74/0x80
    [&lt;0000000004f254b8&gt;] __driver_attach+0x58/0xe0
    [&lt;0000000009d5d19e&gt;] bus_for_each_dev+0x70/0xc8
    [&lt;0000000000d22e1c&gt;] driver_attach+0x24/0x30
    [&lt;0000000001d4e952&gt;] bus_add_driver+0x14c/0x1f0
    [&lt;0000000089928aaa&gt;] driver_register+0x64/0x120

Cc: v5.10 &lt;stable@vger.kernel.org&gt; # v5.10
Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
Signed-off-by: Quanyang Wang &lt;quanyang.wang@windriver.com&gt;
[ Viresh: Added the stable tag ]
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pm-cpufreq'</title>
<updated>2020-12-15T14:24:52+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2020-12-15T14:24:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e1f1320fc0a090e7019ad8ec7d81f8a18a5080eb'/>
<id>urn:sha1:e1f1320fc0a090e7019ad8ec7d81f8a18a5080eb</id>
<content type='text'>
* pm-cpufreq: (31 commits)
  cpufreq: Fix cpufreq_online() return value on errors
  cpufreq: Fix up several kerneldoc comments
  cpufreq: stats: Use local_clock() instead of jiffies
  cpufreq: schedutil: Simplify sugov_update_next_freq()
  cpufreq: intel_pstate: Simplify intel_cpufreq_update_pstate()
  cpufreq: arm_scmi: Discover the power scale in performance protocol
  firmware: arm_scmi: Add power_scale_mw_get() interface
  cpufreq: tegra194: Rename tegra194_get_speed_common function
  cpufreq: tegra194: Remove unnecessary frequency calculation
  cpufreq: tegra186: Simplify cluster information lookup
  cpufreq: tegra186: Fix sparse 'incorrect type in assignment' warning
  cpufreq: imx: fix NVMEM_IMX_OCOTP dependency
  cpufreq: vexpress-spc: Add missing MODULE_ALIAS
  cpufreq: scpi: Add missing MODULE_ALIAS
  cpufreq: loongson1: Add missing MODULE_ALIAS
  cpufreq: sun50i: Add missing MODULE_DEVICE_TABLE
  cpufreq: st: Add missing MODULE_DEVICE_TABLE
  cpufreq: qcom: Add missing MODULE_DEVICE_TABLE
  cpufreq: mediatek: Add missing MODULE_DEVICE_TABLE
  cpufreq: highbank: Add missing MODULE_DEVICE_TABLE
  ...
</content>
</entry>
<entry>
<title>Merge branch 'opp/empty' into opp/linux-next</title>
<updated>2020-12-09T05:54:12+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2020-12-09T05:54:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2c07b0fd9bf6dfb0bdf05aac018e6b3242d60822'/>
<id>urn:sha1:2c07b0fd9bf6dfb0bdf05aac018e6b3242d60822</id>
<content type='text'>
</content>
</entry>
<entry>
<title>opp: of: Allow empty opp-table with opp-shared</title>
<updated>2020-12-09T05:53:46+00:00</updated>
<author>
<name>Nicola Mazzucato</name>
<email>nicola.mazzucato@arm.com</email>
</author>
<published>2020-12-08T17:42:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6ee70e8c34e37a34f4dc2c8bc06febffd375fac4'/>
<id>urn:sha1:6ee70e8c34e37a34f4dc2c8bc06febffd375fac4</id>
<content type='text'>
The opp binding now allows to have an empty opp table and shared-opp to
still describe that devices share v/f lines.

When initialising an empty opp table, allow such case by:
- treating such conditions with warnings in place of errors
- don't fail on empty table

Signed-off-by: Nicola Mazzucato &lt;nicola.mazzucato@arm.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table</title>
<updated>2020-12-09T05:51:11+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2020-11-06T06:46:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c7bf8758c955e6272c0f4b2411d7a85abce8fafe'/>
<id>urn:sha1:c7bf8758c955e6272c0f4b2411d7a85abce8fafe</id>
<content type='text'>
This allows the callers to drop the unnecessary checks.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>opp: Don't create an OPP table from dev_pm_opp_get_opp_table()</title>
<updated>2020-12-09T05:51:11+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2020-11-06T05:07:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e77dcb0b732dd355ca594909f6c2085dfc46cde2'/>
<id>urn:sha1:e77dcb0b732dd355ca594909f6c2085dfc46cde2</id>
<content type='text'>
It has been found that some users (like cpufreq-dt and others on LKML)
have abused the helper dev_pm_opp_get_opp_table() to create the OPP
table instead of just finding it, which is the wrong thing to do. This
routine was meant for OPP core's internal working and exposed the whole
functionality by mistake.

Change the scope of dev_pm_opp_get_opp_table() to only finding the
table. The internal helpers _opp_get_opp_table*() are thus renamed to
_add_opp_table*(), dev_pm_opp_get_opp_table_indexed() is removed (as we
don't need the index field for finding the OPP table) and so the only
user, genpd, is updated.

Note that the prototype of _add_opp_table() was already left in opp.h by
mistake when it was removed earlier and so we weren't required to add it
now.

Acked-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>opp: Reduce the size of critical section in _opp_kref_release()</title>
<updated>2020-12-09T05:51:11+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2020-11-19T05:54:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cf1fac943c6341dfed1db1293864c9fcad47bac3'/>
<id>urn:sha1:cf1fac943c6341dfed1db1293864c9fcad47bac3</id>
<content type='text'>
There is a lot of stuff here which can be done outside of the
opp_table-&gt;lock, do that. This helps avoiding a circular dependency
lockdeps around debugfs.

Reported-by: Rob Clark &lt;robdclark@gmail.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
</feed>
