[PATCH 10/25] memremap: lift the devmap_enable manipulation into devm_memremap_pages
Dan Williams
dan.j.williams at intel.com
Mon Jun 17 19:25:17 UTC 2019
On Mon, Jun 17, 2019 at 5:28 AM Christoph Hellwig <hch at lst.de> wrote:
>
> Just check if there is a ->page_free operation set and take care of the
> static key enable, as well as the put using device managed resources.
> Also check that a ->page_free is provided for the pgmaps types that
> require it, and check for a valid type as well while we are at it.
>
> Note that this also fixes the fact that hmm never called
> dev_pagemap_put_ops and thus would leave the slow path enabled forever,
> even after a device driver unload or disable.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
> drivers/nvdimm/pmem.c | 23 +++--------------
> include/linux/mm.h | 10 --------
> kernel/memremap.c | 57 ++++++++++++++++++++++++++-----------------
> mm/hmm.c | 2 --
> 4 files changed, 39 insertions(+), 53 deletions(-)
>
[..]
> diff --git a/kernel/memremap.c b/kernel/memremap.c
> index ba7156bd52d1..7272027fbdd7 100644
> --- a/kernel/memremap.c
> +++ b/kernel/memremap.c
[..]
> @@ -190,6 +219,12 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap)
> return ERR_PTR(-EINVAL);
> }
>
> + if (pgmap->type != MEMORY_DEVICE_PCI_P2PDMA) {
Once we have MEMORY_DEVICE_DEVDAX then this check needs to be fixed up
to skip that case as well, otherwise:
Missing page_free method
WARNING: CPU: 19 PID: 1518 at kernel/memremap.c:33
devm_memremap_pages+0x745/0x7d0
RIP: 0010:devm_memremap_pages+0x745/0x7d0
Call Trace:
dev_dax_probe+0xc6/0x1e0 [device_dax]
really_probe+0xef/0x390
? driver_allows_async_probing+0x50/0x50
driver_probe_device+0xb4/0x100
More information about the dri-devel
mailing list