linux-stable/drivers/base
Rafael J. Wysocki 4fe1e6caac driver core: Fix PM-runtime for links added during consumer probe
[ Upstream commit 36003d4cf5 ]

Commit 4c06c4e6cf ("driver core: Fix possible supplier PM-usage
counter imbalance") introduced a regression that causes suppliers
to be suspended prematurely for device links added during consumer
driver probe if the initial PM-runtime status of the consumer is
"suspended" and the consumer is resumed after adding the link and
before pm_runtime_put_suppliers() is called.  In that case,
pm_runtime_put_suppliers() will drop the rpm_active refcount for
the link by one and (since rpm_active is equal to two after the
preceding consumer resume) the supplier's PM-runtime usage counter
will be decremented, which may cause the supplier to suspend even
though the consumer's PM-runtime status is "active".

For this reason, partially revert commit 4c06c4e6cf as the problem
it tried to fix needs to be addressed somewhat differently, and
change pm_runtime_get_suppliers() and pm_runtime_put_suppliers() so
that the latter only drops rpm_active references acquired by the
former.  [This requires adding a new field to struct device_link,
but I coulnd't find a cleaner way to address the issue that would
work in all cases.]

This causes pm_runtime_put_suppliers() to effectively ignore device
links added during consumer probe, so device_link_add() doesn't need
to worry about ensuring that suppliers will remain active after
pm_runtime_put_suppliers() for links created with DL_FLAG_RPM_ACTIVE
set and it only needs to bump up rpm_active by one for those links,
so pm_runtime_active_link() is not necessary any more.

Fixes: 4c06c4e6cf ("driver core: Fix possible supplier PM-usage counter imbalance")
Reported-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-27 14:50:26 +01:00
..
firmware_loader firmware: improve LSM/IMA security behaviour 2019-07-21 09:03:03 +02:00
power driver core: Fix PM-runtime for links added during consumer probe 2020-01-27 14:50:26 +01:00
regmap soundwire: fix regmap dependencies and align with other serial links 2019-10-07 18:57:27 +02:00
test
arch_topology.c
attribute_container.c
base.h driver core: Establish order of operations for device_add and device_del via bitflag 2019-08-09 17:52:28 +02:00
bus.c kobject: return error code if writing /sys/.../uevent fails 2019-02-12 19:47:06 +01:00
cacheinfo.c drivers: base: cacheinfo: Ensure cpu hotplug work is done before Intel RDT 2019-07-21 09:03:03 +02:00
class.c
component.c component: fix loop condition to call unbind() if bind() fails 2019-11-20 18:46:47 +01:00
container.c
core.c driver core: Fix PM-runtime for links added during consumer probe 2020-01-27 14:50:26 +01:00
cpu.c x86/bugs: Add ITLB_MULTIHIT bug infrastructure 2019-11-12 19:21:36 +01:00
dd.c driver core: Establish order of operations for device_add and device_del via bitflag 2019-08-09 17:52:28 +02:00
devcon.c drivers: base: Unified device connection lookup 2018-03-22 13:10:29 +01:00
devcoredump.c
devres.c devres: Align data[] to ARCH_KMALLOC_MINALIGN 2019-02-12 19:46:56 +01:00
devtmpfs.c kernel: add ksys_unshare() helper; remove in-kernel calls to sys_unshare() 2018-04-02 20:16:06 +02:00
driver.c driver-core: return EINVAL error instead of BUG_ON() 2018-05-25 18:18:45 +02:00
firmware.c
hypervisor.c
init.c base: fix order of OF initialization 2018-07-07 17:54:29 +02:00
isa.c
Kconfig firmware_loader: move kconfig FW_LOADER entries to its own file 2018-05-14 16:43:10 +02:00
Makefile dma-mapping: move all DMA mapping code to kernel/dma 2018-06-14 08:50:37 +02:00
map.c
memory.c mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock 2019-12-01 09:17:34 +01:00
module.c
node.c mm: hide incomplete nr_indirectly_reclaimable in sysfs 2019-04-20 09:16:05 +02:00
pinctrl.c
platform-msi.c platform-msi: Free descriptors in platform_msi_domain_free() 2019-01-09 17:38:42 +01:00
platform.c drivers/base/platform.c: kmemleak ignore a known leak 2019-12-05 09:21:04 +01:00
property.c device property: Get rid of union aliasing 2018-05-17 12:47:21 +02:00
soc.c base: soc: Export soc_device_register/unregister APIs 2019-10-05 13:09:37 +02:00
syscore.c
topology.c
transport_class.c