Displaying 20 results from an estimated 31 matches for "migrate_to_ram".
2024 Sep 23
1
[PATCH 2/2] nouveau/dmem: Fix memory leak in `migrate_to_ram` upon copy error
A copy push command might fail, causing `migrate_to_ram` to return a
dirty HIGH_USER page to the user.
This exposes a security vulnerability in the nouveau driver. To prevent
memory leaks in `migrate_to_ram` upon a copy error, allocate a zero
page for the destination page.
Signed-off-by: Yonatan Maman <Ymaman at Nvidia.com>
Signed-off-by: Gal Sh...
2019 Jun 26
0
[PATCH 12/25] memremap: add a migrate_to_ram method to struct dev_pagemap_ops
...0,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_fault *vmf);
};
/**
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 4d961668e5fc..15bdb6fe71e5 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -129,12 +129,6 @@ static inline struct page *device_private_entry_to_page(swp_entry_t entry)
{...
2019 Jun 27
1
[PATCH 12/25] memremap: add a migrate_to_ram method to struct dev_pagemap_ops
...| 9 ++-------
> 6 files changed, 17 insertions(+), 67 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg at mellanox.com>
I'ver heard there are some other use models for fault() here beyond
migrate to ram, but we can rename it if we ever see them.
> +static vm_fault_t hmm_devmem_migrate_to_ram(struct vm_fault *vmf)
> {
> - struct hmm_devmem *devmem = page->pgmap->data;
> + struct hmm_devmem *devmem = vmf->page->pgmap->data;
>
> - return devmem->ops->fault(devmem, vma, addr, page, flags, pmdp);
> + return devmem->ops->fault(devmem, vmf->v...
2024 Oct 08
3
[PATCH v4 0/2] drm/nouveau/dmem: Fix Vulnerability and Device Channels configuration
From: Yonatan Maman <Ymaman at Nvidia.com>
This patch series addresses two critical issues in the Nouveau driver
related to device channels, error handling, and sensitive data leaks.
- Vulnerability in migrate_to_ram: The migrate_to_ram function might
return a dirty HIGH_USER page when a copy push command (FW channel)
fails, potentially exposing sensitive data and posing a security
risk. To mitigate this, the patch ensures the allocation of a non-dirty
(zero) page for the destination, preventing the ret...
2024 Sep 23
2
[PATCH 0/2] *** BUG Fix for Nouveau Memory***
This patch series addresses two critical issues in the Nouveau driver related to device channels, error handling and memory leaking.
- Memory Leak in migrate_to_ram - the migrate_to_ram function was identified as leaking memory when a copy push command fails. This results in the function returning a dirty HIGH_USER page, which can expose sensitive information and pose a security risk. To mitigate this vulnerability, the patch ensures that a zero page is alloca...
2024 Oct 08
2
[PATCH v3 0/2] drm/nouveau/dmem: Fix Vulnerability and Device Channels configuration
From: Yonatan Maman <Ymaman at Nvidia.com>
This patch series addresses two critical issues in the Nouveau driver
related to device channels, error handling, and sensitive data leaks.
- Vulnerability in migrate_to_ram: The migrate_to_ram function might
return a dirty HIGH_USER page when a copy push command (FW channel)
fails, potentially exposing sensitive data and posing a security
risk. To mitigate this, the patch ensures the allocation of a non-dirty
(zero) page for the destination, preventing the ret...
2020 Sep 16
0
[PATCH] mm: remove extra ZONE_DEVICE struct page refcount
...rror, i;
if (WARN_ONCE(!nr_range, "nr_range must be specified\n"))
@@ -331,8 +300,9 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
WARN(1, "Device private memory not supported\n");
return ERR_PTR(-EINVAL);
}
- if (!pgmap->ops || !pgmap->ops->migrate_to_ram) {
- WARN(1, "Missing migrate_to_ram method\n");
+ if (!pgmap->ops ||
+ !pgmap->ops->migrate_to_ram || !pgmap->ops->page_free) {
+ WARN(1, "Missing ops\n");
return ERR_PTR(-EINVAL);
}
if (!pgmap->owner) {
@@ -348,11 +318,9 @@ void *memremap_...
2020 Sep 17
0
[PATCH] mm: remove extra ZONE_DEVICE struct page refcount
...nr_range, "nr_range must be specified\n"))
> @@ -331,8 +300,9 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
> WARN(1, "Device private memory not supported\n");
> return ERR_PTR(-EINVAL);
> }
> - if (!pgmap->ops || !pgmap->ops->migrate_to_ram) {
> - WARN(1, "Missing migrate_to_ram method\n");
> + if (!pgmap->ops ||
> + !pgmap->ops->migrate_to_ram || !pgmap->ops->page_free) {
> + WARN(1, "Missing ops\n");
> return ERR_PTR(-EINVAL);
> }
> if (!pgmap->owner)...
2020 Sep 14
5
[PATCH] mm: remove extra ZONE_DEVICE struct page refcount
ZONE_DEVICE struct pages have an extra reference count that complicates the
code for put_page() and several places in the kernel that need to check the
reference count to see that a page is not being used (gup, compaction,
migration, etc.). Clean up the code so the reference count doesn't need to
be treated specially for ZONE_DEVICE.
Signed-off-by: Ralph Campbell <rcampbell at
2024 Oct 15
5
[PATCH v1 0/4] GPU Direct RDMA (P2P DMA) for Device Private Pages
From: Yonatan Maman <Ymaman at Nvidia.com>
This patch series aims to enable Peer-to-Peer (P2P) DMA access in
GPU-centric applications that utilize RDMA and private device pages. This
enhancement is crucial for minimizing data transfer overhead by allowing
the GPU to directly expose device private page data to devices such as
NICs, eliminating the need to traverse system RAM, which is the
2025 Jan 24
1
[Question] Are "device exclusive non-swap entries" / "SVM atomics in Nouveau" still getting used in practice?
...der the limitation of only anon
> memory and only excluding userspace access) then I expect we'll need this
> for a very long time. I just had no idea whether even that is possible.
>
> What isn't good is if it's only mostly reliable, like the current
> pgmap->ops->migrate_to_ram() path in do_swap_page() still is.
I'll cc you on patches once I figure out some details on how to fix some
page table walkers that really don't expect these non-swap entries.
Fortunately, the hmm test device is in place to trigger some shaky
scenarios.
--
Cheers,
David / dhildenb
2019 Jun 18
0
dev_pagemap related cleanups v2
...nup.2
>
> Gitweb:
>
> http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/hmm-devmem-cleanup.2
>
> Changes since v1:
> - rebase
> - also switch p2pdma to the internal refcount
> - add type checking for pgmap->type
> - rename the migrate method to migrate_to_ram
> - cleanup the altmap_valid flag
> - various tidbits from the reviews
Attached is my incremental fixups on top of this series, with those
integrated you can add:
Tested-by: Dan Williams <dan.j.williams at intel.com>
...to the patches that touch kernel/memremap.c, drivers/dax, and...
2020 Mar 16
0
[PATCH 1/4] memremap: add an owner field to struct dev_pagemap
...tatic inline struct vmem_altmap *pgmap_altmap(struct dev_pagemap *pgmap)
diff --git a/mm/memremap.c b/mm/memremap.c
index 09b5b7adc773..9b2c97ceb775 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -181,6 +181,10 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
WARN(1, "Missing migrate_to_ram method\n");
return ERR_PTR(-EINVAL);
}
+ if (!pgmap->owner) {
+ WARN(1, "Missing owner\n");
+ return ERR_PTR(-EINVAL);
+ }
break;
case MEMORY_DEVICE_FS_DAX:
if (!IS_ENABLED(CONFIG_ZONE_DEVICE) ||
--
2.24.1
2019 Jun 17
34
dev_pagemap related cleanups v2
...nfradead.org/users/hch/misc.git hmm-devmem-cleanup.2
Gitweb:
http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/hmm-devmem-cleanup.2
Changes since v1:
- rebase
- also switch p2pdma to the internal refcount
- add type checking for pgmap->type
- rename the migrate method to migrate_to_ram
- cleanup the altmap_valid flag
- various tidbits from the reviews
2024 Dec 01
5
[RFC 0/5] GPU Direct RDMA (P2P DMA) for Device Private Pages
From: Yonatan Maman <Ymaman at Nvidia.com>
Based on: Provide a new two step DMA mapping API patchset
https://lore.kernel.org/kvm/20241114170247.GA5813 at lst.de/T/#t
This patch series aims to enable Peer-to-Peer (P2P) DMA access in
GPU-centric applications that utilize RDMA and private device pages. This
enhancement reduces data transfer overhead by allowing the GPU to directly
expose
2019 Jun 26
41
dev_pagemap related cleanups v3
...that didn't show up in the end
result
- incorporate feedback from Michal Hocko, including killing of
the DEVICE_PUBLIC memory type entirely
Changes since v1:
- rebase
- also switch p2pdma to the internal refcount
- add type checking for pgmap->type
- rename the migrate method to migrate_to_ram
- cleanup the altmap_valid flag
- various tidbits from the reviews
2019 Jun 26
0
[PATCH 14/25] memremap: replace the altmap_valid field with a PGMAP_ALTMAP_VALID flag
...sdax_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 device of the mapping for debug...
2020 Nov 06
0
[PATCH v3 3/6] mm: support THP migration to device private memory
...ud)
{
return false;
diff --git a/include/linux/memremap.h b/include/linux/memremap.h
index 86c6c368ce9b..9b39a896af37 100644
--- a/include/linux/memremap.h
+++ b/include/linux/memremap.h
@@ -87,6 +87,15 @@ struct dev_pagemap_ops {
* the page back to a CPU accessible page.
*/
vm_fault_t (*migrate_to_ram)(struct vm_fault *vmf);
+
+ /*
+ * Used for private (un-addressable) device memory only.
+ * This is called when a compound device private page is split.
+ * The driver uses this callback to set tail_page->pgmap and
+ * tail_page->zone_device_data appropriately based on the head
+ * page...
2020 Oct 12
2
[PATCH v2] mm/hmm: make device private reference counts zero based
...t int nr_range = pgmap->nr_range;
- bool need_devmap_managed = true;
+ bool need_devmap_managed = false;
int error, i;
if (WARN_ONCE(!nr_range, "nr_range must be specified\n"))
@@ -344,6 +328,10 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid)
WARN(1, "Missing migrate_to_ram method\n");
return ERR_PTR(-EINVAL);
}
+ if (!pgmap->ops->page_free) {
+ WARN(1, "Missing page_free method\n");
+ return ERR_PTR(-EINVAL);
+ }
if (!pgmap->owner) {
WARN(1, "Missing owner\n");
return ERR_PTR(-EINVAL);
@@ -355,13 +343,12 @@ vo...
2020 Jun 19
0
[PATCH 13/16] mm: support THP migration to device private memory
...t_t __handle_mm_fault(struct vm_area_struct *vma,
barrier();
if (unlikely(is_swap_pmd(orig_pmd))) {
+ swp_entry_t entry = pmd_to_swp_entry(orig_pmd);
+
+ if (is_device_private_entry(entry)) {
+ vmf.page = device_private_entry_to_page(entry);
+ return vmf.page->pgmap->ops->migrate_to_ram(&vmf);
+ }
VM_BUG_ON(thp_migration_supported() &&
- !is_pmd_migration_entry(orig_pmd));
- if (is_pmd_migration_entry(orig_pmd))
+ !is_migration_entry(entry));
+ if (is_migration_entry(entry))
pmd_migration_entry_wait(mm, vmf.pmd);
return 0;
}
diff --git...