linux/drivers/base
Dan Williams 2374b68225 drivers/base/devres: introduce devm_release_action()
Patch series "mm/devm_memremap_pages: Fix page release race", v2.

Logan audited the devm_memremap_pages() shutdown path and noticed that
it was possible to proceed to arch_remove_memory() before all potential
page references have been reaped.

Introduce a new ->cleanup() callback to do the work of waiting for any
straggling page references and then perform the percpu_ref_exit() in
devm_memremap_pages_release() context.

For p2pdma this involves some deeper reworks to reference count
resources on a per-instance basis rather than a per pci-device basis.  A
modified genalloc api is introduced to convey a driver-private pointer
through gen_pool_{alloc,free}() interfaces.  Also, a
devm_memunmap_pages() api is introduced since p2pdma does not
auto-release resources on a setup failure.

The dax and pmem changes pass the nvdimm unit tests, and the p2pdma
changes should now pass testing with the pci_p2pdma_release() fix.
Jrme, how does this look for HMM?

This patch (of 6):

The devm_add_action() facility allows a resource allocation routine to
add custom devm semantics.  One such user is devm_memremap_pages().

There is now a need to manually trigger
devm_memremap_pages_release().  Introduce devm_release_action() so the
release action can be triggered via a new devm_memunmap_pages() api in a
follow-on change.

Link: http://lkml.kernel.org/r/155727336530.292046.2926860263201336366.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Jérôme Glisse" <jglisse@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-06-13 17:34:56 -10:00
..
firmware_loader firmware_loader: Fix a typo ("syfs" -> "sysfs") 2019-05-01 18:31:11 +02:00
power More power management updates for 5.2-rc1 2019-05-15 08:46:44 -07:00
regmap Merge branch 'regmap-5.2' into regmap-next 2019-04-25 20:27:04 +01:00
test drivers: base: test: add proper SPDX identifier to Makefile 2019-04-04 20:03:40 +02:00
arch_topology.c arch_topology: Make cpu_capacity sysfs node as read-only 2019-04-04 18:41:21 +02:00
attribute_container.c
base.h driver core: Probe devices asynchronously instead of the driver 2019-01-31 14:20:53 +01:00
bus.c driver core: Probe devices asynchronously instead of the driver 2019-01-31 14:20:53 +01:00
cacheinfo.c cacheinfo: Keep the old value if of_property_read_u32 fails 2019-01-22 13:50:31 +01:00
class.c driver core: move device->knode_class to device_private 2019-01-18 16:55:48 +01:00
component.c drivers/component: kerneldoc polish 2019-02-19 13:20:35 +01:00
container.c
core.c driver core: Clarify which counterparts to use to device_add() 2019-04-25 19:34:54 +02:00
cpu.c Merge branch 'x86-mds-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-05-14 07:57:29 -07:00
dd.c driver core: Postpone DMA tear-down until after devres release for probe failure 2019-04-25 21:48:37 +02:00
devcon.c device connection: Find device connections also from device graphs 2019-02-14 10:52:25 +01:00
devcoredump.c
devres.c drivers/base/devres: introduce devm_release_action() 2019-06-13 17:34:56 -10:00
devtmpfs.c vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled 2018-12-20 16:32:56 +00:00
driver.c
firmware.c
hypervisor.c
init.c base: fix order of OF initialization 2018-07-07 17:54:29 +02:00
isa.c
Kconfig Driver core/kobject patches for 5.2-rc1 2019-05-07 13:01:40 -07:00
Makefile drivers: base: Introducing software nodes to the firmware node framework 2018-11-26 18:19:11 +01:00
map.c
memory.c mm/memory_hotplug: make unregister_memory_section() never fail 2019-05-14 09:47:49 -07:00
module.c
node.c node: Add memory-side caching attributes 2019-04-04 18:41:21 +02:00
pinctrl.c
platform-msi.c platform-msi: Free descriptors in platform_msi_domain_free() 2018-12-13 09:35:31 +00:00
platform.c Revert "driver core: platform: Fix the usage of platform device name(pdev->name)" 2019-04-29 19:49:21 +02:00
property.c device property: Add fwnode_graph_get_endpoint_by_id() 2019-04-18 16:44:05 +02:00
soc.c
swnode.c drivers: base: swnode: Make two functions static 2019-03-19 16:37:56 +01:00
syscore.c treewide: Switch printk users from %pf and %pF to %ps and %pS, respectively 2019-04-09 14:19:06 +02:00
topology.c
transport_class.c