search for: dev_pagemap_ops

Displaying 20 results from an estimated 84 matches for "dev_pagemap_ops".

2019 Jun 13
0
[PATCH 10/22] memremap: add a migrate callback to struct dev_pagemap_ops
...p; const struct hmm_devmem_ops *ops; struct percpu_ref ref; - dev_page_fault_t page_fault; }; /* diff --git a/include/linux/memremap.h b/include/linux/memremap.h index 96a3a6d564ad..03a4099be701 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -75,6 +75,12 @@ struct dev_pagemap_ops { * Transition the percpu_ref in struct dev_pagemap to the dead state. */ void (*kill)(struct dev_pagemap *pgmap); + + /* + * Used for private (un-addressable) device memory only. Must migrate + * the page back to a CPU accessible page. + */ + vm_fault_t (*migrate)(struct vm_fault *vmf)...
2019 Jun 14
0
[PATCH 10/22] memremap: add a migrate callback to struct dev_pagemap_ops
On Thu, Jun 13, 2019 at 04:42:07PM -0700, Ralph Campbell wrote: > This needs to either initialize "page" or be changed to "vmf->page". > Otherwise, it is a NULL pointer dereference. Thanks, fixed.
2019 Jun 27
1
[PATCH 12/25] memremap: add a migrate_to_ram method to struct dev_pagemap_ops
On Wed, Jun 26, 2019 at 02:27:11PM +0200, Christoph Hellwig wrote: > This replaces the hacky ->fault callback, which is currently directly > called from common code through a hmm specific data structure as an > exercise in layering violations. > > Signed-off-by: Christoph Hellwig <hch at lst.de> > Reviewed-by: Ralph Campbell <rcampbell at nvidia.com> > --- >
2019 Jun 26
0
[PATCH 12/25] memremap: add a migrate_to_ram method to struct dev_pagemap_ops
...p; const struct hmm_devmem_ops *ops; struct percpu_ref ref; - dev_page_fault_t page_fault; }; /* diff --git a/include/linux/memremap.h b/include/linux/memremap.h index b8666a0d8665..ac985bd03a7f 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -80,6 +80,12 @@ struct dev_pagemap_ops { * Wait for refcount in struct dev_pagemap to be idle and reap it. */ void (*cleanup)(struct dev_pagemap *pgmap); + + /* + * Used for private (un-addressable) device memory only. Must migrate + * the page back to a CPU accessible page. + */ + vm_fault_t (*migrate_to_ram)(struct vm_faul...
2019 Jun 13
1
[PATCH 10/22] memremap: add a migrate callback to struct dev_pagemap_ops
...percpu_ref ref; > - dev_page_fault_t page_fault; > }; > > /* > diff --git a/include/linux/memremap.h b/include/linux/memremap.h > index 96a3a6d564ad..03a4099be701 100644 > --- a/include/linux/memremap.h > +++ b/include/linux/memremap.h > @@ -75,6 +75,12 @@ struct dev_pagemap_ops { > * Transition the percpu_ref in struct dev_pagemap to the dead state. > */ > void (*kill)(struct dev_pagemap *pgmap); > + > + /* > + * Used for private (un-addressable) device memory only. Must migrate > + * the page back to a CPU accessible page. > + */ &g...
2019 Jun 13
0
[PATCH 07/22] memremap: move dev_pagemap callbacks into a separate structure
..., 50 insertions(+), 30 deletions(-) diff --git a/drivers/dax/device.c b/drivers/dax/device.c index 996d68ff992a..4adab774dade 100644 --- a/drivers/dax/device.c +++ b/drivers/dax/device.c @@ -443,6 +443,10 @@ static void dev_dax_kill(void *dev_dax) kill_dev_dax(dev_dax); } +static const struct dev_pagemap_ops dev_dax_pagemap_ops = { + .kill = dev_dax_percpu_kill, +}; + int dev_dax_probe(struct device *dev) { struct dev_dax *dev_dax = to_dev_dax(dev); @@ -471,7 +475,7 @@ int dev_dax_probe(struct device *dev) return rc; dev_dax->pgmap.ref = &dev_dax->ref; - dev_dax->pgmap.kill = d...
2019 Jun 17
0
[PATCH 08/25] memremap: move dev_pagemap callbacks into a separate structure
...dax_percpu_kill(struct percpu_ref *ref) { - struct percpu_ref *ref = data; struct dev_dax *dev_dax = ref_to_dev_dax(ref); dev_dbg(&dev_dax->dev, "%s\n", __func__); @@ -442,6 +441,11 @@ static void dev_dax_kill(void *dev_dax) kill_dev_dax(dev_dax); } +static const struct dev_pagemap_ops dev_dax_pagemap_ops = { + .kill = dev_dax_percpu_kill, + .cleanup = dev_dax_percpu_exit, +}; + int dev_dax_probe(struct device *dev) { struct dev_dax *dev_dax = to_dev_dax(dev); @@ -466,8 +470,7 @@ int dev_dax_probe(struct device *dev) return rc; dev_dax->pgmap.ref = &dev_dax-&gt...
2019 Aug 16
1
[PATCH 04/15] mm: remove the pgmap field from struct hmm_vma_walk
...hmm and migrate_vma seems pretty > broken as far as I can tell, and I have some WIP patches. Basically we > should not touch (or possibly eventually call migrate to ram eventually > in the future) device private pages not owned by the caller, where I > try to defined the caller by the dev_pagemap_ops instance. I think it needs to be more elaborate. For instance, a system may have multiple DEVICE_PRIVATE map's owned by the same driver - but multiple physical devices using that driver. Each physical device's driver should only ever get DEVICE_PRIVATE pages for it's own on-device...
2019 Aug 16
2
[PATCH 04/15] mm: remove the pgmap field from struct hmm_vma_walk
On Thu, Aug 15, 2019 at 04:51:33PM -0400, Jerome Glisse wrote: > struct page. In this case any way we can update the > nouveau_dmem_page() to check that page page->pgmap == the > expected pgmap. I was also wondering if that is a problem.. just blindly doing a container_of on the page->pgmap does seem like it assumes that only this driver is using DEVICE_PRIVATE. It seems like
2019 Jun 13
2
[PATCH 18/22] mm: mark DEVICE_PUBLIC as broken
...ig > index 0d2ba7e1f43e..406fa45e9ecc 100644 > +++ b/mm/Kconfig > @@ -721,6 +721,7 @@ config DEVICE_PRIVATE > config DEVICE_PUBLIC > bool "Addressable device memory (like GPU memory)" > depends on ARCH_HAS_HMM > + depends on BROKEN > select HMM > select DEV_PAGEMAP_OPS This seems a bit harsh, we do have another kconfig that selects this one today: config DRM_NOUVEAU_SVM bool "(EXPERIMENTAL) Enable SVM (Shared Virtual Memory) support" depends on ARCH_HAS_HMM depends on DRM_NOUVEAU depends on STAGING select HMM_MI...
2019 Jun 17
34
dev_pagemap related cleanups v2
Hi Dan, Jérôme and Jason, below is a series that cleans up the dev_pagemap interface so that it is more easily usable, which removes the need to wrap it in hmm and thus allowing to kill a lot of code Note: this series is on top of the rdma/hmm branch + the dev_pagemap releas fix series from Dan that went into 5.2-rc5. Git tree: git://git.infradead.org/users/hch/misc.git
2019 Jun 26
41
dev_pagemap related cleanups v3
Hi Dan, Jérôme and Jason, below is a series that cleans up the dev_pagemap interface so that it is more easily usable, which removes the need to wrap it in hmm and thus allowing to kill a lot of code Note: this series is on top of Linux 5.2-rc5 and has some minor conflicts with the hmm tree that are easy to resolve. Diffstat summary: 32 files changed, 361 insertions(+), 1012 deletions(-) Git
2019 Jun 13
1
[PATCH 17/22] mm: remove hmm_devmem_add
On Thu, Jun 13, 2019 at 11:43:20AM +0200, Christoph Hellwig wrote: > There isn't really much value add in the hmm_devmem_add wrapper. Just > factor out a little helper to find the resource, and otherwise let the > driver implement the dev_pagemap_ops directly. Was this commit message written when other patches were squashed in here? I think the helper this mentions was from an earlier patch > Signed-off-by: Christoph Hellwig <hch at lst.de> > --- > Documentation/vm/hmm.rst | 26 -------- > include/linux/hmm.h | 129 --...
2020 Mar 16
0
[PATCH 1/4] memremap: add an owner field to struct dev_pagemap
...rm->dev; if (IS_ERR(devm_memremap_pages(device, &drm->dmem->pagemap))) goto out_free; diff --git a/include/linux/memremap.h b/include/linux/memremap.h index 6fefb09af7c3..60d97e8fd3c0 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -103,6 +103,9 @@ struct dev_pagemap_ops { * @type: memory type: see MEMORY_* in memory_hotplug.h * @flags: PGMAP_* flags to specify defailed behavior * @ops: method table + * @owner: an opaque pointer identifying the entity that manages this + * instance. Used by various helpers to make sure that no + * foreign ZONE_DEVICE memory...
2019 Jun 13
0
[PATCH 11/22] memremap: remove the data field in struct dev_pagemap
...d *data) +static void pmem_fsdax_page_free(struct page *page) { wake_up_var(&page->_refcount); } diff --git a/include/linux/memremap.h b/include/linux/memremap.h index 03a4099be701..75b80de6394a 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -69,7 +69,7 @@ struct dev_pagemap_ops { * reach 0 refcount unless there is a refcount bug. This allows the * device driver to implement its own memory management.) */ - void (*page_free)(struct page *page, void *data); + void (*page_free)(struct page *page); /* * Transition the percpu_ref in struct dev_pagemap to the de...
2019 Jun 13
57
dev_pagemap related cleanups
Hi Dan, Jérôme and Jason, below is a series that cleans up the dev_pagemap interface so that it is more easily usable, which removes the need to wrap it in hmm and thus allowing to kill a lot of code Diffstat: 22 files changed, 245 insertions(+), 802 deletions(-) Git tree: git://git.infradead.org/users/hch/misc.git hmm-devmem-cleanup Gitweb:
2019 Jun 17
0
[PATCH 16/25] PCI/P2PDMA: use the dev_pagemap internal refcount
...gmap); - - wait_for_completion(&p2p_pgmap->ref_done); - percpu_ref_exit(&p2p_pgmap->ref); -} - static void pci_p2pdma_release(void *data) { struct pci_dev *pdev = data; @@ -153,11 +121,6 @@ static int pci_p2pdma_setup(struct pci_dev *pdev) return error; } -static const struct dev_pagemap_ops pci_p2pdma_pagemap_ops = { - .kill = pci_p2pdma_percpu_kill, - .cleanup = pci_p2pdma_percpu_cleanup, -}; - /** * pci_p2pdma_add_resource - add memory for use as p2p memory * @pdev: the device to add the memory to @@ -171,7 +134,6 @@ static const struct dev_pagemap_ops pci_p2pdma_pagemap_ops =...
2019 Jun 26
0
[PATCH 17/25] PCI/P2PDMA: use the dev_pagemap internal refcount
...gmap); - - wait_for_completion(&p2p_pgmap->ref_done); - percpu_ref_exit(&p2p_pgmap->ref); -} - static void pci_p2pdma_release(void *data) { struct pci_dev *pdev = data; @@ -153,11 +121,6 @@ static int pci_p2pdma_setup(struct pci_dev *pdev) return error; } -static const struct dev_pagemap_ops pci_p2pdma_pagemap_ops = { - .kill = pci_p2pdma_percpu_kill, - .cleanup = pci_p2pdma_percpu_cleanup, -}; - /** * pci_p2pdma_add_resource - add memory for use as p2p memory * @pdev: the device to add the memory to @@ -171,7 +134,6 @@ static const struct dev_pagemap_ops pci_p2pdma_pagemap_ops =...
2019 Jun 26
0
[PATCH 14/25] memremap: replace the altmap_valid field with a PGMAP_ALTMAP_VALID flag
...X; pmem->pgmap.ops = &fsdax_pagemap_ops; addr = devm_memremap_pages(dev, &pmem->pgmap); diff --git a/include/linux/memremap.h b/include/linux/memremap.h index 336eca601dad..e25685b878e9 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -88,6 +88,8 @@ struct dev_pagemap_ops { vm_fault_t (*migrate_to_ram)(struct vm_fault *vmf); }; +#define PGMAP_ALTMAP_VALID (1 << 0) + /** * struct dev_pagemap - metadata for ZONE_DEVICE mappings * @altmap: pre-allocated/reserved memory for vmemmap allocations @@ -96,19 +98,27 @@ struct dev_pagemap_ops { * @dev: host d...
2019 Jun 13
1
[PATCH 18/22] mm: mark DEVICE_PUBLIC as broken
...ecc 100644 >> +++ b/mm/Kconfig >> @@ -721,6 +721,7 @@ config DEVICE_PRIVATE >> config DEVICE_PUBLIC >> bool "Addressable device memory (like GPU memory)" >> depends on ARCH_HAS_HMM >> + depends on BROKEN >> select HMM >> select DEV_PAGEMAP_OPS > > This seems a bit harsh, we do have another kconfig that selects this > one today: > > config DRM_NOUVEAU_SVM > bool "(EXPERIMENTAL) Enable SVM (Shared Virtual Memory) support" > depends on ARCH_HAS_HMM > depends on DRM_NOUVEAU >...