| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/08/05 13:16 | flow | patch-triage |
13mArgs:null Results: {
"EnableConfigs": [
"TEST_HMM",
"DEVICE_PRIVATE",
"ZONE_DEVICE",
"TRANSPARENT_HUGEPAGE"
],
"FocusSymbols": [
"migrate_device_pages",
"migrate_vma_pages"
],
"Reasoning": "The patch modifies core MM device migration logic (mm/migrate_device.c) to properly handle THP (Transparent Huge Pages) splitting during device memory migration. This code is reachable and can be fuzzed using the test_hmm pseudo-device driver, which is designed specifically to test HMM and device memory migration. The changes in drm_pagemap.c are specific to the DRM GPU SVM helper and likely require physical GPU hardware (like Intel Xe), but the core MM changes are hardware-independent and fully testable in a virtualized environment.",
"WorthFuzzing": true
} |
| 1/1 | 2026/08/05 13:16 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 10721d417437b01783271e376d70bab46de443d3\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Wed Aug 5 13:16:38 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c\nindex 892b325fa99b8..01eb29ef023ce 100644\n--- a/drivers/gpu/drm/drm_pagemap.c\n+++ b/drivers/gpu/drm/drm_pagemap.c\n@@ -3,6 +3,7 @@\n * Copyright © 2024-2025 Intel Corporation\n */\n \n+#include \u003clinux/debugfs.h\u003e\n #include \u003clinux/dma-fence.h\u003e\n #include \u003clinux/dma-mapping.h\u003e\n #include \u003clinux/migrate.h\u003e\n@@ -12,6 +13,27 @@\n #include \u003cdrm/drm_pagemap_util.h\u003e\n #include \u003cdrm/drm_print.h\u003e\n \n+#ifdef CONFIG_FAULT_INJECTION\n+#include \u003clinux/fault-inject.h\u003e\n+static DECLARE_FAULT_ATTR(migrate_to_ram_fault_inject);\n+\n+/*\n+ * Force a higher-order destination folio allocation to fail in\n+ * drm_pagemap_migrate_populate_ram_pfn(), exercising the order-0 fallback\n+ * (and, in turn, the THP split path in __migrate_device_pages()) without\n+ * having to drive the system into actual memory pressure.\n+ */\n+static bool drm_pagemap_fault_inject_folio(void)\n+{\n+\treturn should_fail(\u0026migrate_to_ram_fault_inject, 1);\n+}\n+#else\n+static bool drm_pagemap_fault_inject_folio(void)\n+{\n+\treturn false;\n+}\n+#endif\n+\n /**\n * DOC: Overview\n *\n@@ -383,6 +405,58 @@ drm_pagemap_migrate_map_system_pages(struct device *dev,\n \treturn 0;\n }\n \n+/**\n+ * drm_pagemap_migrate_populate_src_pages() - Populate the source page array\n+ * @pages: Array of source pages to populate\n+ * @src_mpfn: Source array of migrate PFNs\n+ * @dst_mpfn: Destination array of migrate PFNs\n+ * @npages: Number of pages in the arrays\n+ *\n+ * Populate @pages with the device pages the copy callback is to read from.\n+ *\n+ * Entries are normally only populated at the head of each source folio, with\n+ * the copy callback deriving the rest of the folio from the order recorded in\n+ * the corresponding drm_pagemap_addr. That does not work where\n+ * drm_pagemap_migrate_populate_ram_pfn() had to demote a higher-order source\n+ * folio to order-0 destination folios: the drm_pagemap_addr entries are then\n+ * per-page, and the copy callback needs a source page for each of them.\n+ * Populate every entry for those ranges.\n+ *\n+ * Note that the source folio itself is only split later, by\n+ * migrate_vma_pages() / migrate_device_pages(), so its order cannot be used to\n+ * detect the demotion - the destination has to be inspected instead.\n+ */\n+static void drm_pagemap_migrate_populate_src_pages(struct page **pages,\n+\t\t\t\t\t\t unsigned long *src_mpfn,\n+\t\t\t\t\t\t unsigned long *dst_mpfn,\n+\t\t\t\t\t\t unsigned long npages)\n+{\n+\tunsigned long i;\n+\n+\tfor (i = 0; i \u003c npages;) {\n+\t\tstruct page *page = migrate_pfn_to_page(src_mpfn[i]);\n+\t\tunsigned int order = 0;\n+\t\tunsigned long j, nr;\n+\n+\t\tif (!page) {\n+\t\t\ti++;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\torder = folio_order(page_folio(page));\n+\t\tnr = NR_PAGES(order);\n+\n+\t\tif (order \u0026\u0026 !(dst_mpfn[i] \u0026 MIGRATE_PFN_COMPOUND)) {\n+\t\t\tfor (j = 0; j \u003c nr \u0026\u0026 i + j \u003c npages; j++)\n+\t\t\t\tpages[i + j] = folio_page(page_folio(page), j);\n+\t\t} else {\n+\t\t\tpages[i] = page;\n+\t\t}\n+\n+\t\ti += nr;\n+\t}\n+}\n+\n /**\n * drm_pagemap_migrate_unmap_pages() - Unmap pages previously mapped for GPU SVM migration\n * @dev: The device for which the pages were mapped\n@@ -875,6 +949,7 @@ static int drm_pagemap_migrate_populate_ram_pfn(struct vm_area_struct *vas,\n \t\tstruct page *page = NULL, *src_page;\n \t\tstruct folio *folio;\n \t\tunsigned int order = 0;\n+\t\tgfp_t gfp = GFP_HIGHUSER;\n \n \t\tif (!(src_mpfn[i] \u0026 MIGRATE_PFN_MIGRATE))\n \t\t\tgoto next;\n@@ -890,12 +965,40 @@ static int drm_pagemap_migrate_populate_ram_pfn(struct vm_area_struct *vas,\n \t\t}\n \n \t\torder = folio_order(page_folio(src_page));\n+\t\tif (order)\n+\t\t\tgfp |= __GFP_NOWARN;\n \n-\t\t/* TODO: Support fallback to single pages if THP allocation fails */\n-\t\tif (vas)\n-\t\t\tfolio = vma_alloc_folio(GFP_HIGHUSER, order, vas, addr);\n+\t\tif (order \u0026\u0026 drm_pagemap_fault_inject_folio())\n+\t\t\tfolio = NULL;\n+\t\telse if (vas)\n+\t\t\tfolio = vma_alloc_folio(gfp, order, vas, addr);\n \t\telse\n-\t\t\tfolio = folio_alloc(GFP_HIGHUSER, order);\n+\t\t\tfolio = folio_alloc(gfp, order);\n+\n+\t\tif (!folio \u0026\u0026 order) {\n+\t\t\t/*\n+\t\t\t * Higher-order allocation failed, fall back to\n+\t\t\t * order-0 allocations for the entire range covered\n+\t\t\t * by the original higher-order allocation, without\n+\t\t\t * setting MIGRATE_PFN_COMPOUND, until we move past\n+\t\t\t * that range.\n+\t\t\t */\n+\t\t\tunsigned long nr = NR_PAGES(order);\n+\t\t\tunsigned long j;\n+\n+\t\t\tgfp \u0026= ~__GFP_NOWARN;\n+\t\t\tfor (j = 0; j \u003c nr \u0026\u0026 i \u003c npages; j++, i++, addr += PAGE_SIZE) {\n+\t\t\t\tfolio = vas ?\n+\t\t\t\t\tvma_alloc_folio(gfp, 0, vas, addr) :\n+\t\t\t\t\tfolio_alloc(gfp, 0);\n+\t\t\t\tif (!folio)\n+\t\t\t\t\tgoto free_pages;\n+\n+\t\t\t\tpage = folio_page(folio, 0);\n+\t\t\t\tmpfn[i] = migrate_pfn(page_to_pfn(page));\n+\t\t\t}\n+\t\t\tcontinue;\n+\t\t}\n \n \t\tif (!folio)\n \t\t\tgoto free_pages;\n@@ -940,11 +1043,11 @@ static int drm_pagemap_migrate_populate_ram_pfn(struct vm_area_struct *vas,\n \t\tif (!page)\n \t\t\tgoto next_put;\n \n+\t\torder = folio_order(page_folio(page));\n+\n \t\tput_page(page);\n \t\tmpfn[i] = 0;\n \n-\t\torder = folio_order(page_folio(page));\n-\n next_put:\n \t\ti += NR_PAGES(order);\n \t}\n@@ -1120,7 +1223,7 @@ int drm_pagemap_evict_to_ram(struct drm_pagemap_devmem *devmem_allocation)\n \tunsigned long *src, *dst;\n \tstruct drm_pagemap_addr *pagemap_addr;\n \tvoid *buf;\n-\tint i, err = 0;\n+\tint err = 0;\n \tunsigned int retry_count = 2;\n \n \tnpages = devmem_allocation-\u003esize \u003e\u003e PAGE_SHIFT;\n@@ -1160,15 +1263,7 @@ int drm_pagemap_evict_to_ram(struct drm_pagemap_devmem *devmem_allocation)\n \tif (err)\n \t\tgoto err_finalize;\n \n-\tfor (i = 0; i \u003c npages;) {\n-\t\tunsigned int order = 0;\n-\n-\t\tpages[i] = migrate_pfn_to_page(src[i]);\n-\t\tif (pages[i])\n-\t\t\torder = folio_order(page_folio(pages[i]));\n-\n-\t\ti += NR_PAGES(order);\n-\t}\n+\tdrm_pagemap_migrate_populate_src_pages(pages, src, dst, npages);\n \n \terr = ops-\u003ecopy_to_ram(pages, pagemap_addr, npages, NULL);\n \tif (err)\n@@ -1235,7 +1330,7 @@ static int __drm_pagemap_migrate_to_ram(struct vm_area_struct *vas,\n \tstruct drm_pagemap_addr *pagemap_addr;\n \tunsigned long start, end;\n \tvoid *buf;\n-\tint i, err = 0;\n+\tint err = 0;\n \n \tzdd = drm_pagemap_page_zone_device_data(page);\n \tif (time_before64(get_jiffies_64(), zdd-\u003edevmem_allocation-\u003etimeslice_expiration))\n@@ -1290,15 +1385,8 @@ static int __drm_pagemap_migrate_to_ram(struct vm_area_struct *vas,\n \tif (err)\n \t\tgoto err_finalize;\n \n-\tfor (i = 0; i \u003c npages;) {\n-\t\tunsigned int order = 0;\n-\n-\t\tpages[i] = migrate_pfn_to_page(migrate.src[i]);\n-\t\tif (pages[i])\n-\t\t\torder = folio_order(page_folio(pages[i]));\n-\n-\t\ti += NR_PAGES(order);\n-\t}\n+\tdrm_pagemap_migrate_populate_src_pages(pages, migrate.src, migrate.dst,\n+\t\t\t\t\t npages);\n \n \terr = ops-\u003ecopy_to_ram(pages, pagemap_addr, npages, NULL);\n \tif (err)\n@@ -1476,6 +1564,16 @@ void drm_pagemap_destroy(struct drm_pagemap *dpagemap, bool is_atomic_or_reclaim\n \t\tkfree(dpagemap);\n }\n \n+static int __init drm_pagemap_module_init(void)\n+{\n+#if defined(CONFIG_DEBUG_FS) \u0026\u0026 defined(CONFIG_FAULT_INJECTION)\n+\tfault_create_debugfs_attr(\"drm_pagemap_fault_inject\", NULL,\n+\t\t\t\t \u0026migrate_to_ram_fault_inject);\n+#endif\n+\treturn 0;\n+}\n+module_init(drm_pagemap_module_init);\n+\n static void drm_pagemap_exit(void)\n {\n \tflush_work(\u0026drm_pagemap_work);\ndiff --git a/mm/migrate_device.c b/mm/migrate_device.c\nindex 908d2d4ec43ac..65a6a15dba4dc 100644\n--- a/mm/migrate_device.c\n+++ b/mm/migrate_device.c\n@@ -899,22 +899,104 @@ static int migrate_vma_insert_huge_pmd_page(struct migrate_vma *migrate,\n \treturn 0;\n }\n \n+static bool migrate_vma_split_pmd_one(struct folio *folio,\n+\t\t\t\t struct vm_area_struct *vma,\n+\t\t\t\t unsigned long addr, void *arg)\n+{\n+\tDEFINE_FOLIO_VMA_WALK(pvmw, folio, vma, addr, PVMW_SYNC | PVMW_MIGRATION);\n+\n+\twhile (page_vma_mapped_walk(\u0026pvmw)) {\n+\t\tif (pvmw.pte)\n+\t\t\tcontinue;\n+\n+\t\taddr = pvmw.address;\n+\t\tpage_vma_mapped_walk_done(\u0026pvmw);\n+\n+\t\t/*\n+\t\t * Demote with freeze = false: the PMD already holds a\n+\t\t * migration entry, so __split_huge_pmd_locked() creates PTE\n+\t\t * sized migration entries from it and leaves the refcount\n+\t\t * alone. There is at most one PMD mapping @folio per VMA, so\n+\t\t * stop the walk here.\n+\t\t */\n+\t\tsplit_huge_pmd_address(vma, addr, false);\n+\t\tbreak;\n+\t}\n+\n+\treturn true;\n+}\n+\n+/*\n+ * Demote every PMD sized migration entry that maps @folio to PTE sized ones.\n+ *\n+ * migrate_device_unmap() unmaps with try_to_migrate(folio, 0), i.e. without\n+ * TTU_SPLIT_HUGE_PMD, so a folio that was PMD mapped in several VMAs -- after\n+ * fork(), for instance -- ends up with a PMD sized migration entry in every one\n+ * of them. folio_split_unmapped() below does not care, it only looks at the\n+ * refcount, so splitting the folio without demoting all of those first would\n+ * leave the other VMAs pointing a huge PMD at what is now an order-0 folio.\n+ * remove_migration_ptes() trips over that in migrate_vma_finalize().\n+ */\n+static void migrate_vma_split_pmd_mappings(struct folio *folio)\n+{\n+\tstruct rmap_walk_control rwc = {\n+\t\t.rmap_one = migrate_vma_split_pmd_one,\n+\t};\n+\n+\t/*\n+\t * Do not pass .anon_lock: folio_lock_anon_vma_read() requires\n+\t * folio_mapped(), and @folio is already fully unmapped here.\n+\t */\n+\trmap_walk(folio, \u0026rwc);\n+}\n+\n static int migrate_vma_split_unmapped_folio(struct migrate_vma *migrate,\n-\t\t\t\t\t unsigned long idx, unsigned long addr,\n+\t\t\t\t\t unsigned long idx,\n \t\t\t\t\t struct folio *folio)\n {\n \tunsigned long i;\n \tunsigned long pfn;\n \tunsigned long flags;\n+\tbool fault_folio;\n \tint ret = 0;\n \n \t/*\n-\t * take a reference, since split_huge_pmd_address() with freeze = true\n-\t * drops a reference at the end.\n+\t * migrate_vma_split_pmd_mappings() walks the rmap, and\n+\t * split_huge_pmd_address() zaps rather than demotes a PMD in a VMA that\n+\t * is not anonymous. migrate_vma_collect_huge_pmd() does not check the\n+\t * VMA type, so a file THP can reach here; the rest of the migrate_vma()\n+\t * machinery only supports anonymous memory anyway.\n \t */\n-\tfolio_get(folio);\n-\tsplit_huge_pmd_address(migrate-\u003evma, addr, true);\n+\tif (!folio_test_anon(folio))\n+\t\treturn -EINVAL;\n+\n+\t/*\n+\t * A CPU fault on a device private PMD holds an extra reference on the\n+\t * folio, taken by do_huge_pmd_device_private(). folio_split_unmapped()\n+\t * only tolerates a single caller reference, so the split would always\n+\t * fail with -EAGAIN while this fault reference is held.\n+\t *\n+\t * do_huge_pmd_device_private() derives the fault page from the PMD\n+\t * entry, so it is always the head page of @folio, and therefore always\n+\t * ends up in the head folio after an uniform split to order 0. Drop\n+\t * the reference across the split and re-take it on the head folio\n+\t * afterwards, leaving the reference exactly where it is expected to be\n+\t * released.\n+\t *\n+\t * The folio cannot go away while the reference is dropped: the\n+\t * reference taken by migrate_vma_collect_huge_pmd() is still held.\n+\t */\n+\tfault_folio = migrate-\u003efault_page \u0026\u0026\n+\t\tpage_folio(migrate-\u003efault_page) == folio;\n+\n+\tmigrate_vma_split_pmd_mappings(folio);\n+\n+\tif (fault_folio)\n+\t\tfolio_put(folio);\n \tret = folio_split_unmapped(folio, 0);\n+\tif (fault_folio)\n+\t\tfolio_get(folio);\n+\n \tif (ret)\n \t\treturn ret;\n \tmigrate-\u003esrc[idx] \u0026= ~MIGRATE_PFN_COMPOUND;\n@@ -935,7 +1017,7 @@ static int migrate_vma_insert_huge_pmd_page(struct migrate_vma *migrate,\n }\n \n static int migrate_vma_split_unmapped_folio(struct migrate_vma *migrate,\n-\t\t\t\t\t unsigned long idx, unsigned long addr,\n+\t\t\t\t\t unsigned long idx,\n \t\t\t\t\t struct folio *folio)\n {\n \treturn 0;\n@@ -1103,14 +1185,13 @@ static void __migrate_device_pages(unsigned long *src_pfns,\n \tstruct mmu_notifier_range range;\n \tunsigned long i, j;\n \tbool notified = false;\n-\tunsigned long addr;\n \n \tfor (i = 0; i \u003c npages; ) {\n \t\tstruct page *newpage = migrate_pfn_to_page(dst_pfns[i]);\n \t\tstruct page *page = migrate_pfn_to_page(src_pfns[i]);\n \t\tstruct address_space *mapping;\n \t\tstruct folio *newfolio, *folio;\n-\t\tint r, extra_cnt = 0;\n+\t\tint r;\n \t\tunsigned long nr = 1;\n \n \t\tif (!newpage) {\n@@ -1177,8 +1258,7 @@ static void __migrate_device_pages(unsigned long *src_pfns,\n \t\t\t\t\tgoto next;\n \t\t\t\t}\n \t\t\t\tnr = 1 \u003c\u003c folio_order(folio);\n-\t\t\t\taddr = migrate-\u003estart + i * PAGE_SIZE;\n-\t\t\t\tif (migrate_vma_split_unmapped_folio(migrate, i, addr, folio)) {\n+\t\t\t\tif (migrate_vma_split_unmapped_folio(migrate, i, folio)) {\n \t\t\t\t\tsrc_pfns[i] \u0026= ~(MIGRATE_PFN_MIGRATE |\n \t\t\t\t\t\t\t MIGRATE_PFN_COMPOUND);\n \t\t\t\t\tgoto next;\n@@ -1216,13 +1296,25 @@ static void __migrate_device_pages(unsigned long *src_pfns,\n \n \t\tBUG_ON(folio_test_writeback(folio));\n \n-\t\tif (migrate \u0026\u0026 migrate-\u003efault_page == page)\n-\t\t\textra_cnt = 1;\n \t\tfor (j = 0; j \u003c nr \u0026\u0026 i + j \u003c npages; j++) {\n-\t\t\tfolio = page_folio(migrate_pfn_to_page(src_pfns[i+j]));\n+\t\t\tstruct page *src_page = migrate_pfn_to_page(src_pfns[i+j]);\n+\t\t\tint extra_cnt = 0;\n+\n+\t\t\tfolio = page_folio(src_page);\n \t\t\tnewfolio = page_folio(migrate_pfn_to_page(dst_pfns[i+j]));\n \n-\t\t\tr = folio_migrate_mapping(mapping, newfolio, folio, extra_cnt);\n+\t\t\t/*\n+\t\t\t * The CPU fault holds an extra reference on the folio\n+\t\t\t * containing the fault page. @folio may have been\n+\t\t\t * split above, so the fault page only accounts for an\n+\t\t\t * extra reference on the folio it actually ended up\n+\t\t\t * in, not on every folio of the original THP.\n+\t\t\t */\n+\t\t\tif (migrate \u0026\u0026 migrate-\u003efault_page == src_page)\n+\t\t\t\textra_cnt = 1;\n+\n+\t\t\tr = folio_migrate_mapping(folio_mapping(folio), newfolio,\n+\t\t\t\t\t\t folio, extra_cnt);\n \t\t\tif (r)\n \t\t\t\tsrc_pfns[i+j] \u0026= ~MIGRATE_PFN_MIGRATE;\n \t\t\telse\n"
} |
| 2/1 | 2026/08/05 13:16 | agent | patch-evaluator |
13mModel:best-expensive Args: null Results: {
"EnableConfigs": [
"TEST_HMM",
"DEVICE_PRIVATE",
"ZONE_DEVICE",
"TRANSPARENT_HUGEPAGE"
],
"FocusSymbols": [
"migrate_device_pages",
"migrate_vma_pages"
],
"Reasoning": "The patch modifies core MM device migration logic (mm/migrate_device.c) to properly handle THP (Transparent Huge Pages) splitting during device memory migration. This code is reachable and can be fuzzed using the test_hmm pseudo-device driver, which is designed specifically to test HMM and device memory migration. The changes in drm_pagemap.c are specific to the DRM GPU SVM helper and likely require physical GPU hardware (like Intel Xe), but the core MM changes are hardware-independent and fully testable in a virtualized environment.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer. Your job is to review a provided patch series and determine if it makes functional changes to the kernel that should be fuzzed. IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively use your code access tools to examine the actual source code and confirm any assumptions. Return WorthFuzzing=false if the patch only contains: - Modifications to Documentation/, Kconfig files, or code comments. - Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints. - Changes to numeric constants or macros that do not functionally alter execution flow. - Code paths that are impossible to reach in virtualized environments like GCE or QEMU, even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim). - Code in vendor-specific PCIe switch, SmartNIC, or GPU drivers (e.g., mlxsw, pds_core, qed, ionic, amdgpu) that require physical PCIe hardware cards not emulated in standard QEMU. - Driver .remove, .shutdown, or pci_unregister_driver teardown callbacks (e.g., igb_remove) that are executed only during PCI hot-unplug or sysfs driver unbind operations. If it modifies reachable core kernel logic, drivers, or architectures, use your code search tools to verify the code can be executed, then return WorthFuzzing=true. When returning WorthFuzzing=true, you MUST ALSO: 1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols. Avoid listing generic hot-path functions to prevent skewed test distributions. Prefer non-static, non-inlined API entrypoint functions over internal static helper functions (which are inlined by the compiler and do not have distinct symbol addresses). 2. Identify any specific CONFIG_ options required to properly test this new/modified feature. Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions. Also check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed for Kbuild to compile the code statically into vmlinux. List them in the EnableConfigs output array, and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4"). Prefer calling several tools at the same time to save round-trips. Use set-results tool to provide results of the analysis. It must be called exactly once before the final reply. Ignore results of this tool. Prompt: For your convenience, here is the diff of the changes:
commit 10721d417437b01783271e376d70bab46de443d3
Author: syz-cluster <triage@syzkaller.com>
Date: Wed Aug 5 13:16:38 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c
index 892b325fa99b8..01eb29ef023ce 100644
--- a/drivers/gpu/drm/drm_pagemap.c
+++ b/drivers/gpu/drm/drm_pagemap.c
@@ -3,6 +3,7 @@
* Copyright © 2024-2025 Intel Corporation
*/
+#include <linux/debugfs.h>
#include <linux/dma-fence.h>
#include <linux/dma-mapping.h>
#include <linux/migrate.h>
@@ -12,6 +13,27 @@
#include <drm/drm_pagemap_util.h>
#include <drm/drm_print.h>
+#ifdef CONFIG_FAULT_INJECTION
+#include <linux/fault-inject.h>
+static DECLARE_FAULT_ATTR(migrate_to_ram_fault_inject);
+
+/*
+ * Force a higher-order destination folio allocation to fail in
+ * drm_pagemap_migrate_populate_ram_pfn(), exercising the order-0 fallback
+ * (and, in turn, the THP split path in __migrate_device_pages()) without
+ * having to drive the system into actual memory pressure.
+ */
+static bool drm_pagemap_fault_inject_folio(void)
+{
+ return should_fail(&migrate_to_ram_fault_inject, 1);
+}
+#else
+static bool drm_pagemap_fault_inject_folio(void)
+{
+ return false;
+}
+#endif
+
/**
* DOC: Overview
*
@@ -383,6 +405,58 @@ drm_pagemap_migrate_map_system_pages(struct device *dev,
return 0;
}
+/**
+ * drm_pagemap_migrate_populate_src_pages() - Populate the source page array
+ * @pages: Array of source pages to populate
+ * @src_mpfn: Source array of migrate PFNs
+ * @dst_mpfn: Destination array of migrate PFNs
+ * @npages: Number of pages in the arrays
+ *
+ * Populate @pages with the device pages the copy callback is to read from.
+ *
+ * Entries are normally only populated at the head of each source folio, with
+ * the copy callback deriving the rest of the folio from the order recorded in
+ * the corresponding drm_pagemap_addr. That does not work where
+ * drm_pagemap_migrate_populate_ram_pfn() had to demote a higher-order source
+ * folio to order-0 destination folios: the drm_pagemap_addr entries are then
+ * per-page, and the copy callback needs a source page for each of them.
+ * Populate every entry for those ranges.
+ *
+ * Note that the source folio itself is only split later, by
+ * migrate_vma_pages() / migrate_device_pages(), so its order cannot be used to
+ * detect the demotion - the destination has to be inspected instead.
+ */
+static void drm_pagemap_migrate_populate_src_pages(struct page **pages,
+ unsigned long *src_mpfn,
+ unsigned long *dst_mpfn,
+ unsigned long npages)
+{
+ unsigned long i;
+
+ for (i = 0; i < npages;) {
+ struct page *page = migrate_pfn_to_page(src_mpfn[i]);
+ unsigned int order = 0;
+ unsigned long j, nr;
+
+ if (!page) {
+ i++;
+ continue;
+ }
+
+ order = folio_order(page_folio(page));
+ nr = NR_PAGES(order);
+
+ if (order && !(dst_mpfn[i] & MIGRATE_PFN_COMPOUND)) {
+ for (j = 0; j < nr && i + j < npages; j++)
+ pages[i + j] = folio_page(page_folio(page), j);
+ } else {
+ pages[i] = page;
+ }
+
+ i += nr;
+ }
+}
+
/**
* drm_pagemap_migrate_unmap_pages() - Unmap pages previously mapped for GPU SVM migration
* @dev: The device for which the pages were mapped
@@ -875,6 +949,7 @@ static int drm_pagemap_migrate_populate_ram_pfn(struct vm_area_struct *vas,
struct page *page = NULL, *src_page;
struct folio *folio;
unsigned int order = 0;
+ gfp_t gfp = GFP_HIGHUSER;
if (!(src_mpfn[i] & MIGRATE_PFN_MIGRATE))
goto next;
@@ -890,12 +965,40 @@ static int drm_pagemap_migrate_populate_ram_pfn(struct vm_area_struct *vas,
}
order = folio_order(page_folio(src_page));
+ if (order)
+ gfp |= __GFP_NOWARN;
- /* TODO: Support fallback to single pages if THP allocation fails */
- if (vas)
- folio = vma_alloc_folio(GFP_HIGHUSER, order, vas, addr);
+ if (order && drm_pagemap_fault_inject_folio())
+ folio = NULL;
+ else if (vas)
+ folio = vma_alloc_folio(gfp, order, vas, addr);
else
- folio = folio_alloc(GFP_HIGHUSER, order);
+ folio = folio_alloc(gfp, order);
+
+ if (!folio && order) {
+ /*
+ * Higher-order allocation failed, fall back to
+ * order-0 allocations for the entire range covered
+ * by the original higher-order allocation, without
+ * setting MIGRATE_PFN_COMPOUND, until we move past
+ * that range.
+ */
+ unsigned long nr = NR_PAGES(order);
+ unsigned long j;
+
+ gfp &= ~__GFP_NOWARN;
+ for (j = 0; j < nr && i < npages; j++, i++, addr += PAGE_SIZE) {
+ folio = vas ?
+ vma_alloc_folio(gfp, 0, vas, addr) :
+ folio_alloc(gfp, 0);
+ if (!folio)
+ goto free_pages;
+
+ page = folio_page(folio, 0);
+ mpfn[i] = migrate_pfn(page_to_pfn(page));
+ }
+ continue;
+ }
if (!folio)
goto free_pages;
@@ -940,11 +1043,11 @@ static int drm_pagemap_migrate_populate_ram_pfn(struct vm_area_struct *vas,
if (!page)
goto next_put;
+ order = folio_order(page_folio(page));
+
put_page(page);
mpfn[i] = 0;
- order = folio_order(page_folio(page));
-
next_put:
i += NR_PAGES(order);
}
@@ -1120,7 +1223,7 @@ int drm_pagemap_evict_to_ram(struct drm_pagemap_devmem *devmem_allocation)
unsigned long *src, *dst;
struct drm_pagemap_addr *pagemap_addr;
void *buf;
- int i, err = 0;
+ int err = 0;
unsigned int retry_count = 2;
npages = devmem_allocation->size >> PAGE_SHIFT;
@@ -1160,15 +1263,7 @@ int drm_pagemap_evict_to_ram(struct drm_pagemap_devmem *devmem_allocation)
if (err)
goto err_finalize;
- for (i = 0; i < npages;) {
- unsigned int order = 0;
-
- pages[i] = migrate_pfn_to_page(src[i]);
- if (pages[i])
- order = folio_order(page_folio(pages[i]));
-
- i += NR_PAGES(order);
- }
+ drm_pagemap_migrate_populate_src_pages(pages, src, dst, npages);
err = ops->copy_to_ram(pages, pagemap_addr, npages, NULL);
if (err)
@@ -1235,7 +1330,7 @@ static int __drm_pagemap_migrate_to_ram(struct vm_area_struct *vas,
struct drm_pagemap_addr *pagemap_addr;
unsigned long start, end;
void *buf;
- int i, err = 0;
+ int err = 0;
zdd = drm_pagemap_page_zone_device_data(page);
if (time_before64(get_jiffies_64(), zdd->devmem_allocation->timeslice_expiration))
@@ -1290,15 +1385,8 @@ static int __drm_pagemap_migrate_to_ram(struct vm_area_struct *vas,
if (err)
goto err_finalize;
- for (i = 0; i < npages;) {
- unsigned int order = 0;
-
- pages[i] = migrate_pfn_to_page(migrate.src[i]);
- if (pages[i])
- order = folio_order(page_folio(pages[i]));
-
- i += NR_PAGES(order);
- }
+ drm_pagemap_migrate_populate_src_pages(pages, migrate.src, migrate.dst,
+ npages);
err = ops->copy_to_ram(pages, pagemap_addr, npages, NULL);
if (err)
@@ -1476,6 +1564,16 @@ void drm_pagemap_destroy(struct drm_pagemap *dpagemap, bool is_atomic_or_reclaim
kfree(dpagemap);
}
+static int __init drm_pagemap_module_init(void)
+{
+#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_FAULT_INJECTION)
+ fault_create_debugfs_attr("drm_pagemap_fault_inject", NULL,
+ &migrate_to_ram_fault_inject);
+#endif
+ return 0;
+}
+module_init(drm_pagemap_module_init);
+
static void drm_pagemap_exit(void)
{
flush_work(&drm_pagemap_work);
diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index 908d2d4ec43ac..65a6a15dba4dc 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -899,22 +899,104 @@ static int migrate_vma_insert_huge_pmd_page(struct migrate_vma *migrate,
return 0;
}
+static bool migrate_vma_split_pmd_one(struct folio *folio,
+ struct vm_area_struct *vma,
+ unsigned long addr, void *arg)
+{
+ DEFINE_FOLIO_VMA_WALK(pvmw, folio, vma, addr, PVMW_SYNC | PVMW_MIGRATION);
+
+ while (page_vma_mapped_walk(&pvmw)) {
+ if (pvmw.pte)
+ continue;
+
+ addr = pvmw.address;
+ page_vma_mapped_walk_done(&pvmw);
+
+ /*
+ * Demote with freeze = false: the PMD already holds a
+ * migration entry, so __split_huge_pmd_locked() creates PTE
+ * sized migration entries from it and leaves the refcount
+ * alone. There is at most one PMD mapping @folio per VMA, so
+ * stop the walk here.
+ */
+ split_huge_pmd_address(vma, addr, false);
+ break;
+ }
+
+ return true;
+}
+
+/*
+ * Demote every PMD sized migration entry that maps @folio to PTE sized ones.
+ *
+ * migrate_device_unmap() unmaps with try_to_migrate(folio, 0), i.e. without
+ * TTU_SPLIT_HUGE_PMD, so a folio that was PMD mapped in several VMAs -- after
+ * fork(), for instance -- ends up with a PMD sized migration entry in every one
+ * of them. folio_split_unmapped() below does not care, it only looks at the
+ * refcount, so splitting the folio without demoting all of those first would
+ * leave the other VMAs pointing a huge PMD at what is now an order-0 folio.
+ * remove_migration_ptes() trips over that in migrate_vma_finalize().
+ */
+static void migrate_vma_split_pmd_mappings(struct folio *folio)
+{
+ struct rmap_walk_control rwc = {
+ .rmap_one = migrate_vma_split_pmd_one,
+ };
+
+ /*
+ * Do not pass .anon_lock: folio_lock_anon_vma_read() requires
+ * folio_mapped(), and @folio is already fully unmapped here.
+ */
+ rmap_walk(folio, &rwc);
+}
+
static int migrate_vma_split_unmapped_folio(struct migrate_vma *migrate,
- unsigned long idx, unsigned long addr,
+ unsigned long idx,
struct folio *folio)
{
unsigned long i;
unsigned long pfn;
unsigned long flags;
+ bool fault_folio;
int ret = 0;
/*
- * take a reference, since split_huge_pmd_address() with freeze = true
- * drops a reference at the end.
+ * migrate_vma_split_pmd_mappings() walks the rmap, and
+ * split_huge_pmd_address() zaps rather than demotes a PMD in a VMA that
+ * is not anonymous. migrate_vma_collect_huge_pmd() does not check the
+ * VMA type, so a file THP can reach here; the rest of the migrate_vma()
+ * machinery only supports anonymous memory anyway.
*/
- folio_get(folio);
- split_huge_pmd_address(migrate->vma, addr, true);
+ if (!folio_test_anon(folio))
+ return -EINVAL;
+
+ /*
+ * A CPU fault on a device private PMD holds an extra reference on the
+ * folio, taken by do_huge_pmd_device_private(). folio_split_unmapped()
+ * only tolerates a single caller reference, so the split would always
+ * fail with -EAGAIN while this fault reference is held.
+ *
+ * do_huge_pmd_device_private() derives the fault page from the PMD
+ * entry, so it is always the head page of @folio, and therefore always
+ * ends up in the head folio after an uniform split to order 0. Drop
+ * the reference across the split and re-take it on the head folio
+ * afterwards, leaving the reference exactly where it is expected to be
+ * released.
+ *
+ * The folio cannot go away while the reference is dropped: the
+ * reference taken by migrate_vma_collect_huge_pmd() is still held.
+ */
+ fault_folio = migrate->fault_page &&
+ page_folio(migrate->fault_page) == folio;
+
+ migrate_vma_split_pmd_mappings(folio);
+
+ if (fault_folio)
+ folio_put(folio);
ret = folio_split_unmapped(folio, 0);
+ if (fault_folio)
+ folio_get(folio);
+
if (ret)
return ret;
migrate->src[idx] &= ~MIGRATE_PFN_COMPOUND;
@@ -935,7 +1017,7 @@ static int migrate_vma_insert_huge_pmd_page(struct migrate_vma *migrate,
}
static int migrate_vma_split_unmapped_folio(struct migrate_vma *migrate,
- unsigned long idx, unsigned long addr,
+ unsigned long idx,
struct folio *folio)
{
return 0;
@@ -1103,14 +1185,13 @@ static void __migrate_device_pages(unsigned long *src_pfns,
struct mmu_notifier_range range;
unsigned long i, j;
bool notified = false;
- unsigned long addr;
for (i = 0; i < npages; ) {
struct page *newpage = migrate_pfn_to_page(dst_pfns[i]);
struct page *page = migrate_pfn_to_page(src_pfns[i]);
struct address_space *mapping;
struct folio *newfolio, *folio;
- int r, extra_cnt = 0;
+ int r;
unsigned long nr = 1;
if (!newpage) {
@@ -1177,8 +1258,7 @@ static void __migrate_device_pages(unsigned long *src_pfns,
goto next;
}
nr = 1 << folio_order(folio);
- addr = migrate->start + i * PAGE_SIZE;
- if (migrate_vma_split_unmapped_folio(migrate, i, addr, folio)) {
+ if (migrate_vma_split_unmapped_folio(migrate, i, folio)) {
src_pfns[i] &= ~(MIGRATE_PFN_MIGRATE |
MIGRATE_PFN_COMPOUND);
goto next;
@@ -1216,13 +1296,25 @@ static void __migrate_device_pages(unsigned long *src_pfns,
BUG_ON(folio_test_writeback(folio));
- if (migrate && migrate->fault_page == page)
- extra_cnt = 1;
for (j = 0; j < nr && i + j < npages; j++) {
- folio = page_folio(migrate_pfn_to_page(src_pfns[i+j]));
+ struct page *src_page = migrate_pfn_to_page(src_pfns[i+j]);
+ int extra_cnt = 0;
+
+ folio = page_folio(src_page);
newfolio = page_folio(migrate_pfn_to_page(dst_pfns[i+j]));
- r = folio_migrate_mapping(mapping, newfolio, folio, extra_cnt);
+ /*
+ * The CPU fault holds an extra reference on the folio
+ * containing the fault page. @folio may have been
+ * split above, so the fault page only accounts for an
+ * extra reference on the folio it actually ended up
+ * in, not on every folio of the original THP.
+ */
+ if (migrate && migrate->fault_page == src_page)
+ extra_cnt = 1;
+
+ r = folio_migrate_mapping(folio_mapping(folio), newfolio,
+ folio, extra_cnt);
if (r)
src_pfns[i+j] &= ~MIGRATE_PFN_MIGRATE;
else
|
| 3/2 | 2026/08/05 13:16 | llm | patch-evaluator |
5mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 6942 output: 19 thoughts: 490 Thoughts: **Analyzing a Patch for Device Memory Migration with THP Handling** Okay, so I'm looking at this patch and it seems to be tackling a tricky problem: how Transparent Huge Pages (THP) get split during device memory migration, specifically when we're trying to move data from a device to RAM and the larger allocation fails. This forces us to fall back to using order-0 pages, which creates a whole set of complications. My first thought is to dive into the changes. I see modifications in two key areas: `drivers/gpu/drm/drm_pagemap.c` and `mm/migrate_device.c`. That tells me this touches both the graphics driver and the core memory management. Let's break down the changes in `drm_pagemap.c`: * We've got a new fault injection point, `drm_pagemap_fault_inject_folio`, which is clever. This lets us *simulate* the failure of the higher-order folio allocation, which is critical for testing the fallback logic. * I see a modification to `drm_pagemap_migrate_populate_src_pages`. This is where the source pages are populated correctly when a large folio gets demoted to many smaller ones on the destination. Seems like a key piece of the puzzle. * The `drm_pagemap_migrate_populate_ram_pfn` function is now updated to handle the order-0 allocation fallback if the higher-order allocation fails. This is the heart of the solution. * And finally, `drm_pagemap_evict_to_ram` and `__drm_pagemap_migrate_to_ram` are using the new `drm_pagemap_migrate_populate_src_pages`, which makes sense. Now, let's switch gears to `mm/migrate_device.c`: * There's a change in `migrate_vma_split_unmapped_folio` to ensure PMD splitting is handled correctly. * They've added `migrate_vma_split_pmd_one` and `migrate_vma_split_pmd_mappings` to handle splitting up larger PMD sized entries. This maps to the folio, making them PTE sized. * Finally, `__migrate_device_pages` is updated to properly handle calls to `migrate_vma_split_unmapped_folio` and per page accounting with `extra_cnt`. So, it's a functional change across both memory management and the DRM subsystem. My immediate question is: Is this reachable in a virtualized environment? `mm/migrate_device.c` is definitely relevant if device migration is used, that's certain. But `drm_pagemap.c` is part of the DRM subsystem, and I need to assess which virtualized drivers *actually* use it. I'll need to check the dependencies. |
| 4/2 | 2026/08/05 13:22 | tool | grepper |
0mArgs:{
"Expression": "drm_pagemap"
}Results: {
"Output": "\nFull output is too long, showing 500 out of 2070 lines.\nUse more precise expression if possible.\n\nDocumentation/gpu/rfc/gpusvm.rst=67=Overview of baseline design\n--\nDocumentation/gpu/rfc/gpusvm.rst-81-\nDocumentation/gpu/rfc/gpusvm.rst:82:Overview of drm_pagemap design\nDocumentation/gpu/rfc/gpusvm.rst-83-==============================\nDocumentation/gpu/rfc/gpusvm.rst-84-\nDocumentation/gpu/rfc/gpusvm.rst:85:.. kernel-doc:: drivers/gpu/drm/drm_pagemap.c\nDocumentation/gpu/rfc/gpusvm.rst-86- :doc: Overview\nDocumentation/gpu/rfc/gpusvm.rst-87-\nDocumentation/gpu/rfc/gpusvm.rst:88:.. kernel-doc:: drivers/gpu/drm/drm_pagemap.c\nDocumentation/gpu/rfc/gpusvm.rst-89- :doc: Migration\n--\ndrivers/gpu/drm/Makefile=111=drm_gpusvm_helper-$(CONFIG_ZONE_DEVICE) += \\\ndrivers/gpu/drm/Makefile:112:\tdrm_pagemap.o\\\ndrivers/gpu/drm/Makefile:113:\tdrm_pagemap_util.o\ndrivers/gpu/drm/Makefile-114-\n--\ndrivers/gpu/drm/drm_gpusvm.c-18-#include \u003cdrm/drm_gpusvm.h\u003e\ndrivers/gpu/drm/drm_gpusvm.c:19:#include \u003cdrm/drm_pagemap.h\u003e\ndrivers/gpu/drm/drm_gpusvm.c-20-#include \u003cdrm/drm_print.h\u003e\n--\ndrivers/gpu/drm/drm_gpusvm.c-178- *\t\tif (driver_migration_policy(range)) {\ndrivers/gpu/drm/drm_gpusvm.c:179: *\t\t\terr = drm_pagemap_populate_mm(driver_choose_drm_pagemap(),\ndrivers/gpu/drm/drm_gpusvm.c-180- *\t\t\t\t\t\t gpuva_start, gpuva_end, gpusvm-\u003emm,\n--\ndrivers/gpu/drm/drm_gpusvm.c=885=drm_gpusvm_range_chunk_size(struct drm_gpusvm *gpusvm,\n--\ndrivers/gpu/drm/drm_gpusvm.c-930-\t\t * ranges. When migrating the SVM ranges, some processes fail in\ndrivers/gpu/drm/drm_gpusvm.c:931:\t\t * drm_pagemap_migrate_to_devmem with 'migrate.cpages != npages'\ndrivers/gpu/drm/drm_gpusvm.c-932-\t\t * and then upon drm_gpusvm_range_get_pages device pages from\n--\ndrivers/gpu/drm/drm_gpusvm.c=1133=static void __drm_gpusvm_unmap_pages(struct drm_gpusvm *gpusvm,\n--\ndrivers/gpu/drm/drm_gpusvm.c-1136-{\ndrivers/gpu/drm/drm_gpusvm.c:1137:\tstruct drm_pagemap *dpagemap = svm_pages-\u003edpagemap;\ndrivers/gpu/drm/drm_gpusvm.c-1138-\tstruct device *dev = gpusvm-\u003edrm-\u003edev;\n--\ndrivers/gpu/drm/drm_gpusvm.c-1163-\t\tfor (i = 0, j = 0; i \u003c npages; j++) {\ndrivers/gpu/drm/drm_gpusvm.c:1164:\t\t\tstruct drm_pagemap_addr *addr = \u0026svm_pages-\u003edma_addr[j];\ndrivers/gpu/drm/drm_gpusvm.c-1165-\n--\ndrivers/gpu/drm/drm_gpusvm.c-1187-\ndrivers/gpu/drm/drm_gpusvm.c:1188:\t\tdrm_pagemap_put(svm_pages-\u003edpagemap);\ndrivers/gpu/drm/drm_gpusvm.c-1189-\t\tsvm_pages-\u003edpagemap = NULL;\n--\ndrivers/gpu/drm/drm_gpusvm.c=1408=int drm_gpusvm_get_pages(struct drm_gpusvm *gpusvm,\n--\ndrivers/gpu/drm/drm_gpusvm.c-1432-\tstruct dev_pagemap *pagemap;\ndrivers/gpu/drm/drm_gpusvm.c:1433:\tstruct drm_pagemap *dpagemap;\ndrivers/gpu/drm/drm_gpusvm.c-1434-\tstruct drm_gpusvm_pages_flags flags;\n--\ndrivers/gpu/drm/drm_gpusvm.c-1520-\t\t is_device_coherent_page(page)) {\ndrivers/gpu/drm/drm_gpusvm.c:1521:\t\t\tstruct drm_pagemap_zdd *__zdd =\ndrivers/gpu/drm/drm_gpusvm.c:1522:\t\t\t\tdrm_pagemap_page_zone_device_data(page);\ndrivers/gpu/drm/drm_gpusvm.c-1523-\n--\ndrivers/gpu/drm/drm_gpusvm.c-1536-\t\t\t\tpagemap = page_pgmap(page);\ndrivers/gpu/drm/drm_gpusvm.c:1537:\t\t\t\tdpagemap = drm_pagemap_page_to_dpagemap(page);\ndrivers/gpu/drm/drm_gpusvm.c-1538-\t\t\t\tif (drm_WARN_ON(gpusvm-\u003edrm, !dpagemap)) {\n--\ndrivers/gpu/drm/drm_gpusvm.c-1553-\t\t\t\t */\ndrivers/gpu/drm/drm_gpusvm.c:1554:\t\t\t\tdrm_pagemap_get(dpagemap);\ndrivers/gpu/drm/drm_gpusvm.c:1555:\t\t\t\tdrm_pagemap_put(svm_pages-\u003edpagemap);\ndrivers/gpu/drm/drm_gpusvm.c-1556-\t\t\t\tsvm_pages-\u003edpagemap = dpagemap;\n--\ndrivers/gpu/drm/drm_gpusvm.c-1607-\ndrivers/gpu/drm/drm_gpusvm.c:1608:\t\t\tsvm_pages-\u003edma_addr[j] = drm_pagemap_addr_encode\ndrivers/gpu/drm/drm_gpusvm.c-1609-\t\t\t\t(addr, DRM_INTERCONNECT_SYSTEM, order,\n--\ndrivers/gpu/drm/drm_pagemap.c-11-#include \u003cdrm/drm_drv.h\u003e\ndrivers/gpu/drm/drm_pagemap.c:12:#include \u003cdrm/drm_pagemap.h\u003e\ndrivers/gpu/drm/drm_pagemap.c:13:#include \u003cdrm/drm_pagemap_util.h\u003e\ndrivers/gpu/drm/drm_pagemap.c-14-#include \u003cdrm/drm_print.h\u003e\n--\ndrivers/gpu/drm/drm_pagemap.c=18=static DECLARE_FAULT_ATTR(migrate_to_ram_fault_inject);\n--\ndrivers/gpu/drm/drm_pagemap.c-21- * Force a higher-order destination folio allocation to fail in\ndrivers/gpu/drm/drm_pagemap.c:22: * drm_pagemap_migrate_populate_ram_pfn(), exercising the order-0 fallback\ndrivers/gpu/drm/drm_pagemap.c-23- * (and, in turn, the THP split path in __migrate_device_pages()) without\n--\ndrivers/gpu/drm/drm_pagemap.c-25- */\ndrivers/gpu/drm/drm_pagemap.c:26:static bool drm_pagemap_fault_inject_folio(void)\ndrivers/gpu/drm/drm_pagemap.c-27-{\n--\ndrivers/gpu/drm/drm_pagemap.c-30-#else\ndrivers/gpu/drm/drm_pagemap.c:31:static bool drm_pagemap_fault_inject_folio(void)\ndrivers/gpu/drm/drm_pagemap.c-32-{\n--\ndrivers/gpu/drm/drm_pagemap.c-76- * - Device Memory Allocations:\ndrivers/gpu/drm/drm_pagemap.c:77: * Embedded structure containing enough information for the drm_pagemap to\ndrivers/gpu/drm/drm_pagemap.c-78- * migrate to / from device memory.\n--\ndrivers/gpu/drm/drm_pagemap.c-85-/**\ndrivers/gpu/drm/drm_pagemap.c:86: * struct drm_pagemap_zdd - GPU SVM zone device data\ndrivers/gpu/drm/drm_pagemap.c-87- *\n--\ndrivers/gpu/drm/drm_pagemap.c-89- * @devmem_allocation: device memory allocation\ndrivers/gpu/drm/drm_pagemap.c:90: * @dpagemap: Refcounted pointer to the underlying struct drm_pagemap.\ndrivers/gpu/drm/drm_pagemap.c-91- *\n--\ndrivers/gpu/drm/drm_pagemap.c-98- */\ndrivers/gpu/drm/drm_pagemap.c:99:struct drm_pagemap_zdd {\ndrivers/gpu/drm/drm_pagemap.c-100-\tstruct kref refcount;\ndrivers/gpu/drm/drm_pagemap.c:101:\tstruct drm_pagemap_devmem *devmem_allocation;\ndrivers/gpu/drm/drm_pagemap.c:102:\tstruct drm_pagemap *dpagemap;\ndrivers/gpu/drm/drm_pagemap.c-103-};\n--\ndrivers/gpu/drm/drm_pagemap.c-105-/**\ndrivers/gpu/drm/drm_pagemap.c:106: * drm_pagemap_zdd_alloc() - Allocate a zdd structure.\ndrivers/gpu/drm/drm_pagemap.c:107: * @dpagemap: Pointer to the underlying struct drm_pagemap.\ndrivers/gpu/drm/drm_pagemap.c-108- *\n--\ndrivers/gpu/drm/drm_pagemap.c-113- */\ndrivers/gpu/drm/drm_pagemap.c:114:static struct drm_pagemap_zdd *\ndrivers/gpu/drm/drm_pagemap.c:115:drm_pagemap_zdd_alloc(struct drm_pagemap *dpagemap)\ndrivers/gpu/drm/drm_pagemap.c-116-{\ndrivers/gpu/drm/drm_pagemap.c:117:\tstruct drm_pagemap_zdd *zdd;\ndrivers/gpu/drm/drm_pagemap.c-118-\n--\ndrivers/gpu/drm/drm_pagemap.c-124-\tzdd-\u003edevmem_allocation = NULL;\ndrivers/gpu/drm/drm_pagemap.c:125:\tzdd-\u003edpagemap = drm_pagemap_get(dpagemap);\ndrivers/gpu/drm/drm_pagemap.c-126-\n--\ndrivers/gpu/drm/drm_pagemap.c-130-/**\ndrivers/gpu/drm/drm_pagemap.c:131: * drm_pagemap_zdd_get() - Get a reference to a zdd structure.\ndrivers/gpu/drm/drm_pagemap.c-132- * @zdd: Pointer to the zdd structure.\n--\ndrivers/gpu/drm/drm_pagemap.c-137- */\ndrivers/gpu/drm/drm_pagemap.c:138:static struct drm_pagemap_zdd *drm_pagemap_zdd_get(struct drm_pagemap_zdd *zdd)\ndrivers/gpu/drm/drm_pagemap.c-139-{\n--\ndrivers/gpu/drm/drm_pagemap.c-144-/**\ndrivers/gpu/drm/drm_pagemap.c:145: * drm_pagemap_zdd_destroy() - Destroy a zdd structure.\ndrivers/gpu/drm/drm_pagemap.c-146- * @ref: Pointer to the reference count structure.\n--\ndrivers/gpu/drm/drm_pagemap.c-149- */\ndrivers/gpu/drm/drm_pagemap.c:150:static void drm_pagemap_zdd_destroy(struct kref *ref)\ndrivers/gpu/drm/drm_pagemap.c-151-{\ndrivers/gpu/drm/drm_pagemap.c:152:\tstruct drm_pagemap_zdd *zdd =\ndrivers/gpu/drm/drm_pagemap.c:153:\t\tcontainer_of(ref, struct drm_pagemap_zdd, refcount);\ndrivers/gpu/drm/drm_pagemap.c:154:\tstruct drm_pagemap_devmem *devmem = zdd-\u003edevmem_allocation;\ndrivers/gpu/drm/drm_pagemap.c:155:\tstruct drm_pagemap *dpagemap = zdd-\u003edpagemap;\ndrivers/gpu/drm/drm_pagemap.c-156-\n--\ndrivers/gpu/drm/drm_pagemap.c-162-\tkfree(zdd);\ndrivers/gpu/drm/drm_pagemap.c:163:\tdrm_pagemap_put(dpagemap);\ndrivers/gpu/drm/drm_pagemap.c-164-}\n--\ndrivers/gpu/drm/drm_pagemap.c-166-/**\ndrivers/gpu/drm/drm_pagemap.c:167: * drm_pagemap_zdd_put() - Put a zdd reference.\ndrivers/gpu/drm/drm_pagemap.c-168- * @zdd: Pointer to the zdd structure.\n--\ndrivers/gpu/drm/drm_pagemap.c-172- */\ndrivers/gpu/drm/drm_pagemap.c:173:static void drm_pagemap_zdd_put(struct drm_pagemap_zdd *zdd)\ndrivers/gpu/drm/drm_pagemap.c-174-{\ndrivers/gpu/drm/drm_pagemap.c:175:\tkref_put(\u0026zdd-\u003erefcount, drm_pagemap_zdd_destroy);\ndrivers/gpu/drm/drm_pagemap.c-176-}\n--\ndrivers/gpu/drm/drm_pagemap.c-178-/**\ndrivers/gpu/drm/drm_pagemap.c:179: * drm_pagemap_migration_unlock_put_folio() - Put a migration folio\ndrivers/gpu/drm/drm_pagemap.c-180- * @folio: Pointer to the folio to put\n--\ndrivers/gpu/drm/drm_pagemap.c-183- */\ndrivers/gpu/drm/drm_pagemap.c:184:static void drm_pagemap_migration_unlock_put_folio(struct folio *folio)\ndrivers/gpu/drm/drm_pagemap.c-185-{\n--\ndrivers/gpu/drm/drm_pagemap.c-190-/**\ndrivers/gpu/drm/drm_pagemap.c:191: * drm_pagemap_migration_unlock_put_pages() - Put migration pages\ndrivers/gpu/drm/drm_pagemap.c-192- * @npages: Number of pages\n--\ndrivers/gpu/drm/drm_pagemap.c-196- */\ndrivers/gpu/drm/drm_pagemap.c:197:static void drm_pagemap_migration_unlock_put_pages(unsigned long npages,\ndrivers/gpu/drm/drm_pagemap.c-198-\t\t\t\t\t\t unsigned long *migrate_pfn)\n--\ndrivers/gpu/drm/drm_pagemap.c-213-\ndrivers/gpu/drm/drm_pagemap.c:214:\t\tdrm_pagemap_migration_unlock_put_folio(folio);\ndrivers/gpu/drm/drm_pagemap.c-215-\t\tmigrate_pfn[i] = 0;\n--\ndrivers/gpu/drm/drm_pagemap.c-222-/**\ndrivers/gpu/drm/drm_pagemap.c:223: * drm_pagemap_get_devmem_page() - Get a reference to a device memory page\ndrivers/gpu/drm/drm_pagemap.c-224- * @page: Pointer to the page\n--\ndrivers/gpu/drm/drm_pagemap.c-230- */\ndrivers/gpu/drm/drm_pagemap.c:231:static void drm_pagemap_get_devmem_page(struct page *page,\ndrivers/gpu/drm/drm_pagemap.c-232-\t\t\t\t\tunsigned int order,\ndrivers/gpu/drm/drm_pagemap.c:233:\t\t\t\t\tstruct drm_pagemap_zdd *zdd)\ndrivers/gpu/drm/drm_pagemap.c-234-{\n--\ndrivers/gpu/drm/drm_pagemap.c-236-\t\t\t order);\ndrivers/gpu/drm/drm_pagemap.c:237:\tfolio_set_zone_device_data(page_folio(page), drm_pagemap_zdd_get(zdd));\ndrivers/gpu/drm/drm_pagemap.c-238-}\n--\ndrivers/gpu/drm/drm_pagemap.c-240-/**\ndrivers/gpu/drm/drm_pagemap.c:241: * drm_pagemap_migrate_map_device_private_pages() - Map device private migration\ndrivers/gpu/drm/drm_pagemap.c-242- * pages for GPU SVM migration\ndrivers/gpu/drm/drm_pagemap.c-243- * @dev: The device performing the migration.\ndrivers/gpu/drm/drm_pagemap.c:244: * @local_dpagemap: The drm_pagemap local to the migrating device.\ndrivers/gpu/drm/drm_pagemap.c-245- * @pagemap_addr: Array to store DMA information corresponding to mapped pages.\n--\ndrivers/gpu/drm/drm_pagemap.c=258=static int\ndrivers/gpu/drm/drm_pagemap.c:259:drm_pagemap_migrate_map_device_private_pages(struct device *dev,\ndrivers/gpu/drm/drm_pagemap.c:260:\t\t\t\t\t struct drm_pagemap *local_dpagemap,\ndrivers/gpu/drm/drm_pagemap.c:261:\t\t\t\t\t struct drm_pagemap_addr *pagemap_addr,\ndrivers/gpu/drm/drm_pagemap.c-262-\t\t\t\t\t unsigned long *migrate_pfn,\n--\ndrivers/gpu/drm/drm_pagemap.c-264-\t\t\t\t\t enum dma_data_direction dir,\ndrivers/gpu/drm/drm_pagemap.c:265:\t\t\t\t\t const struct drm_pagemap_migrate_details *mdetails)\ndrivers/gpu/drm/drm_pagemap.c-266-{\n--\ndrivers/gpu/drm/drm_pagemap.c-270-\t\tstruct page *page = migrate_pfn_to_page(migrate_pfn[i]);\ndrivers/gpu/drm/drm_pagemap.c:271:\t\tstruct drm_pagemap_zdd *zdd;\ndrivers/gpu/drm/drm_pagemap.c:272:\t\tstruct drm_pagemap *dpagemap;\ndrivers/gpu/drm/drm_pagemap.c:273:\t\tstruct drm_pagemap_addr addr;\ndrivers/gpu/drm/drm_pagemap.c-274-\t\tstruct folio *folio;\n--\ndrivers/gpu/drm/drm_pagemap.c-283-\ndrivers/gpu/drm/drm_pagemap.c:284:\t\tzdd = drm_pagemap_page_zone_device_data(page);\ndrivers/gpu/drm/drm_pagemap.c-285-\t\tdpagemap = zdd-\u003edpagemap;\n--\ndrivers/gpu/drm/drm_pagemap.c-316-/**\ndrivers/gpu/drm/drm_pagemap.c:317: * struct drm_pagemap_iova_state - DRM pagemap IOVA state\ndrivers/gpu/drm/drm_pagemap.c-318- * @dma_state: DMA IOVA state.\n--\ndrivers/gpu/drm/drm_pagemap.c-323- */\ndrivers/gpu/drm/drm_pagemap.c:324:struct drm_pagemap_iova_state {\ndrivers/gpu/drm/drm_pagemap.c-325-\tstruct dma_iova_state dma_state;\n--\ndrivers/gpu/drm/drm_pagemap.c-329-/**\ndrivers/gpu/drm/drm_pagemap.c:330: * drm_pagemap_migrate_map_system_pages() - Map system or device coherent\ndrivers/gpu/drm/drm_pagemap.c-331- * migration pages for GPU SVM migration\n--\ndrivers/gpu/drm/drm_pagemap.c=346=static int\ndrivers/gpu/drm/drm_pagemap.c:347:drm_pagemap_migrate_map_system_pages(struct device *dev,\ndrivers/gpu/drm/drm_pagemap.c:348:\t\t\t\t struct drm_pagemap_addr *pagemap_addr,\ndrivers/gpu/drm/drm_pagemap.c-349-\t\t\t\t unsigned long *migrate_pfn,\n--\ndrivers/gpu/drm/drm_pagemap.c-351-\t\t\t\t enum dma_data_direction dir,\ndrivers/gpu/drm/drm_pagemap.c:352:\t\t\t\t struct drm_pagemap_iova_state *state)\ndrivers/gpu/drm/drm_pagemap.c-353-{\n--\ndrivers/gpu/drm/drm_pagemap.c-393-\t\tpagemap_addr[i] =\ndrivers/gpu/drm/drm_pagemap.c:394:\t\t\tdrm_pagemap_addr_encode(dma_addr,\ndrivers/gpu/drm/drm_pagemap.c-395-\t\t\t\t\t\tDRM_INTERCONNECT_SYSTEM,\n--\ndrivers/gpu/drm/drm_pagemap.c-408-/**\ndrivers/gpu/drm/drm_pagemap.c:409: * drm_pagemap_migrate_populate_src_pages() - Populate the source page array\ndrivers/gpu/drm/drm_pagemap.c-410- * @pages: Array of source pages to populate\n--\ndrivers/gpu/drm/drm_pagemap.c-418- * the copy callback deriving the rest of the folio from the order recorded in\ndrivers/gpu/drm/drm_pagemap.c:419: * the corresponding drm_pagemap_addr. That does not work where\ndrivers/gpu/drm/drm_pagemap.c:420: * drm_pagemap_migrate_populate_ram_pfn() had to demote a higher-order source\ndrivers/gpu/drm/drm_pagemap.c:421: * folio to order-0 destination folios: the drm_pagemap_addr entries are then\ndrivers/gpu/drm/drm_pagemap.c-422- * per-page, and the copy callback needs a source page for each of them.\n--\ndrivers/gpu/drm/drm_pagemap.c-428- */\ndrivers/gpu/drm/drm_pagemap.c:429:static void drm_pagemap_migrate_populate_src_pages(struct page **pages,\ndrivers/gpu/drm/drm_pagemap.c-430-\t\t\t\t\t\t unsigned long *src_mpfn,\n--\ndrivers/gpu/drm/drm_pagemap.c-460-/**\ndrivers/gpu/drm/drm_pagemap.c:461: * drm_pagemap_migrate_unmap_pages() - Unmap pages previously mapped for GPU SVM migration\ndrivers/gpu/drm/drm_pagemap.c-462- * @dev: The device for which the pages were mapped\ndrivers/gpu/drm/drm_pagemap.c-463- * @migrate_pfn: Array of migrate pfns set up for the mapped pages. Used to\ndrivers/gpu/drm/drm_pagemap.c:464: * determine the drm_pagemap of a peer device private page.\ndrivers/gpu/drm/drm_pagemap.c-465- * @pagemap_addr: Array of DMA information corresponding to mapped pages\n--\ndrivers/gpu/drm/drm_pagemap.c-474- */\ndrivers/gpu/drm/drm_pagemap.c:475:static void drm_pagemap_migrate_unmap_pages(struct device *dev,\ndrivers/gpu/drm/drm_pagemap.c:476:\t\t\t\t\t struct drm_pagemap_addr *pagemap_addr,\ndrivers/gpu/drm/drm_pagemap.c-477-\t\t\t\t\t unsigned long *migrate_pfn,\n--\ndrivers/gpu/drm/drm_pagemap.c-479-\t\t\t\t\t enum dma_data_direction dir,\ndrivers/gpu/drm/drm_pagemap.c:480:\t\t\t\t\t struct drm_pagemap_iova_state *state)\ndrivers/gpu/drm/drm_pagemap.c-481-{\n--\ndrivers/gpu/drm/drm_pagemap.c-495-\t\tif (is_zone_device_page(page)) {\ndrivers/gpu/drm/drm_pagemap.c:496:\t\t\tstruct drm_pagemap_zdd *zdd = drm_pagemap_page_zone_device_data(page);\ndrivers/gpu/drm/drm_pagemap.c:497:\t\t\tstruct drm_pagemap *dpagemap = zdd-\u003edpagemap;\ndrivers/gpu/drm/drm_pagemap.c-498-\n--\ndrivers/gpu/drm/drm_pagemap.c=516=static int\ndrivers/gpu/drm/drm_pagemap.c:517:drm_pagemap_migrate_remote_to_local(struct drm_pagemap_devmem *devmem,\ndrivers/gpu/drm/drm_pagemap.c-518-\t\t\t\t struct device *remote_device,\ndrivers/gpu/drm/drm_pagemap.c:519:\t\t\t\t struct drm_pagemap *remote_dpagemap,\ndrivers/gpu/drm/drm_pagemap.c-520-\t\t\t\t unsigned long local_pfns[],\ndrivers/gpu/drm/drm_pagemap.c-521-\t\t\t\t struct page *remote_pages[],\ndrivers/gpu/drm/drm_pagemap.c:522:\t\t\t\t struct drm_pagemap_addr pagemap_addr[],\ndrivers/gpu/drm/drm_pagemap.c-523-\t\t\t\t unsigned long npages,\ndrivers/gpu/drm/drm_pagemap.c:524:\t\t\t\t const struct drm_pagemap_devmem_ops *ops,\ndrivers/gpu/drm/drm_pagemap.c:525:\t\t\t\t const struct drm_pagemap_migrate_details *mdetails)\ndrivers/gpu/drm/drm_pagemap.c-526-\ndrivers/gpu/drm/drm_pagemap.c-527-{\ndrivers/gpu/drm/drm_pagemap.c:528:\tint err = drm_pagemap_migrate_map_device_private_pages(remote_device,\ndrivers/gpu/drm/drm_pagemap.c-529-\t\t\t\t\t\t\t remote_dpagemap,\n--\ndrivers/gpu/drm/drm_pagemap.c-541-out:\ndrivers/gpu/drm/drm_pagemap.c:542:\tdrm_pagemap_migrate_unmap_pages(remote_device, pagemap_addr, local_pfns,\ndrivers/gpu/drm/drm_pagemap.c-543-\t\t\t\t\tnpages, DMA_FROM_DEVICE, NULL);\n--\ndrivers/gpu/drm/drm_pagemap.c=547=static int\ndrivers/gpu/drm/drm_pagemap.c:548:drm_pagemap_migrate_sys_to_dev(struct drm_pagemap_devmem *devmem,\ndrivers/gpu/drm/drm_pagemap.c-549-\t\t\t unsigned long sys_pfns[],\ndrivers/gpu/drm/drm_pagemap.c-550-\t\t\t struct page *local_pages[],\ndrivers/gpu/drm/drm_pagemap.c:551:\t\t\t struct drm_pagemap_addr pagemap_addr[],\ndrivers/gpu/drm/drm_pagemap.c-552-\t\t\t unsigned long npages,\ndrivers/gpu/drm/drm_pagemap.c:553:\t\t\t const struct drm_pagemap_devmem_ops *ops,\ndrivers/gpu/drm/drm_pagemap.c:554:\t\t\t struct drm_pagemap_iova_state *state)\ndrivers/gpu/drm/drm_pagemap.c-555-{\ndrivers/gpu/drm/drm_pagemap.c:556:\tint err = drm_pagemap_migrate_map_system_pages(devmem-\u003edev,\ndrivers/gpu/drm/drm_pagemap.c-557-\t\t\t\t\t\t pagemap_addr, sys_pfns,\n--\ndrivers/gpu/drm/drm_pagemap.c-566-out:\ndrivers/gpu/drm/drm_pagemap.c:567:\tdrm_pagemap_migrate_unmap_pages(devmem-\u003edev, pagemap_addr, sys_pfns, npages,\ndrivers/gpu/drm/drm_pagemap.c-568-\t\t\t\t\tDMA_TO_DEVICE, state);\n--\ndrivers/gpu/drm/drm_pagemap.c-576- * @device: migrating device.\ndrivers/gpu/drm/drm_pagemap.c:577: * @dpagemap: Pointer to struct drm_pagemap used by the migrating device.\ndrivers/gpu/drm/drm_pagemap.c-578- * @ops: The copy ops to be used for the migrating device.\n--\ndrivers/gpu/drm/drm_pagemap.c=580=struct migrate_range_loc {\n--\ndrivers/gpu/drm/drm_pagemap.c-582-\tstruct device *device;\ndrivers/gpu/drm/drm_pagemap.c:583:\tstruct drm_pagemap *dpagemap;\ndrivers/gpu/drm/drm_pagemap.c:584:\tconst struct drm_pagemap_devmem_ops *ops;\ndrivers/gpu/drm/drm_pagemap.c-585-};\ndrivers/gpu/drm/drm_pagemap.c-586-\ndrivers/gpu/drm/drm_pagemap.c:587:static int drm_pagemap_migrate_range(struct drm_pagemap_devmem *devmem,\ndrivers/gpu/drm/drm_pagemap.c-588-\t\t\t\t unsigned long src_pfns[],\n--\ndrivers/gpu/drm/drm_pagemap.c-590-\t\t\t\t struct page *pages[],\ndrivers/gpu/drm/drm_pagemap.c:591:\t\t\t\t struct drm_pagemap_addr pagemap_addr[],\ndrivers/gpu/drm/drm_pagemap.c-592-\t\t\t\t struct migrate_range_loc *last,\ndrivers/gpu/drm/drm_pagemap.c-593-\t\t\t\t const struct migrate_range_loc *cur,\ndrivers/gpu/drm/drm_pagemap.c:594:\t\t\t\t const struct drm_pagemap_migrate_details *mdetails)\ndrivers/gpu/drm/drm_pagemap.c-595-{\ndrivers/gpu/drm/drm_pagemap.c:596:\tstruct drm_pagemap_iova_state state = {};\ndrivers/gpu/drm/drm_pagemap.c-597-\tint ret = 0;\n--\ndrivers/gpu/drm/drm_pagemap.c-608-\tif (last-\u003edpagemap)\ndrivers/gpu/drm/drm_pagemap.c:609:\t\tret = drm_pagemap_migrate_remote_to_local(devmem,\ndrivers/gpu/drm/drm_pagemap.c-610-\t\t\t\t\t\t\t last-\u003edevice,\n--\ndrivers/gpu/drm/drm_pagemap.c-618-\telse\ndrivers/gpu/drm/drm_pagemap.c:619:\t\tret = drm_pagemap_migrate_sys_to_dev(devmem,\ndrivers/gpu/drm/drm_pagemap.c-620-\t\t\t\t\t\t \u0026src_pfns[last-\u003estart],\n--\ndrivers/gpu/drm/drm_pagemap.c-631-/**\ndrivers/gpu/drm/drm_pagemap.c:632: * drm_pagemap_cpages() - Count collected pages\ndrivers/gpu/drm/drm_pagemap.c-633- * @migrate_pfn: Array of migrate_pfn entries to account\n--\ndrivers/gpu/drm/drm_pagemap.c-641- */\ndrivers/gpu/drm/drm_pagemap.c:642:static int drm_pagemap_cpages(unsigned long *migrate_pfn, unsigned long npages)\ndrivers/gpu/drm/drm_pagemap.c-643-{\n--\ndrivers/gpu/drm/drm_pagemap.c-666-/**\ndrivers/gpu/drm/drm_pagemap.c:667: * drm_pagemap_migrate_to_devmem() - Migrate a struct mm_struct range to device memory\ndrivers/gpu/drm/drm_pagemap.c-668- * @devmem_allocation: The device memory allocation to migrate to.\n--\ndrivers/gpu/drm/drm_pagemap.c-689- */\ndrivers/gpu/drm/drm_pagemap.c:690:int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation,\ndrivers/gpu/drm/drm_pagemap.c-691-\t\t\t\t struct mm_struct *mm,\ndrivers/gpu/drm/drm_pagemap.c-692-\t\t\t\t unsigned long start, unsigned long end,\ndrivers/gpu/drm/drm_pagemap.c:693:\t\t\t\t const struct drm_pagemap_migrate_details *mdetails)\ndrivers/gpu/drm/drm_pagemap.c-694-{\ndrivers/gpu/drm/drm_pagemap.c:695:\tconst struct drm_pagemap_devmem_ops *ops = devmem_allocation-\u003eops;\ndrivers/gpu/drm/drm_pagemap.c:696:\tstruct drm_pagemap *dpagemap = devmem_allocation-\u003edpagemap;\ndrivers/gpu/drm/drm_pagemap.c-697-\tstruct dev_pagemap *pagemap = dpagemap-\u003epagemap;\n--\ndrivers/gpu/drm/drm_pagemap.c-708-\tstruct vm_area_struct *vas;\ndrivers/gpu/drm/drm_pagemap.c:709:\tstruct drm_pagemap_zdd *zdd = NULL;\ndrivers/gpu/drm/drm_pagemap.c-710-\tstruct page **pages;\ndrivers/gpu/drm/drm_pagemap.c:711:\tstruct drm_pagemap_addr *pagemap_addr;\ndrivers/gpu/drm/drm_pagemap.c-712-\tvoid *buf;\n--\ndrivers/gpu/drm/drm_pagemap.c-745-\ndrivers/gpu/drm/drm_pagemap.c:746:\tzdd = drm_pagemap_zdd_alloc(dpagemap);\ndrivers/gpu/drm/drm_pagemap.c-747-\tif (!zdd) {\n--\ndrivers/gpu/drm/drm_pagemap.c-768-\tif (migrate.cpages != npages \u0026\u0026\ndrivers/gpu/drm/drm_pagemap.c:769:\t drm_pagemap_cpages(migrate.src, npages) != npages) {\ndrivers/gpu/drm/drm_pagemap.c-770-\t\t/*\n--\ndrivers/gpu/drm/drm_pagemap.c-819-\t\tif (src_page \u0026\u0026 is_device_private_page(src_page)) {\ndrivers/gpu/drm/drm_pagemap.c:820:\t\t\tstruct drm_pagemap_zdd *src_zdd =\ndrivers/gpu/drm/drm_pagemap.c:821:\t\t\t\tdrm_pagemap_page_zone_device_data(src_page);\ndrivers/gpu/drm/drm_pagemap.c-822-\n--\ndrivers/gpu/drm/drm_pagemap.c-853-\ndrivers/gpu/drm/drm_pagemap.c:854:\t\tdrm_pagemap_get_devmem_page(page, order, zdd);\ndrivers/gpu/drm/drm_pagemap.c-855-\ndrivers/gpu/drm/drm_pagemap.c:856:\t\t/* If we switched the migrating drm_pagemap, migrate previous pages now */\ndrivers/gpu/drm/drm_pagemap.c:857:\t\terr = drm_pagemap_migrate_range(devmem_allocation, migrate.src, migrate.dst,\ndrivers/gpu/drm/drm_pagemap.c-858-\t\t\t\t\t\tpages, pagemap_addr, \u0026last, \u0026cur,\n--\ndrivers/gpu/drm/drm_pagemap.c-870-\tcur.ops = NULL; /* Force migration */\ndrivers/gpu/drm/drm_pagemap.c:871:\terr = drm_pagemap_migrate_range(devmem_allocation, migrate.src, migrate.dst,\ndrivers/gpu/drm/drm_pagemap.c-872-\t\t\t\t\tpages, pagemap_addr, \u0026last, \u0026cur, mdetails);\n--\ndrivers/gpu/drm/drm_pagemap.c-886-\tif (err) {\ndrivers/gpu/drm/drm_pagemap.c:887:\t\tdrm_pagemap_migration_unlock_put_pages(npages, migrate.dst);\ndrivers/gpu/drm/drm_pagemap.c-888-\t\tfor (i = npages; i \u003c npages_in_range(start, end); ++i)\n--\ndrivers/gpu/drm/drm_pagemap.c-910-err_free:\ndrivers/gpu/drm/drm_pagemap.c:911:\tdrm_pagemap_zdd_put(zdd);\ndrivers/gpu/drm/drm_pagemap.c-912-\tkvfree(buf);\n--\ndrivers/gpu/drm/drm_pagemap.c-918-}\ndrivers/gpu/drm/drm_pagemap.c:919:EXPORT_SYMBOL_GPL(drm_pagemap_migrate_to_devmem);\ndrivers/gpu/drm/drm_pagemap.c-920-\ndrivers/gpu/drm/drm_pagemap.c-921-/**\ndrivers/gpu/drm/drm_pagemap.c:922: * drm_pagemap_migrate_populate_ram_pfn() - Populate RAM PFNs for a VM area\ndrivers/gpu/drm/drm_pagemap.c-923- * @vas: Pointer to the VM area structure, can be NULL\n--\ndrivers/gpu/drm/drm_pagemap.c-937- */\ndrivers/gpu/drm/drm_pagemap.c:938:static int drm_pagemap_migrate_populate_ram_pfn(struct vm_area_struct *vas,\ndrivers/gpu/drm/drm_pagemap.c-939-\t\t\t\t\t\tstruct page *fault_page,\n--\ndrivers/gpu/drm/drm_pagemap.c-961-\t\tif (fault_page) {\ndrivers/gpu/drm/drm_pagemap.c:962:\t\t\tif (drm_pagemap_page_zone_device_data(src_page) !=\ndrivers/gpu/drm/drm_pagemap.c:963:\t\t\t drm_pagemap_page_zone_device_data(fault_page))\ndrivers/gpu/drm/drm_pagemap.c-964-\t\t\t\tgoto next;\n--\ndrivers/gpu/drm/drm_pagemap.c-970-\ndrivers/gpu/drm/drm_pagemap.c:971:\t\tif (order \u0026\u0026 drm_pagemap_fault_inject_folio())\ndrivers/gpu/drm/drm_pagemap.c-972-\t\t\tfolio = NULL;\n--\ndrivers/gpu/drm/drm_pagemap.c-1056-\ndrivers/gpu/drm/drm_pagemap.c:1057:static void drm_pagemap_dev_unhold_work(struct work_struct *work);\ndrivers/gpu/drm/drm_pagemap.c:1058:static LLIST_HEAD(drm_pagemap_unhold_list);\ndrivers/gpu/drm/drm_pagemap.c:1059:static DECLARE_WORK(drm_pagemap_work, drm_pagemap_dev_unhold_work);\ndrivers/gpu/drm/drm_pagemap.c-1060-\ndrivers/gpu/drm/drm_pagemap.c-1061-/**\ndrivers/gpu/drm/drm_pagemap.c:1062: * struct drm_pagemap_dev_hold - Struct to aid in drm_device release.\ndrivers/gpu/drm/drm_pagemap.c:1063: * @link: Link into drm_pagemap_unhold_list for deferred reference releases.\ndrivers/gpu/drm/drm_pagemap.c-1064- * @drm: drm device to put.\ndrivers/gpu/drm/drm_pagemap.c-1065- *\ndrivers/gpu/drm/drm_pagemap.c:1066: * When a struct drm_pagemap is released, we also need to release the\ndrivers/gpu/drm/drm_pagemap.c-1067- * reference it holds on the drm device. However, typically that needs\ndrivers/gpu/drm/drm_pagemap.c-1068- * to be done separately from a system-wide workqueue.\ndrivers/gpu/drm/drm_pagemap.c:1069: * Each time a struct drm_pagemap is initialized\ndrivers/gpu/drm/drm_pagemap.c-1070- * (or re-initialized if cached) therefore allocate a separate\ndrivers/gpu/drm/drm_pagemap.c:1071: * drm_pagemap_dev_hold item, from which we put the drm device and\ndrivers/gpu/drm/drm_pagemap.c-1072- * associated module.\ndrivers/gpu/drm/drm_pagemap.c-1073- */\ndrivers/gpu/drm/drm_pagemap.c:1074:struct drm_pagemap_dev_hold {\ndrivers/gpu/drm/drm_pagemap.c-1075-\tstruct llist_node link;\n--\ndrivers/gpu/drm/drm_pagemap.c-1078-\ndrivers/gpu/drm/drm_pagemap.c:1079:static void drm_pagemap_release(struct kref *ref)\ndrivers/gpu/drm/drm_pagemap.c-1080-{\ndrivers/gpu/drm/drm_pagemap.c:1081:\tstruct drm_pagemap *dpagemap = container_of(ref, typeof(*dpagemap), ref);\ndrivers/gpu/drm/drm_pagemap.c:1082:\tstruct drm_pagemap_dev_hold *dev_hold = dpagemap-\u003edev_hold;\ndrivers/gpu/drm/drm_pagemap.c-1083-\n--\ndrivers/gpu/drm/drm_pagemap.c-1085-\t * We know the pagemap provider is alive at this point, since\ndrivers/gpu/drm/drm_pagemap.c:1086:\t * the struct drm_pagemap_dev_hold holds a reference to the\ndrivers/gpu/drm/drm_pagemap.c-1087-\t * pagemap provider drm_device and its module.\n--\ndrivers/gpu/drm/drm_pagemap.c-1089-\tdpagemap-\u003edev_hold = NULL;\ndrivers/gpu/drm/drm_pagemap.c:1090:\tdrm_pagemap_shrinker_add(dpagemap);\ndrivers/gpu/drm/drm_pagemap.c:1091:\tllist_add(\u0026dev_hold-\u003elink, \u0026drm_pagemap_unhold_list);\ndrivers/gpu/drm/drm_pagemap.c:1092:\tschedule_work(\u0026drm_pagemap_work);\ndrivers/gpu/drm/drm_pagemap.c-1093-\t/*\n--\ndrivers/gpu/drm/drm_pagemap.c-1095-\t * page_free(), the caller is holding a reference on the dev_pagemap,\ndrivers/gpu/drm/drm_pagemap.c:1096:\t * or if called from drm_pagemap_put(), the direct caller is still alive.\ndrivers/gpu/drm/drm_pagemap.c-1097-\t * This ensures we can't race with THIS module unload.\n--\ndrivers/gpu/drm/drm_pagemap.c-1100-\ndrivers/gpu/drm/drm_pagemap.c:1101:static void drm_pagemap_dev_unhold_work(struct work_struct *work)\ndrivers/gpu/drm/drm_pagemap.c-1102-{\ndrivers/gpu/drm/drm_pagemap.c:1103:\tstruct llist_node *node = llist_del_all(\u0026drm_pagemap_unhold_list);\ndrivers/gpu/drm/drm_pagemap.c:1104:\tstruct drm_pagemap_dev_hold *dev_hold, *next;\ndrivers/gpu/drm/drm_pagemap.c-1105-\ndrivers/gpu/drm/drm_pagemap.c-1106-\t/*\ndrivers/gpu/drm/drm_pagemap.c:1107:\t * Deferred release of drm_pagemap provider device and module.\ndrivers/gpu/drm/drm_pagemap.c-1108-\t * THIS module is kept alive during the release by the\ndrivers/gpu/drm/drm_pagemap.c:1109:\t * flush_work() in the drm_pagemap_exit() function.\ndrivers/gpu/drm/drm_pagemap.c-1110-\t */\n--\ndrivers/gpu/drm/drm_pagemap.c-1121-\ndrivers/gpu/drm/drm_pagemap.c:1122:static struct drm_pagemap_dev_hold *\ndrivers/gpu/drm/drm_pagemap.c:1123:drm_pagemap_dev_hold(struct drm_pagemap *dpagemap)\ndrivers/gpu/drm/drm_pagemap.c-1124-{\ndrivers/gpu/drm/drm_pagemap.c:1125:\tstruct drm_pagemap_dev_hold *dev_hold;\ndrivers/gpu/drm/drm_pagemap.c-1126-\tstruct drm_device *drm = dpagemap-\u003edrm;\n--\ndrivers/gpu/drm/drm_pagemap.c-1140-/**\ndrivers/gpu/drm/drm_pagemap.c:1141: * drm_pagemap_reinit() - Reinitialize a drm_pagemap\ndrivers/gpu/drm/drm_pagemap.c:1142: * @dpagemap: The drm_pagemap to reinitialize\ndrivers/gpu/drm/drm_pagemap.c-1143- *\ndrivers/gpu/drm/drm_pagemap.c:1144: * Reinitialize a drm_pagemap, for which drm_pagemap_release\ndrivers/gpu/drm/drm_pagemap.c-1145- * has already been called. This interface is intended for the\ndrivers/gpu/drm/drm_pagemap.c:1146: * situation where the driver caches a destroyed drm_pagemap.\ndrivers/gpu/drm/drm_pagemap.c-1147- *\n--\ndrivers/gpu/drm/drm_pagemap.c-1149- */\ndrivers/gpu/drm/drm_pagemap.c:1150:int drm_pagemap_reinit(struct drm_pagemap *dpagemap)\ndrivers/gpu/drm/drm_pagemap.c-1151-{\ndrivers/gpu/drm/drm_pagemap.c:1152:\tdpagemap-\u003edev_hold = drm_pagemap_dev_hold(dpagemap);\ndrivers/gpu/drm/drm_pagemap.c-1153-\tif (IS_ERR(dpagemap-\u003edev_hold))\n\n"
} |
| 5/2 | 2026/08/05 13:22 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 20652 output: 19 thoughts: 62 Thoughts: **Investigating the Reachability of `drm_gpusvm` in a QEMU Context** Okay, so I'm thinking about how `drm_pagemap` is tied into `drm_gpusvm`, which is, of course, a core component used by various GPU drivers, like Intel's Xe. My immediate question is whether `drm_gpusvm` is even accessible, or "reachable," within a QEMU environment. This is crucial for debugging and understanding virtualized driver interactions. Therefore, my next step has to be figuring out if there are any current virtualized drivers actually *using* `drm_gpusvm`. I need to figure out how to verify whether it's in play during QEMU operations. |
| 6/2 | 2026/08/05 13:22 | tool | grepper |
0mArgs:{
"Expression": "drm_gpusvm"
}Results: {
"Output": "\nFull output is too long, showing 500 out of 1544 lines.\nUse more precise expression if possible.\n\n.clang-format=71=ForEachMacros:\n--\n.clang-format-182- - 'drm_gem_for_each_gpuvm_bo_safe'\n.clang-format:183: - 'drm_gpusvm_for_each_range'\n.clang-format-184- - 'drm_gpuva_for_each_op'\n--\nDocumentation/gpu/rfc/gpusvm.rst=67=Overview of baseline design\n--\nDocumentation/gpu/rfc/gpusvm.rst-69-\nDocumentation/gpu/rfc/gpusvm.rst:70:.. kernel-doc:: drivers/gpu/drm/drm_gpusvm.c\nDocumentation/gpu/rfc/gpusvm.rst-71- :doc: Overview\nDocumentation/gpu/rfc/gpusvm.rst-72-\nDocumentation/gpu/rfc/gpusvm.rst:73:.. kernel-doc:: drivers/gpu/drm/drm_gpusvm.c\nDocumentation/gpu/rfc/gpusvm.rst-74- :doc: Locking\nDocumentation/gpu/rfc/gpusvm.rst-75-\nDocumentation/gpu/rfc/gpusvm.rst:76:.. kernel-doc:: drivers/gpu/drm/drm_gpusvm.c\nDocumentation/gpu/rfc/gpusvm.rst-77- :doc: Partial Unmapping of Ranges\nDocumentation/gpu/rfc/gpusvm.rst-78-\nDocumentation/gpu/rfc/gpusvm.rst:79:.. kernel-doc:: drivers/gpu/drm/drm_gpusvm.c\nDocumentation/gpu/rfc/gpusvm.rst-80- :doc: Examples\n--\nDocumentation/gpu/rfc/gpusvm.rst=91=Possible future design features\n--\nDocumentation/gpu/rfc/gpusvm.rst-100-* Ranges with mixed system and device pages\nDocumentation/gpu/rfc/gpusvm.rst:101:\t* Can be added if required to drm_gpusvm_get_pages fairly easily.\nDocumentation/gpu/rfc/gpusvm.rst-102-* Multi-GPU support\n--\ndrivers/gpu/drm/Makefile=107=obj-$(CONFIG_DRM_GPUVM) += drm_gpuvm.o\ndrivers/gpu/drm/Makefile-108-\ndrivers/gpu/drm/Makefile:109:drm_gpusvm_helper-y := \\\ndrivers/gpu/drm/Makefile:110:\tdrm_gpusvm.o\ndrivers/gpu/drm/Makefile:111:drm_gpusvm_helper-$(CONFIG_ZONE_DEVICE) += \\\ndrivers/gpu/drm/Makefile-112-\tdrm_pagemap.o\\\n--\ndrivers/gpu/drm/Makefile-114-\ndrivers/gpu/drm/Makefile:115:obj-$(CONFIG_DRM_GPUSVM) += drm_gpusvm_helper.o\ndrivers/gpu/drm/Makefile-116-\n--\ndrivers/gpu/drm/drm_gpusvm.c-17-#include \u003cdrm/drm_device.h\u003e\ndrivers/gpu/drm/drm_gpusvm.c:18:#include \u003cdrm/drm_gpusvm.h\u003e\ndrivers/gpu/drm/drm_gpusvm.c-19-#include \u003cdrm/drm_pagemap.h\u003e\n--\ndrivers/gpu/drm/drm_gpusvm.c-94- * except for the recheck range's pages being valid\ndrivers/gpu/drm/drm_gpusvm.c:95: * (drm_gpusvm_range_pages_valid) when the driver is committing GPU bindings.\ndrivers/gpu/drm/drm_gpusvm.c-96- * This lock corresponds to the ``driver-\u003eupdate`` lock mentioned in\n--\ndrivers/gpu/drm/drm_gpusvm.c-102- * lock to safeguard core GPU SVM function calls that modify state, such as\ndrivers/gpu/drm/drm_gpusvm.c:103: * drm_gpusvm_range_find_or_insert and drm_gpusvm_range_remove. This lock is\ndrivers/gpu/drm/drm_gpusvm.c-104- * denoted as 'driver_svm_lock' in code examples. Finer grained driver side\ndrivers/gpu/drm/drm_gpusvm.c-105- * locking should also be possible for concurrent GPU fault processing within a\ndrivers/gpu/drm/drm_gpusvm.c:106: * single GPU SVM. The 'driver_svm_lock' can be via drm_gpusvm_driver_set_lock\ndrivers/gpu/drm/drm_gpusvm.c-107- * to add annotations to GPU SVM.\n--\ndrivers/gpu/drm/drm_gpusvm.c-142- *\ndrivers/gpu/drm/drm_gpusvm.c:143: *\tint driver_bind_range(struct drm_gpusvm *gpusvm, struct drm_gpusvm_range *range)\ndrivers/gpu/drm/drm_gpusvm.c-144- *\t{\n--\ndrivers/gpu/drm/drm_gpusvm.c-148- *\ndrivers/gpu/drm/drm_gpusvm.c:149: *\t\tdrm_gpusvm_notifier_lock(gpusvm);\ndrivers/gpu/drm/drm_gpusvm.c:150: *\t\tif (drm_gpusvm_range_pages_valid(range))\ndrivers/gpu/drm/drm_gpusvm.c-151- *\t\t\tdriver_commit_bind(gpusvm, range);\n--\ndrivers/gpu/drm/drm_gpusvm.c-153- *\t\t\terr = -EAGAIN;\ndrivers/gpu/drm/drm_gpusvm.c:154: *\t\tdrm_gpusvm_notifier_unlock(gpusvm);\ndrivers/gpu/drm/drm_gpusvm.c-155- *\n--\ndrivers/gpu/drm/drm_gpusvm.c-158- *\ndrivers/gpu/drm/drm_gpusvm.c:159: *\tint driver_gpu_fault(struct drm_gpusvm *gpusvm, unsigned long fault_addr,\ndrivers/gpu/drm/drm_gpusvm.c-160- *\t\t\t unsigned long gpuva_start, unsigned long gpuva_end)\ndrivers/gpu/drm/drm_gpusvm.c-161- *\t{\ndrivers/gpu/drm/drm_gpusvm.c:162: *\t\tstruct drm_gpusvm_ctx ctx = {};\ndrivers/gpu/drm/drm_gpusvm.c-163- *\t\tint err;\n--\ndrivers/gpu/drm/drm_gpusvm.c-169- *\ndrivers/gpu/drm/drm_gpusvm.c:170: *\t\trange = drm_gpusvm_range_find_or_insert(gpusvm, fault_addr,\ndrivers/gpu/drm/drm_gpusvm.c-171- *\t\t\t\t\t\t\tgpuva_start, gpuva_end,\n--\ndrivers/gpu/drm/drm_gpusvm.c-185- *\ndrivers/gpu/drm/drm_gpusvm.c:186: *\t\terr = drm_gpusvm_range_get_pages(gpusvm, range, \u0026ctx);\ndrivers/gpu/drm/drm_gpusvm.c-187- *\t\tif (err == -EOPNOTSUPP || err == -EFAULT || err == -EPERM) {\t// CPU mappings changed\ndrivers/gpu/drm/drm_gpusvm.c-188- *\t\t\tif (err == -EOPNOTSUPP)\ndrivers/gpu/drm/drm_gpusvm.c:189: *\t\t\t\tdrm_gpusvm_range_evict(gpusvm, range);\ndrivers/gpu/drm/drm_gpusvm.c-190- *\t\t\tgoto retry;\n--\ndrivers/gpu/drm/drm_gpusvm.c-207- *\ndrivers/gpu/drm/drm_gpusvm.c:208: *\tvoid __driver_garbage_collector(struct drm_gpusvm *gpusvm,\ndrivers/gpu/drm/drm_gpusvm.c:209: *\t\t\t\t\tstruct drm_gpusvm_range *range)\ndrivers/gpu/drm/drm_gpusvm.c-210- *\t{\n--\ndrivers/gpu/drm/drm_gpusvm.c-214- *\t\tif (range-\u003eflags.partial_unmap)\ndrivers/gpu/drm/drm_gpusvm.c:215: *\t\t\tdrm_gpusvm_range_evict(gpusvm, range);\ndrivers/gpu/drm/drm_gpusvm.c-216- *\ndrivers/gpu/drm/drm_gpusvm.c-217- *\t\tdriver_unbind_range(range);\ndrivers/gpu/drm/drm_gpusvm.c:218: *\t\tdrm_gpusvm_range_remove(gpusvm, range);\ndrivers/gpu/drm/drm_gpusvm.c-219- *\t}\ndrivers/gpu/drm/drm_gpusvm.c-220- *\ndrivers/gpu/drm/drm_gpusvm.c:221: *\tvoid driver_garbage_collector(struct drm_gpusvm *gpusvm)\ndrivers/gpu/drm/drm_gpusvm.c-222- *\t{\n--\ndrivers/gpu/drm/drm_gpusvm.c-232- *\ndrivers/gpu/drm/drm_gpusvm.c:233: *\tvoid driver_invalidation(struct drm_gpusvm *gpusvm,\ndrivers/gpu/drm/drm_gpusvm.c:234: *\t\t\t\t struct drm_gpusvm_notifier *notifier,\ndrivers/gpu/drm/drm_gpusvm.c-235- *\t\t\t\t const struct mmu_notifier_range *mmu_range)\ndrivers/gpu/drm/drm_gpusvm.c-236- *\t{\ndrivers/gpu/drm/drm_gpusvm.c:237: *\t\tstruct drm_gpusvm_ctx ctx = { .in_notifier = true, };\ndrivers/gpu/drm/drm_gpusvm.c:238: *\t\tstruct drm_gpusvm_range *range = NULL;\ndrivers/gpu/drm/drm_gpusvm.c-239- *\n--\ndrivers/gpu/drm/drm_gpusvm.c-241- *\ndrivers/gpu/drm/drm_gpusvm.c:242: *\t\tdrm_gpusvm_for_each_range(range, notifier, mmu_range-\u003estart,\ndrivers/gpu/drm/drm_gpusvm.c-243- *\t\t\t\t\t mmu_range-\u003eend) {\ndrivers/gpu/drm/drm_gpusvm.c:244: *\t\t\tdrm_gpusvm_range_unmap_pages(gpusvm, range, \u0026ctx);\ndrivers/gpu/drm/drm_gpusvm.c-245- *\n--\ndrivers/gpu/drm/drm_gpusvm.c-248- *\ndrivers/gpu/drm/drm_gpusvm.c:249: *\t\t\tdrm_gpusvm_range_set_unmapped(range, mmu_range);\ndrivers/gpu/drm/drm_gpusvm.c-250- *\t\t\tdriver_garbage_collector_add(gpusvm, range);\n--\ndrivers/gpu/drm/drm_gpusvm.c=268=npages_in_range(unsigned long start, unsigned long end)\n--\ndrivers/gpu/drm/drm_gpusvm.c-273-/**\ndrivers/gpu/drm/drm_gpusvm.c:274: * drm_gpusvm_notifier_find() - Find GPU SVM notifier from GPU SVM\ndrivers/gpu/drm/drm_gpusvm.c-275- * @gpusvm: Pointer to the GPU SVM structure.\n--\ndrivers/gpu/drm/drm_gpusvm.c-278- *\ndrivers/gpu/drm/drm_gpusvm.c:279: * Return: A pointer to the drm_gpusvm_notifier if found or NULL\ndrivers/gpu/drm/drm_gpusvm.c-280- */\ndrivers/gpu/drm/drm_gpusvm.c:281:struct drm_gpusvm_notifier *\ndrivers/gpu/drm/drm_gpusvm.c:282:drm_gpusvm_notifier_find(struct drm_gpusvm *gpusvm, unsigned long start,\ndrivers/gpu/drm/drm_gpusvm.c-283-\t\t\t unsigned long end)\n--\ndrivers/gpu/drm/drm_gpusvm.c-289-\tif (itree)\ndrivers/gpu/drm/drm_gpusvm.c:290:\t\treturn container_of(itree, struct drm_gpusvm_notifier, itree);\ndrivers/gpu/drm/drm_gpusvm.c-291-\telse\n--\ndrivers/gpu/drm/drm_gpusvm.c-293-}\ndrivers/gpu/drm/drm_gpusvm.c:294:EXPORT_SYMBOL_GPL(drm_gpusvm_notifier_find);\ndrivers/gpu/drm/drm_gpusvm.c-295-\ndrivers/gpu/drm/drm_gpusvm.c-296-/**\ndrivers/gpu/drm/drm_gpusvm.c:297: * drm_gpusvm_range_find() - Find GPU SVM range from GPU SVM notifier\ndrivers/gpu/drm/drm_gpusvm.c-298- * @notifier: Pointer to the GPU SVM notifier structure.\n--\ndrivers/gpu/drm/drm_gpusvm.c-301- *\ndrivers/gpu/drm/drm_gpusvm.c:302: * Return: A pointer to the drm_gpusvm_range if found or NULL\ndrivers/gpu/drm/drm_gpusvm.c-303- */\ndrivers/gpu/drm/drm_gpusvm.c:304:struct drm_gpusvm_range *\ndrivers/gpu/drm/drm_gpusvm.c:305:drm_gpusvm_range_find(struct drm_gpusvm_notifier *notifier, unsigned long start,\ndrivers/gpu/drm/drm_gpusvm.c-306-\t\t unsigned long end)\n--\ndrivers/gpu/drm/drm_gpusvm.c-312-\tif (itree)\ndrivers/gpu/drm/drm_gpusvm.c:313:\t\treturn container_of(itree, struct drm_gpusvm_range, itree);\ndrivers/gpu/drm/drm_gpusvm.c-314-\telse\n--\ndrivers/gpu/drm/drm_gpusvm.c-316-}\ndrivers/gpu/drm/drm_gpusvm.c:317:EXPORT_SYMBOL_GPL(drm_gpusvm_range_find);\ndrivers/gpu/drm/drm_gpusvm.c-318-\ndrivers/gpu/drm/drm_gpusvm.c-319-/**\ndrivers/gpu/drm/drm_gpusvm.c:320: * drm_gpusvm_notifier_invalidate() - Invalidate a GPU SVM notifier.\ndrivers/gpu/drm/drm_gpusvm.c-321- * @mni: Pointer to the mmu_interval_notifier structure.\n--\ndrivers/gpu/drm/drm_gpusvm.c=331=static bool\ndrivers/gpu/drm/drm_gpusvm.c:332:drm_gpusvm_notifier_invalidate(struct mmu_interval_notifier *mni,\ndrivers/gpu/drm/drm_gpusvm.c-333-\t\t\t const struct mmu_notifier_range *mmu_range,\n--\ndrivers/gpu/drm/drm_gpusvm.c-335-{\ndrivers/gpu/drm/drm_gpusvm.c:336:\tstruct drm_gpusvm_notifier *notifier =\ndrivers/gpu/drm/drm_gpusvm.c-337-\t\tcontainer_of(mni, typeof(*notifier), notifier);\ndrivers/gpu/drm/drm_gpusvm.c:338:\tstruct drm_gpusvm *gpusvm = notifier-\u003egpusvm;\ndrivers/gpu/drm/drm_gpusvm.c-339-\n--\ndrivers/gpu/drm/drm_gpusvm.c-351-/*\ndrivers/gpu/drm/drm_gpusvm.c:352: * drm_gpusvm_notifier_ops - MMU interval notifier operations for GPU SVM\ndrivers/gpu/drm/drm_gpusvm.c-353- */\ndrivers/gpu/drm/drm_gpusvm.c:354:static const struct mmu_interval_notifier_ops drm_gpusvm_notifier_ops = {\ndrivers/gpu/drm/drm_gpusvm.c:355:\t.invalidate = drm_gpusvm_notifier_invalidate,\ndrivers/gpu/drm/drm_gpusvm.c-356-};\n--\ndrivers/gpu/drm/drm_gpusvm.c-358-/**\ndrivers/gpu/drm/drm_gpusvm.c:359: * drm_gpusvm_init() - Initialize the GPU SVM.\ndrivers/gpu/drm/drm_gpusvm.c-360- * @gpusvm: Pointer to the GPU SVM structure.\n--\ndrivers/gpu/drm/drm_gpusvm.c-374- *\ndrivers/gpu/drm/drm_gpusvm.c:375: * Note: If only using the simple drm_gpusvm_pages API (get/unmap/free),\ndrivers/gpu/drm/drm_gpusvm.c-376- * then only @gpusvm, @name, and @drm are expected. However, the same base\ndrivers/gpu/drm/drm_gpusvm.c-377- * @gpusvm can also be used with both modes together in which case the full\ndrivers/gpu/drm/drm_gpusvm.c:378: * setup is needed, where the core drm_gpusvm_pages API will simply never use\ndrivers/gpu/drm/drm_gpusvm.c-379- * the other fields.\n--\ndrivers/gpu/drm/drm_gpusvm.c-382- */\ndrivers/gpu/drm/drm_gpusvm.c:383:int drm_gpusvm_init(struct drm_gpusvm *gpusvm,\ndrivers/gpu/drm/drm_gpusvm.c-384-\t\t const char *name, struct drm_device *drm,\n--\ndrivers/gpu/drm/drm_gpusvm.c-387-\t\t unsigned long notifier_size,\ndrivers/gpu/drm/drm_gpusvm.c:388:\t\t const struct drm_gpusvm_ops *ops,\ndrivers/gpu/drm/drm_gpusvm.c-389-\t\t const unsigned long *chunk_sizes, int num_chunks)\n--\ndrivers/gpu/drm/drm_gpusvm.c-395-\t} else {\ndrivers/gpu/drm/drm_gpusvm.c:396:\t\t/* No full SVM mode, only core drm_gpusvm_pages API. */\ndrivers/gpu/drm/drm_gpusvm.c-397-\t\tif (ops || num_chunks || mm_range || notifier_size)\n--\ndrivers/gpu/drm/drm_gpusvm.c-425-}\ndrivers/gpu/drm/drm_gpusvm.c:426:EXPORT_SYMBOL_GPL(drm_gpusvm_init);\ndrivers/gpu/drm/drm_gpusvm.c-427-\ndrivers/gpu/drm/drm_gpusvm.c-428-/**\ndrivers/gpu/drm/drm_gpusvm.c:429: * to_drm_gpusvm_notifier() - retrieve the container struct for a given rbtree node\ndrivers/gpu/drm/drm_gpusvm.c:430: * @node: a pointer to the rbtree node embedded within a drm_gpusvm_notifier struct\ndrivers/gpu/drm/drm_gpusvm.c-431- *\ndrivers/gpu/drm/drm_gpusvm.c:432: * Return: A pointer to the containing drm_gpusvm_notifier structure.\ndrivers/gpu/drm/drm_gpusvm.c-433- */\ndrivers/gpu/drm/drm_gpusvm.c:434:static struct drm_gpusvm_notifier *to_drm_gpusvm_notifier(struct rb_node *node)\ndrivers/gpu/drm/drm_gpusvm.c-435-{\ndrivers/gpu/drm/drm_gpusvm.c:436:\treturn container_of(node, struct drm_gpusvm_notifier, itree.rb);\ndrivers/gpu/drm/drm_gpusvm.c-437-}\n--\ndrivers/gpu/drm/drm_gpusvm.c-439-/**\ndrivers/gpu/drm/drm_gpusvm.c:440: * drm_gpusvm_notifier_insert() - Insert GPU SVM notifier\ndrivers/gpu/drm/drm_gpusvm.c-441- * @gpusvm: Pointer to the GPU SVM structure\n--\ndrivers/gpu/drm/drm_gpusvm.c-445- */\ndrivers/gpu/drm/drm_gpusvm.c:446:static void drm_gpusvm_notifier_insert(struct drm_gpusvm *gpusvm,\ndrivers/gpu/drm/drm_gpusvm.c:447:\t\t\t\t struct drm_gpusvm_notifier *notifier)\ndrivers/gpu/drm/drm_gpusvm.c-448-{\n--\ndrivers/gpu/drm/drm_gpusvm.c-455-\tif (node)\ndrivers/gpu/drm/drm_gpusvm.c:456:\t\thead = \u0026(to_drm_gpusvm_notifier(node))-\u003eentry;\ndrivers/gpu/drm/drm_gpusvm.c-457-\telse\n--\ndrivers/gpu/drm/drm_gpusvm.c-463-/**\ndrivers/gpu/drm/drm_gpusvm.c:464: * drm_gpusvm_notifier_remove() - Remove GPU SVM notifier\ndrivers/gpu/drm/drm_gpusvm.c-465- * @gpusvm: Pointer to the GPU SVM tructure\n--\ndrivers/gpu/drm/drm_gpusvm.c-469- */\ndrivers/gpu/drm/drm_gpusvm.c:470:static void drm_gpusvm_notifier_remove(struct drm_gpusvm *gpusvm,\ndrivers/gpu/drm/drm_gpusvm.c:471:\t\t\t\t struct drm_gpusvm_notifier *notifier)\ndrivers/gpu/drm/drm_gpusvm.c-472-{\n--\ndrivers/gpu/drm/drm_gpusvm.c-477-/**\ndrivers/gpu/drm/drm_gpusvm.c:478: * drm_gpusvm_fini() - Finalize the GPU SVM.\ndrivers/gpu/drm/drm_gpusvm.c-479- * @gpusvm: Pointer to the GPU SVM structure.\n--\ndrivers/gpu/drm/drm_gpusvm.c-483- */\ndrivers/gpu/drm/drm_gpusvm.c:484:void drm_gpusvm_fini(struct drm_gpusvm *gpusvm)\ndrivers/gpu/drm/drm_gpusvm.c-485-{\ndrivers/gpu/drm/drm_gpusvm.c:486:\tstruct drm_gpusvm_notifier *notifier, *next;\ndrivers/gpu/drm/drm_gpusvm.c-487-\ndrivers/gpu/drm/drm_gpusvm.c:488:\tdrm_gpusvm_for_each_notifier_safe(notifier, next, gpusvm, 0, LONG_MAX) {\ndrivers/gpu/drm/drm_gpusvm.c:489:\t\tstruct drm_gpusvm_range *range, *__next;\ndrivers/gpu/drm/drm_gpusvm.c-490-\n--\ndrivers/gpu/drm/drm_gpusvm.c-496-\ndrivers/gpu/drm/drm_gpusvm.c:497:\t\tdrm_gpusvm_for_each_range_safe(range, __next, notifier, 0,\ndrivers/gpu/drm/drm_gpusvm.c-498-\t\t\t\t\t LONG_MAX)\ndrivers/gpu/drm/drm_gpusvm.c:499:\t\t\tdrm_gpusvm_range_remove(gpusvm, range);\ndrivers/gpu/drm/drm_gpusvm.c-500-\t}\n--\ndrivers/gpu/drm/drm_gpusvm.c-505-}\ndrivers/gpu/drm/drm_gpusvm.c:506:EXPORT_SYMBOL_GPL(drm_gpusvm_fini);\ndrivers/gpu/drm/drm_gpusvm.c-507-\ndrivers/gpu/drm/drm_gpusvm.c-508-/**\ndrivers/gpu/drm/drm_gpusvm.c:509: * drm_gpusvm_notifier_alloc() - Allocate GPU SVM notifier\ndrivers/gpu/drm/drm_gpusvm.c-510- * @gpusvm: Pointer to the GPU SVM structure\n--\ndrivers/gpu/drm/drm_gpusvm.c-516- */\ndrivers/gpu/drm/drm_gpusvm.c:517:static struct drm_gpusvm_notifier *\ndrivers/gpu/drm/drm_gpusvm.c:518:drm_gpusvm_notifier_alloc(struct drm_gpusvm *gpusvm, unsigned long fault_addr)\ndrivers/gpu/drm/drm_gpusvm.c-519-{\ndrivers/gpu/drm/drm_gpusvm.c:520:\tstruct drm_gpusvm_notifier *notifier;\ndrivers/gpu/drm/drm_gpusvm.c-521-\n--\ndrivers/gpu/drm/drm_gpusvm.c-540-/**\ndrivers/gpu/drm/drm_gpusvm.c:541: * drm_gpusvm_notifier_free() - Free GPU SVM notifier\ndrivers/gpu/drm/drm_gpusvm.c-542- * @gpusvm: Pointer to the GPU SVM structure\n--\ndrivers/gpu/drm/drm_gpusvm.c-546- */\ndrivers/gpu/drm/drm_gpusvm.c:547:static void drm_gpusvm_notifier_free(struct drm_gpusvm *gpusvm,\ndrivers/gpu/drm/drm_gpusvm.c:548:\t\t\t\t struct drm_gpusvm_notifier *notifier)\ndrivers/gpu/drm/drm_gpusvm.c-549-{\n--\ndrivers/gpu/drm/drm_gpusvm.c-558-/**\ndrivers/gpu/drm/drm_gpusvm.c:559: * to_drm_gpusvm_range() - retrieve the container struct for a given rbtree node\ndrivers/gpu/drm/drm_gpusvm.c:560: * @node: a pointer to the rbtree node embedded within a drm_gpusvm_range struct\ndrivers/gpu/drm/drm_gpusvm.c-561- *\ndrivers/gpu/drm/drm_gpusvm.c:562: * Return: A pointer to the containing drm_gpusvm_range structure.\ndrivers/gpu/drm/drm_gpusvm.c-563- */\ndrivers/gpu/drm/drm_gpusvm.c:564:static struct drm_gpusvm_range *to_drm_gpusvm_range(struct rb_node *node)\ndrivers/gpu/drm/drm_gpusvm.c-565-{\ndrivers/gpu/drm/drm_gpusvm.c:566:\treturn container_of(node, struct drm_gpusvm_range, itree.rb);\ndrivers/gpu/drm/drm_gpusvm.c-567-}\n--\ndrivers/gpu/drm/drm_gpusvm.c-569-/**\ndrivers/gpu/drm/drm_gpusvm.c:570: * drm_gpusvm_range_insert() - Insert GPU SVM range\ndrivers/gpu/drm/drm_gpusvm.c-571- * @notifier: Pointer to the GPU SVM notifier structure\n--\ndrivers/gpu/drm/drm_gpusvm.c-575- */\ndrivers/gpu/drm/drm_gpusvm.c:576:static void drm_gpusvm_range_insert(struct drm_gpusvm_notifier *notifier,\ndrivers/gpu/drm/drm_gpusvm.c:577:\t\t\t\t struct drm_gpusvm_range *range)\ndrivers/gpu/drm/drm_gpusvm.c-578-{\n--\ndrivers/gpu/drm/drm_gpusvm.c-581-\ndrivers/gpu/drm/drm_gpusvm.c:582:\tdrm_gpusvm_notifier_lock(notifier-\u003egpusvm);\ndrivers/gpu/drm/drm_gpusvm.c-583-\tinterval_tree_insert(\u0026range-\u003eitree, \u0026notifier-\u003eroot);\n--\ndrivers/gpu/drm/drm_gpusvm.c-586-\tif (node)\ndrivers/gpu/drm/drm_gpusvm.c:587:\t\thead = \u0026(to_drm_gpusvm_range(node))-\u003eentry;\ndrivers/gpu/drm/drm_gpusvm.c-588-\telse\n--\ndrivers/gpu/drm/drm_gpusvm.c-591-\tlist_add(\u0026range-\u003eentry, head);\ndrivers/gpu/drm/drm_gpusvm.c:592:\tdrm_gpusvm_notifier_unlock(notifier-\u003egpusvm);\ndrivers/gpu/drm/drm_gpusvm.c-593-}\n--\ndrivers/gpu/drm/drm_gpusvm.c-595-/**\ndrivers/gpu/drm/drm_gpusvm.c:596: * __drm_gpusvm_range_remove() - Remove GPU SVM range\ndrivers/gpu/drm/drm_gpusvm.c-597- * @notifier: Pointer to the GPU SVM notifier structure\n--\ndrivers/gpu/drm/drm_gpusvm.c-601- */\ndrivers/gpu/drm/drm_gpusvm.c:602:static void __drm_gpusvm_range_remove(struct drm_gpusvm_notifier *notifier,\ndrivers/gpu/drm/drm_gpusvm.c:603:\t\t\t\t struct drm_gpusvm_range *range)\ndrivers/gpu/drm/drm_gpusvm.c-604-{\n--\ndrivers/gpu/drm/drm_gpusvm.c-609-/**\ndrivers/gpu/drm/drm_gpusvm.c:610: * drm_gpusvm_range_alloc() - Allocate GPU SVM range\ndrivers/gpu/drm/drm_gpusvm.c-611- * @gpusvm: Pointer to the GPU SVM structure\n--\ndrivers/gpu/drm/drm_gpusvm.c-620- */\ndrivers/gpu/drm/drm_gpusvm.c:621:static struct drm_gpusvm_range *\ndrivers/gpu/drm/drm_gpusvm.c:622:drm_gpusvm_range_alloc(struct drm_gpusvm *gpusvm,\ndrivers/gpu/drm/drm_gpusvm.c:623:\t\t struct drm_gpusvm_notifier *notifier,\ndrivers/gpu/drm/drm_gpusvm.c-624-\t\t unsigned long fault_addr, unsigned long chunk_size,\n--\ndrivers/gpu/drm/drm_gpusvm.c-626-{\ndrivers/gpu/drm/drm_gpusvm.c:627:\tstruct drm_gpusvm_range *range;\ndrivers/gpu/drm/drm_gpusvm.c-628-\n--\ndrivers/gpu/drm/drm_gpusvm.c-649-/**\ndrivers/gpu/drm/drm_gpusvm.c:650: * drm_gpusvm_hmm_pfn_to_order() - Get the largest CPU mapping order.\ndrivers/gpu/drm/drm_gpusvm.c-651- * @hmm_pfn: The current hmm_pfn.\n--\ndrivers/gpu/drm/drm_gpusvm.c-662- */\ndrivers/gpu/drm/drm_gpusvm.c:663:static unsigned int drm_gpusvm_hmm_pfn_to_order(unsigned long hmm_pfn,\ndrivers/gpu/drm/drm_gpusvm.c-664-\t\t\t\t\t\tunsigned long hmm_pfn_index,\n--\ndrivers/gpu/drm/drm_gpusvm.c-678-/**\ndrivers/gpu/drm/drm_gpusvm.c:679: * drm_gpusvm_check_pages() - Check pages\ndrivers/gpu/drm/drm_gpusvm.c-680- * @gpusvm: Pointer to the GPU SVM structure\n--\ndrivers/gpu/drm/drm_gpusvm.c-690- */\ndrivers/gpu/drm/drm_gpusvm.c:691:static bool drm_gpusvm_check_pages(struct drm_gpusvm *gpusvm,\ndrivers/gpu/drm/drm_gpusvm.c:692:\t\t\t\t struct drm_gpusvm_notifier *notifier,\ndrivers/gpu/drm/drm_gpusvm.c-693-\t\t\t\t unsigned long start, unsigned long end,\n--\ndrivers/gpu/drm/drm_gpusvm.c-737-\t\t}\ndrivers/gpu/drm/drm_gpusvm.c:738:\t\ti += 0x1 \u003c\u003c drm_gpusvm_hmm_pfn_to_order(pfns[i], i, npages);\ndrivers/gpu/drm/drm_gpusvm.c-739-\t}\n--\ndrivers/gpu/drm/drm_gpusvm.c-746-/**\ndrivers/gpu/drm/drm_gpusvm.c:747: * drm_gpusvm_scan_mm() - Check the migration state of a drm_gpusvm_range\ndrivers/gpu/drm/drm_gpusvm.c:748: * @range: Pointer to the struct drm_gpusvm_range to check.\ndrivers/gpu/drm/drm_gpusvm.c-749- * @dev_private_owner: The struct dev_private_owner to use to determine\n--\ndrivers/gpu/drm/drm_gpusvm.c-759- *\ndrivers/gpu/drm/drm_gpusvm.c:760: * Return: See \u0026enum drm_gpusvm_scan_result.\ndrivers/gpu/drm/drm_gpusvm.c-761- */\ndrivers/gpu/drm/drm_gpusvm.c:762:enum drm_gpusvm_scan_result drm_gpusvm_scan_mm(struct drm_gpusvm_range *range,\ndrivers/gpu/drm/drm_gpusvm.c-763-\t\t\t\t\t void *dev_private_owner,\n--\ndrivers/gpu/drm/drm_gpusvm.c-766-\tstruct mmu_interval_notifier *notifier = \u0026range-\u003enotifier-\u003enotifier;\ndrivers/gpu/drm/drm_gpusvm.c:767:\tunsigned long start = drm_gpusvm_range_start(range);\ndrivers/gpu/drm/drm_gpusvm.c:768:\tunsigned long end = drm_gpusvm_range_end(range);\ndrivers/gpu/drm/drm_gpusvm.c-769-\tstruct hmm_range hmm_range = {\n--\ndrivers/gpu/drm/drm_gpusvm.c-777-\t\tjiffies + msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);\ndrivers/gpu/drm/drm_gpusvm.c:778:\tenum drm_gpusvm_scan_result state = DRM_GPUSVM_SCAN_UNPOPULATED, new_state;\ndrivers/gpu/drm/drm_gpusvm.c-779-\tunsigned long *pfns;\n--\ndrivers/gpu/drm/drm_gpusvm.c-809-\ndrivers/gpu/drm/drm_gpusvm.c:810:\tdrm_gpusvm_notifier_lock(range-\u003egpusvm);\ndrivers/gpu/drm/drm_gpusvm.c-811-\tif (mmu_interval_read_retry(notifier, hmm_range.notifier_seq)) {\ndrivers/gpu/drm/drm_gpusvm.c:812:\t\tdrm_gpusvm_notifier_unlock(range-\u003egpusvm);\ndrivers/gpu/drm/drm_gpusvm.c-813-\t\tgoto retry;\n--\ndrivers/gpu/drm/drm_gpusvm.c-855-\ndrivers/gpu/drm/drm_gpusvm.c:856:\t\ti += 1ul \u003c\u003c drm_gpusvm_hmm_pfn_to_order(pfns[i], i, npages);\ndrivers/gpu/drm/drm_gpusvm.c-857-\t}\ndrivers/gpu/drm/drm_gpusvm.c-858-\ndrivers/gpu/drm/drm_gpusvm.c:859:\tdrm_gpusvm_notifier_unlock(range-\u003egpusvm);\ndrivers/gpu/drm/drm_gpusvm.c-860-\n--\ndrivers/gpu/drm/drm_gpusvm.c-864-}\ndrivers/gpu/drm/drm_gpusvm.c:865:EXPORT_SYMBOL(drm_gpusvm_scan_mm);\ndrivers/gpu/drm/drm_gpusvm.c-866-\ndrivers/gpu/drm/drm_gpusvm.c-867-/**\ndrivers/gpu/drm/drm_gpusvm.c:868: * drm_gpusvm_range_chunk_size() - Determine chunk size for GPU SVM range\ndrivers/gpu/drm/drm_gpusvm.c-869- * @gpusvm: Pointer to the GPU SVM structure\n--\ndrivers/gpu/drm/drm_gpusvm.c=884=static unsigned long\ndrivers/gpu/drm/drm_gpusvm.c:885:drm_gpusvm_range_chunk_size(struct drm_gpusvm *gpusvm,\ndrivers/gpu/drm/drm_gpusvm.c:886:\t\t\t struct drm_gpusvm_notifier *notifier,\ndrivers/gpu/drm/drm_gpusvm.c-887-\t\t\t struct vm_area_struct *vas,\n--\ndrivers/gpu/drm/drm_gpusvm.c-902-\t\tif (start \u003e= vas-\u003evm_start \u0026\u0026 end \u003c= vas-\u003evm_end \u0026\u0026\ndrivers/gpu/drm/drm_gpusvm.c:903:\t\t start \u003e= drm_gpusvm_notifier_start(notifier) \u0026\u0026\ndrivers/gpu/drm/drm_gpusvm.c:904:\t\t end \u003c= drm_gpusvm_notifier_end(notifier) \u0026\u0026\ndrivers/gpu/drm/drm_gpusvm.c-905-\t\t start \u003e= gpuva_start \u0026\u0026 end \u003c= gpuva_end)\n--\ndrivers/gpu/drm/drm_gpusvm.c-916-\tif (end - start != SZ_4K) {\ndrivers/gpu/drm/drm_gpusvm.c:917:\t\tstruct drm_gpusvm_range *range;\ndrivers/gpu/drm/drm_gpusvm.c-918-\ndrivers/gpu/drm/drm_gpusvm.c:919:\t\trange = drm_gpusvm_range_find(notifier, start, end);\ndrivers/gpu/drm/drm_gpusvm.c-920-\t\tif (range) {\n--\ndrivers/gpu/drm/drm_gpusvm.c-931-\t\t * drm_pagemap_migrate_to_devmem with 'migrate.cpages != npages'\ndrivers/gpu/drm/drm_gpusvm.c:932:\t\t * and then upon drm_gpusvm_range_get_pages device pages from\ndrivers/gpu/drm/drm_gpusvm.c-933-\t\t * other processes are collected + faulted in which creates all\n--\ndrivers/gpu/drm/drm_gpusvm.c-938-\t\tif (end - start \u003c= check_pages_threshold \u0026\u0026\ndrivers/gpu/drm/drm_gpusvm.c:939:\t\t !drm_gpusvm_check_pages(gpusvm, notifier, start, end, dev_private_owner)) {\ndrivers/gpu/drm/drm_gpusvm.c-940-\t\t\t++i;\n--\ndrivers/gpu/drm/drm_gpusvm.c-949-/**\ndrivers/gpu/drm/drm_gpusvm.c:950: * drm_gpusvm_driver_lock_held() - Assert GPU SVM driver lock is held\ndrivers/gpu/drm/drm_gpusvm.c-951- * @gpusvm: Pointer to the GPU SVM structure.\n--\ndrivers/gpu/drm/drm_gpusvm.c-954- */\ndrivers/gpu/drm/drm_gpusvm.c:955:static void drm_gpusvm_driver_lock_held(struct drm_gpusvm *gpusvm)\ndrivers/gpu/drm/drm_gpusvm.c-956-{\n--\ndrivers/gpu/drm/drm_gpusvm.c-960-#else\ndrivers/gpu/drm/drm_gpusvm.c:961:static void drm_gpusvm_driver_lock_held(struct drm_gpusvm *gpusvm)\ndrivers/gpu/drm/drm_gpusvm.c-962-{\n--\ndrivers/gpu/drm/drm_gpusvm.c-966-/**\ndrivers/gpu/drm/drm_gpusvm.c:967: * drm_gpusvm_find_vma_start() - Find start address for first VMA in range\ndrivers/gpu/drm/drm_gpusvm.c-968- * @gpusvm: Pointer to the GPU SVM structure\n--\ndrivers/gpu/drm/drm_gpusvm.c=975=unsigned long\ndrivers/gpu/drm/drm_gpusvm.c:976:drm_gpusvm_find_vma_start(struct drm_gpusvm *gpusvm,\ndrivers/gpu/drm/drm_gpusvm.c-977-\t\t\t unsigned long start,\n--\ndrivers/gpu/drm/drm_gpusvm.c-997-}\ndrivers/gpu/drm/drm_gpusvm.c:998:EXPORT_SYMBOL_GPL(drm_gpusvm_find_vma_start);\ndrivers/gpu/drm/drm_gpusvm.c-999-\ndrivers/gpu/drm/drm_gpusvm.c-1000-/**\ndrivers/gpu/drm/drm_gpusvm.c:1001: * drm_gpusvm_range_find_or_insert() - Find or insert GPU SVM range\ndrivers/gpu/drm/drm_gpusvm.c-1002- * @gpusvm: Pointer to the GPU SVM structure\n--\ndrivers/gpu/drm/drm_gpusvm.c-1012- */\ndrivers/gpu/drm/drm_gpusvm.c:1013:struct drm_gpusvm_range *\ndrivers/gpu/drm/drm_gpusvm.c:1014:drm_gpusvm_range_find_or_insert(struct drm_gpusvm *gpusvm,\ndrivers/gpu/drm/drm_gpusvm.c-1015-\t\t\t\tunsigned long fault_addr,\n--\ndrivers/gpu/drm/drm_gpusvm.c-1017-\t\t\t\tunsigned long gpuva_end,\ndrivers/gpu/drm/drm_gpusvm.c:1018:\t\t\t\tconst struct drm_gpusvm_ctx *ctx)\ndrivers/gpu/drm/drm_gpusvm.c-1019-{\ndrivers/gpu/drm/drm_gpusvm.c:1020:\tstruct drm_gpusvm_notifier *notifier;\ndrivers/gpu/drm/drm_gpusvm.c:1021:\tstruct drm_gpusvm_range *range;\ndrivers/gpu/drm/drm_gpusvm.c-1022-\tstruct mm_struct *mm = gpusvm-\u003emm;\n--\ndrivers/gpu/drm/drm_gpusvm.c-1028-\ndrivers/gpu/drm/drm_gpusvm.c:1029:\tdrm_gpusvm_driver_lock_held(gpusvm);\ndrivers/gpu/drm/drm_gpusvm.c-1030-\n--\ndrivers/gpu/drm/drm_gpusvm.c-1037-\ndrivers/gpu/drm/drm_gpusvm.c:1038:\tnotifier = drm_gpusvm_notifier_find(gpusvm, fault_addr, fault_addr + 1);\ndrivers/gpu/drm/drm_gpusvm.c-1039-\tif (!notifier) {\ndrivers/gpu/drm/drm_gpusvm.c:1040:\t\tnotifier = drm_gpusvm_notifier_alloc(gpusvm, fault_addr);\ndrivers/gpu/drm/drm_gpusvm.c-1041-\t\tif (IS_ERR(notifier)) {\n--\ndrivers/gpu/drm/drm_gpusvm.c-1047-\t\t\t\t\t\t mm,\ndrivers/gpu/drm/drm_gpusvm.c:1048:\t\t\t\t\t\t drm_gpusvm_notifier_start(notifier),\ndrivers/gpu/drm/drm_gpusvm.c:1049:\t\t\t\t\t\t drm_gpusvm_notifier_size(notifier),\ndrivers/gpu/drm/drm_gpusvm.c:1050:\t\t\t\t\t\t \u0026drm_gpusvm_notifier_ops);\ndrivers/gpu/drm/drm_gpusvm.c-1051-\t\tif (err)\n--\ndrivers/gpu/drm/drm_gpusvm.c-1072-\ndrivers/gpu/drm/drm_gpusvm.c:1073:\trange = drm_gpusvm_range_find(notifier, fault_addr, fault_addr + 1);\ndrivers/gpu/drm/drm_gpusvm.c-1074-\tif (range)\n--\ndrivers/gpu/drm/drm_gpusvm.c-1083-\ndrivers/gpu/drm/drm_gpusvm.c:1084:\tchunk_size = drm_gpusvm_range_chunk_size(gpusvm, notifier, vas,\ndrivers/gpu/drm/drm_gpusvm.c-1085-\t\t\t\t\t\t fault_addr, gpuva_start,\n--\ndrivers/gpu/drm/drm_gpusvm.c-1093-\ndrivers/gpu/drm/drm_gpusvm.c:1094:\trange = drm_gpusvm_range_alloc(gpusvm, notifier, fault_addr, chunk_size,\ndrivers/gpu/drm/drm_gpusvm.c-1095-\t\t\t\t migrate_devmem);\n--\ndrivers/gpu/drm/drm_gpusvm.c-1100-\ndrivers/gpu/drm/drm_gpusvm.c:1101:\tdrm_gpusvm_range_insert(notifier, range);\ndrivers/gpu/drm/drm_gpusvm.c-1102-\tif (notifier_alloc)\ndrivers/gpu/drm/drm_gpusvm.c:1103:\t\tdrm_gpusvm_notifier_insert(gpusvm, notifier);\ndrivers/gpu/drm/drm_gpusvm.c-1104-\n--\ndrivers/gpu/drm/drm_gpusvm.c-1116-\tif (notifier_alloc)\ndrivers/gpu/drm/drm_gpusvm.c:1117:\t\tdrm_gpusvm_notifier_free(gpusvm, notifier);\ndrivers/gpu/drm/drm_gpusvm.c-1118-err_mmunlock:\n--\ndrivers/gpu/drm/drm_gpusvm.c-1121-}\ndrivers/gpu/drm/drm_gpusvm.c:1122:EXPORT_SYMBOL_GPL(drm_gpusvm_range_find_or_insert);\ndrivers/gpu/drm/drm_gpusvm.c-1123-\ndrivers/gpu/drm/drm_gpusvm.c-1124-/**\ndrivers/gpu/drm/drm_gpusvm.c:1125: * __drm_gpusvm_unmap_pages() - Unmap pages associated with GPU SVM pages (internal)\n\n"
} |
| 7/2 | 2026/08/05 13:22 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 33072 output: 32 thoughts: 100 Thoughts: **Investigating the Reach of `drm_gpusvm` in QEMU** Okay, so I'm thinking about `drm_gpusvm`. I know the `xe` driver, Intel's Xe GPU driver, utilizes it. The question is, can I actually play with `xe` in a QEMU environment? No, that won't work. It needs either physical Intel Xe hardware or a SR-IOV Virtual Function, neither of which are standard QEMU features. That much I know. But wait a minute... didn't I see something about `drm_gpusvm` and `nouveau` at some point? My memory is fuzzy, but it's worth a double-check. Time to quickly open up `drivers/gpu/drm/xe` and `drivers/gpu/drm/nouveau` and see what's what. Gotta be sure about this. |
| 8/2 | 2026/08/05 13:22 | tool | grepper |
0mArgs:{
"Expression": "drm_gpusvm",
"PathPrefix": "drivers/gpu/drm/xe"
}Results: {
"Output": "drivers/gpu/drm/xe/xe_bo_types.h-10-\ndrivers/gpu/drm/xe/xe_bo_types.h:11:#include \u003cdrm/drm_gpusvm.h\u003e\ndrivers/gpu/drm/xe/xe_bo_types.h-12-#include \u003cdrm/drm_pagemap.h\u003e\n--\ndrivers/gpu/drm/xe/xe_pt.c=1411=static int xe_pt_pre_commit(struct xe_migrate_pt_update *pt_update)\n--\ndrivers/gpu/drm/xe/xe_pt.c-1430- * xe_vma_userptr_force_invalidate() path that calls\ndrivers/gpu/drm/xe/xe_pt.c:1431: * drm_gpusvm_unmap_pages() with ctx-\u003ein_notifier=true, which requires the\ndrivers/gpu/drm/xe/xe_pt.c-1432- * lock held for write.\n--\ndrivers/gpu/drm/xe/xe_svm.c=60=static bool xe_svm_range_in_vram(struct xe_svm_range *range)\n--\ndrivers/gpu/drm/xe/xe_svm.c-66-\ndrivers/gpu/drm/xe/xe_svm.c:67:\tstruct drm_gpusvm_pages_flags flags = {\ndrivers/gpu/drm/xe/xe_svm.c:68:\t\t/* Pairs with WRITE_ONCE in drm_gpusvm.c */\ndrivers/gpu/drm/xe/xe_svm.c-69-\t\t.__flags = READ_ONCE(range-\u003ebase.pages.flags.__flags),\n--\ndrivers/gpu/drm/xe/xe_svm.c=75=static bool xe_svm_range_has_vram_binding(struct xe_svm_range *range)\n--\ndrivers/gpu/drm/xe/xe_svm.c-80-\ndrivers/gpu/drm/xe/xe_svm.c:81:static struct xe_vm *gpusvm_to_vm(struct drm_gpusvm *gpusvm)\ndrivers/gpu/drm/xe/xe_svm.c-82-{\n--\ndrivers/gpu/drm/xe/xe_svm.c-85-\ndrivers/gpu/drm/xe/xe_svm.c:86:static struct xe_vm *range_to_vm(struct drm_gpusvm_range *r)\ndrivers/gpu/drm/xe/xe_svm.c-87-{\n--\ndrivers/gpu/drm/xe/xe_svm.c=103=void xe_svm_range_debug(struct xe_svm_range *range, const char *operation)\n--\ndrivers/gpu/drm/xe/xe_svm.c-107-\ndrivers/gpu/drm/xe/xe_svm.c:108:static struct drm_gpusvm_range *\ndrivers/gpu/drm/xe/xe_svm.c:109:xe_svm_range_alloc(struct drm_gpusvm *gpusvm)\ndrivers/gpu/drm/xe/xe_svm.c-110-{\n--\ndrivers/gpu/drm/xe/xe_svm.c-122-\ndrivers/gpu/drm/xe/xe_svm.c:123:static void xe_svm_range_free(struct drm_gpusvm_range *range)\ndrivers/gpu/drm/xe/xe_svm.c-124-{\n--\ndrivers/gpu/drm/xe/xe_svm.c=130=xe_svm_garbage_collector_add_range(struct xe_vm *vm, struct xe_svm_range *range,\n--\ndrivers/gpu/drm/xe/xe_svm.c-136-\ndrivers/gpu/drm/xe/xe_svm.c:137:\tdrm_gpusvm_range_set_unmapped(\u0026range-\u003ebase, mmu_range);\ndrivers/gpu/drm/xe/xe_svm.c-138-\n--\ndrivers/gpu/drm/xe/xe_svm.c=153=static u8\ndrivers/gpu/drm/xe/xe_svm.c:154:xe_svm_range_notifier_event_begin(struct xe_vm *vm, struct drm_gpusvm_range *r,\ndrivers/gpu/drm/xe/xe_svm.c-155-\t\t\t\t const struct mmu_notifier_range *mmu_range,\n--\ndrivers/gpu/drm/xe/xe_svm.c=203=static void\ndrivers/gpu/drm/xe/xe_svm.c:204:xe_svm_range_notifier_event_end(struct xe_vm *vm, struct drm_gpusvm_range *r,\ndrivers/gpu/drm/xe/xe_svm.c-205-\t\t\t\tconst struct mmu_notifier_range *mmu_range)\ndrivers/gpu/drm/xe/xe_svm.c-206-{\ndrivers/gpu/drm/xe/xe_svm.c:207:\tstruct drm_gpusvm_ctx ctx = { .in_notifier = true, };\ndrivers/gpu/drm/xe/xe_svm.c-208-\n--\ndrivers/gpu/drm/xe/xe_svm.c-210-\ndrivers/gpu/drm/xe/xe_svm.c:211:\tdrm_gpusvm_range_unmap_pages(\u0026vm-\u003esvm.gpusvm, r, \u0026ctx);\ndrivers/gpu/drm/xe/xe_svm.c-212-\tif (!xe_vm_is_closed(vm) \u0026\u0026 mmu_range-\u003eevent == MMU_NOTIFY_UNMAP)\n--\ndrivers/gpu/drm/xe/xe_svm.c=217=static void xe_svm_tlb_inval_us_stats_incr(struct xe_gt *gt, ktime_t start)\n--\ndrivers/gpu/drm/xe/xe_svm.c-223-\ndrivers/gpu/drm/xe/xe_svm.c:224:static void xe_svm_invalidate(struct drm_gpusvm *gpusvm,\ndrivers/gpu/drm/xe/xe_svm.c:225:\t\t\t struct drm_gpusvm_notifier *notifier,\ndrivers/gpu/drm/xe/xe_svm.c-226-\t\t\t const struct mmu_notifier_range *mmu_range)\n--\ndrivers/gpu/drm/xe/xe_svm.c-230-\tstruct xe_device *xe = vm-\u003exe;\ndrivers/gpu/drm/xe/xe_svm.c:231:\tstruct drm_gpusvm_range *r, *first;\ndrivers/gpu/drm/xe/xe_svm.c-232-\tstruct xe_tile *tile;\n--\ndrivers/gpu/drm/xe/xe_svm.c-245-\t/* Adjust invalidation to notifier boundaries */\ndrivers/gpu/drm/xe/xe_svm.c:246:\tadj_start = max(drm_gpusvm_notifier_start(notifier), adj_start);\ndrivers/gpu/drm/xe/xe_svm.c:247:\tadj_end = min(drm_gpusvm_notifier_end(notifier), adj_end);\ndrivers/gpu/drm/xe/xe_svm.c-248-\ndrivers/gpu/drm/xe/xe_svm.c:249:\tfirst = drm_gpusvm_range_find(notifier, adj_start, adj_end);\ndrivers/gpu/drm/xe/xe_svm.c-250-\tif (!first)\n--\ndrivers/gpu/drm/xe/xe_svm.c-271-\tr = first;\ndrivers/gpu/drm/xe/xe_svm.c:272:\tdrm_gpusvm_for_each_range(r, notifier, adj_start, adj_end)\ndrivers/gpu/drm/xe/xe_svm.c-273-\t\ttile_mask |= xe_svm_range_notifier_event_begin(vm, r, mmu_range,\n--\ndrivers/gpu/drm/xe/xe_svm.c-287-\tr = first;\ndrivers/gpu/drm/xe/xe_svm.c:288:\tdrm_gpusvm_for_each_range(r, notifier, adj_start, adj_end)\ndrivers/gpu/drm/xe/xe_svm.c-289-\t\txe_svm_range_notifier_event_end(vm, r, mmu_range);\n--\ndrivers/gpu/drm/xe/xe_svm.c=299=static int __xe_svm_garbage_collector(struct xe_vm *vm,\n--\ndrivers/gpu/drm/xe/xe_svm.c-312-\ndrivers/gpu/drm/xe/xe_svm.c:313:\tdrm_gpusvm_range_remove(\u0026vm-\u003esvm.gpusvm, \u0026range-\u003ebase);\ndrivers/gpu/drm/xe/xe_svm.c-314-\n--\ndrivers/gpu/drm/xe/xe_svm.c=814=static int xe_svm_get_pagemaps(struct xe_vm *vm)\n--\ndrivers/gpu/drm/xe/xe_svm.c-819-\ndrivers/gpu/drm/xe/xe_svm.c:820:static const struct drm_gpusvm_ops gpusvm_ops = {\ndrivers/gpu/drm/xe/xe_svm.c-821-\t.range_alloc = xe_svm_range_alloc,\n--\ndrivers/gpu/drm/xe/xe_svm.c=882=int xe_svm_init(struct xe_vm *vm)\n--\ndrivers/gpu/drm/xe/xe_svm.c-903-\ndrivers/gpu/drm/xe/xe_svm.c:904:\t\terr = drm_gpusvm_init(\u0026vm-\u003esvm.gpusvm, \"Xe SVM\", \u0026vm-\u003exe-\u003edrm,\ndrivers/gpu/drm/xe/xe_svm.c-905-\t\t\t\t current-\u003emm, 0, vm-\u003esize,\n--\ndrivers/gpu/drm/xe/xe_svm.c-908-\t\t\t\t ARRAY_SIZE(fault_chunk_sizes));\ndrivers/gpu/drm/xe/xe_svm.c:909:\t\tdrm_gpusvm_driver_set_lock(\u0026vm-\u003esvm.gpusvm, \u0026vm-\u003elock);\ndrivers/gpu/drm/xe/xe_svm.c-910-\n--\ndrivers/gpu/drm/xe/xe_svm.c-916-\t} else {\ndrivers/gpu/drm/xe/xe_svm.c:917:\t\terr = drm_gpusvm_init(\u0026vm-\u003esvm.gpusvm, \"Xe SVM (simple)\",\ndrivers/gpu/drm/xe/xe_svm.c-918-\t\t\t\t \u0026vm-\u003exe-\u003edrm, NULL, 0, 0, 0, NULL,\n--\ndrivers/gpu/drm/xe/xe_svm.c=945=void xe_svm_fini(struct xe_vm *vm)\n--\ndrivers/gpu/drm/xe/xe_svm.c-948-\ndrivers/gpu/drm/xe/xe_svm.c:949:\tdrm_gpusvm_fini(\u0026vm-\u003esvm.gpusvm);\ndrivers/gpu/drm/xe/xe_svm.c-950-}\n--\ndrivers/gpu/drm/xe/xe_svm.c=989=void xe_svm_range_migrate_to_smem(struct xe_vm *vm, struct xe_svm_range *range)\n--\ndrivers/gpu/drm/xe/xe_svm.c-991-\tif (xe_svm_range_in_vram(range))\ndrivers/gpu/drm/xe/xe_svm.c:992:\t\tdrm_gpusvm_range_evict(\u0026vm-\u003esvm.gpusvm, \u0026range-\u003ebase);\ndrivers/gpu/drm/xe/xe_svm.c-993-}\n--\ndrivers/gpu/drm/xe/xe_svm.c=1042=u64 xe_svm_find_vma_start(struct xe_vm *vm, u64 start, u64 end, struct xe_vma *vma)\ndrivers/gpu/drm/xe/xe_svm.c-1043-{\ndrivers/gpu/drm/xe/xe_svm.c:1044:\treturn drm_gpusvm_find_vma_start(\u0026vm-\u003esvm.gpusvm,\ndrivers/gpu/drm/xe/xe_svm.c-1045-\t\t\t\t\t max(start, xe_vma_start(vma)),\n--\ndrivers/gpu/drm/xe/xe_svm.c=1206=static int __xe_svm_handle_pagefault(struct xe_vm *vm, struct xe_vma *vma,\n--\ndrivers/gpu/drm/xe/xe_svm.c-1211-\t\tIS_ENABLED(CONFIG_DRM_XE_PAGEMAP);\ndrivers/gpu/drm/xe/xe_svm.c:1212:\tstruct drm_gpusvm_ctx ctx = {\ndrivers/gpu/drm/xe/xe_svm.c-1213-\t\t.read_only = xe_vma_read_only(vma),\n--\ndrivers/gpu/drm/xe/xe_svm.c=1413=bool xe_svm_has_mapping(struct xe_vm *vm, u64 start, u64 end)\ndrivers/gpu/drm/xe/xe_svm.c-1414-{\ndrivers/gpu/drm/xe/xe_svm.c:1415:\treturn drm_gpusvm_has_mapping(\u0026vm-\u003esvm.gpusvm, start, end);\ndrivers/gpu/drm/xe/xe_svm.c-1416-}\n--\ndrivers/gpu/drm/xe/xe_svm.c=1426=void xe_svm_unmap_address_range(struct xe_vm *vm, u64 start, u64 end)\ndrivers/gpu/drm/xe/xe_svm.c-1427-{\ndrivers/gpu/drm/xe/xe_svm.c:1428:\tstruct drm_gpusvm_notifier *notifier, *next;\ndrivers/gpu/drm/xe/xe_svm.c-1429-\n--\ndrivers/gpu/drm/xe/xe_svm.c-1431-\ndrivers/gpu/drm/xe/xe_svm.c:1432:\tdrm_gpusvm_for_each_notifier_safe(notifier, next, \u0026vm-\u003esvm.gpusvm, start, end) {\ndrivers/gpu/drm/xe/xe_svm.c:1433:\t\tstruct drm_gpusvm_range *range, *__next;\ndrivers/gpu/drm/xe/xe_svm.c-1434-\ndrivers/gpu/drm/xe/xe_svm.c:1435:\t\tdrm_gpusvm_for_each_range_safe(range, __next, notifier, start, end) {\ndrivers/gpu/drm/xe/xe_svm.c:1436:\t\t\tif (start \u003e drm_gpusvm_range_start(range) ||\ndrivers/gpu/drm/xe/xe_svm.c:1437:\t\t\t end \u003c drm_gpusvm_range_end(range)) {\ndrivers/gpu/drm/xe/xe_svm.c-1438-\t\t\t\tif (IS_DGFX(vm-\u003exe) \u0026\u0026 xe_svm_range_in_vram(to_xe_range(range)))\ndrivers/gpu/drm/xe/xe_svm.c:1439:\t\t\t\t\tdrm_gpusvm_range_evict(\u0026vm-\u003esvm.gpusvm, range);\ndrivers/gpu/drm/xe/xe_svm.c:1440:\t\t\t\tdrm_gpusvm_range_get(range);\ndrivers/gpu/drm/xe/xe_svm.c-1441-\t\t\t\t__xe_svm_garbage_collector(vm, to_xe_range(range));\n--\ndrivers/gpu/drm/xe/xe_svm.c-1446-\t\t\t\t}\ndrivers/gpu/drm/xe/xe_svm.c:1447:\t\t\t\tdrm_gpusvm_range_put(range);\ndrivers/gpu/drm/xe/xe_svm.c-1448-\t\t\t}\n--\ndrivers/gpu/drm/xe/xe_svm.c=1479=struct xe_svm_range *xe_svm_range_find_or_insert(struct xe_vm *vm, u64 addr,\ndrivers/gpu/drm/xe/xe_svm.c:1480:\t\t\t\t\t\t struct xe_vma *vma, struct drm_gpusvm_ctx *ctx)\ndrivers/gpu/drm/xe/xe_svm.c-1481-{\ndrivers/gpu/drm/xe/xe_svm.c:1482:\tstruct drm_gpusvm_range *r;\ndrivers/gpu/drm/xe/xe_svm.c-1483-\ndrivers/gpu/drm/xe/xe_svm.c:1484:\tr = drm_gpusvm_range_find_or_insert(\u0026vm-\u003esvm.gpusvm, max(addr, xe_vma_start(vma)),\ndrivers/gpu/drm/xe/xe_svm.c-1485-\t\t\t\t\t xe_vma_start(vma), xe_vma_end(vma), ctx);\n--\ndrivers/gpu/drm/xe/xe_svm.c=1503=int xe_svm_range_get_pages(struct xe_vm *vm, struct xe_svm_range *range,\ndrivers/gpu/drm/xe/xe_svm.c:1504:\t\t\t struct drm_gpusvm_ctx *ctx)\ndrivers/gpu/drm/xe/xe_svm.c-1505-{\n--\ndrivers/gpu/drm/xe/xe_svm.c-1507-\ndrivers/gpu/drm/xe/xe_svm.c:1508:\terr = drm_gpusvm_range_get_pages(\u0026vm-\u003esvm.gpusvm, \u0026range-\u003ebase, ctx);\ndrivers/gpu/drm/xe/xe_svm.c-1509-\tif (err == -EOPNOTSUPP) {\ndrivers/gpu/drm/xe/xe_svm.c-1510-\t\trange_debug(range, \"PAGE FAULT - EVICT PAGES\");\ndrivers/gpu/drm/xe/xe_svm.c:1511:\t\tdrm_gpusvm_range_evict(\u0026vm-\u003esvm.gpusvm, \u0026range-\u003ebase);\ndrivers/gpu/drm/xe/xe_svm.c-1512-\t}\n--\ndrivers/gpu/drm/xe/xe_svm.c=1528=u8 xe_svm_ranges_zap_ptes_in_range(struct xe_vm *vm, u64 start, u64 end)\ndrivers/gpu/drm/xe/xe_svm.c-1529-{\ndrivers/gpu/drm/xe/xe_svm.c:1530:\tstruct drm_gpusvm_notifier *notifier;\ndrivers/gpu/drm/xe/xe_svm.c-1531-\tstruct xe_svm_range *range;\n--\ndrivers/gpu/drm/xe/xe_svm.c-1539-\ndrivers/gpu/drm/xe/xe_svm.c:1540:\tdrm_gpusvm_for_each_notifier(notifier, \u0026vm-\u003esvm.gpusvm, start, end) {\ndrivers/gpu/drm/xe/xe_svm.c:1541:\t\tstruct drm_gpusvm_range *r = NULL;\ndrivers/gpu/drm/xe/xe_svm.c-1542-\ndrivers/gpu/drm/xe/xe_svm.c:1543:\t\tadj_start = max(start, drm_gpusvm_notifier_start(notifier));\ndrivers/gpu/drm/xe/xe_svm.c:1544:\t\tadj_end = min(end, drm_gpusvm_notifier_end(notifier));\ndrivers/gpu/drm/xe/xe_svm.c:1545:\t\tdrm_gpusvm_for_each_range(r, notifier, adj_start, adj_end) {\ndrivers/gpu/drm/xe/xe_svm.c-1546-\t\t\trange = to_xe_range(r);\n--\ndrivers/gpu/drm/xe/xe_svm.c=1586=struct drm_pagemap *xe_vma_resolve_pagemap(struct xe_vma *vma, struct xe_tile *tile)\n--\ndrivers/gpu/drm/xe/xe_svm.c-1613- */\ndrivers/gpu/drm/xe/xe_svm.c:1614:int xe_svm_alloc_vram(struct xe_svm_range *range, const struct drm_gpusvm_ctx *ctx,\ndrivers/gpu/drm/xe/xe_svm.c-1615-\t\t struct drm_pagemap *dpagemap)\n--\ndrivers/gpu/drm/xe/xe_svm.c-1618-\tstruct xe_vm *vm = range_to_vm(\u0026range-\u003ebase);\ndrivers/gpu/drm/xe/xe_svm.c:1619:\tenum drm_gpusvm_scan_result migration_state;\ndrivers/gpu/drm/xe/xe_svm.c-1620-\tstruct xe_device *xe = vm-\u003exe;\n--\ndrivers/gpu/drm/xe/xe_svm.c-1626-\ndrivers/gpu/drm/xe/xe_svm.c:1627:\tmigration_state = drm_gpusvm_scan_mm(\u0026range-\u003ebase,\ndrivers/gpu/drm/xe/xe_svm.c-1628-\t\t\t\t\t xe_svm_private_page_owner(vm, false),\n--\ndrivers/gpu/drm/xe/xe_svm.c-1659-\t\t\t}\ndrivers/gpu/drm/xe/xe_svm.c:1660:\t\t\tdrm_gpusvm_range_evict(range-\u003ebase.gpusvm, \u0026range-\u003ebase);\ndrivers/gpu/drm/xe/xe_svm.c-1661-\t\t}\n--\ndrivers/gpu/drm/xe/xe_svm.c=2018=int xe_svm_alloc_vram(struct xe_svm_range *range,\ndrivers/gpu/drm/xe/xe_svm.c:2019:\t\t const struct drm_gpusvm_ctx *ctx,\ndrivers/gpu/drm/xe/xe_svm.c-2020-\t\t struct drm_pagemap *dpagemap)\n--\ndrivers/gpu/drm/xe/xe_svm.h-11-#include \u003cdrm/drm_pagemap.h\u003e\ndrivers/gpu/drm/xe/xe_svm.h:12:#include \u003cdrm/drm_gpusvm.h\u003e\ndrivers/gpu/drm/xe/xe_svm.h-13-#include \u003cdrm/drm_pagemap_util.h\u003e\n--\ndrivers/gpu/drm/xe/xe_svm.h=31=struct xe_svm_range {\ndrivers/gpu/drm/xe/xe_svm.h:32:\t/** @base: base drm_gpusvm_range */\ndrivers/gpu/drm/xe/xe_svm.h:33:\tstruct drm_gpusvm_range base;\ndrivers/gpu/drm/xe/xe_svm.h-34-\t/**\n--\ndrivers/gpu/drm/xe/xe_svm.h=75=static inline bool xe_svm_range_pages_valid(struct xe_svm_range *range)\ndrivers/gpu/drm/xe/xe_svm.h-76-{\ndrivers/gpu/drm/xe/xe_svm.h:77:\treturn drm_gpusvm_range_pages_valid(range-\u003ebase.gpusvm, \u0026range-\u003ebase);\ndrivers/gpu/drm/xe/xe_svm.h-78-}\n--\ndrivers/gpu/drm/xe/xe_svm.h=96=void xe_svm_range_debug(struct xe_svm_range *range, const char *operation);\ndrivers/gpu/drm/xe/xe_svm.h-97-\ndrivers/gpu/drm/xe/xe_svm.h:98:int xe_svm_alloc_vram(struct xe_svm_range *range, const struct drm_gpusvm_ctx *ctx,\ndrivers/gpu/drm/xe/xe_svm.h-99-\t\t struct drm_pagemap *dpagemap);\n--\ndrivers/gpu/drm/xe/xe_svm.h=101=struct xe_svm_range *xe_svm_range_find_or_insert(struct xe_vm *vm, u64 addr,\ndrivers/gpu/drm/xe/xe_svm.h:102:\t\t\t\t\t\t struct xe_vma *vma, struct drm_gpusvm_ctx *ctx);\ndrivers/gpu/drm/xe/xe_svm.h-103-\ndrivers/gpu/drm/xe/xe_svm.h=104=int xe_svm_range_get_pages(struct xe_vm *vm, struct xe_svm_range *range,\ndrivers/gpu/drm/xe/xe_svm.h:105:\t\t\t struct drm_gpusvm_ctx *ctx);\ndrivers/gpu/drm/xe/xe_svm.h-106-\n--\ndrivers/gpu/drm/xe/xe_svm.h=132=static inline bool xe_svm_range_has_dma_mapping(struct xe_svm_range *range)\n--\ndrivers/gpu/drm/xe/xe_svm.h-138-/**\ndrivers/gpu/drm/xe/xe_svm.h:139: * to_xe_range - Convert a drm_gpusvm_range pointer to a xe_svm_range\ndrivers/gpu/drm/xe/xe_svm.h:140: * @r: Pointer to the drm_gpusvm_range structure\ndrivers/gpu/drm/xe/xe_svm.h-141- *\ndrivers/gpu/drm/xe/xe_svm.h:142: * This function takes a pointer to a drm_gpusvm_range structure and\ndrivers/gpu/drm/xe/xe_svm.h-143- * converts it to a pointer to the containing xe_svm_range structure.\n--\ndrivers/gpu/drm/xe/xe_svm.h-146- */\ndrivers/gpu/drm/xe/xe_svm.h:147:static inline struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)\ndrivers/gpu/drm/xe/xe_svm.h-148-{\n--\ndrivers/gpu/drm/xe/xe_svm.h=158=static inline unsigned long xe_svm_range_start(struct xe_svm_range *range)\ndrivers/gpu/drm/xe/xe_svm.h-159-{\ndrivers/gpu/drm/xe/xe_svm.h:160:\treturn drm_gpusvm_range_start(\u0026range-\u003ebase);\ndrivers/gpu/drm/xe/xe_svm.h-161-}\n--\ndrivers/gpu/drm/xe/xe_svm.h=169=static inline unsigned long xe_svm_range_end(struct xe_svm_range *range)\ndrivers/gpu/drm/xe/xe_svm.h-170-{\ndrivers/gpu/drm/xe/xe_svm.h:171:\treturn drm_gpusvm_range_end(\u0026range-\u003ebase);\ndrivers/gpu/drm/xe/xe_svm.h-172-}\n--\ndrivers/gpu/drm/xe/xe_svm.h=180=static inline unsigned long xe_svm_range_size(struct xe_svm_range *range)\ndrivers/gpu/drm/xe/xe_svm.h-181-{\ndrivers/gpu/drm/xe/xe_svm.h:182:\treturn drm_gpusvm_range_size(\u0026range-\u003ebase);\ndrivers/gpu/drm/xe/xe_svm.h-183-}\n--\ndrivers/gpu/drm/xe/xe_svm.h=197=struct drm_pagemap_addr;\ndrivers/gpu/drm/xe/xe_svm.h:198:struct drm_gpusvm_ctx;\ndrivers/gpu/drm/xe/xe_svm.h:199:struct drm_gpusvm_range;\ndrivers/gpu/drm/xe/xe_svm.h-200-struct xe_bo;\n--\ndrivers/gpu/drm/xe/xe_svm.h=233=int xe_svm_init(struct xe_vm *vm)\n--\ndrivers/gpu/drm/xe/xe_svm.h-235-#if IS_ENABLED(CONFIG_DRM_GPUSVM)\ndrivers/gpu/drm/xe/xe_svm.h:236:\treturn drm_gpusvm_init(\u0026vm-\u003esvm.gpusvm, \"Xe SVM (simple)\", \u0026vm-\u003exe-\u003edrm,\ndrivers/gpu/drm/xe/xe_svm.h-237-\t\t\t NULL, 0, 0, 0, NULL, NULL, 0);\n--\ndrivers/gpu/drm/xe/xe_svm.h=244=void xe_svm_fini(struct xe_vm *vm)\n--\ndrivers/gpu/drm/xe/xe_svm.h-247-\txe_assert(vm-\u003exe, xe_vm_is_closed(vm));\ndrivers/gpu/drm/xe/xe_svm.h:248:\tdrm_gpusvm_fini(\u0026vm-\u003esvm.gpusvm);\ndrivers/gpu/drm/xe/xe_svm.h-249-#endif\n--\ndrivers/gpu/drm/xe/xe_svm.h=282=static inline int\ndrivers/gpu/drm/xe/xe_svm.h:283:xe_svm_alloc_vram(struct xe_svm_range *range, const struct drm_gpusvm_ctx *ctx,\ndrivers/gpu/drm/xe/xe_svm.h-284-\t\t struct drm_pagemap *dpagemap)\n--\ndrivers/gpu/drm/xe/xe_svm.h=290=struct xe_svm_range *xe_svm_range_find_or_insert(struct xe_vm *vm, u64 addr,\ndrivers/gpu/drm/xe/xe_svm.h:291:\t\t\t\t\t\t struct xe_vma *vma, struct drm_gpusvm_ctx *ctx)\ndrivers/gpu/drm/xe/xe_svm.h-292-{\n--\ndrivers/gpu/drm/xe/xe_svm.h=297=int xe_svm_range_get_pages(struct xe_vm *vm, struct xe_svm_range *range,\ndrivers/gpu/drm/xe/xe_svm.h:298:\t\t\t struct drm_gpusvm_ctx *ctx)\ndrivers/gpu/drm/xe/xe_svm.h-299-{\n--\ndrivers/gpu/drm/xe/xe_svm.h-302-\ndrivers/gpu/drm/xe/xe_svm.h:303:static inline struct xe_svm_range *to_xe_range(struct drm_gpusvm_range *r)\ndrivers/gpu/drm/xe/xe_svm.h-304-{\n--\ndrivers/gpu/drm/xe/xe_svm.h=385=static inline struct drm_pagemap *xe_drm_pagemap_from_fd(int fd, u32 region_instance)\n--\ndrivers/gpu/drm/xe/xe_svm.h-399- * when CONFIG_DRM_XE_USERPTR_INVAL_INJECT is on, because that path forces\ndrivers/gpu/drm/xe/xe_svm.h:400: * a userptr invalidation that ends in drm_gpusvm_unmap_pages() with\ndrivers/gpu/drm/xe/xe_svm.h-401- * ctx-\u003ein_notifier=true, which requires the lock held for write.\n--\ndrivers/gpu/drm/xe/xe_svm.h-411-#define xe_svm_notifier_lock(vm__)\t\\\ndrivers/gpu/drm/xe/xe_svm.h:412:\tdrm_gpusvm_notifier_lock(\u0026(vm__)-\u003esvm.gpusvm)\ndrivers/gpu/drm/xe/xe_svm.h-413-\n--\ndrivers/gpu/drm/xe/xe_svm.h-417-#define xe_svm_notifier_unlock(vm__)\t\\\ndrivers/gpu/drm/xe/xe_svm.h:418:\tdrm_gpusvm_notifier_unlock(\u0026(vm__)-\u003esvm.gpusvm)\ndrivers/gpu/drm/xe/xe_svm.h-419-\n--\ndrivers/gpu/drm/xe/xe_userptr.c=60=int xe_vma_userptr_pin_pages(struct xe_userptr_vma *uvma)\n--\ndrivers/gpu/drm/xe/xe_userptr.c-64-\tstruct xe_device *xe = vm-\u003exe;\ndrivers/gpu/drm/xe/xe_userptr.c:65:\tstruct drm_gpusvm_ctx ctx = {\ndrivers/gpu/drm/xe/xe_userptr.c-66-\t\t.read_only = xe_vma_read_only(vma),\n--\ndrivers/gpu/drm/xe/xe_userptr.c-76-\ndrivers/gpu/drm/xe/xe_userptr.c:77:\treturn drm_gpusvm_get_pages(\u0026vm-\u003esvm.gpusvm, \u0026uvma-\u003euserptr.pages,\ndrivers/gpu/drm/xe/xe_userptr.c-78-\t\t\t\t uvma-\u003euserptr.notifier.mm,\n--\ndrivers/gpu/drm/xe/xe_userptr.c=86=xe_vma_userptr_do_inval(struct xe_vm *vm, struct xe_userptr_vma *uvma, bool is_deferred)\n--\ndrivers/gpu/drm/xe/xe_userptr.c-89-\tstruct xe_vma *vma = \u0026uvma-\u003evma;\ndrivers/gpu/drm/xe/xe_userptr.c:90:\tstruct drm_gpusvm_ctx ctx = {\ndrivers/gpu/drm/xe/xe_userptr.c-91-\t\t.in_notifier = true,\n--\ndrivers/gpu/drm/xe/xe_userptr.c-124-\t\tuserptr-\u003efinish_inuse = false;\ndrivers/gpu/drm/xe/xe_userptr.c:125:\tdrm_gpusvm_unmap_pages(\u0026vm-\u003esvm.gpusvm, \u0026uvma-\u003euserptr.pages,\ndrivers/gpu/drm/xe/xe_userptr.c-126-\t\t\t xe_vma_size(vma) \u003e\u003e PAGE_SHIFT, \u0026ctx);\n--\ndrivers/gpu/drm/xe/xe_userptr.c=131=xe_vma_userptr_complete_tlb_inval(struct xe_vm *vm, struct xe_userptr_vma *uvma)\n--\ndrivers/gpu/drm/xe/xe_userptr.c-134-\tstruct xe_vma *vma = \u0026uvma-\u003evma;\ndrivers/gpu/drm/xe/xe_userptr.c:135:\tstruct drm_gpusvm_ctx ctx = {\ndrivers/gpu/drm/xe/xe_userptr.c-136-\t\t.in_notifier = true,\n--\ndrivers/gpu/drm/xe/xe_userptr.c-146-\tuserptr-\u003efinish_inuse = false;\ndrivers/gpu/drm/xe/xe_userptr.c:147:\tdrm_gpusvm_unmap_pages(\u0026vm-\u003esvm.gpusvm, \u0026uvma-\u003euserptr.pages,\ndrivers/gpu/drm/xe/xe_userptr.c-148-\t\t\t xe_vma_size(vma) \u003e\u003e PAGE_SHIFT, \u0026ctx);\n--\ndrivers/gpu/drm/xe/xe_userptr.c=409=void xe_userptr_remove(struct xe_userptr_vma *uvma)\n--\ndrivers/gpu/drm/xe/xe_userptr.c-413-\ndrivers/gpu/drm/xe/xe_userptr.c:414:\tdrm_gpusvm_free_pages(\u0026vm-\u003esvm.gpusvm, \u0026uvma-\u003euserptr.pages,\ndrivers/gpu/drm/xe/xe_userptr.c-415-\t\t\t xe_vma_size(\u0026uvma-\u003evma) \u003e\u003e PAGE_SHIFT);\n--\ndrivers/gpu/drm/xe/xe_userptr.h-14-\ndrivers/gpu/drm/xe/xe_userptr.h:15:#include \u003cdrm/drm_gpusvm.h\u003e\ndrivers/gpu/drm/xe/xe_userptr.h-16-\n--\ndrivers/gpu/drm/xe/xe_userptr.h=48=struct xe_userptr {\n--\ndrivers/gpu/drm/xe/xe_userptr.h-55-\t */\ndrivers/gpu/drm/xe/xe_userptr.h:56:\tstruct drm_gpusvm_pages pages;\ndrivers/gpu/drm/xe/xe_userptr.h-57-\t/**\n--\ndrivers/gpu/drm/xe/xe_vm.c=2398=vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_vma_ops *vops,\n--\ndrivers/gpu/drm/xe/xe_vm.c-2491-\t\t\tstruct xe_svm_range *svm_range;\ndrivers/gpu/drm/xe/xe_vm.c:2492:\t\t\tstruct drm_gpusvm_ctx ctx = {};\ndrivers/gpu/drm/xe/xe_vm.c-2493-\t\t\tstruct drm_pagemap *dpagemap = NULL;\n--\ndrivers/gpu/drm/xe/xe_vm.c=3107=static int prefetch_ranges(struct xe_vm *vm, struct xe_vma_op *op)\n--\ndrivers/gpu/drm/xe/xe_vm.c-3114-\tstruct xe_svm_range *svm_range;\ndrivers/gpu/drm/xe/xe_vm.c:3115:\tstruct drm_gpusvm_ctx ctx = {};\ndrivers/gpu/drm/xe/xe_vm.c-3116-\tunsigned long i;\n--\ndrivers/gpu/drm/xe/xe_vm_types.h-8-\ndrivers/gpu/drm/xe/xe_vm_types.h:9:#include \u003cdrm/drm_gpusvm.h\u003e\ndrivers/gpu/drm/xe/xe_vm_types.h-10-#include \u003cdrm/drm_gpuvm.h\u003e\n--\ndrivers/gpu/drm/xe/xe_vm_types.h=209=struct xe_vm {\n--\ndrivers/gpu/drm/xe/xe_vm_types.h-215-\t\t/** @svm.gpusvm: base GPUSVM used to track fault allocations */\ndrivers/gpu/drm/xe/xe_vm_types.h:216:\t\tstruct drm_gpusvm gpusvm;\ndrivers/gpu/drm/xe/xe_vm_types.h-217-\t\t/**\n"
} |
| 9/2 | 2026/08/05 13:22 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 43104 output: 33 thoughts: 21 Thoughts: Okay, here's my interpretation of those thoughts, tailored for an expert audience, presented in the first person: **Initial GPUVM Considerations** Right, so I see someone's leveraging `drm_gpusvm`. Interesting. My initial thought process immediately jumps to the broader implications. With `drm_gpusvm`, we're clearly dealing with some advanced memory management, likely kernel-level sharing, or maybe even offloading of certain memory operations to the GPU directly. This raises questions about the specific workload profile and the target hardware. Is this for compute, graphics, or some hybrid application? The deeper implications would be the memory access patterns, the page fault handling (or lack thereof), and the potential for increased latency or contention if not carefully designed. Then my mind drifts to the more established, albeit sometimes more complex, options. The `nouveau` driver comes to mind; it's mature and has been around longer. Are they considering this for compatibility, performance or perhaps this is for a new feature not yet supported by `nouveau`? Or maybe they are taking `nouveau` as a baseline and need something newer to accomplish their goal. What are the advantages of using `drm_gpusvm` over `nouveau` in this context? So I need more information to really dig in. Why this choice? What are the underlying performance requirements? What's the target hardware? The interplay between those elements will dictate the optimal path. |
| 10/2 | 2026/08/05 13:22 | tool | grepper |
0mError:no matches Args: {
"Expression": "drm_gpusvm",
"PathPrefix": "drivers/gpu/drm/nouveau"
}Results: {
"error": "no matches"
} |
| 11/2 | 2026/08/05 13:22 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 43474 output: 19 thoughts: 26 Thoughts: Okay, here's my take on those initial thoughts: **Dissecting the `drm_pagemap` Landscape** Right, so the immediate question arising from this is: `nouveau` isn't making use of `drm_pagemap`. That's a key observation. Now, the next logical step, from an architectural perspective, is to determine the scope of `drm_pagemap`. Since `nouveau` *isn't* using it, the question becomes: is this a broadly adopted component within the DRM subsystem, or is it more isolated? Are other drivers leaning on `drm_pagemap` or is it confined to a specific niche? Understanding its footprint is crucial for comprehending its overall design philosophy and potential interactions with other parts of the graphics stack. I need to figure out what else depends on it to understand its purpose and the implications of any changes or removals. |
| 12/2 | 2026/08/05 13:22 | tool | grepper |
0mArgs:{
"Expression": "drm_pagemap"
}Results: {
"Output": "\nFull output is too long, showing 500 out of 2070 lines.\nUse more precise expression if possible.\n\nDocumentation/gpu/rfc/gpusvm.rst=67=Overview of baseline design\n--\nDocumentation/gpu/rfc/gpusvm.rst-81-\nDocumentation/gpu/rfc/gpusvm.rst:82:Overview of drm_pagemap design\nDocumentation/gpu/rfc/gpusvm.rst-83-==============================\nDocumentation/gpu/rfc/gpusvm.rst-84-\nDocumentation/gpu/rfc/gpusvm.rst:85:.. kernel-doc:: drivers/gpu/drm/drm_pagemap.c\nDocumentation/gpu/rfc/gpusvm.rst-86- :doc: Overview\nDocumentation/gpu/rfc/gpusvm.rst-87-\nDocumentation/gpu/rfc/gpusvm.rst:88:.. kernel-doc:: drivers/gpu/drm/drm_pagemap.c\nDocumentation/gpu/rfc/gpusvm.rst-89- :doc: Migration\n--\ndrivers/gpu/drm/Makefile=111=drm_gpusvm_helper-$(CONFIG_ZONE_DEVICE) += \\\ndrivers/gpu/drm/Makefile:112:\tdrm_pagemap.o\\\ndrivers/gpu/drm/Makefile:113:\tdrm_pagemap_util.o\ndrivers/gpu/drm/Makefile-114-\n--\ndrivers/gpu/drm/drm_gpusvm.c-18-#include \u003cdrm/drm_gpusvm.h\u003e\ndrivers/gpu/drm/drm_gpusvm.c:19:#include \u003cdrm/drm_pagemap.h\u003e\ndrivers/gpu/drm/drm_gpusvm.c-20-#include \u003cdrm/drm_print.h\u003e\n--\ndrivers/gpu/drm/drm_gpusvm.c-178- *\t\tif (driver_migration_policy(range)) {\ndrivers/gpu/drm/drm_gpusvm.c:179: *\t\t\terr = drm_pagemap_populate_mm(driver_choose_drm_pagemap(),\ndrivers/gpu/drm/drm_gpusvm.c-180- *\t\t\t\t\t\t gpuva_start, gpuva_end, gpusvm-\u003emm,\n--\ndrivers/gpu/drm/drm_gpusvm.c=885=drm_gpusvm_range_chunk_size(struct drm_gpusvm *gpusvm,\n--\ndrivers/gpu/drm/drm_gpusvm.c-930-\t\t * ranges. When migrating the SVM ranges, some processes fail in\ndrivers/gpu/drm/drm_gpusvm.c:931:\t\t * drm_pagemap_migrate_to_devmem with 'migrate.cpages != npages'\ndrivers/gpu/drm/drm_gpusvm.c-932-\t\t * and then upon drm_gpusvm_range_get_pages device pages from\n--\ndrivers/gpu/drm/drm_gpusvm.c=1133=static void __drm_gpusvm_unmap_pages(struct drm_gpusvm *gpusvm,\n--\ndrivers/gpu/drm/drm_gpusvm.c-1136-{\ndrivers/gpu/drm/drm_gpusvm.c:1137:\tstruct drm_pagemap *dpagemap = svm_pages-\u003edpagemap;\ndrivers/gpu/drm/drm_gpusvm.c-1138-\tstruct device *dev = gpusvm-\u003edrm-\u003edev;\n--\ndrivers/gpu/drm/drm_gpusvm.c-1163-\t\tfor (i = 0, j = 0; i \u003c npages; j++) {\ndrivers/gpu/drm/drm_gpusvm.c:1164:\t\t\tstruct drm_pagemap_addr *addr = \u0026svm_pages-\u003edma_addr[j];\ndrivers/gpu/drm/drm_gpusvm.c-1165-\n--\ndrivers/gpu/drm/drm_gpusvm.c-1187-\ndrivers/gpu/drm/drm_gpusvm.c:1188:\t\tdrm_pagemap_put(svm_pages-\u003edpagemap);\ndrivers/gpu/drm/drm_gpusvm.c-1189-\t\tsvm_pages-\u003edpagemap = NULL;\n--\ndrivers/gpu/drm/drm_gpusvm.c=1408=int drm_gpusvm_get_pages(struct drm_gpusvm *gpusvm,\n--\ndrivers/gpu/drm/drm_gpusvm.c-1432-\tstruct dev_pagemap *pagemap;\ndrivers/gpu/drm/drm_gpusvm.c:1433:\tstruct drm_pagemap *dpagemap;\ndrivers/gpu/drm/drm_gpusvm.c-1434-\tstruct drm_gpusvm_pages_flags flags;\n--\ndrivers/gpu/drm/drm_gpusvm.c-1520-\t\t is_device_coherent_page(page)) {\ndrivers/gpu/drm/drm_gpusvm.c:1521:\t\t\tstruct drm_pagemap_zdd *__zdd =\ndrivers/gpu/drm/drm_gpusvm.c:1522:\t\t\t\tdrm_pagemap_page_zone_device_data(page);\ndrivers/gpu/drm/drm_gpusvm.c-1523-\n--\ndrivers/gpu/drm/drm_gpusvm.c-1536-\t\t\t\tpagemap = page_pgmap(page);\ndrivers/gpu/drm/drm_gpusvm.c:1537:\t\t\t\tdpagemap = drm_pagemap_page_to_dpagemap(page);\ndrivers/gpu/drm/drm_gpusvm.c-1538-\t\t\t\tif (drm_WARN_ON(gpusvm-\u003edrm, !dpagemap)) {\n--\ndrivers/gpu/drm/drm_gpusvm.c-1553-\t\t\t\t */\ndrivers/gpu/drm/drm_gpusvm.c:1554:\t\t\t\tdrm_pagemap_get(dpagemap);\ndrivers/gpu/drm/drm_gpusvm.c:1555:\t\t\t\tdrm_pagemap_put(svm_pages-\u003edpagemap);\ndrivers/gpu/drm/drm_gpusvm.c-1556-\t\t\t\tsvm_pages-\u003edpagemap = dpagemap;\n--\ndrivers/gpu/drm/drm_gpusvm.c-1607-\ndrivers/gpu/drm/drm_gpusvm.c:1608:\t\t\tsvm_pages-\u003edma_addr[j] = drm_pagemap_addr_encode\ndrivers/gpu/drm/drm_gpusvm.c-1609-\t\t\t\t(addr, DRM_INTERCONNECT_SYSTEM, order,\n--\ndrivers/gpu/drm/drm_pagemap.c-11-#include \u003cdrm/drm_drv.h\u003e\ndrivers/gpu/drm/drm_pagemap.c:12:#include \u003cdrm/drm_pagemap.h\u003e\ndrivers/gpu/drm/drm_pagemap.c:13:#include \u003cdrm/drm_pagemap_util.h\u003e\ndrivers/gpu/drm/drm_pagemap.c-14-#include \u003cdrm/drm_print.h\u003e\n--\ndrivers/gpu/drm/drm_pagemap.c=18=static DECLARE_FAULT_ATTR(migrate_to_ram_fault_inject);\n--\ndrivers/gpu/drm/drm_pagemap.c-21- * Force a higher-order destination folio allocation to fail in\ndrivers/gpu/drm/drm_pagemap.c:22: * drm_pagemap_migrate_populate_ram_pfn(), exercising the order-0 fallback\ndrivers/gpu/drm/drm_pagemap.c-23- * (and, in turn, the THP split path in __migrate_device_pages()) without\n--\ndrivers/gpu/drm/drm_pagemap.c-25- */\ndrivers/gpu/drm/drm_pagemap.c:26:static bool drm_pagemap_fault_inject_folio(void)\ndrivers/gpu/drm/drm_pagemap.c-27-{\n--\ndrivers/gpu/drm/drm_pagemap.c-30-#else\ndrivers/gpu/drm/drm_pagemap.c:31:static bool drm_pagemap_fault_inject_folio(void)\ndrivers/gpu/drm/drm_pagemap.c-32-{\n--\ndrivers/gpu/drm/drm_pagemap.c-76- * - Device Memory Allocations:\ndrivers/gpu/drm/drm_pagemap.c:77: * Embedded structure containing enough information for the drm_pagemap to\ndrivers/gpu/drm/drm_pagemap.c-78- * migrate to / from device memory.\n--\ndrivers/gpu/drm/drm_pagemap.c-85-/**\ndrivers/gpu/drm/drm_pagemap.c:86: * struct drm_pagemap_zdd - GPU SVM zone device data\ndrivers/gpu/drm/drm_pagemap.c-87- *\n--\ndrivers/gpu/drm/drm_pagemap.c-89- * @devmem_allocation: device memory allocation\ndrivers/gpu/drm/drm_pagemap.c:90: * @dpagemap: Refcounted pointer to the underlying struct drm_pagemap.\ndrivers/gpu/drm/drm_pagemap.c-91- *\n--\ndrivers/gpu/drm/drm_pagemap.c-98- */\ndrivers/gpu/drm/drm_pagemap.c:99:struct drm_pagemap_zdd {\ndrivers/gpu/drm/drm_pagemap.c-100-\tstruct kref refcount;\ndrivers/gpu/drm/drm_pagemap.c:101:\tstruct drm_pagemap_devmem *devmem_allocation;\ndrivers/gpu/drm/drm_pagemap.c:102:\tstruct drm_pagemap *dpagemap;\ndrivers/gpu/drm/drm_pagemap.c-103-};\n--\ndrivers/gpu/drm/drm_pagemap.c-105-/**\ndrivers/gpu/drm/drm_pagemap.c:106: * drm_pagemap_zdd_alloc() - Allocate a zdd structure.\ndrivers/gpu/drm/drm_pagemap.c:107: * @dpagemap: Pointer to the underlying struct drm_pagemap.\ndrivers/gpu/drm/drm_pagemap.c-108- *\n--\ndrivers/gpu/drm/drm_pagemap.c-113- */\ndrivers/gpu/drm/drm_pagemap.c:114:static struct drm_pagemap_zdd *\ndrivers/gpu/drm/drm_pagemap.c:115:drm_pagemap_zdd_alloc(struct drm_pagemap *dpagemap)\ndrivers/gpu/drm/drm_pagemap.c-116-{\ndrivers/gpu/drm/drm_pagemap.c:117:\tstruct drm_pagemap_zdd *zdd;\ndrivers/gpu/drm/drm_pagemap.c-118-\n--\ndrivers/gpu/drm/drm_pagemap.c-124-\tzdd-\u003edevmem_allocation = NULL;\ndrivers/gpu/drm/drm_pagemap.c:125:\tzdd-\u003edpagemap = drm_pagemap_get(dpagemap);\ndrivers/gpu/drm/drm_pagemap.c-126-\n--\ndrivers/gpu/drm/drm_pagemap.c-130-/**\ndrivers/gpu/drm/drm_pagemap.c:131: * drm_pagemap_zdd_get() - Get a reference to a zdd structure.\ndrivers/gpu/drm/drm_pagemap.c-132- * @zdd: Pointer to the zdd structure.\n--\ndrivers/gpu/drm/drm_pagemap.c-137- */\ndrivers/gpu/drm/drm_pagemap.c:138:static struct drm_pagemap_zdd *drm_pagemap_zdd_get(struct drm_pagemap_zdd *zdd)\ndrivers/gpu/drm/drm_pagemap.c-139-{\n--\ndrivers/gpu/drm/drm_pagemap.c-144-/**\ndrivers/gpu/drm/drm_pagemap.c:145: * drm_pagemap_zdd_destroy() - Destroy a zdd structure.\ndrivers/gpu/drm/drm_pagemap.c-146- * @ref: Pointer to the reference count structure.\n--\ndrivers/gpu/drm/drm_pagemap.c-149- */\ndrivers/gpu/drm/drm_pagemap.c:150:static void drm_pagemap_zdd_destroy(struct kref *ref)\ndrivers/gpu/drm/drm_pagemap.c-151-{\ndrivers/gpu/drm/drm_pagemap.c:152:\tstruct drm_pagemap_zdd *zdd =\ndrivers/gpu/drm/drm_pagemap.c:153:\t\tcontainer_of(ref, struct drm_pagemap_zdd, refcount);\ndrivers/gpu/drm/drm_pagemap.c:154:\tstruct drm_pagemap_devmem *devmem = zdd-\u003edevmem_allocation;\ndrivers/gpu/drm/drm_pagemap.c:155:\tstruct drm_pagemap *dpagemap = zdd-\u003edpagemap;\ndrivers/gpu/drm/drm_pagemap.c-156-\n--\ndrivers/gpu/drm/drm_pagemap.c-162-\tkfree(zdd);\ndrivers/gpu/drm/drm_pagemap.c:163:\tdrm_pagemap_put(dpagemap);\ndrivers/gpu/drm/drm_pagemap.c-164-}\n--\ndrivers/gpu/drm/drm_pagemap.c-166-/**\ndrivers/gpu/drm/drm_pagemap.c:167: * drm_pagemap_zdd_put() - Put a zdd reference.\ndrivers/gpu/drm/drm_pagemap.c-168- * @zdd: Pointer to the zdd structure.\n--\ndrivers/gpu/drm/drm_pagemap.c-172- */\ndrivers/gpu/drm/drm_pagemap.c:173:static void drm_pagemap_zdd_put(struct drm_pagemap_zdd *zdd)\ndrivers/gpu/drm/drm_pagemap.c-174-{\ndrivers/gpu/drm/drm_pagemap.c:175:\tkref_put(\u0026zdd-\u003erefcount, drm_pagemap_zdd_destroy);\ndrivers/gpu/drm/drm_pagemap.c-176-}\n--\ndrivers/gpu/drm/drm_pagemap.c-178-/**\ndrivers/gpu/drm/drm_pagemap.c:179: * drm_pagemap_migration_unlock_put_folio() - Put a migration folio\ndrivers/gpu/drm/drm_pagemap.c-180- * @folio: Pointer to the folio to put\n--\ndrivers/gpu/drm/drm_pagemap.c-183- */\ndrivers/gpu/drm/drm_pagemap.c:184:static void drm_pagemap_migration_unlock_put_folio(struct folio *folio)\ndrivers/gpu/drm/drm_pagemap.c-185-{\n--\ndrivers/gpu/drm/drm_pagemap.c-190-/**\ndrivers/gpu/drm/drm_pagemap.c:191: * drm_pagemap_migration_unlock_put_pages() - Put migration pages\ndrivers/gpu/drm/drm_pagemap.c-192- * @npages: Number of pages\n--\ndrivers/gpu/drm/drm_pagemap.c-196- */\ndrivers/gpu/drm/drm_pagemap.c:197:static void drm_pagemap_migration_unlock_put_pages(unsigned long npages,\ndrivers/gpu/drm/drm_pagemap.c-198-\t\t\t\t\t\t unsigned long *migrate_pfn)\n--\ndrivers/gpu/drm/drm_pagemap.c-213-\ndrivers/gpu/drm/drm_pagemap.c:214:\t\tdrm_pagemap_migration_unlock_put_folio(folio);\ndrivers/gpu/drm/drm_pagemap.c-215-\t\tmigrate_pfn[i] = 0;\n--\ndrivers/gpu/drm/drm_pagemap.c-222-/**\ndrivers/gpu/drm/drm_pagemap.c:223: * drm_pagemap_get_devmem_page() - Get a reference to a device memory page\ndrivers/gpu/drm/drm_pagemap.c-224- * @page: Pointer to the page\n--\ndrivers/gpu/drm/drm_pagemap.c-230- */\ndrivers/gpu/drm/drm_pagemap.c:231:static void drm_pagemap_get_devmem_page(struct page *page,\ndrivers/gpu/drm/drm_pagemap.c-232-\t\t\t\t\tunsigned int order,\ndrivers/gpu/drm/drm_pagemap.c:233:\t\t\t\t\tstruct drm_pagemap_zdd *zdd)\ndrivers/gpu/drm/drm_pagemap.c-234-{\n--\ndrivers/gpu/drm/drm_pagemap.c-236-\t\t\t order);\ndrivers/gpu/drm/drm_pagemap.c:237:\tfolio_set_zone_device_data(page_folio(page), drm_pagemap_zdd_get(zdd));\ndrivers/gpu/drm/drm_pagemap.c-238-}\n--\ndrivers/gpu/drm/drm_pagemap.c-240-/**\ndrivers/gpu/drm/drm_pagemap.c:241: * drm_pagemap_migrate_map_device_private_pages() - Map device private migration\ndrivers/gpu/drm/drm_pagemap.c-242- * pages for GPU SVM migration\ndrivers/gpu/drm/drm_pagemap.c-243- * @dev: The device performing the migration.\ndrivers/gpu/drm/drm_pagemap.c:244: * @local_dpagemap: The drm_pagemap local to the migrating device.\ndrivers/gpu/drm/drm_pagemap.c-245- * @pagemap_addr: Array to store DMA information corresponding to mapped pages.\n--\ndrivers/gpu/drm/drm_pagemap.c=258=static int\ndrivers/gpu/drm/drm_pagemap.c:259:drm_pagemap_migrate_map_device_private_pages(struct device *dev,\ndrivers/gpu/drm/drm_pagemap.c:260:\t\t\t\t\t struct drm_pagemap *local_dpagemap,\ndrivers/gpu/drm/drm_pagemap.c:261:\t\t\t\t\t struct drm_pagemap_addr *pagemap_addr,\ndrivers/gpu/drm/drm_pagemap.c-262-\t\t\t\t\t unsigned long *migrate_pfn,\n--\ndrivers/gpu/drm/drm_pagemap.c-264-\t\t\t\t\t enum dma_data_direction dir,\ndrivers/gpu/drm/drm_pagemap.c:265:\t\t\t\t\t const struct drm_pagemap_migrate_details *mdetails)\ndrivers/gpu/drm/drm_pagemap.c-266-{\n--\ndrivers/gpu/drm/drm_pagemap.c-270-\t\tstruct page *page = migrate_pfn_to_page(migrate_pfn[i]);\ndrivers/gpu/drm/drm_pagemap.c:271:\t\tstruct drm_pagemap_zdd *zdd;\ndrivers/gpu/drm/drm_pagemap.c:272:\t\tstruct drm_pagemap *dpagemap;\ndrivers/gpu/drm/drm_pagemap.c:273:\t\tstruct drm_pagemap_addr addr;\ndrivers/gpu/drm/drm_pagemap.c-274-\t\tstruct folio *folio;\n--\ndrivers/gpu/drm/drm_pagemap.c-283-\ndrivers/gpu/drm/drm_pagemap.c:284:\t\tzdd = drm_pagemap_page_zone_device_data(page);\ndrivers/gpu/drm/drm_pagemap.c-285-\t\tdpagemap = zdd-\u003edpagemap;\n--\ndrivers/gpu/drm/drm_pagemap.c-316-/**\ndrivers/gpu/drm/drm_pagemap.c:317: * struct drm_pagemap_iova_state - DRM pagemap IOVA state\ndrivers/gpu/drm/drm_pagemap.c-318- * @dma_state: DMA IOVA state.\n--\ndrivers/gpu/drm/drm_pagemap.c-323- */\ndrivers/gpu/drm/drm_pagemap.c:324:struct drm_pagemap_iova_state {\ndrivers/gpu/drm/drm_pagemap.c-325-\tstruct dma_iova_state dma_state;\n--\ndrivers/gpu/drm/drm_pagemap.c-329-/**\ndrivers/gpu/drm/drm_pagemap.c:330: * drm_pagemap_migrate_map_system_pages() - Map system or device coherent\ndrivers/gpu/drm/drm_pagemap.c-331- * migration pages for GPU SVM migration\n--\ndrivers/gpu/drm/drm_pagemap.c=346=static int\ndrivers/gpu/drm/drm_pagemap.c:347:drm_pagemap_migrate_map_system_pages(struct device *dev,\ndrivers/gpu/drm/drm_pagemap.c:348:\t\t\t\t struct drm_pagemap_addr *pagemap_addr,\ndrivers/gpu/drm/drm_pagemap.c-349-\t\t\t\t unsigned long *migrate_pfn,\n--\ndrivers/gpu/drm/drm_pagemap.c-351-\t\t\t\t enum dma_data_direction dir,\ndrivers/gpu/drm/drm_pagemap.c:352:\t\t\t\t struct drm_pagemap_iova_state *state)\ndrivers/gpu/drm/drm_pagemap.c-353-{\n--\ndrivers/gpu/drm/drm_pagemap.c-393-\t\tpagemap_addr[i] =\ndrivers/gpu/drm/drm_pagemap.c:394:\t\t\tdrm_pagemap_addr_encode(dma_addr,\ndrivers/gpu/drm/drm_pagemap.c-395-\t\t\t\t\t\tDRM_INTERCONNECT_SYSTEM,\n--\ndrivers/gpu/drm/drm_pagemap.c-408-/**\ndrivers/gpu/drm/drm_pagemap.c:409: * drm_pagemap_migrate_populate_src_pages() - Populate the source page array\ndrivers/gpu/drm/drm_pagemap.c-410- * @pages: Array of source pages to populate\n--\ndrivers/gpu/drm/drm_pagemap.c-418- * the copy callback deriving the rest of the folio from the order recorded in\ndrivers/gpu/drm/drm_pagemap.c:419: * the corresponding drm_pagemap_addr. That does not work where\ndrivers/gpu/drm/drm_pagemap.c:420: * drm_pagemap_migrate_populate_ram_pfn() had to demote a higher-order source\ndrivers/gpu/drm/drm_pagemap.c:421: * folio to order-0 destination folios: the drm_pagemap_addr entries are then\ndrivers/gpu/drm/drm_pagemap.c-422- * per-page, and the copy callback needs a source page for each of them.\n--\ndrivers/gpu/drm/drm_pagemap.c-428- */\ndrivers/gpu/drm/drm_pagemap.c:429:static void drm_pagemap_migrate_populate_src_pages(struct page **pages,\ndrivers/gpu/drm/drm_pagemap.c-430-\t\t\t\t\t\t unsigned long *src_mpfn,\n--\ndrivers/gpu/drm/drm_pagemap.c-460-/**\ndrivers/gpu/drm/drm_pagemap.c:461: * drm_pagemap_migrate_unmap_pages() - Unmap pages previously mapped for GPU SVM migration\ndrivers/gpu/drm/drm_pagemap.c-462- * @dev: The device for which the pages were mapped\ndrivers/gpu/drm/drm_pagemap.c-463- * @migrate_pfn: Array of migrate pfns set up for the mapped pages. Used to\ndrivers/gpu/drm/drm_pagemap.c:464: * determine the drm_pagemap of a peer device private page.\ndrivers/gpu/drm/drm_pagemap.c-465- * @pagemap_addr: Array of DMA information corresponding to mapped pages\n--\ndrivers/gpu/drm/drm_pagemap.c-474- */\ndrivers/gpu/drm/drm_pagemap.c:475:static void drm_pagemap_migrate_unmap_pages(struct device *dev,\ndrivers/gpu/drm/drm_pagemap.c:476:\t\t\t\t\t struct drm_pagemap_addr *pagemap_addr,\ndrivers/gpu/drm/drm_pagemap.c-477-\t\t\t\t\t unsigned long *migrate_pfn,\n--\ndrivers/gpu/drm/drm_pagemap.c-479-\t\t\t\t\t enum dma_data_direction dir,\ndrivers/gpu/drm/drm_pagemap.c:480:\t\t\t\t\t struct drm_pagemap_iova_state *state)\ndrivers/gpu/drm/drm_pagemap.c-481-{\n--\ndrivers/gpu/drm/drm_pagemap.c-495-\t\tif (is_zone_device_page(page)) {\ndrivers/gpu/drm/drm_pagemap.c:496:\t\t\tstruct drm_pagemap_zdd *zdd = drm_pagemap_page_zone_device_data(page);\ndrivers/gpu/drm/drm_pagemap.c:497:\t\t\tstruct drm_pagemap *dpagemap = zdd-\u003edpagemap;\ndrivers/gpu/drm/drm_pagemap.c-498-\n--\ndrivers/gpu/drm/drm_pagemap.c=516=static int\ndrivers/gpu/drm/drm_pagemap.c:517:drm_pagemap_migrate_remote_to_local(struct drm_pagemap_devmem *devmem,\ndrivers/gpu/drm/drm_pagemap.c-518-\t\t\t\t struct device *remote_device,\ndrivers/gpu/drm/drm_pagemap.c:519:\t\t\t\t struct drm_pagemap *remote_dpagemap,\ndrivers/gpu/drm/drm_pagemap.c-520-\t\t\t\t unsigned long local_pfns[],\ndrivers/gpu/drm/drm_pagemap.c-521-\t\t\t\t struct page *remote_pages[],\ndrivers/gpu/drm/drm_pagemap.c:522:\t\t\t\t struct drm_pagemap_addr pagemap_addr[],\ndrivers/gpu/drm/drm_pagemap.c-523-\t\t\t\t unsigned long npages,\ndrivers/gpu/drm/drm_pagemap.c:524:\t\t\t\t const struct drm_pagemap_devmem_ops *ops,\ndrivers/gpu/drm/drm_pagemap.c:525:\t\t\t\t const struct drm_pagemap_migrate_details *mdetails)\ndrivers/gpu/drm/drm_pagemap.c-526-\ndrivers/gpu/drm/drm_pagemap.c-527-{\ndrivers/gpu/drm/drm_pagemap.c:528:\tint err = drm_pagemap_migrate_map_device_private_pages(remote_device,\ndrivers/gpu/drm/drm_pagemap.c-529-\t\t\t\t\t\t\t remote_dpagemap,\n--\ndrivers/gpu/drm/drm_pagemap.c-541-out:\ndrivers/gpu/drm/drm_pagemap.c:542:\tdrm_pagemap_migrate_unmap_pages(remote_device, pagemap_addr, local_pfns,\ndrivers/gpu/drm/drm_pagemap.c-543-\t\t\t\t\tnpages, DMA_FROM_DEVICE, NULL);\n--\ndrivers/gpu/drm/drm_pagemap.c=547=static int\ndrivers/gpu/drm/drm_pagemap.c:548:drm_pagemap_migrate_sys_to_dev(struct drm_pagemap_devmem *devmem,\ndrivers/gpu/drm/drm_pagemap.c-549-\t\t\t unsigned long sys_pfns[],\ndrivers/gpu/drm/drm_pagemap.c-550-\t\t\t struct page *local_pages[],\ndrivers/gpu/drm/drm_pagemap.c:551:\t\t\t struct drm_pagemap_addr pagemap_addr[],\ndrivers/gpu/drm/drm_pagemap.c-552-\t\t\t unsigned long npages,\ndrivers/gpu/drm/drm_pagemap.c:553:\t\t\t const struct drm_pagemap_devmem_ops *ops,\ndrivers/gpu/drm/drm_pagemap.c:554:\t\t\t struct drm_pagemap_iova_state *state)\ndrivers/gpu/drm/drm_pagemap.c-555-{\ndrivers/gpu/drm/drm_pagemap.c:556:\tint err = drm_pagemap_migrate_map_system_pages(devmem-\u003edev,\ndrivers/gpu/drm/drm_pagemap.c-557-\t\t\t\t\t\t pagemap_addr, sys_pfns,\n--\ndrivers/gpu/drm/drm_pagemap.c-566-out:\ndrivers/gpu/drm/drm_pagemap.c:567:\tdrm_pagemap_migrate_unmap_pages(devmem-\u003edev, pagemap_addr, sys_pfns, npages,\ndrivers/gpu/drm/drm_pagemap.c-568-\t\t\t\t\tDMA_TO_DEVICE, state);\n--\ndrivers/gpu/drm/drm_pagemap.c-576- * @device: migrating device.\ndrivers/gpu/drm/drm_pagemap.c:577: * @dpagemap: Pointer to struct drm_pagemap used by the migrating device.\ndrivers/gpu/drm/drm_pagemap.c-578- * @ops: The copy ops to be used for the migrating device.\n--\ndrivers/gpu/drm/drm_pagemap.c=580=struct migrate_range_loc {\n--\ndrivers/gpu/drm/drm_pagemap.c-582-\tstruct device *device;\ndrivers/gpu/drm/drm_pagemap.c:583:\tstruct drm_pagemap *dpagemap;\ndrivers/gpu/drm/drm_pagemap.c:584:\tconst struct drm_pagemap_devmem_ops *ops;\ndrivers/gpu/drm/drm_pagemap.c-585-};\ndrivers/gpu/drm/drm_pagemap.c-586-\ndrivers/gpu/drm/drm_pagemap.c:587:static int drm_pagemap_migrate_range(struct drm_pagemap_devmem *devmem,\ndrivers/gpu/drm/drm_pagemap.c-588-\t\t\t\t unsigned long src_pfns[],\n--\ndrivers/gpu/drm/drm_pagemap.c-590-\t\t\t\t struct page *pages[],\ndrivers/gpu/drm/drm_pagemap.c:591:\t\t\t\t struct drm_pagemap_addr pagemap_addr[],\ndrivers/gpu/drm/drm_pagemap.c-592-\t\t\t\t struct migrate_range_loc *last,\ndrivers/gpu/drm/drm_pagemap.c-593-\t\t\t\t const struct migrate_range_loc *cur,\ndrivers/gpu/drm/drm_pagemap.c:594:\t\t\t\t const struct drm_pagemap_migrate_details *mdetails)\ndrivers/gpu/drm/drm_pagemap.c-595-{\ndrivers/gpu/drm/drm_pagemap.c:596:\tstruct drm_pagemap_iova_state state = {};\ndrivers/gpu/drm/drm_pagemap.c-597-\tint ret = 0;\n--\ndrivers/gpu/drm/drm_pagemap.c-608-\tif (last-\u003edpagemap)\ndrivers/gpu/drm/drm_pagemap.c:609:\t\tret = drm_pagemap_migrate_remote_to_local(devmem,\ndrivers/gpu/drm/drm_pagemap.c-610-\t\t\t\t\t\t\t last-\u003edevice,\n--\ndrivers/gpu/drm/drm_pagemap.c-618-\telse\ndrivers/gpu/drm/drm_pagemap.c:619:\t\tret = drm_pagemap_migrate_sys_to_dev(devmem,\ndrivers/gpu/drm/drm_pagemap.c-620-\t\t\t\t\t\t \u0026src_pfns[last-\u003estart],\n--\ndrivers/gpu/drm/drm_pagemap.c-631-/**\ndrivers/gpu/drm/drm_pagemap.c:632: * drm_pagemap_cpages() - Count collected pages\ndrivers/gpu/drm/drm_pagemap.c-633- * @migrate_pfn: Array of migrate_pfn entries to account\n--\ndrivers/gpu/drm/drm_pagemap.c-641- */\ndrivers/gpu/drm/drm_pagemap.c:642:static int drm_pagemap_cpages(unsigned long *migrate_pfn, unsigned long npages)\ndrivers/gpu/drm/drm_pagemap.c-643-{\n--\ndrivers/gpu/drm/drm_pagemap.c-666-/**\ndrivers/gpu/drm/drm_pagemap.c:667: * drm_pagemap_migrate_to_devmem() - Migrate a struct mm_struct range to device memory\ndrivers/gpu/drm/drm_pagemap.c-668- * @devmem_allocation: The device memory allocation to migrate to.\n--\ndrivers/gpu/drm/drm_pagemap.c-689- */\ndrivers/gpu/drm/drm_pagemap.c:690:int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation,\ndrivers/gpu/drm/drm_pagemap.c-691-\t\t\t\t struct mm_struct *mm,\ndrivers/gpu/drm/drm_pagemap.c-692-\t\t\t\t unsigned long start, unsigned long end,\ndrivers/gpu/drm/drm_pagemap.c:693:\t\t\t\t const struct drm_pagemap_migrate_details *mdetails)\ndrivers/gpu/drm/drm_pagemap.c-694-{\ndrivers/gpu/drm/drm_pagemap.c:695:\tconst struct drm_pagemap_devmem_ops *ops = devmem_allocation-\u003eops;\ndrivers/gpu/drm/drm_pagemap.c:696:\tstruct drm_pagemap *dpagemap = devmem_allocation-\u003edpagemap;\ndrivers/gpu/drm/drm_pagemap.c-697-\tstruct dev_pagemap *pagemap = dpagemap-\u003epagemap;\n--\ndrivers/gpu/drm/drm_pagemap.c-708-\tstruct vm_area_struct *vas;\ndrivers/gpu/drm/drm_pagemap.c:709:\tstruct drm_pagemap_zdd *zdd = NULL;\ndrivers/gpu/drm/drm_pagemap.c-710-\tstruct page **pages;\ndrivers/gpu/drm/drm_pagemap.c:711:\tstruct drm_pagemap_addr *pagemap_addr;\ndrivers/gpu/drm/drm_pagemap.c-712-\tvoid *buf;\n--\ndrivers/gpu/drm/drm_pagemap.c-745-\ndrivers/gpu/drm/drm_pagemap.c:746:\tzdd = drm_pagemap_zdd_alloc(dpagemap);\ndrivers/gpu/drm/drm_pagemap.c-747-\tif (!zdd) {\n--\ndrivers/gpu/drm/drm_pagemap.c-768-\tif (migrate.cpages != npages \u0026\u0026\ndrivers/gpu/drm/drm_pagemap.c:769:\t drm_pagemap_cpages(migrate.src, npages) != npages) {\ndrivers/gpu/drm/drm_pagemap.c-770-\t\t/*\n--\ndrivers/gpu/drm/drm_pagemap.c-819-\t\tif (src_page \u0026\u0026 is_device_private_page(src_page)) {\ndrivers/gpu/drm/drm_pagemap.c:820:\t\t\tstruct drm_pagemap_zdd *src_zdd =\ndrivers/gpu/drm/drm_pagemap.c:821:\t\t\t\tdrm_pagemap_page_zone_device_data(src_page);\ndrivers/gpu/drm/drm_pagemap.c-822-\n--\ndrivers/gpu/drm/drm_pagemap.c-853-\ndrivers/gpu/drm/drm_pagemap.c:854:\t\tdrm_pagemap_get_devmem_page(page, order, zdd);\ndrivers/gpu/drm/drm_pagemap.c-855-\ndrivers/gpu/drm/drm_pagemap.c:856:\t\t/* If we switched the migrating drm_pagemap, migrate previous pages now */\ndrivers/gpu/drm/drm_pagemap.c:857:\t\terr = drm_pagemap_migrate_range(devmem_allocation, migrate.src, migrate.dst,\ndrivers/gpu/drm/drm_pagemap.c-858-\t\t\t\t\t\tpages, pagemap_addr, \u0026last, \u0026cur,\n--\ndrivers/gpu/drm/drm_pagemap.c-870-\tcur.ops = NULL; /* Force migration */\ndrivers/gpu/drm/drm_pagemap.c:871:\terr = drm_pagemap_migrate_range(devmem_allocation, migrate.src, migrate.dst,\ndrivers/gpu/drm/drm_pagemap.c-872-\t\t\t\t\tpages, pagemap_addr, \u0026last, \u0026cur, mdetails);\n--\ndrivers/gpu/drm/drm_pagemap.c-886-\tif (err) {\ndrivers/gpu/drm/drm_pagemap.c:887:\t\tdrm_pagemap_migration_unlock_put_pages(npages, migrate.dst);\ndrivers/gpu/drm/drm_pagemap.c-888-\t\tfor (i = npages; i \u003c npages_in_range(start, end); ++i)\n--\ndrivers/gpu/drm/drm_pagemap.c-910-err_free:\ndrivers/gpu/drm/drm_pagemap.c:911:\tdrm_pagemap_zdd_put(zdd);\ndrivers/gpu/drm/drm_pagemap.c-912-\tkvfree(buf);\n--\ndrivers/gpu/drm/drm_pagemap.c-918-}\ndrivers/gpu/drm/drm_pagemap.c:919:EXPORT_SYMBOL_GPL(drm_pagemap_migrate_to_devmem);\ndrivers/gpu/drm/drm_pagemap.c-920-\ndrivers/gpu/drm/drm_pagemap.c-921-/**\ndrivers/gpu/drm/drm_pagemap.c:922: * drm_pagemap_migrate_populate_ram_pfn() - Populate RAM PFNs for a VM area\ndrivers/gpu/drm/drm_pagemap.c-923- * @vas: Pointer to the VM area structure, can be NULL\n--\ndrivers/gpu/drm/drm_pagemap.c-937- */\ndrivers/gpu/drm/drm_pagemap.c:938:static int drm_pagemap_migrate_populate_ram_pfn(struct vm_area_struct *vas,\ndrivers/gpu/drm/drm_pagemap.c-939-\t\t\t\t\t\tstruct page *fault_page,\n--\ndrivers/gpu/drm/drm_pagemap.c-961-\t\tif (fault_page) {\ndrivers/gpu/drm/drm_pagemap.c:962:\t\t\tif (drm_pagemap_page_zone_device_data(src_page) !=\ndrivers/gpu/drm/drm_pagemap.c:963:\t\t\t drm_pagemap_page_zone_device_data(fault_page))\ndrivers/gpu/drm/drm_pagemap.c-964-\t\t\t\tgoto next;\n--\ndrivers/gpu/drm/drm_pagemap.c-970-\ndrivers/gpu/drm/drm_pagemap.c:971:\t\tif (order \u0026\u0026 drm_pagemap_fault_inject_folio())\ndrivers/gpu/drm/drm_pagemap.c-972-\t\t\tfolio = NULL;\n--\ndrivers/gpu/drm/drm_pagemap.c-1056-\ndrivers/gpu/drm/drm_pagemap.c:1057:static void drm_pagemap_dev_unhold_work(struct work_struct *work);\ndrivers/gpu/drm/drm_pagemap.c:1058:static LLIST_HEAD(drm_pagemap_unhold_list);\ndrivers/gpu/drm/drm_pagemap.c:1059:static DECLARE_WORK(drm_pagemap_work, drm_pagemap_dev_unhold_work);\ndrivers/gpu/drm/drm_pagemap.c-1060-\ndrivers/gpu/drm/drm_pagemap.c-1061-/**\ndrivers/gpu/drm/drm_pagemap.c:1062: * struct drm_pagemap_dev_hold - Struct to aid in drm_device release.\ndrivers/gpu/drm/drm_pagemap.c:1063: * @link: Link into drm_pagemap_unhold_list for deferred reference releases.\ndrivers/gpu/drm/drm_pagemap.c-1064- * @drm: drm device to put.\ndrivers/gpu/drm/drm_pagemap.c-1065- *\ndrivers/gpu/drm/drm_pagemap.c:1066: * When a struct drm_pagemap is released, we also need to release the\ndrivers/gpu/drm/drm_pagemap.c-1067- * reference it holds on the drm device. However, typically that needs\ndrivers/gpu/drm/drm_pagemap.c-1068- * to be done separately from a system-wide workqueue.\ndrivers/gpu/drm/drm_pagemap.c:1069: * Each time a struct drm_pagemap is initialized\ndrivers/gpu/drm/drm_pagemap.c-1070- * (or re-initialized if cached) therefore allocate a separate\ndrivers/gpu/drm/drm_pagemap.c:1071: * drm_pagemap_dev_hold item, from which we put the drm device and\ndrivers/gpu/drm/drm_pagemap.c-1072- * associated module.\ndrivers/gpu/drm/drm_pagemap.c-1073- */\ndrivers/gpu/drm/drm_pagemap.c:1074:struct drm_pagemap_dev_hold {\ndrivers/gpu/drm/drm_pagemap.c-1075-\tstruct llist_node link;\n--\ndrivers/gpu/drm/drm_pagemap.c-1078-\ndrivers/gpu/drm/drm_pagemap.c:1079:static void drm_pagemap_release(struct kref *ref)\ndrivers/gpu/drm/drm_pagemap.c-1080-{\ndrivers/gpu/drm/drm_pagemap.c:1081:\tstruct drm_pagemap *dpagemap = container_of(ref, typeof(*dpagemap), ref);\ndrivers/gpu/drm/drm_pagemap.c:1082:\tstruct drm_pagemap_dev_hold *dev_hold = dpagemap-\u003edev_hold;\ndrivers/gpu/drm/drm_pagemap.c-1083-\n--\ndrivers/gpu/drm/drm_pagemap.c-1085-\t * We know the pagemap provider is alive at this point, since\ndrivers/gpu/drm/drm_pagemap.c:1086:\t * the struct drm_pagemap_dev_hold holds a reference to the\ndrivers/gpu/drm/drm_pagemap.c-1087-\t * pagemap provider drm_device and its module.\n--\ndrivers/gpu/drm/drm_pagemap.c-1089-\tdpagemap-\u003edev_hold = NULL;\ndrivers/gpu/drm/drm_pagemap.c:1090:\tdrm_pagemap_shrinker_add(dpagemap);\ndrivers/gpu/drm/drm_pagemap.c:1091:\tllist_add(\u0026dev_hold-\u003elink, \u0026drm_pagemap_unhold_list);\ndrivers/gpu/drm/drm_pagemap.c:1092:\tschedule_work(\u0026drm_pagemap_work);\ndrivers/gpu/drm/drm_pagemap.c-1093-\t/*\n--\ndrivers/gpu/drm/drm_pagemap.c-1095-\t * page_free(), the caller is holding a reference on the dev_pagemap,\ndrivers/gpu/drm/drm_pagemap.c:1096:\t * or if called from drm_pagemap_put(), the direct caller is still alive.\ndrivers/gpu/drm/drm_pagemap.c-1097-\t * This ensures we can't race with THIS module unload.\n--\ndrivers/gpu/drm/drm_pagemap.c-1100-\ndrivers/gpu/drm/drm_pagemap.c:1101:static void drm_pagemap_dev_unhold_work(struct work_struct *work)\ndrivers/gpu/drm/drm_pagemap.c-1102-{\ndrivers/gpu/drm/drm_pagemap.c:1103:\tstruct llist_node *node = llist_del_all(\u0026drm_pagemap_unhold_list);\ndrivers/gpu/drm/drm_pagemap.c:1104:\tstruct drm_pagemap_dev_hold *dev_hold, *next;\ndrivers/gpu/drm/drm_pagemap.c-1105-\ndrivers/gpu/drm/drm_pagemap.c-1106-\t/*\ndrivers/gpu/drm/drm_pagemap.c:1107:\t * Deferred release of drm_pagemap provider device and module.\ndrivers/gpu/drm/drm_pagemap.c-1108-\t * THIS module is kept alive during the release by the\ndrivers/gpu/drm/drm_pagemap.c:1109:\t * flush_work() in the drm_pagemap_exit() function.\ndrivers/gpu/drm/drm_pagemap.c-1110-\t */\n--\ndrivers/gpu/drm/drm_pagemap.c-1121-\ndrivers/gpu/drm/drm_pagemap.c:1122:static struct drm_pagemap_dev_hold *\ndrivers/gpu/drm/drm_pagemap.c:1123:drm_pagemap_dev_hold(struct drm_pagemap *dpagemap)\ndrivers/gpu/drm/drm_pagemap.c-1124-{\ndrivers/gpu/drm/drm_pagemap.c:1125:\tstruct drm_pagemap_dev_hold *dev_hold;\ndrivers/gpu/drm/drm_pagemap.c-1126-\tstruct drm_device *drm = dpagemap-\u003edrm;\n--\ndrivers/gpu/drm/drm_pagemap.c-1140-/**\ndrivers/gpu/drm/drm_pagemap.c:1141: * drm_pagemap_reinit() - Reinitialize a drm_pagemap\ndrivers/gpu/drm/drm_pagemap.c:1142: * @dpagemap: The drm_pagemap to reinitialize\ndrivers/gpu/drm/drm_pagemap.c-1143- *\ndrivers/gpu/drm/drm_pagemap.c:1144: * Reinitialize a drm_pagemap, for which drm_pagemap_release\ndrivers/gpu/drm/drm_pagemap.c-1145- * has already been called. This interface is intended for the\ndrivers/gpu/drm/drm_pagemap.c:1146: * situation where the driver caches a destroyed drm_pagemap.\ndrivers/gpu/drm/drm_pagemap.c-1147- *\n--\ndrivers/gpu/drm/drm_pagemap.c-1149- */\ndrivers/gpu/drm/drm_pagemap.c:1150:int drm_pagemap_reinit(struct drm_pagemap *dpagemap)\ndrivers/gpu/drm/drm_pagemap.c-1151-{\ndrivers/gpu/drm/drm_pagemap.c:1152:\tdpagemap-\u003edev_hold = drm_pagemap_dev_hold(dpagemap);\ndrivers/gpu/drm/drm_pagemap.c-1153-\tif (IS_ERR(dpagemap-\u003edev_hold))\n\n"
} |
| 13/2 | 2026/08/05 13:22 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 56282 output: 20 thoughts: 53 Thoughts: **Analyzing the MM Change** Okay, so the heart of this MM alteration seems to be nestled within `mm/migrate_device.c`. My initial question, as always, is about the potential reach of this change. Specifically, I'm trying to ascertain if either `migrate_vma_setup` or `migrate_device_pages` are accessible or potentially triggerable without the involvement of GPU drivers. That's a critical detail for me. To fully understand the implications, I need to know the scope of this update. My next move is to dissect the code. Let's delve in and find out precisely what code paths utilize `migrate_vma_setup`. That will give me the information I need to proceed. |
| 14/2 | 2026/08/05 13:22 | tool | grepper |
0mArgs:{
"Expression": "migrate_vma_setup"
}Results: {
"Output": "Documentation/mm/hmm.rst=264=use hardware DMA or device specific load/store instructions to migrate data.\nDocumentation/mm/hmm.rst:265:The migrate_vma_setup(), migrate_vma_pages(), and migrate_vma_finalize()\nDocumentation/mm/hmm.rst-266-functions are designed to make drivers easier to write and to centralize common\n--\nDocumentation/mm/hmm.rst=297=between device driver specific code and shared common code:\n--\nDocumentation/mm/hmm.rst-301- The device driver has to pass a ``struct vm_area_struct`` to\nDocumentation/mm/hmm.rst:302: migrate_vma_setup() so the mmap_read_lock() or mmap_write_lock() needs to\nDocumentation/mm/hmm.rst-303- be held for the duration of the migration.\nDocumentation/mm/hmm.rst-304-\nDocumentation/mm/hmm.rst:305:2. ``migrate_vma_setup(struct migrate_vma *args)``\nDocumentation/mm/hmm.rst-306-\nDocumentation/mm/hmm.rst-307- The device driver initializes the ``struct migrate_vma`` fields and passes\nDocumentation/mm/hmm.rst:308: the pointer to migrate_vma_setup(). The ``args-\u003eflags`` field is used to\nDocumentation/mm/hmm.rst-309- filter which source pages should be migrated. For example, setting\n--\nDocumentation/mm/hmm.rst-317-\nDocumentation/mm/hmm.rst:318: One of the first steps migrate_vma_setup() does is to invalidate other\nDocumentation/mm/hmm.rst-319- device's MMUs with the ``mmu_notifier_invalidate_range_start(()`` and\n--\nDocumentation/mm/hmm.rst-324- ``MMU_NOTIFY_MIGRATE`` and the ``owner`` field set to\nDocumentation/mm/hmm.rst:325: the ``args-\u003epgmap_owner`` field passed to migrate_vma_setup(). This\nDocumentation/mm/hmm.rst-326- allows the device driver to skip the invalidation callback and only\n--\nDocumentation/mm/hmm.rst-337- inserted in place of the original PTE.\nDocumentation/mm/hmm.rst:338: migrate_vma_setup() also clears the ``args-\u003edst`` array.\nDocumentation/mm/hmm.rst-339-\n--\nDocumentation/translations/zh_CN/mm/hmm.rst=212=HMM 切换到直接使用 struct page 用于设备内存,这使得大多数内核代码路径不知道差异。\n--\nDocumentation/translations/zh_CN/mm/hmm.rst-218-由于 CPU 无法直接访问设备内存,因此设备驱动程序必须使用硬件 DMA 或设备特定的加载/存\nDocumentation/translations/zh_CN/mm/hmm.rst:219:储指令来迁移数据。migrate_vma_setup()、migrate_vma_pages() 和\nDocumentation/translations/zh_CN/mm/hmm.rst-220-migrate_vma_finalize() 函数旨在使驱动程序更易于编写并集中跨驱动程序的通用代码。\n--\nDocumentation/translations/zh_CN/mm/hmm.rst=243=devm_memunmap_pages() 和 devm_release_mem_region() 当资源可以绑定到 ``struct device``.\n--\nDocumentation/translations/zh_CN/mm/hmm.rst-249-\nDocumentation/translations/zh_CN/mm/hmm.rst:250: 设备驱动程序必须将 ``struct vm_area_struct`` 传递给migrate_vma_setup(),\nDocumentation/translations/zh_CN/mm/hmm.rst-251- 因此需要在迁移期间保留 mmap_read_lock() 或 mmap_write_lock()。\nDocumentation/translations/zh_CN/mm/hmm.rst-252-\nDocumentation/translations/zh_CN/mm/hmm.rst:253:2. ``migrate_vma_setup(struct migrate_vma *args)``\nDocumentation/translations/zh_CN/mm/hmm.rst-254-\nDocumentation/translations/zh_CN/mm/hmm.rst-255- 设备驱动初始化了 ``struct migrate_vma`` 的字段,并将该指针传递给\nDocumentation/translations/zh_CN/mm/hmm.rst:256: migrate_vma_setup()。``args-\u003eflags`` 字段是用来过滤哪些源页面应该被迁移。\nDocumentation/translations/zh_CN/mm/hmm.rst-257- 例如,设置 ``MIGRATE_VMA_SELECT_SYSTEM`` 将只迁移系统内存,设置\n--\nDocumentation/translations/zh_CN/mm/hmm.rst-262-\nDocumentation/translations/zh_CN/mm/hmm.rst:263: migrate_vma_setup()所做的第一步是用 ``mmu_notifier_invalidate_range_start()``\nDocumentation/translations/zh_CN/mm/hmm.rst-264- 和 ``mmu_notifier_invalidate_range_end()`` 调用来遍历设备周围的页表,使\n--\nDocumentation/translations/zh_CN/mm/hmm.rst-267- 其 ``event`` 字段设置为MMU_NOTIFY_MIGRATE, ``owner`` 字段设置为传递给\nDocumentation/translations/zh_CN/mm/hmm.rst:268: migrate_vma_setup()的 ``args-\u003epgmap_owner`` 字段。这允许设备驱动跳过无\nDocumentation/translations/zh_CN/mm/hmm.rst-269- 效化回调,只无效化那些实际正在迁移的设备私有MMU映射。这一点将在下一节详细解释。\n--\nDocumentation/translations/zh_CN/mm/hmm.rst-275- ``lock_page()``锁定,与LRU隔离(如果系统内存和设备私有页不在LRU上),从进\nDocumentation/translations/zh_CN/mm/hmm.rst:276: 程中取消映射,并插入一个特殊的迁移PTE来代替原来的PTE。 migrate_vma_setup()\nDocumentation/translations/zh_CN/mm/hmm.rst-277- 还清除了 ``args-\u003edst`` 数组。\n--\narch/powerpc/kvm/book3s_hv_uvmem.c=513=static int __kvmppc_svm_page_out(struct vm_area_struct *vma,\n--\narch/powerpc/kvm/book3s_hv_uvmem.c-538-\narch/powerpc/kvm/book3s_hv_uvmem.c:539:\tret = migrate_vma_setup(\u0026mig);\narch/powerpc/kvm/book3s_hv_uvmem.c-540-\tif (ret)\n--\narch/powerpc/kvm/book3s_hv_uvmem.c=740=static int kvmppc_svm_page_in(struct vm_area_struct *vma,\n--\narch/powerpc/kvm/book3s_hv_uvmem.c-760-\narch/powerpc/kvm/book3s_hv_uvmem.c:761:\tret = migrate_vma_setup(\u0026mig);\narch/powerpc/kvm/book3s_hv_uvmem.c-762-\tif (ret)\n--\ndrivers/gpu/drm/amd/amdkfd/kfd_migrate.c=394=svm_migrate_vma_to_vram(struct kfd_node *node, struct svm_range *prange,\n--\ndrivers/gpu/drm/amd/amdkfd/kfd_migrate.c-431-\ndrivers/gpu/drm/amd/amdkfd/kfd_migrate.c:432:\tr = migrate_vma_setup(\u0026migrate);\ndrivers/gpu/drm/amd/amdkfd/kfd_migrate.c-433-\tif (r) {\n--\ndrivers/gpu/drm/amd/amdkfd/kfd_migrate.c=693=svm_migrate_vma_to_ram(struct kfd_node *node, struct svm_range *prange,\n--\ndrivers/gpu/drm/amd/amdkfd/kfd_migrate.c-734-\ndrivers/gpu/drm/amd/amdkfd/kfd_migrate.c:735:\tr = migrate_vma_setup(\u0026migrate);\ndrivers/gpu/drm/amd/amdkfd/kfd_migrate.c-736-\tif (r) {\n--\ndrivers/gpu/drm/amd/amdkfd/kfd_svm.c=3515=svm_range_best_prefetch_location(struct svm_range *prange)\n--\ndrivers/gpu/drm/amd/amdkfd/kfd_svm.c-3582- * and restore work:\ndrivers/gpu/drm/amd/amdkfd/kfd_svm.c:3583: * 1. migrate_vma_setup invalidate pages, MMU notifier callback svm_range_evict\ndrivers/gpu/drm/amd/amdkfd/kfd_svm.c-3584- * stops all queues, schedule restore work\n--\ndrivers/gpu/drm/drm_pagemap.c=690=int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation,\n--\ndrivers/gpu/drm/drm_pagemap.c-757-\ndrivers/gpu/drm/drm_pagemap.c:758:\terr = migrate_vma_setup(\u0026migrate);\ndrivers/gpu/drm/drm_pagemap.c-759-\tif (err)\n--\ndrivers/gpu/drm/drm_pagemap.c=1311=static int __drm_pagemap_migrate_to_ram(struct vm_area_struct *vas,\n--\ndrivers/gpu/drm/drm_pagemap.c-1364-\ndrivers/gpu/drm/drm_pagemap.c:1365:\terr = migrate_vma_setup(\u0026migrate);\ndrivers/gpu/drm/drm_pagemap.c-1366-\tif (err)\n--\ndrivers/gpu/drm/nouveau/nouveau_dmem.c=183=static vm_fault_t nouveau_dmem_migrate_to_ram(struct vm_fault *vmf)\n--\ndrivers/gpu/drm/nouveau/nouveau_dmem.c-235-\t */\ndrivers/gpu/drm/nouveau/nouveau_dmem.c:236:\tif (migrate_vma_setup(\u0026args) \u003c 0)\ndrivers/gpu/drm/nouveau/nouveau_dmem.c-237-\t\treturn VM_FAULT_SIGBUS;\n--\ndrivers/gpu/drm/nouveau/nouveau_dmem.c=822=nouveau_dmem_migrate_vma(struct nouveau_drm *drm,\n--\ndrivers/gpu/drm/nouveau/nouveau_dmem.c-871-\ndrivers/gpu/drm/nouveau/nouveau_dmem.c:872:\t\tret = migrate_vma_setup(\u0026args);\ndrivers/gpu/drm/nouveau/nouveau_dmem.c-873-\t\tif (ret)\n--\ninclude/linux/migrate.h=158=struct migrate_vma {\n--\ninclude/linux/migrate.h-164-\t * The src array must not be modified by the caller after\ninclude/linux/migrate.h:165:\t * migrate_vma_setup(), and must not change the dst array after\ninclude/linux/migrate.h-166-\t * migrate_vma_pages() returns.\n--\ninclude/linux/migrate.h-192-\ninclude/linux/migrate.h:193:int migrate_vma_setup(struct migrate_vma *args);\ninclude/linux/migrate.h-194-void migrate_vma_pages(struct migrate_vma *migrate);\n--\nlib/test_hmm.c=1120=static int dmirror_migrate_to_system(struct dmirror *dmirror,\n--\nlib/test_hmm.c-1164-\nlib/test_hmm.c:1165:\t\tret = migrate_vma_setup(\u0026args);\nlib/test_hmm.c-1166-\t\tif (ret)\n--\nlib/test_hmm.c=1189=static int dmirror_migrate_to_device(struct dmirror *dmirror,\n--\nlib/test_hmm.c-1242-\t\t\t\tMIGRATE_VMA_SELECT_COMPOUND;\nlib/test_hmm.c:1243:\t\tret = migrate_vma_setup(\u0026args);\nlib/test_hmm.c-1244-\t\tif (ret)\n--\nlib/test_hmm.c=1653=static vm_fault_t dmirror_devmem_fault(struct vm_fault *vmf)\n--\nlib/test_hmm.c-1705-\t/*\nlib/test_hmm.c:1706:\t * In practice migrate_vma_setup() should never fail unless the\nlib/test_hmm.c-1707-\t * test is wrong as it just tests some static VMA properties.\nlib/test_hmm.c-1708-\t */\nlib/test_hmm.c:1709:\tif (migrate_vma_setup(\u0026args)) {\nlib/test_hmm.c-1710-\t\tret = VM_FAULT_SIGBUS;\n--\nmm/migrate_device.c=660=static void migrate_vma_unmap(struct migrate_vma *migrate)\n--\nmm/migrate_device.c-666-/**\nmm/migrate_device.c:667: * migrate_vma_setup() - prepare to migrate a range of memory\nmm/migrate_device.c-668- * @args: contains the vma, start, and pfns arrays for the migration\n--\nmm/migrate_device.c-729- */\nmm/migrate_device.c:730:int migrate_vma_setup(struct migrate_vma *args)\nmm/migrate_device.c-731-{\n--\nmm/migrate_device.c-769-}\nmm/migrate_device.c:770:EXPORT_SYMBOL(migrate_vma_setup);\nmm/migrate_device.c-771-\n--\nmm/migrate_device.c=1448=static unsigned long migrate_device_pfn_lock(unsigned long pfn)\n--\nmm/migrate_device.c-1469- *\nmm/migrate_device.c:1470: * migrate_vma_setup() is similar in concept to migrate_vma_setup() except that\nmm/migrate_device.c-1471- * instead of looking up pages based on virtual address mappings a range of\n--\nmm/migrate_device.c-1477- *\nmm/migrate_device.c:1478: * Like migrate_vma_setup() this function will take a reference and lock any\nmm/migrate_device.c-1479- * migrating pages that aren't free before unmapping them. Drivers may then\n--\nmm/migrate_device.c=1548=int migrate_device_coherent_folio(struct folio *folio)\n--\nmm/migrate_device.c-1560-\t * the source folio. So call migrate_vma_unmap() directly to unmap the\nmm/migrate_device.c:1561:\t * folio as migrate_vma_setup() will fail if args.vma == NULL.\nmm/migrate_device.c-1562-\t */\n"
} |
| 15/2 | 2026/08/05 13:22 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 60368 output: 26 thoughts: 120 Thoughts: **Investigating the Test HMM Kernel Module for Syzkaller Integration** Okay, so I've spotted that `lib/test_hmm.c` leverages `migrate_vma_setup`. That immediately flags my interest, as I recognize `test_hmm` as a kernel module specifically designed for testing HMM – Heterogeneous Memory Management. The real kicker is that it provides a virtual device specifically to test memory migration, which is a key area of focus for kernel fuzzing. My mind immediately jumps to Syzkaller. Can we leverage `test_hmm` in our fuzzing campaigns? Is it already enabled, or could it be? My next step is clearly to determine whether `CONFIG_TEST_HMM` is accessible in the syzkaller environment. I'll need to dig into the kernel configuration files. The logical places to start looking are `lib/Kconfig.debug` and `lib/Kconfig`. I'll be searching for that `TEST_HMM` symbol to confirm its status and determine if it can be readily enabled for fuzzing purposes. This could potentially unlock a new avenue for discovering migration-related bugs. |
| 16/2 | 2026/08/05 13:23 | tool | grepper |
0mArgs:{
"Expression": "TEST_HMM",
"PathPrefix": "lib/"
}Results: {
"Output": "lib/Kconfig.debug=3346=config TEST_MEMINIT\n--\nlib/Kconfig.debug-3353-\nlib/Kconfig.debug:3354:config TEST_HMM\nlib/Kconfig.debug-3355-\ttristate \"Test HMM (Heterogeneous Memory Management)\"\n--\nlib/Makefile=102=obj-$(CONFIG_TEST_LOCKUP) += test_lockup.o\nlib/Makefile:103:obj-$(CONFIG_TEST_HMM) += test_hmm.o\nlib/Makefile-104-obj-$(CONFIG_TEST_FREE_PAGES) += test_free_pages.o\n--\nlib/test_hmm_uapi.h-6- */\nlib/test_hmm_uapi.h:7:#ifndef _LIB_TEST_HMM_UAPI_H\nlib/test_hmm_uapi.h:8:#define _LIB_TEST_HMM_UAPI_H\nlib/test_hmm_uapi.h-9-\n--\nlib/test_hmm_uapi.h=74=enum {\n--\nlib/test_hmm_uapi.h-79-\nlib/test_hmm_uapi.h:80:#endif /* _LIB_TEST_HMM_UAPI_H */\n"
} |
| 17/2 | 2026/08/05 13:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 61076 output: 32 thoughts: 138 Thoughts: **Investigating the Configuration for Device Migration Testing** Okay, so I see this patch enables `CONFIG_TEST_HMM`, which I know is used to specifically test `mm/migrate_device.c`. That makes sense, a targeted test setup. But then I noticed a modification to `drivers/gpu/drm/drm_pagemap.c` as well. That's a little unexpected. Now, `drm_pagemap.c` is part of `drm_gpusvm_helper`, which suggests some interaction with GPU virtual memory management. So `drm_gpusvm_helper` is only compiled in if `CONFIG_DRM_GPUSVM` is enabled, or if we have `CONFIG_ZONE_DEVICE` and `drm_gpusvm_helper-y`. Right, I'll need to check the relevant Kconfig file (`drivers/gpu/drm/Kconfig`) to understand the complete dependency picture. I need to figure out what triggers the build of `drm_gpusvm_helper` to fully grasp this change. So, I will be searching for `DRM_GPUSVM` or `DRM_PAGEMAP` in there. |
| 18/2 | 2026/08/05 13:23 | tool | grepper |
0mArgs:{
"Expression": "DRM_GPUSVM",
"PathPrefix": "drivers/gpu/drm/"
}Results: {
"Output": "drivers/gpu/drm/Kconfig=221=config RUST_DRM_GPUVM\n--\ndrivers/gpu/drm/Kconfig-227-\ndrivers/gpu/drm/Kconfig:228:config DRM_GPUSVM\ndrivers/gpu/drm/Kconfig-229-\ttristate\n--\ndrivers/gpu/drm/Makefile=111=drm_gpusvm_helper-$(CONFIG_ZONE_DEVICE) += \\\n--\ndrivers/gpu/drm/Makefile-114-\ndrivers/gpu/drm/Makefile:115:obj-$(CONFIG_DRM_GPUSVM) += drm_gpusvm_helper.o\ndrivers/gpu/drm/Makefile-116-\n--\ndrivers/gpu/drm/drm_gpusvm.c=762=enum drm_gpusvm_scan_result drm_gpusvm_scan_mm(struct drm_gpusvm_range *range,\n--\ndrivers/gpu/drm/drm_gpusvm.c-777-\t\tjiffies + msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);\ndrivers/gpu/drm/drm_gpusvm.c:778:\tenum drm_gpusvm_scan_result state = DRM_GPUSVM_SCAN_UNPOPULATED, new_state;\ndrivers/gpu/drm/drm_gpusvm.c-779-\tunsigned long *pfns;\n--\ndrivers/gpu/drm/drm_gpusvm.c-785-\tif (!pfns)\ndrivers/gpu/drm/drm_gpusvm.c:786:\t\treturn DRM_GPUSVM_SCAN_UNPOPULATED;\ndrivers/gpu/drm/drm_gpusvm.c-787-\n--\ndrivers/gpu/drm/drm_gpusvm.c-820-\t\tif (!(pfns[i] \u0026 HMM_PFN_VALID)) {\ndrivers/gpu/drm/drm_gpusvm.c:821:\t\t\tstate = DRM_GPUSVM_SCAN_UNPOPULATED;\ndrivers/gpu/drm/drm_gpusvm.c-822-\t\t\tbreak;\n--\ndrivers/gpu/drm/drm_gpusvm.c-830-\t\tif (cur == pagemap) {\ndrivers/gpu/drm/drm_gpusvm.c:831:\t\t\tnew_state = DRM_GPUSVM_SCAN_EQUAL;\ndrivers/gpu/drm/drm_gpusvm.c-832-\t\t} else if (cur \u0026\u0026 (cur == other || !other)) {\ndrivers/gpu/drm/drm_gpusvm.c:833:\t\t\tnew_state = DRM_GPUSVM_SCAN_OTHER;\ndrivers/gpu/drm/drm_gpusvm.c-834-\t\t\tother = cur;\ndrivers/gpu/drm/drm_gpusvm.c-835-\t\t} else if (cur) {\ndrivers/gpu/drm/drm_gpusvm.c:836:\t\t\tnew_state = DRM_GPUSVM_SCAN_MIXED_DEVICE;\ndrivers/gpu/drm/drm_gpusvm.c-837-\t\t} else {\ndrivers/gpu/drm/drm_gpusvm.c:838:\t\t\tnew_state = DRM_GPUSVM_SCAN_SYSTEM;\ndrivers/gpu/drm/drm_gpusvm.c-839-\t\t}\n--\ndrivers/gpu/drm/drm_gpusvm.c-845-\t\t */\ndrivers/gpu/drm/drm_gpusvm.c:846:\t\tif (state == DRM_GPUSVM_SCAN_UNPOPULATED) {\ndrivers/gpu/drm/drm_gpusvm.c-847-\t\t\tstate = new_state;\ndrivers/gpu/drm/drm_gpusvm.c-848-\t\t} else if (state != new_state) {\ndrivers/gpu/drm/drm_gpusvm.c:849:\t\t\tif (new_state == DRM_GPUSVM_SCAN_SYSTEM ||\ndrivers/gpu/drm/drm_gpusvm.c:850:\t\t\t state == DRM_GPUSVM_SCAN_SYSTEM)\ndrivers/gpu/drm/drm_gpusvm.c:851:\t\t\t\tstate = DRM_GPUSVM_SCAN_MIXED;\ndrivers/gpu/drm/drm_gpusvm.c:852:\t\t\telse if (state != DRM_GPUSVM_SCAN_MIXED)\ndrivers/gpu/drm/drm_gpusvm.c:853:\t\t\t\tstate = DRM_GPUSVM_SCAN_MIXED_DEVICE;\ndrivers/gpu/drm/drm_gpusvm.c-854-\t\t}\n--\ndrivers/gpu/drm/xe/Kconfig=2=config DRM_XE\n--\ndrivers/gpu/drm/xe/Kconfig-41-\tselect DRM_EXEC\ndrivers/gpu/drm/xe/Kconfig:42:\tselect DRM_GPUSVM if !UML\ndrivers/gpu/drm/xe/Kconfig-43-\tselect DRM_GPUVM\n--\ndrivers/gpu/drm/xe/Kconfig=79=config DRM_XE_GPUSVM\n--\ndrivers/gpu/drm/xe/Kconfig-85-\tselect DEVICE_PRIVATE\ndrivers/gpu/drm/xe/Kconfig:86:\tselect DRM_GPUSVM\ndrivers/gpu/drm/xe/Kconfig-87-\thelp\n--\ndrivers/gpu/drm/xe/Kconfig.debug=105=config DRM_XE_USERPTR_INVAL_INJECT\ndrivers/gpu/drm/xe/Kconfig.debug-106- bool \"Inject userptr invalidation -EINVAL errors\"\ndrivers/gpu/drm/xe/Kconfig.debug:107: depends on DRM_GPUSVM\ndrivers/gpu/drm/xe/Kconfig.debug-108- default n\n--\ndrivers/gpu/drm/xe/Makefile=156=xe-$(CONFIG_DRM_XE_GPUSVM) += xe_svm.o\ndrivers/gpu/drm/xe/Makefile:157:xe-$(CONFIG_DRM_GPUSVM) += xe_userptr.o\ndrivers/gpu/drm/xe/Makefile-158-\n--\ndrivers/gpu/drm/xe/xe_pt.c=1411=static int xe_pt_pre_commit(struct xe_migrate_pt_update *pt_update)\n--\ndrivers/gpu/drm/xe/xe_pt.c-1423-\ndrivers/gpu/drm/xe/xe_pt.c:1424:#if IS_ENABLED(CONFIG_DRM_GPUSVM)\ndrivers/gpu/drm/xe/xe_pt.c-1425-/*\n--\ndrivers/gpu/drm/xe/xe_pt.c=1453=static inline void xe_pt_svm_userptr_notifier_unlock(struct xe_vm *vm) { }\n--\ndrivers/gpu/drm/xe/xe_pt.c-1455-\ndrivers/gpu/drm/xe/xe_pt.c:1456:#if IS_ENABLED(CONFIG_DRM_GPUSVM)\ndrivers/gpu/drm/xe/xe_pt.c-1457-#ifdef CONFIG_DRM_XE_USERPTR_INVAL_INJECT\n--\ndrivers/gpu/drm/xe/xe_pt.c=2589=static const struct xe_migrate_pt_update_ops migrate_ops = {\n--\ndrivers/gpu/drm/xe/xe_pt.c-2594-\ndrivers/gpu/drm/xe/xe_pt.c:2595:#if IS_ENABLED(CONFIG_DRM_GPUSVM)\ndrivers/gpu/drm/xe/xe_pt.c-2596-static const struct xe_migrate_pt_update_ops svm_userptr_migrate_ops = {\n--\ndrivers/gpu/drm/xe/xe_svm.c=1614=int xe_svm_alloc_vram(struct xe_svm_range *range, const struct drm_gpusvm_ctx *ctx,\n--\ndrivers/gpu/drm/xe/xe_svm.c-1630-\ndrivers/gpu/drm/xe/xe_svm.c:1631:\tif (migration_state == DRM_GPUSVM_SCAN_EQUAL) {\ndrivers/gpu/drm/xe/xe_svm.c-1632-\t\tif (IS_ENABLED(CONFIG_DRM_XE_DEBUG_VM))\n--\ndrivers/gpu/drm/xe/xe_svm.h=233=int xe_svm_init(struct xe_vm *vm)\ndrivers/gpu/drm/xe/xe_svm.h-234-{\ndrivers/gpu/drm/xe/xe_svm.h:235:#if IS_ENABLED(CONFIG_DRM_GPUSVM)\ndrivers/gpu/drm/xe/xe_svm.h-236-\treturn drm_gpusvm_init(\u0026vm-\u003esvm.gpusvm, \"Xe SVM (simple)\", \u0026vm-\u003exe-\u003edrm,\n--\ndrivers/gpu/drm/xe/xe_svm.h=244=void xe_svm_fini(struct xe_vm *vm)\ndrivers/gpu/drm/xe/xe_svm.h-245-{\ndrivers/gpu/drm/xe/xe_svm.h:246:#if IS_ENABLED(CONFIG_DRM_GPUSVM)\ndrivers/gpu/drm/xe/xe_svm.h-247-\txe_assert(vm-\u003exe, xe_vm_is_closed(vm));\n--\ndrivers/gpu/drm/xe/xe_svm.h=385=static inline struct drm_pagemap *xe_drm_pagemap_from_fd(int fd, u32 region_instance)\n--\ndrivers/gpu/drm/xe/xe_svm.h-392-\ndrivers/gpu/drm/xe/xe_svm.h:393:#if IS_ENABLED(CONFIG_DRM_GPUSVM) /* Need to support userptr without XE_GPUSVM */\ndrivers/gpu/drm/xe/xe_svm.h-394-#define xe_svm_assert_in_notifier(vm__) \\\n--\ndrivers/gpu/drm/xe/xe_svm.h=436=static inline void xe_svm_notifier_unlock(struct xe_vm *vm)\n--\ndrivers/gpu/drm/xe/xe_svm.h-438-}\ndrivers/gpu/drm/xe/xe_svm.h:439:#endif /* CONFIG_DRM_GPUSVM */\ndrivers/gpu/drm/xe/xe_svm.h-440-\n--\ndrivers/gpu/drm/xe/xe_userptr.h=48=struct xe_userptr {\n--\ndrivers/gpu/drm/xe/xe_userptr.h-99-\ndrivers/gpu/drm/xe/xe_userptr.h:100:#if IS_ENABLED(CONFIG_DRM_GPUSVM)\ndrivers/gpu/drm/xe/xe_userptr.h-101-void xe_userptr_remove(struct xe_userptr_vma *uvma);\n--\ndrivers/gpu/drm/xe/xe_vm.c=3606=static int vm_bind_ioctl_check_args(struct xe_device *xe, struct xe_vm *vm,\n--\ndrivers/gpu/drm/xe/xe_vm.c-3716-\t\t XE_IOCTL_DBG(xe, op == DRM_XE_VM_BIND_OP_MAP_USERPTR \u0026\u0026\ndrivers/gpu/drm/xe/xe_vm.c:3717:\t\t\t\t !IS_ENABLED(CONFIG_DRM_GPUSVM)) ||\ndrivers/gpu/drm/xe/xe_vm.c-3718-\t\t XE_IOCTL_DBG(xe, obj \u0026\u0026\n"
} |
| 19/2 | 2026/08/05 13:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 64377 output: 32 thoughts: 710 Thoughts: **Analyzing the Reachability of Code Modifications** Okay, let's break this down. My initial thought process revolves around `CONFIG_DRM_GPUSVM`. I see it's selected by `DRM_XE` and `DRM_XE_GPUSVM`, and I was thinking that enabling `CONFIG_DRM_GPUSVM` along with `CONFIG_TEST_HMM` would allow me to test `mm/migrate_device.c`. But I need to go deeper than that. I remember `drm_pagemap.c` is compiled only when `CONFIG_ZONE_DEVICE` is enabled, and `drm_gpusvm_helper-y` is set. So, the dependency seems to be `CONFIG_ZONE_DEVICE` and `CONFIG_DRM_GPUSVM`. However, the question is, can I fuzz `drm_pagemap.c` without the `xe` driver? I see that it exports `drm_pagemap_migrate_to_devmem`, but does `test_hmm` call it? No, `test_hmm` uses `migrate_vma_setup` directly. I need to be sure; no other driver calls `drm_pagemap_migrate_to_devmem`? Looking deeper, only `drm_gpusvm.c` and `xe_svm.c` touch this. Specifically, `drm_gpusvm.c` exports `drm_gpusvm_range_get_pages`, which *does* call `drm_pagemap_migrate_to_devmem`. But `test_hmm` is a separate module, so the route to `drm_pagemap.c` is not valid via `test_hmm`. So, the core question is: Is `drm_pagemap` reachable? Only `xe` and `drm_gpusvm` appear to be using it. Can I even fuzz `xe` in QEMU? And, no, the `xe` driver needs real hardware, since it is an Intel Xe GPU driver. I did see `drm_pagemap.c` has a fault injection mechanism, `drm_pagemap_fault_inject`, which is interesting because it's a core DRM helper for GPU SVM, but I need to figure out how to trigger it. There isn't any virtual driver using `drm_gpusvm`. I was looking for something virtual to get around the hardware dependencies of `xe`. I need to circle back. `test_hmm` is for testing HMM; it doesn't directly touch `drm_pagemap.c`. So, these changes in `drm_pagemap.c` are only reachable with the `xe` driver. And, the `xe` driver requires hardware. Let's shift focus to `mm/migrate_device.c`. The patch modifies `migrate_vma_split_unmapped_folio` and `__migrate_device_pages`. Those functions are used by `migrate_vma_setup` and `migrate_device_pages`. Wait... I see it: `test_hmm` actually *does* use `migrate_vma_setup` and `migrate_device_pages`! So, now I need to check whether `test_hmm` can reach the modified code in `mm/migrate_device.c`. |
| 20/2 | 2026/08/05 13:23 | tool | grepper |
0mArgs:{
"Expression": "migrate_device_pages",
"PathPrefix": "lib/test_hmm.c"
}Results: {
"Output": "lib/test_hmm.c=188=static void dmirror_device_evict_chunk(struct dmirror_chunk *chunk)\n--\nlib/test_hmm.c-231-\t}\nlib/test_hmm.c:232:\tmigrate_device_pages(src_pfns, dst_pfns, npages);\nlib/test_hmm.c-233-\tmigrate_device_finalize(src_pfns, dst_pfns, npages);\n"
} |
| 21/2 | 2026/08/05 13:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 65967 output: 25 thoughts: 117 Thoughts: **Reaching the `migrate_device.c` Code via `test_hmm`** Alright, this is great! Looking at `lib/test_hmm.c`, I see that it indeed calls both `migrate_device_pages` and `migrate_vma_setup`. That confirms it – the modifications I made in `mm/migrate_device.c` are absolutely reachable through the `test_hmm` code path. Now, a minor concern crosses my mind: `test_hmm` is primarily a testing module. Does syzkaller, our primary fuzzing tool, have the capability to interact with it directly? I need to be sure the coverage is there. Let's see... the answer is a definitive yes. I recall seeing syzkaller descriptions for `test_hmm` specifically, things like `/dev/hmm_dmirror*`, so I know that the syzkaller interface can definitely hit these entrypoints. Time to verify that those descriptions are in place, just to be absolutely certain. |
| 22/2 | 2026/08/05 13:23 | tool | grepper |
0mError:no matches Args: {
"Expression": "hmm",
"PathPrefix": "sys/linux/"
}Results: {
"error": "no matches"
} |
| 23/2 | 2026/08/05 13:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 66336 output: 28 thoughts: 875 Thoughts: **WorthFuzzing Analysis** Okay, so I can't directly `grep` the syzkaller descriptions, as the prompt explicitly states. I need to think this through a bit more strategically. I know `test_hmm` is a known fuzzer target, exposing `/dev/hmm_dmirror*` devices, which means it likely hits these changes, and the patch modifies `mm/migrate_device.c`, which is core MM. That's a good starting point. The key question is reachability. Is `mm/migrate_device.c` reachable through `nouveau` or `amdgpu`? Those are GPU drivers, and `nouveau` needs physical hardware to fuzz properly, so probably not. But then I remember `test_hmm` is a *software-only* test driver specifically for testing `migrate_device.c` and HMM. Bingo! That confirms reachability and makes this patch WorthFuzzing=true. I need to focus on this code. I'll look at the specific functions modified in `mm/migrate_device.c`. The core functions seem to be: * `migrate_device_pages` (exported, so used by `test_hmm.c`, `nouveau`, `amdgpu`, etc.) * `migrate_vma_split_unmapped_folio` * `migrate_vma_split_pmd_mappings` * `migrate_vma_split_pmd_one` I also note changes in `drm_pagemap.c`: * `drm_pagemap_migrate_populate_src_pages` * `drm_pagemap_migrate_populate_ram_pfn` However, the `drm_pagemap.c` changes depend on the `xe` driver, which, again, requires physical hardware, so probably not reachable in QEMU. I'm going to lean towards not focusing on those, but will keep an eye on them. The crucial takeaway is that `mm/migrate_device.c` *is* reachable via `test_hmm`, which makes it a priority. Now, I need to check the kernel configuration to make sure I have the necessary options enabled to reproduce the issue. `CONFIG_TEST_HMM` seems obvious; I need to ensure that's in `EnableConfigs`. I should also look at `CONFIG_DEVICE_PRIVATE` or `CONFIG_ZONE_DEVICE`, and I'll check `mm/Kconfig` for `MIGRATE_VMA_HELPER` to see if there are any other dependencies. |
| 24/2 | 2026/08/05 13:23 | tool | grepper |
0mArgs:{
"Expression": "config DEVICE_PRIVATE",
"PathPrefix": "mm/Kconfig"
}Results: {
"Output": "mm/Kconfig=1264=config GET_FREE_REGION\n--\nmm/Kconfig-1266-\nmm/Kconfig:1267:config DEVICE_PRIVATE\nmm/Kconfig-1268-\tbool \"Unaddressable device memory (GPU memory, ...)\"\n"
} |
| 25/2 | 2026/08/05 13:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 67887 output: 31 thoughts: 13 Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience: **Analyzing the Selection Process of `TEST_HMM`** Alright, let's dive in. I need to quickly ascertain the selection criteria or, more precisely, *what* `TEST_HMM` is using to make its decisions. Knowing this is fundamental to understanding its behavior, debugging any potential issues, and, ultimately, trusting its output. I'm going to quickly review its implementation – probably looking for key conditional statements, call to external functions that return some value. Is it a threshold, a set of parameters, some kind of internal score? I'll be looking for clues that point to the governing factors. I have to know *why* this component is making its choices. That's the essence of this inspection. |
| 26/2 | 2026/08/05 13:24 | tool | grepper |
0mArgs:{
"Expression": "config TEST_HMM",
"PathPrefix": "lib/Kconfig.debug"
}Results: {
"Output": "lib/Kconfig.debug=3346=config TEST_MEMINIT\n--\nlib/Kconfig.debug-3353-\nlib/Kconfig.debug:3354:config TEST_HMM\nlib/Kconfig.debug-3355-\ttristate \"Test HMM (Heterogeneous Memory Management)\"\n"
} |
| 27/2 | 2026/08/05 13:24 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 68192 output: 31 thoughts: 14 Thoughts: Okay, here's my attempt at summarizing that thought process, tailored for an expert audience: **Analyzing the Definition** Alright, my immediate thought is to get the complete picture. Instead of jumping to conclusions or relying on prior knowledge (which, admittedly, I *do* have, but it's crucial to be thorough), I need the actual, concrete definition of `TEST_HMM`. My initial understanding might be incomplete or based on context; I want to ensure my mental model aligns precisely with the formal specification. I'm thinking, "Let's dig into the details. What are all the parameters, the conditional dependencies, any constraints, the underlying assumptions, everything… to get a solid grasp of how `TEST_HMM` is implemented or defined." I can then proceed with my work more confidently. |
| 28/2 | 2026/08/05 13:24 | tool | grepper |
0mArgs:{
"Expression": "config TEST_HMM",
"PathPrefix": "lib/Kconfig.debug"
}Results: {
"Output": "lib/Kconfig.debug=3346=config TEST_MEMINIT\n--\nlib/Kconfig.debug-3353-\nlib/Kconfig.debug:3354:config TEST_HMM\nlib/Kconfig.debug-3355-\ttristate \"Test HMM (Heterogeneous Memory Management)\"\n"
} |
| 29/2 | 2026/08/05 13:24 | llm | patch-evaluator |
2mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 68496 output: 35 thoughts: 20 Thoughts: Here's my take on the thought process, as requested: **Diving into Debugging Configuration** Okay, time to get my hands dirty. I need to understand something specific about the debugging configuration for this project. My intuition tells me that the relevant settings are likely located within the `Kconfig.debug` file, specifically around line 3354. I'll take a look at that file location directly. Let's see what secrets it holds. Hopefully, this section will shed some light on the configuration I'm trying to decipher. |
| 30/2 | 2026/08/05 13:27 | tool | read-file |
0mArgs:{
"File": "lib/Kconfig.debug",
"FirstLine": 3350,
"LineCount": 20
}Results: {
"Contents": "3350:\t\t This can be useful to test init_on_alloc and init_on_free features.\n3351:\t\n3352:\t\t If unsure, say N.\n3353:\t\n3354:\tconfig TEST_HMM\n3355:\t\ttristate \"Test HMM (Heterogeneous Memory Management)\"\n3356:\t\tdepends on TRANSPARENT_HUGEPAGE\n3357:\t\tdepends on DEVICE_PRIVATE\n3358:\t\tselect HMM_MIRROR\n3359:\t\tselect MMU_NOTIFIER\n3360:\t\thelp\n3361:\t\t This is a pseudo device driver solely for testing HMM.\n3362:\t\t Say M here if you want to build the HMM test module.\n3363:\t\t Doing so will allow you to run tools/testing/selftest/vm/hmm-tests.\n3364:\t\n3365:\t\t If unsure, say N.\n3366:\t\n3367:\tconfig TEST_FREE_PAGES\n3368:\t\ttristate \"Test freeing pages\"\n3369:\t\thelp\n"
} |
| 31/2 | 2026/08/05 13:27 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 68964 output: 33 thoughts: 81 Thoughts: **Configuration Dependencies** Okay, so I'm looking at this `TEST_HMM` feature, and it seems like it's dependent on both `TRANSPARENT_HUGEPAGE` and `DEVICE_PRIVATE`. Logically, I should enable all three: `TEST_HMM`, `DEVICE_PRIVATE`, and `TRANSPARENT_HUGEPAGE`. But hold on... something feels off about `DEVICE_PRIVATE`. I seem to recall it having its own dependencies. Let me double-check that by verifying its dependencies. Ah, right, `DEVICE_PRIVATE` relies on `ZONE_DEVICE`. Time to dive into `mm/Kconfig` and verify the exact dependency chain for `DEVICE_PRIVATE`. |
| 32/2 | 2026/08/05 13:28 | tool | read-file |
0mArgs:{
"File": "mm/Kconfig",
"FirstLine": 1260,
"LineCount": 20
}Results: {
"Contents": "1260:\tconfig HMM_MIRROR\n1261:\t\tbool\n1262:\t\tdepends on MMU\n1263:\t\n1264:\tconfig GET_FREE_REGION\n1265:\t\tbool\n1266:\t\n1267:\tconfig DEVICE_PRIVATE\n1268:\t\tbool \"Unaddressable device memory (GPU memory, ...)\"\n1269:\t\tdepends on ZONE_DEVICE\n1270:\t\tselect GET_FREE_REGION\n1271:\t\n1272:\t\thelp\n1273:\t\t Allows creation of struct pages to represent unaddressable device\n1274:\t\t memory; i.e., memory that is only accessible from the device (or\n1275:\t\t group of devices). You likely also want to select HMM_MIRROR.\n1276:\t\n1277:\tconfig VMAP_PFN\n1278:\t\tbool\n1279:\t\n"
} |
| 33/2 | 2026/08/05 13:28 | llm | patch-evaluator |
1mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 69483 output: 28 thoughts: 22 Thoughts: Here's a summary of my immediate thought process: **Dependency Check: Diving into Zone_Device** Okay, so I've hit a point where my mental model of the system requires me to understand `DEVICE_PRIVATE`. But I know `DEVICE_PRIVATE` relies on `ZONE_DEVICE`. Therefore, the first thing I need to do is to refresh my understanding of `ZONE_DEVICE`. I need to drill down into that module or concept *first*. I'm going to quickly review everything I know (or, more likely, need to relearn) about `ZONE_DEVICE` before I can move forward with a truly informed grasp of `DEVICE_PRIVATE`. Let's get to it. |
| 34/2 | 2026/08/05 13:29 | tool | grepper |
0mArgs:{
"Expression": "config ZONE_DEVICE",
"PathPrefix": "mm/Kconfig"
}Results: {
"Output": "mm/Kconfig=1231=config ZONE_DMA32\n--\nmm/Kconfig-1235-\nmm/Kconfig:1236:config ZONE_DEVICE\nmm/Kconfig-1237-\tbool \"Device memory (pmem, HMM, etc...) hotplug support\"\n"
} |
| 35/2 | 2026/08/05 13:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 69768 output: 33 thoughts: 18 Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience: **Diving into the Kernel Configuration Landscape** Okay, so I need to get a handle on how this particular configuration option is handled. Let's start by zeroing in on `mm/Kconfig`. I'm thinking around line 1236 should be a good starting point, given the context of what I'm dealing with. I have a hunch it's related to some memory management feature. Let's see what the Kconfig entries reveal about the conditional compilation, dependencies, and any accompanying documentation. I want to quickly grasp the relevant context and ensure I have the right dependencies in mind for subsequent analysis. I'm hoping to uncover the underlying logic for this feature. |
| 36/2 | 2026/08/05 13:29 | tool | read-file |
0mArgs:{
"File": "mm/Kconfig",
"FirstLine": 1230,
"LineCount": 20
}Results: {
"Contents": "1230:\t\n1231:\tconfig ZONE_DMA32\n1232:\t\tbool \"Support DMA32 zone\" if ARCH_HAS_ZONE_DMA_SET\n1233:\t\tdepends on !X86_32\n1234:\t\tdefault y if ARM64\n1235:\t\n1236:\tconfig ZONE_DEVICE\n1237:\t\tbool \"Device memory (pmem, HMM, etc...) hotplug support\"\n1238:\t\tdepends on MEMORY_HOTPLUG\n1239:\t\tdepends on MEMORY_HOTREMOVE\n1240:\t\tdepends on SPARSEMEM_VMEMMAP\n1241:\t\tselect XARRAY_MULTI\n1242:\t\n1243:\t\thelp\n1244:\t\t Device memory hotplug support allows for establishing pmem,\n1245:\t\t or other device driver discovered memory regions, in the\n1246:\t\t memmap. This allows pfn_to_page() lookups of otherwise\n1247:\t\t \"device-physical\" addresses which is needed for DAX, PCI_P2PDMA, and\n1248:\t\t DEVICE_PRIVATE features among others.\n1249:\t\n"
} |
| 37/2 | 2026/08/05 13:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 70293 output: 30 thoughts: 398 Thoughts: **My Current Configuration Investigation** Okay, so I'm looking at these kernel configuration options. It looks like `ZONE_DEVICE` has dependencies on `MEMORY_HOTPLUG`, `MEMORY_HOTREMOVE`, and `SPARSEMEM_VMEMMAP`. Makes sense. I'll enable those. And for this testing, it looks like I need: * `TEST_HMM` * `DEVICE_PRIVATE` * `ZONE_DEVICE` * `MEMORY_HOTPLUG` * `MEMORY_HOTREMOVE` * `SPARSEMEM_VMEMMAP` * `TRANSPARENT_HUGEPAGE` Wait, there are also some changes related to `drm_pagemap.c`. Right. If I want to exercise those, I need to enable `DRM_GPUSVM` and `DRM_XE`. The problem is `xe` requires actual physical hardware. I remember we checked before. It appears only `xe` and `drm_gpusvm.c` itself uses `drm_pagemap.c`. That means `drm_pagemap.c` is not reachable in my QEMU setup. So, I'm going to shift my focus. `mm/migrate_device.c` looks promising because `test_hmm` can exercise it. I should concentrate on the functions in `mm/migrate_device.c`. Specifically these functions: * `migrate_vma_split_pmd_one` * `migrate_vma_split_pmd_mappings` * `migrate_vma_split_unmapped_folio` * `__migrate_device_pages` Hold on a second. It seems that `__migrate_device_pages`, `migrate_vma_split_pmd_mappings`, and `migrate_vma_split_unmapped_folio` are all static. That means the non-static entry points are: * `migrate_device_pages` * `migrate_vma_setup` * `migrate_vma_finalize` I need to check `mm/migrate_device.c` to verify these exported functions. |
| 38/2 | 2026/08/05 13:29 | tool | grepper |
0mArgs:{
"Expression": "EXPORT_SYMBOL",
"PathPrefix": "mm/migrate_device.c"
}Results: {
"Output": "mm/migrate_device.c=730=int migrate_vma_setup(struct migrate_vma *args)\n--\nmm/migrate_device.c-769-}\nmm/migrate_device.c:770:EXPORT_SYMBOL(migrate_vma_setup);\nmm/migrate_device.c-771-\n--\nmm/migrate_device.c=1340=void migrate_device_pages(unsigned long *src_pfns, unsigned long *dst_pfns,\n--\nmm/migrate_device.c-1344-}\nmm/migrate_device.c:1345:EXPORT_SYMBOL(migrate_device_pages);\nmm/migrate_device.c-1346-\n--\nmm/migrate_device.c=1355=void migrate_vma_pages(struct migrate_vma *migrate)\n--\nmm/migrate_device.c-1358-}\nmm/migrate_device.c:1359:EXPORT_SYMBOL(migrate_vma_pages);\nmm/migrate_device.c-1360-\n--\nmm/migrate_device.c=1423=void migrate_device_finalize(unsigned long *src_pfns,\n--\nmm/migrate_device.c-1427-}\nmm/migrate_device.c:1428:EXPORT_SYMBOL(migrate_device_finalize);\nmm/migrate_device.c-1429-\n--\nmm/migrate_device.c=1441=void migrate_vma_finalize(struct migrate_vma *migrate)\n--\nmm/migrate_device.c-1445-}\nmm/migrate_device.c:1446:EXPORT_SYMBOL(migrate_vma_finalize);\nmm/migrate_device.c-1447-\n--\nmm/migrate_device.c=1483=int migrate_device_range(unsigned long *src_pfns, unsigned long start,\n--\nmm/migrate_device.c-1507-}\nmm/migrate_device.c:1508:EXPORT_SYMBOL(migrate_device_range);\nmm/migrate_device.c-1509-\n--\nmm/migrate_device.c=1518=int migrate_device_pfns(unsigned long *src_pfns, unsigned long npages)\n--\nmm/migrate_device.c-1540-}\nmm/migrate_device.c:1541:EXPORT_SYMBOL(migrate_device_pfns);\nmm/migrate_device.c-1542-\n"
} |
| 39/2 | 2026/08/05 13:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 71827 output: 33 thoughts: 150 Thoughts: **Analyzing the Patch's Impact on Page Migration** Okay, so this patch is modifying `__migrate_device_pages`, which is directly called by both `migrate_device_pages` and `migrate_vma_pages`. Immediately, I see that these two functions, `migrate_device_pages` and `migrate_vma_pages`, need to be included in `FocusSymbols`. Those are definitely the initial entry points to consider. But, hold on... the patch also introduces `migrate_vma_split_pmd_mappings`. Hmm, interesting. It looks like `migrate_vma_split_pmd_mappings` is called by `migrate_vma_split_unmapped_folio`, which in turn is called from within `__migrate_device_pages`. This confirms that `migrate_device_pages` and `migrate_vma_pages` are the key entry points. They're the top-level functions we need to really focus on for the overall behavior. Now, just to be absolutely sure, let me quickly double-check if `migrate_vma_pages` is actually used anywhere in `test_hmm`. Just a quick scan to make sure there aren't any unexpected interactions. |
| 40/2 | 2026/08/05 13:29 | tool | grepper |
0mArgs:{
"Expression": "migrate_vma_pages",
"PathPrefix": "lib/test_hmm.c"
}Results: {
"Output": "lib/test_hmm.c=1004=static vm_fault_t dmirror_devmem_fault_alloc_and_copy(struct migrate_vma *args,\n--\nlib/test_hmm.c-1075-\t\t\t\t\t/* Clear remaining dst entries to avoid\nlib/test_hmm.c:1076:\t\t\t\t\t * migrate_vma_pages/finalize() using\nlib/test_hmm.c-1077-\t\t\t\t\t * uninitialized values.\n--\nlib/test_hmm.c=1120=static int dmirror_migrate_to_system(struct dmirror *dmirror,\n--\nlib/test_hmm.c-1175-\nlib/test_hmm.c:1176:\t\tmigrate_vma_pages(\u0026args);\nlib/test_hmm.c-1177-\t\tcmd-\u003ecpages += dmirror_successful_migrated_pages(\u0026args);\n--\nlib/test_hmm.c=1189=static int dmirror_migrate_to_device(struct dmirror *dmirror,\n--\nlib/test_hmm.c-1248-\t\tdmirror_migrate_alloc_and_copy(\u0026args, dmirror);\nlib/test_hmm.c:1249:\t\tmigrate_vma_pages(\u0026args);\nlib/test_hmm.c-1250-\t\tdmirror_migrate_finalize_and_map(\u0026args, dmirror);\n--\nlib/test_hmm.c=1653=static vm_fault_t dmirror_devmem_fault(struct vm_fault *vmf)\n--\nlib/test_hmm.c-1718-\t}\nlib/test_hmm.c:1719:\tmigrate_vma_pages(\u0026args);\nlib/test_hmm.c-1720-\t/*\n"
} |
| 41/2 | 2026/08/05 13:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 72719 output: 34 thoughts: 284 Thoughts: **My Analysis of Test Coverage** Okay, so I see that `test_hmm` *does* leverage both `migrate_vma_pages` and `migrate_device_pages`. Excellent. This means the modifications within `mm/migrate_device.c` are demonstrably covered and can be thoroughly tested through `test_hmm`. That's the core of what I wanted to confirm. Let's nail down the configuration prerequisites. We need these to be set: * `TEST_HMM` * `DEVICE_PRIVATE` * `TRANSPARENT_HUGEPAGE` * `ZONE_DEVICE` * `MEMORY_HOTPLUG` * `MEMORY_HOTREMOVE` * `SPARSEMEM_VMEMMAP` Hold on a second...I'm also seeing changes touching `drm_pagemap.c` in the diff. Is that code path actually exercised? We know that `drm_pagemap.c` compiles when `CONFIG_ZONE_DEVICE` is enabled, and when `drm_gpusvm_helper-y` is also selected. Right, and `drm_gpusvm_helper-y` is set when `CONFIG_DRM_GPUSVM` is enabled. Ah, and `CONFIG_DRM_GPUSVM` is, in turn, selected by `DRM_XE`. The question is, can we enable `DRM_GPUSVM` independently of `DRM_XE`? I need to look into this more carefully, so I'll check `drivers/gpu/drm/Kconfig` to see the dependencies of `DRM_GPUSVM`. This is crucial to see if it makes sense to add new test cases or modify existing ones to more thoroughly test this part of the code base. |
| 42/2 | 2026/08/05 13:29 | tool | grepper |
0mArgs:{
"Expression": "config DRM_GPUSVM",
"PathPrefix": "drivers/gpu/drm/Kconfig"
}Results: {
"Output": "drivers/gpu/drm/Kconfig=221=config RUST_DRM_GPUVM\n--\ndrivers/gpu/drm/Kconfig-227-\ndrivers/gpu/drm/Kconfig:228:config DRM_GPUSVM\ndrivers/gpu/drm/Kconfig-229-\ttristate\n"
} |
| 43/2 | 2026/08/05 13:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 73517 output: 20 thoughts: 35 Thoughts: Okay, here's my interpretation of those thoughts, framed as my own: **Analyzing a Tristate Dependency** Alright, this looks like a tristate config option, and critically, it's *unprompted*. That means it won't be directly exposed to the user in a configuration menu. It's only going to be enabled by *another* configuration option selecting it. So, I need to figure out the dependencies. The key here is to find what's driving this `DRM_GPUSVM` selection. Let's dig into the other configs and see what's directly or indirectly turning that feature on. Gotta trace the upstream dependencies. |
| 44/2 | 2026/08/05 13:30 | tool | grepper |
0mArgs:{
"Expression": "select DRM_GPUSVM"
}Results: {
"Output": "drivers/gpu/drm/xe/Kconfig=2=config DRM_XE\n--\ndrivers/gpu/drm/xe/Kconfig-41-\tselect DRM_EXEC\ndrivers/gpu/drm/xe/Kconfig:42:\tselect DRM_GPUSVM if !UML\ndrivers/gpu/drm/xe/Kconfig-43-\tselect DRM_GPUVM\n--\ndrivers/gpu/drm/xe/Kconfig=79=config DRM_XE_GPUSVM\n--\ndrivers/gpu/drm/xe/Kconfig-85-\tselect DEVICE_PRIVATE\ndrivers/gpu/drm/xe/Kconfig:86:\tselect DRM_GPUSVM\ndrivers/gpu/drm/xe/Kconfig-87-\thelp\n"
} |
| 45/2 | 2026/08/05 13:30 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 73898 output: 32 thoughts: 556 Thoughts: **My Fuzzing Strategy for This Patch** Okay, so I've got this patch here and I need to figure out the best way to fuzz it effectively. I see that only `DRM_XE` and `DRM_XE_GPUSVM` are selecting it, which complicates things since I can't easily enable the feature on its own. `DRM_XE` depends on PCI hardware, so that's a no-go for QEMU. However, the *core* memory management changes are accessible via `test_hmm` in `mm/migrate_device.c`. That's the key. This means the patch is functionally sound and worth fuzzing, but I'll need to focus on those MM functions and enable `TEST_HMM`. Let's start by reviewing the initial `FocusSymbols` I identified. Hmm, I had `migrate_device_pages`, `migrate_vma_pages`, and `migrate_vma_setup`. Wait a minute, `migrate_vma_setup` isn't even *modified* in this patch, so let's cross that off the list. The functions that are modified are `migrate_vma_split_pmd_one` (static), `migrate_vma_split_pmd_mappings` (static), `migrate_vma_split_unmapped_folio` (static), and `__migrate_device_pages` (static). The non-static callers are: `migrate_device_pages` and `migrate_vma_pages`. Therefore, the updated `FocusSymbols` should be: `migrate_device_pages` and `migrate_vma_pages`. I'll need to verify that `migrate_vma_split_unmapped_folio` is actually called by something else. Oh, it is. It's called by `__migrate_device_pages`, which in turn, is called by `migrate_device_pages` and `migrate_vma_pages`. Good. Those are my targets. Now, are there any other exported functions I need to consider? No. So, those two functions are the key points to fuzz. Now, let's double-check the configuration options. I've got `TEST_HMM`, `DEVICE_PRIVATE`, `TRANSPARENT_HUGEPAGE`, `ZONE_DEVICE`, `MEMORY_HOTPLUG`, `MEMORY_HOTREMOVE`, and `SPARSEMEM_VMEMMAP`. Wait, `MEMORY_HOTREMOVE` is usually enabled by default if `MEMORY_HOTPLUG` is. Does `TRANSPARENT_HUGEPAGE` require `TRANSPARENT_HUGEPAGE_ALWAYS` or something else? No, `TRANSPARENT_HUGEPAGE` is a bool or tristate. I will double-check `mm/Kconfig` to be absolutely sure. |
| 46/2 | 2026/08/05 13:30 | tool | grepper |
0mArgs:{
"Expression": "config TRANSPARENT_HUGEPAGE",
"PathPrefix": "mm/Kconfig"
}Results: {
"Output": "mm/Kconfig=843=config MM_ID\n--\nmm/Kconfig-845-\nmm/Kconfig:846:menuconfig TRANSPARENT_HUGEPAGE\nmm/Kconfig-847-\tbool \"Transparent Hugepage Support\"\n--\nmm/Kconfig=864=choice\n--\nmm/Kconfig-869-\nmm/Kconfig:870:\tconfig TRANSPARENT_HUGEPAGE_ALWAYS\nmm/Kconfig-871-\t\tbool \"always\"\n--\nmm/Kconfig-876-\nmm/Kconfig:877:\tconfig TRANSPARENT_HUGEPAGE_MADVISE\nmm/Kconfig-878-\t\tbool \"madvise\"\n--\nmm/Kconfig-885-\nmm/Kconfig:886:\tconfig TRANSPARENT_HUGEPAGE_NEVER\nmm/Kconfig-887-\t\tbool \"never\"\n--\nmm/Kconfig=893=choice\n--\nmm/Kconfig-902-\nmm/Kconfig:903:\tconfig TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER\nmm/Kconfig-904-\t\tbool \"never\"\n--\nmm/Kconfig-912-\nmm/Kconfig:913:\tconfig TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ALWAYS\nmm/Kconfig-914-\t\tbool \"always\"\n--\nmm/Kconfig-920-\nmm/Kconfig:921:\tconfig TRANSPARENT_HUGEPAGE_SHMEM_HUGE_WITHIN_SIZE\nmm/Kconfig-922-\t\tbool \"within_size\"\n--\nmm/Kconfig-928-\nmm/Kconfig:929:\tconfig TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ADVISE\nmm/Kconfig-930-\t\tbool \"advise\"\n--\nmm/Kconfig=938=choice\n--\nmm/Kconfig-947-\nmm/Kconfig:948:\tconfig TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER\nmm/Kconfig-949-\t\tbool \"never\"\n--\nmm/Kconfig-956-\nmm/Kconfig:957:\tconfig TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ALWAYS\nmm/Kconfig-958-\t\tbool \"always\"\n--\nmm/Kconfig-964-\nmm/Kconfig:965:\tconfig TRANSPARENT_HUGEPAGE_TMPFS_HUGE_WITHIN_SIZE\nmm/Kconfig-966-\t\tbool \"within_size\"\n--\nmm/Kconfig-972-\nmm/Kconfig:973:\tconfig TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ADVISE\nmm/Kconfig-974-\t\tbool \"advise\"\n"
} |
| 47/2 | 2026/08/05 13:30 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 75814 output: 190 thoughts: 578 Thoughts: **My Analysis of the Device Memory Migration Patch** Okay, so I've been reviewing this patch concerning device memory migration and THP splitting. First things first: enabling `TRANSPARENT_HUGEPAGE` is definitely a key requirement here. Let's make that a primary target. The core of the fix is in `mm/migrate_device.c`. It's addressing a subtle issue where `migrate_device_unmap()` wasn't properly handling THP splitting during migration, specifically when a folio (huge page) mapped in multiple VMAs ends up with orphaned huge PMD entries after a split. `folio_split_unmapped()` only considers refcount, and this can lead to memory corruption. This is a functional correctness issue that's core to the MM and is definitely something we need to validate rigorously. Good news: the code is reachable through `test_hmm` pseudo-device driver, which is perfect for fuzzing. We can use it to create the conditions necessary to expose this THP split issue. The changes to `drm_pagemap.c` are also functional, but they seem specific to the Intel Xe GPU and, therefore, less of an immediate focus for general testing. So, for testing, I'm thinking: * Enable `TEST_HMM` - We'll need this to make the test harness. It's a tristate, but listing it in Kbuild should enable it. * `DEVICE_PRIVATE` - This seems reasonable, required to get some of the functionality in the driver. * `ZONE_DEVICE` - Also necessary to properly create and use the device memory. * `TRANSPARENT_HUGEPAGE` - As mentioned, crucial. I'm zeroing in on `migrate_device_pages` and `migrate_vma_pages` as the main focus of testing and fuzzing effort. The patch includes the `drm_pagemap_fault_inject_folio` function which uses `FAULT_INJECTION`. However, since the changes to `drm_pagemap.c` are not reachable, and the fault injection functionality could potentially make the tests much more complex, I'm going to hold off on adding that. It would be helpful, but it introduces an extra layer. Let's keep the focus on the MM. I've got the configs lined up, the core MM functions identified, and the testing environment defined. I think we're ready to proceed with a focused fuzzing campaign. |
| 48/2 | 2026/08/05 13:30 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"TEST_HMM",
"DEVICE_PRIVATE",
"ZONE_DEVICE",
"TRANSPARENT_HUGEPAGE"
],
"FocusSymbols": [
"migrate_device_pages",
"migrate_vma_pages"
],
"Reasoning": "The patch modifies core MM device migration logic (mm/migrate_device.c) to properly handle THP (Transparent Huge Pages) splitting during device memory migration. This code is reachable and can be fuzzed using the test_hmm pseudo-device driver, which is designed specifically to test HMM and device memory migration. The changes in drm_pagemap.c are specific to the DRM GPU SVM helper and likely require physical GPU hardware (like Intel Xe), but the core MM changes are hardware-independent and fully testable in a virtualized environment.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"TEST_HMM",
"DEVICE_PRIVATE",
"ZONE_DEVICE",
"TRANSPARENT_HUGEPAGE"
],
"FocusSymbols": [
"migrate_device_pages",
"migrate_vma_pages"
],
"Reasoning": "The patch modifies core MM device migration logic (mm/migrate_device.c) to properly handle THP (Transparent Huge Pages) splitting during device memory migration. This code is reachable and can be fuzzed using the test_hmm pseudo-device driver, which is designed specifically to test HMM and device memory migration. The changes in drm_pagemap.c are specific to the DRM GPU SVM helper and likely require physical GPU hardware (like Intel Xe), but the core MM changes are hardware-independent and fully testable in a virtualized environment.",
"WorthFuzzing": true
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|