Remove device private pages from physical address space
Subsystems (26)
v6 cover Remove device private pages from physical address space
Introduction
------------
The existing design of device private memory imposes limitations which render it non functional for certain systems and configurations where the physical address space is limited.
Limited available address space
-------------------------------
Device private memory is implemented by first reserving a region of the physical address space. This is a problem. The physical address space is not a resource that is directly under the kernel's control. Availability of suitable physical address space is constrained by the underlying hardware and firmware and may not always be available.
Device private memory assumes that it will be able to reserve a device memory sized chunk of physical address space. However, there is nothing guaranteeing that this will succeed, and there a number of factors that increase the likelihood of failure. We need to consider what else may exist in the physical address space. It is observed that certain VM configurations place very large PCI windows immediately after RAM. Large enough that there is no physical address space available at all for device private memory. This is more likely to occur on 43 bit physical width systems which have less physical address space.
The fundamental issue is the physical address space is not a resource the kernel can rely on being to allocate from at will.
New implementation
------------------
This series changes device private memory so that it does not require allocation of physical address space and these problems are avoided. Instead of using the physical address space, we introduce a "device private address space" and allocate from there.
A consequence of placing the device private pages outside of the physical address space is that they no longer have a PFN. However, it is still necessary to be able to look up a corresponding device private page from a device private PTE entry, which means that we still require some way to index into this device private address space. Instead of a PFN, device private pages use an offset into this device private address space to look up device private struct pages.
The problem that then needs to be addressed is how to avoid confusing these device private offsets with PFNs. It is the limited usage of the device private pages themselves which make this possible. A device private page is only used for userspace mappings, we do not need to be concerned with them being used within the mm more broadly. This means that the only way that the core kernel looks up these pages is via the page table, where their PTE already indicates if they refer to a device private page via their swap type, e.g. SWP_DEVICE_WRITE. We can use this information to determine if the PTE contains a PFN which should be looked up in the page map, or a device private offset which should be looked up elsewhere.
This applies when we are creating PTE entries for device private pages - because they have their own type there are already must be handled separately, so it is a small step to convert them to a device private PFN now too.
The first part of the series updates callers where device private offsets might now be encountered to track this extra state.
The last patch contains the bulk of the work where we change how we convert between device private pages to device private offsets and then use a new interface for allocating device private pages without the need for reserving physical address space.
By removing the device private pages from the physical address space, this series also opens up the possibility to moving away from tracking device private memory using struct pages in the future. This is desirable as on systems with large amounts of memory these device private struct pages use a signifiant amount of memory and take a significant amount of time to initialize.
Changes in v6
-------------
- Fix maybe unused in kgd2kfd_init_zone_device()
- Replace division by PAGE_SIZE with DIV_ROUND_UP() when setting nr_pages. This mirrors the align up that previously happened in get_free_mem_region()
Note removed previous discussion in the cover letter relating to aarch64 and memremap_pages() as this was actually already addressed in commit eeb8fdfcf090 ("arm64: Expose the end of the linear map in PHYSMEM_END").
Testing:
- selftests/mm/hmm-tests on an amd64 VM
Revisions:
- RFC: https://lore.kernel.org/all/[email protected]/
- v1: https://lore.kernel.org/all/[email protected]/
- v2: https://lore.kernel.org/all/[email protected]/
- v3: https://lore.kernel.org/all/[email protected]/
- v4: https://lore.kernel.org/all/[email protected]/
- v5: https://lore.kernel.org/all/[email protected]/
Jordan Niethe (13):
mm/migrate_device: Introduce migrate_pfn_from_page() helper drm/amdkfd: Use migrate pfns internally
mm/migrate_device: Make migrate_device_{pfns,range}() take mpfns mm/migrate_device: Add migrate PFN flag to track device private pages mm/page_vma_mapped: Add flag to page_vma_mapped_walk::flags to track
device private pages
mm: Add helpers to create migration entries from struct pages
mm: Add a new swap type for migration entries of device private pages
mm: Add softleaf support for device private migration entries
mm: Begin creating device private migration entries
mm: Add helpers to create device private entries from struct pages mm/util: Add flag to track device private pages in page snapshots mm/hmm: Add flag to track device private pages
mm: Remove device private pages from the physical address space
Documentation/mm/hmm.rst | 11 +- arch/powerpc/kvm/book3s_hv_uvmem.c | 43 ++--- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 45 +++--- drivers/gpu/drm/amd/amdkfd/kfd_migrate.h | 2 +- drivers/gpu/drm/drm_pagemap.c | 11 +- drivers/gpu/drm/nouveau/nouveau_dmem.c | 45 ++---- drivers/gpu/drm/xe/xe_svm.c | 39 ++--- fs/proc/page.c | 6 +- include/drm/drm_pagemap.h | 8 +- include/linux/hmm.h | 7 +- include/linux/leafops.h | 120 ++++++++++++-- include/linux/memremap.h | 64 +++++++- include/linux/migrate.h | 23 ++- include/linux/mm.h | 9 +- include/linux/rmap.h | 29 +++- include/linux/swap.h | 8 +- include/linux/swapops.h | 100 ++++++++++++ lib/test_hmm.c | 87 ++++++---- mm/debug.c | 9 +- mm/hmm.c | 5 +- mm/huge_memory.c | 43 ++--- mm/hugetlb.c | 15 +- mm/memory.c | 5 +- mm/memremap.c | 196 ++++++++++++++++++----- mm/migrate.c | 6 +- mm/migrate_device.c | 76 +++++---- mm/mm_init.c | 8 +- mm/mprotect.c | 10 +- mm/page_vma_mapped.c | 26 ++- mm/rmap.c | 59 ++++--- mm/util.c | 8 +- mm/vmscan.c | 2 +- 32 files changed, 783 insertions(+), 342 deletions(-)
drm-tip:
base-commit: 23427233a45136e0f56ae07abc0905ddc5a70dd6
Signature · 1 line
2.34.1
PATCH v6 1/13 mm/migrate_device: Introduce migrate_pfn_from_page() helper
To create a migrate entry from a given struct page, that page is first converted to its pfn, before passing the pfn to migrate_pfn().
A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have a pfn and must be handled separately.
Prepare for this with a new helper:
- migrate_pfn_from_page()
This helper takes a struct page as parameter instead of a pfn. This will allow more flexibility for handling the mpfn differently for device private pages.
---
v2: New to series
v3: No change
--- arch/powerpc/kvm/book3s_hv_uvmem.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 2 +- drivers/gpu/drm/drm_pagemap.c | 2 +- drivers/gpu/drm/nouveau/nouveau_dmem.c | 4 ++-- include/linux/migrate.h | 5 +++++ lib/test_hmm.c | 11 ++++++----- mm/migrate_device.c | 7 +++---- 7 files changed, 19 insertions(+), 14 deletions(-)
arch/powerpc/kvm/book3s_hv_uvmem.c +1 -1
@@ -784,7 +784,7 @@ static int kvmppc_svm_page_in(struct vm_area_struct *vma, } } - *mig.dst =migrate_pfn (page_to_pfn (dpage)); + *mig.dst =migrate_pfn_from_page (dpage);migrate_vma_pages (&mig); out_finalize:migrate_vma_finalize (&mig);
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +1 -1
@@ -652,7 +652,7 @@ svm_migrate_copy_to_ram(struct amdgpu_device *adev, struct svm_range *prange,pr_debug_ratelimited ("dma mapping dst to 0x%llx, pfn 0x%lx\n" , dst[i] >>PAGE_SHIFT ,page_to_pfn (dpage)); - migrate->dst[i] =migrate_pfn (page_to_pfn (dpage)); + migrate->dst[i] =migrate_pfn_from_page (dpage); j++; }
drivers/gpu/drm/drm_pagemap.c +1 -1
@@ -742,7 +742,7 @@ static int drm_pagemap_migrate_populate_ram_pfn(struct vm_area_struct *vas, goto free_pages; page =folio_page (folio,0 ); - mpfn[i] =migrate_pfn (page_to_pfn (page)); + mpfn[i] =migrate_pfn_from_page (page); next:if (page)
drivers/gpu/drm/nouveau/nouveau_dmem.c +2 -2
@@ -249,7 +249,7 @@ static vm_fault_t nouveau_dmem_migrate_to_ram(struct vm_fault *vmf) goto done; } - args.dst[0 ] =migrate_pfn (page_to_pfn (dpage)); + args.dst[0 ] =migrate_pfn_from_page (dpage);if (order) args.dst[0 ] |=MIGRATE_PFN_COMPOUND ; dfolio =page_folio (dpage);
@@ -766,7 +766,7 @@ static unsigned long nouveau_dmem_migrate_copy_one(struct nouveau_drm *drm, ((paddr >>PAGE_SHIFT ) <<NVIF_VMM_PFNMAP_V0_ADDR_SHIFT );if (src &MIGRATE_PFN_WRITE ) *pfn |=NVIF_VMM_PFNMAP_V0_W ; - mpfn =migrate_pfn (page_to_pfn (dpage)); + mpfn =migrate_pfn_from_page (dpage);if (folio_order (page_folio (dpage))) mpfn |=MIGRATE_PFN_COMPOUND ;return mpfn;
include/linux/migrate.h +5 -0
@@ -140,6 +140,11 @@ static inline unsigned long migrate_pfn(unsigned long pfn)return (pfn <<MIGRATE_PFN_SHIFT ) |MIGRATE_PFN_VALID ; } +static inline unsigned long migrate_pfn_from_page (struct page *page) +{ +return migrate_pfn (page_to_pfn (page)); +} +enum migrate_vma_direction {MIGRATE_VMA_SELECT_SYSTEM =1 <<0 ,MIGRATE_VMA_SELECT_DEVICE_PRIVATE =1 <<1 ,
lib/test_hmm.c +6 -5
@@ -729,7 +729,8 @@ static void dmirror_migrate_alloc_and_copy(struct migrate_vma *args, rpage =BACKING_PAGE (dpage); rpage->zone_device_data = dmirror; - *dst =migrate_pfn (page_to_pfn (dpage)) | write; + *dst =migrate_pfn_from_page (dpage) | + write; src_page =pfn_to_page (spfn + i);if (spage)
@@ -756,7 +757,7 @@ static void dmirror_migrate_alloc_and_copy(struct migrate_vma *args,pr_debug ("migrating from sys to dev pfn src: 0x%lx pfn dst: 0x%lx\n" ,page_to_pfn (spage),page_to_pfn (dpage)); - *dst =migrate_pfn (page_to_pfn (dpage)) | write; + *dst =migrate_pfn_from_page (dpage) | write;if (is_large) {int i;
@@ -991,7 +992,7 @@ static vm_fault_t dmirror_devmem_fault_alloc_and_copy(struct migrate_vma *args,if (dpage) {lock_page (dpage); - *dst |=migrate_pfn (page_to_pfn (dpage)); + *dst |=migrate_pfn_from_page (dpage); }for (i =0 ; i < (1 << order); i++) {
@@ -1002,7 +1003,7 @@ static vm_fault_t dmirror_devmem_fault_alloc_and_copy(struct migrate_vma *args,if (!dpage && order) { dpage =alloc_page_vma (GFP_HIGHUSER_MOVABLE , args->vma, addr);lock_page (dpage); - dst[i] =migrate_pfn (page_to_pfn (dpage)); + dst[i] =migrate_pfn_from_page (dpage); dst_page =pfn_to_page (page_to_pfn (dpage)); dpage =NULL ;/* For the next iteration */ }else {
@@ -1414,7 +1415,7 @@ static void dmirror_device_evict_chunk(struct dmirror_chunk *chunk)/* TODO Support splitting here */ lock_page (dpage); - dst_pfns[i] =migrate_pfn (page_to_pfn (dpage)); + dst_pfns[i] =migrate_pfn_from_page (dpage);if (src_pfns[i] &MIGRATE_PFN_WRITE ) dst_pfns[i] |=MIGRATE_PFN_WRITE ;if (order)
mm/migrate_device.c +3 -4
@@ -207,9 +207,8 @@ static int migrate_vma_collect_huge_pmd(pmd_t *pmdp, unsigned long start, .vma = walk->vma, }; -unsigned long pfn =page_to_pfn (folio_page (folio,0 )); - - migrate->src[migrate->npages] =migrate_pfn (pfn) | write + migrate->src[migrate->npages] =migrate_pfn_from_page (folio_page (folio,0 )) + | write |MIGRATE_PFN_MIGRATE |MIGRATE_PFN_COMPOUND ; migrate->dst[migrate->npages++] =0 ;
@@ -328,7 +327,7 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, goto again; } - mpfn =migrate_pfn (page_to_pfn (page)) | + mpfn =migrate_pfn_from_page (page) |MIGRATE_PFN_MIGRATE ;if (softleaf_is_device_private_write (entry)) mpfn |=MIGRATE_PFN_WRITE ;
Signature · 1 line
2.34.1
Re: [PATCH v6 01/13] mm/migrate_device: Introduce migrate_pfn_from_page() helper
Quoted 11 lines · Jordan Niethe
To create a migrate entry from a given struct page, that page is first converted to its pfn, before passing the pfn to
migrate_pfn().A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have a pfn and must be handled separately.
Prepare for this with a new helper:
-
migrate_pfn_from_page()
Quoted 8 lines
This helper takes a struct page as parameter instead of a pfn. This will allow more flexibility for handling the mpfn differently for device private pages.
Reviewed-by Balbir Singh <[email protected]>Acked-by Felix Kuehling <[email protected]>Signed-off-by Jordan Niethe <[email protected]>---
Signature · 3 lines
Cheers, David
Re: [PATCH v6 01/13] mm/migrate_device: Introduce migrate_pfn_from_page() helper
Hi,
Quoted 16 lines · David Hildenbrand (Arm)
Quoted 15 lines · Jordan Niethe
To create a migrate entry from a given struct page, that page is first converted to its pfn, before passing the pfn to
migrate_pfn().A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have a pfn and must be handled separately.
Prepare for this with a new helper:
-
migrate_pfn_from_page()This helper takes a struct page as parameter instead of a pfn. This will allow more flexibility for handling the mpfn differently for device private pages.
Quoted 6 lines
Quoted 4 lines
Reviewed-by Balbir Singh <[email protected]>Acked-by Felix Kuehling <[email protected]>Signed-off-by Jordan Niethe <[email protected]>---
Thanks David,
Jordan.
Quoted 1 line
David Hildenbrand (Arm)
maintainerRe: [PATCH v6 01/13] mm/migrate_device: Introduce migrate_pfn_from_page() helper
Quoted 25 lines · Jordan Niethe
Hi,
Quoted 22 lines · David Hildenbrand (Arm)
Quoted 11 lines · Jordan Niethe
To create a migrate entry from a given struct page, that page is first converted to its pfn, before passing the pfn to
migrate_pfn().A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have a pfn and must be handled separately.
Prepare for this with a new helper:
-
migrate_pfn_from_page()Quoted 8 lines
This helper takes a struct page as parameter instead of a pfn. This will allow more flexibility for handling the mpfn differently for device private pages.
Reviewed-by Balbir Singh <[email protected]>Acked-by Felix Kuehling <[email protected]>Signed-off-by Jordan Niethe <[email protected]>---
I'll go through he remainder of the patchset this week.
While skimming over patch #2, I was wondering whether "page_to_migration_pfn()" would better fit "migration_pfn_to_page".
... and I was wondering why that code deals with pages instead of folios.
E.g.,
page = folio_page(folio, 0); mpfn[i] = migrate_pfn_from_page(page);
Should just be
mpfn[i] = folio_to_migration_pfn(folio);
Right?
Signature · 3 lines
Cheers, David
Re: [PATCH v6 01/13] mm/migrate_device: Introduce migrate_pfn_from_page() helper
Hi
Quoted 20 lines · David Hildenbrand (Arm)
Quoted 19 lines · Jordan Niethe
Hi,
Quoted 16 lines · David Hildenbrand (Arm)
Quoted 15 lines · Jordan Niethe
To create a migrate entry from a given struct page, that page is first converted to its pfn, before passing the pfn to
migrate_pfn().A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have a pfn and must be handled separately.
Prepare for this with a new helper:
-
migrate_pfn_from_page()This helper takes a struct page as parameter instead of a pfn. This will allow more flexibility for handling the mpfn differently for device private pages.
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Reviewed-by Balbir Singh <[email protected]>Acked-by Felix Kuehling <[email protected]>Signed-off-by Jordan Niethe <[email protected]>---
I'll go through he remainder of the patchset this week.
Much appreciated.
Quoted 3 lines
While skimming over patch #2, I was wondering whether "
page_to_migration_pfn()" would better fit "migration_pfn_to_page".
I guess you were thinking about migration_pfn_/from/_page() rather than "migration_pfn_to_page()"? Renaming it to page_to_migration_pfn() would be fine.
Quoted 6 lines
... and I was wondering why that code deals with pages instead of folios.
E.g.,
Quoted 8 lines
page = folio_page(folio, 0); mpfn[i] = migrate_pfn_from_page(page);Should just be
mpfn[i] = folio_to_migration_pfn(folio);Right?
This patch is quite limited, essentially just converts usages of migrate_pfn(page_to_pfn()) to migration_pfn_from_page(). However, I agree, there could be scope for moving some of those usages to folios.
Was that example from drm_pagemap_migrate_populate_ram_pfn()? There 'page' goes on to be used elsewhere in the function so we'd need some further refactoring to fully benefit.
I see migrate_vma_collect_huge_pmd() as a candidate for a folio_to_migration_pfn() function too.
Thanks,
Jordan.
Quoted 1 line
David Hildenbrand (Arm)
maintainerRe: [PATCH v6 01/13] mm/migrate_device: Introduce migrate_pfn_from_page() helper
Quoted 12 lines · Jordan Niethe
Hi
Quoted 5 lines · David Hildenbrand (Arm)
Quoted 2 lines · Jordan Niethe
Hi,
I'll go through he remainder of the patchset this week.
Much appreciated.
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
While skimming over patch #2, I was wondering whether "
page_to_migration_pfn()" would better fit "migration_pfn_to_page".I guess you were thinking about migration_pfn_/from/_page() rather than "
migration_pfn_to_page()"? Renaming it topage_to_migration_pfn()would be fine.
Yes. :)
page_to_migration_pfn() and migration_pfn_to_page()
But really, we should only be dealing with folio migration longterm ...
Quoted 20 lines
Quoted 7 lines
... and I was wondering why that code deals with pages instead of folios.
E.g.,
Quoted 8 lines
page =
folio_page(folio, 0);
mpfn[i] =migrate_pfn_from_page(page);Should just be
mpfn[i] =
folio_to_migration_pfn(folio);Right?
This patch is quite limited, essentially just converts usages of migrate_pfn(page_to_pfn()) to migration_pfn_from_page(). However, I agree, there could be scope for moving some of those usages to folios.
Quoted 6 lines
Was that example from drm_pagemap_migrate_populate_ram_pfn()? There 'page' goes on to be used elsewhere in the function so we'd need some further refactoring to fully benefit.
I see
migrate_vma_collect_huge_pmd()as a candidate for afolio_to_migration_pfn()function too.
All that code should be converted to folios (unless I am missing something important). We only support migration of folios, and all ZONE_DEVICE pages correspond to folios.
E.g., in migrate_vma_setup() we're implicitly converting from page to folio multiple times, which is rather wasteful.
Now, I don't think the conversion is your responsibility :)
But you'd provide the folio helpers and use them where we can already.
I'm fine with leaving the code the still operates purely on page to be converted later.
Signature · 3 lines
Cheers, David
PATCH v6 2/13 drm/amdkfd: Use migrate pfns internally
In reply to Jordan NietheA future change will remove device private pages from the physical address space. This will mean that device private pages no longer have a pfn.
A MIGRATE_PFN flag will be introduced that distinguishes between mpfns that contain a pfn vs an offset into device private memory.
Replace usages of pfns and page_to_pfn() with mpfns and migrate_pfn_to_page() to prepare for handling this distinction. This will assist in continuing to use the same code paths for both MEMORY_DEVICE_PRIVATE and MEMORY_DEVICE_COHERENT devices.
---
v2:
- New to series
v3:
- No change
v4:
- No change
--- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 15 +++++++-------- drivers/gpu/drm/amd/amdkfd/kfd_migrate.h | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +7 -8
@@ -210,17 +210,17 @@ svm_migrate_copy_done(struct amdgpu_device *adev, struct dma_fence *mfence) }unsigned long -svm_migrate_addr_to_pfn (struct amdgpu_device *adev,unsigned long addr) +svm_migrate_addr_to_mpfn (struct amdgpu_device *adev,unsigned long addr) { -return (addr + adev->kfd.pgmap.range.start) >>PAGE_SHIFT ; +return migrate_pfn ((addr + adev->kfd.pgmap.range.start) >>PAGE_SHIFT ); }static void -svm_migrate_get_vram_page (struct svm_range *prange,unsigned long pfn) +svm_migrate_get_vram_page (struct svm_range *prange,unsigned long mpfn) {struct page *page; - page =pfn_to_page (pfn); + page =migrate_pfn_to_page (mpfn);svm_range_bo_ref (prange->svm_bo); page->zone_device_data = prange->svm_bo;zone_device_page_init (page,page_pgmap (page),0 );
@@ -231,7 +231,7 @@ svm_migrate_put_vram_page(struct amdgpu_device *adev, unsigned long addr) {struct page *page; - page =pfn_to_page (svm_migrate_addr_to_pfn (adev, addr)); + page =migrate_pfn_to_page (svm_migrate_addr_to_mpfn (adev, addr));unlock_page (page);put_page (page); }
@@ -241,7 +241,7 @@ svm_migrate_addr(struct amdgpu_device *adev, struct page *page) {unsigned long addr; - addr =page_to_pfn (page) <<PAGE_SHIFT ; + addr = (migrate_pfn_from_page (page) >>MIGRATE_PFN_SHIFT ) <<PAGE_SHIFT ;return (addr - adev->kfd.pgmap.range.start); }
@@ -307,9 +307,8 @@ svm_migrate_copy_to_vram(struct kfd_node *node, struct svm_range *prange,if (migrate->src[i] &MIGRATE_PFN_MIGRATE ) { dst[i] = cursor.start + (j <<PAGE_SHIFT ); - migrate->dst[i] =svm_migrate_addr_to_pfn (adev, dst[i]); + migrate->dst[i] =svm_migrate_addr_to_mpfn (adev, dst[i]);svm_migrate_get_vram_page (prange, migrate->dst[i]); - migrate->dst[i] =migrate_pfn (migrate->dst[i]); mpages++; } spage =migrate_pfn_to_page (migrate->src[i]);
drivers/gpu/drm/amd/amdkfd/kfd_migrate.h +1 -1
@@ -48,7 +48,7 @@ int svm_migrate_vram_to_ram(struct svm_range *prange, struct mm_struct *mm, uint32_t trigger, struct page *fault_page);unsigned long -svm_migrate_addr_to_pfn (struct amdgpu_device *adev,unsigned long addr); +svm_migrate_addr_to_mpfn (struct amdgpu_device *adev,unsigned long addr);#endif /* IS_ENABLED(CONFIG_HSA_AMD_SVM) */
Signature · 1 line
2.34.1
David Hildenbrand (Arm)
maintainerRe: [PATCH v6 02/13] drm/amdkfd: Use migrate pfns internally
Quoted 32 lines · Jordan Niethe
A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have a pfn.
A
MIGRATE_PFNflag will be introduced that distinguishes between mpfns that contain a pfn vs an offset into device private memory.Replace usages of pfns and
page_to_pfn()with mpfns andmigrate_pfn_to_page()to prepare for handling this distinction. This will assist in continuing to use the same code paths for bothMEMORY_DEVICE_PRIVATEandMEMORY_DEVICE_COHERENTdevices.Acked-by Balbir Singh <[email protected]>Reviewed-by Felix Kuehling <[email protected]>Signed-off-by Jordan Niethe <[email protected]>---
v2:
- New to series
v3:
- No change
v4:
- No change--- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 15 +++++++-------- drivers/gpu/drm/amd/amdkfd/kfd_migrate.h | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +0
-0
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c svm_migrate_copy_done(struct amdgpu_device *adev, struct dma_fence *mfence) · line 216
Quoted 9 lines
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +2
-2@@ -210,17 +210,17 @@ svm_migrate_copy_done(struct amdgpu_device *adev, struct dma_fence *mfence) }unsigned long -svm_migrate_addr_to_pfn (struct amdgpu_device *adev,unsigned long addr) +svm_migrate_addr_to_mpfn (struct amdgpu_device *adev,unsigned long addr) { -return (addr + adev->kfd.pgmap.range.start) >>PAGE_SHIFT ; +return migrate_pfn ((addr + adev->kfd.pgmap.range.start) >>PAGE_SHIFT ); }
To make it clearer that the result is a "migrate pfn" I'd call this.
svm_addr_to_migrate_pfn()
Not sure if maintainers have any other preference.
Apart from that LGTM (someone should convert this code to use folios ;) ).
Signature · 3 lines
Cheers, David
PATCH v6 3/13 mm/migrate_device: Make migrate_device_{pfns,range}() take mpfns
In reply to Jordan NietheA future change will remove device private pages from the physical address space. This will mean that device private pages no longer have a pfn.
This causes an issue for migrate_device_{pfns,range}() which take pfn parameters. Depending on if the device is MEMORY_DEVICE_PRIVATE or MEMORY_DEVICE_COHERENT will effect how that parameter should be interpreted.
A MIGRATE_PFN flag will be introduced that distinguishes between mpfns that contain a pfn vs an offset into device private memory, we will take advantage of that here.
Update migrate_device_{pfns,range}() to take a mpfn instead of pfn.
Update the users of migrate_device_{pfns,range}() to pass in an mpfn.
To support this change, update dpagemap_devmem_ops::populate_devmem_pfn() to instead return mpfns and rename accordingly.
---
v2: New to series
v3: No change
--- drivers/gpu/drm/drm_pagemap.c | 9 +++--- drivers/gpu/drm/nouveau/nouveau_dmem.c | 5 +-- drivers/gpu/drm/xe/xe_svm.c | 9 +++--- include/drm/drm_pagemap.h | 8 ++--- lib/test_hmm.c | 2 +- mm/migrate_device.c | 45 ++++++++++++++------------ 6 files changed, 41 insertions(+), 37 deletions(-)
drivers/gpu/drm/drm_pagemap.c +4 -5
@@ -505,7 +505,7 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation,mmap_assert_locked (mm); -if (!ops->populate_devmem_pfn || !ops->copy_to_devmem || +if (!ops->populate_devmem_mpfn || !ops->copy_to_devmem || !ops->copy_to_ram)return -EOPNOTSUPP ;
@@ -590,14 +590,14 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation, goto err_aborted_migration; } - err = ops->populate_devmem_pfn (devmem_allocation, npages, migrate.dst); + err = ops->populate_devmem_mpfn (devmem_allocation, npages, migrate.dst);if (err) goto err_aborted_migration; own_pages =0 ;for (i =0 ; i < npages; ++i) { -struct page *page =pfn_to_page (migrate.dst[i]); +struct page *page =migrate_pfn_to_page (migrate.dst[i]);struct page *src_page =migrate_pfn_to_page (migrate.src[i]); cur.start = i;
@@ -624,7 +624,6 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem *devmem_allocation, cur.device = dpagemap->drm->dev; pages[i] = page; } - migrate.dst[i] =migrate_pfn (migrate.dst[i]);drm_pagemap_get_devmem_page (page, zdd);/* If we switched the migrating drm_pagemap, migrate previous pages now */
@@ -979,7 +978,7 @@ int drm_pagemap_evict_to_ram(struct drm_pagemap_devmem *devmem_allocation) pagemap_addr = buf + (2 *sizeof (*src) * npages); pages = buf + (2 *sizeof (*src) +sizeof (*pagemap_addr)) * npages; - err = ops->populate_devmem_pfn (devmem_allocation, npages, src); + err = ops->populate_devmem_mpfn (devmem_allocation, npages, src);if (err) goto err_free;
drivers/gpu/drm/nouveau/nouveau_dmem.c +3 -2
@@ -483,8 +483,9 @@ nouveau_dmem_evict_chunk(struct nouveau_dmem_chunk *chunk) dst_pfns =kvcalloc (npages,sizeof (*dst_pfns),GFP_KERNEL | __GFP_NOFAIL); dma_info =kvcalloc (npages,sizeof (*dma_info),GFP_KERNEL | __GFP_NOFAIL); -migrate_device_range (src_pfns, chunk->pagemap.range.start >>PAGE_SHIFT , - npages); +migrate_device_range (src_pfns, +migrate_pfn (chunk->pagemap.range.start >>PAGE_SHIFT ), + npages);for (i =0 ; i < npages; i++) {if (src_pfns[i] &MIGRATE_PFN_MIGRATE ) {
drivers/gpu/drm/xe/xe_svm.c +5 -4
@@ -10,6 +10,7 @@#include <drm/drm_pagemap.h> #include <drm/drm_pagemap_util.h> +#include <linux/migrate.h> #include "xe_bo.h" #include "xe_exec_queue_types.h" #include "xe_gt_stats.h"
@@ -752,8 +753,8 @@ static struct drm_buddy *vram_to_buddy(struct xe_vram_region *vram)return &vram->ttm.mm; } -static int xe_svm_populate_devmem_pfn (struct drm_pagemap_devmem *devmem_allocation, -unsigned long npages,unsigned long *pfn) +static int xe_svm_populate_devmem_mpfn (struct drm_pagemap_devmem *devmem_allocation, +unsigned long npages,unsigned long *pfn) {struct xe_bo *bo =to_xe_bo (devmem_allocation);struct ttm_resource *res = bo->ttm.resource;
@@ -769,7 +770,7 @@ static int xe_svm_populate_devmem_pfn(struct drm_pagemap_devmem *devmem_allocatiint i;for (i =0 ; i <drm_buddy_block_size (buddy, block) >>PAGE_SHIFT ; ++i) - pfn[j++] = block_pfn + i; + pfn[j++] =migrate_pfn (block_pfn + i); }return 0 ;
@@ -777,7 +778,7 @@ static int xe_svm_populate_devmem_pfn(struct drm_pagemap_devmem *devmem_allocatistatic const struct drm_pagemap_devmem_ops dpagemap_devmem_ops = { .devmem_release = xe_svm_devmem_release, - .populate_devmem_pfn = xe_svm_populate_devmem_pfn, + .populate_devmem_mpfn = xe_svm_populate_devmem_mpfn, .copy_to_devmem = xe_svm_copy_to_devmem, .copy_to_ram = xe_svm_copy_to_ram, };
include/drm/drm_pagemap.h +4 -4
@@ -192,17 +192,17 @@ struct drm_pagemap_devmem_ops {void (*devmem_release)(struct drm_pagemap_devmem *devmem_allocation);/** -* @populate_devmem_pfn: Populate device memory PFN (required for migration) +* @populate_devmem_mpfn: Populate device memory PFN (required for migration) * @devmem_allocation: device memory allocation * @npages: Number of pages to populate -* @pfn: Array of page frame numbers to populate +* @mpfn: Array of migrate page frame numbers to populate * * Populate device memory page frame numbers (PFN). * * Return: 0 on success, a negative error code on failure. */ -int (*populate_devmem_pfn)(struct drm_pagemap_devmem *devmem_allocation, -unsigned long npages,unsigned long *pfn); +int (*populate_devmem_mpfn)(struct drm_pagemap_devmem *devmem_allocation, +unsigned long npages,unsigned long *pfn);/** * @copy_to_devmem: Copy to device memory (required for migration)
lib/test_hmm.c +1 -1
@@ -1391,7 +1391,7 @@ static void dmirror_device_evict_chunk(struct dmirror_chunk *chunk) src_pfns =kvcalloc (npages,sizeof (*src_pfns),GFP_KERNEL | __GFP_NOFAIL); dst_pfns =kvcalloc (npages,sizeof (*dst_pfns),GFP_KERNEL | __GFP_NOFAIL); -migrate_device_range (src_pfns, start_pfn, npages); +migrate_device_range (src_pfns,migrate_pfn (start_pfn), npages);for (i =0 ; i < npages; i++) {struct page *dpage, *spage;
mm/migrate_device.c +24 -21
108 lines not on this page · raw message
Signature · 1 line
2.34.1
David Hildenbrand (Arm)
maintainerRe: [PATCH v6 03/13] mm/migrate_device: Make migrate_device_{pfns,range}() take mpfns
Quoted 21 lines · Jordan Niethe
A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have a pfn.
This causes an issue for migrate_device_{pfns,range}() which take pfn parameters. Depending on if the device is
MEMORY_DEVICE_PRIVATEorMEMORY_DEVICE_COHERENTwill effect how that parameter should be interpreted.A
MIGRATE_PFNflag will be introduced that distinguishes between mpfns that contain a pfn vs an offset into device private memory, we will take advantage of that here.Update migrate_device_{pfns,range}() to take a mpfn instead of pfn.
Update the users of migrate_device_{pfns,range}() to pass in an mpfn.
To support this change, update
dpagemap_devmem_ops::populate_devmem_pfn()to instead return mpfns and rename accordingly.
Quoted 5 lines
Signed-off-by Jordan Niethe <[email protected]>---
v2: New to series
v3: No change
---
The fact that "migrate pfns" are just dressed as ordinary pfns is confusing and error prone, especially when we suddenly have to derive from the variable name whether something is a pfn or an mpfn ...
Something to think about would be treating migrate pfns as opaque objects and move from misleading "unsigned long" to something like
typedef struct migrate_pfn {
unsigned long data;
} migrate_pfn_t;And providing proper accessors.
That would make it much clearer when passing these things around what they are ... and the compiler can easily catch bugs.
Signature · 3 lines
Cheers, David
PATCH v6 4/13 mm/migrate_device: Add migrate PFN flag to track device private pages
In reply to Jordan NietheA future change will remove device private pages from the physical address space. This will mean that device private pages no longer have normal PFN and must be handled separately.
Prepare for this by adding a MIGRATE_PFN_DEVICE_PRIVATE flag to indicate that a migrate pfn contains a PFN for a device private page.
---
v1:
- Update for HMM huge page support
- Update existing drivers to use MIGRATE_PFN_DEVICE
v2:
- Include changes to migrate_pfn_from_page()
- Rename to MIGRATE_PFN_DEVICE_PRIVATE
- drm/amd: Check adev->gmc.xgmi.connected_to_cpu
- lib/test_hmm.c: Check chunk->pagemap.type == MEMORY_DEVICE_PRIVATE
v3:
- Use adev->kfd.pgmap.type == MEMORY_DEVICE_PRIVATE
v4:
- No change
--- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 7 ++++++- drivers/gpu/drm/nouveau/nouveau_dmem.c | 3 ++- drivers/gpu/drm/xe/xe_svm.c | 2 +- include/linux/migrate.h | 14 +++++++++----- lib/test_hmm.c | 6 +++++- 5 files changed, 23 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +6 -1
@@ -212,7 +212,12 @@ svm_migrate_copy_done(struct amdgpu_device *adev, struct dma_fence *mfence)unsigned long svm_migrate_addr_to_mpfn (struct amdgpu_device *adev,unsigned long addr) { -return migrate_pfn ((addr + adev->kfd.pgmap.range.start) >>PAGE_SHIFT ); +unsigned long flags =0 ; + +if (adev->kfd.pgmap.type ==MEMORY_DEVICE_PRIVATE ) + flags |=MIGRATE_PFN_DEVICE_PRIVATE ; +return migrate_pfn ((addr + adev->kfd.pgmap.range.start) >>PAGE_SHIFT ) | + flags; } static void
drivers/gpu/drm/nouveau/nouveau_dmem.c +2 -1
@@ -484,7 +484,8 @@ nouveau_dmem_evict_chunk(struct nouveau_dmem_chunk *chunk) dma_info =kvcalloc (npages,sizeof (*dma_info),GFP_KERNEL | __GFP_NOFAIL);migrate_device_range (src_pfns, -migrate_pfn (chunk->pagemap.range.start >>PAGE_SHIFT ), +migrate_pfn (chunk->pagemap.range.start >>PAGE_SHIFT ) | +MIGRATE_PFN_DEVICE_PRIVATE , npages);for (i =0 ; i < npages; i++) {
drivers/gpu/drm/xe/xe_svm.c +1 -1
@@ -770,7 +770,7 @@ static int xe_svm_populate_devmem_mpfn(struct drm_pagemap_devmem *devmem_allocatint i;for (i =0 ; i <drm_buddy_block_size (buddy, block) >>PAGE_SHIFT ; ++i) - pfn[j++] =migrate_pfn (block_pfn + i); + pfn[j++] =migrate_pfn (block_pfn + i) |MIGRATE_PFN_DEVICE_PRIVATE ; }return 0 ;
include/linux/migrate.h +9 -5
@@ -122,11 +122,12 @@ static inline int migrate_misplaced_folio(struct folio *folio, int node)* have enough bits to store all physical address and flags. So far we have * enough room for all our flags. */ -#define MIGRATE_PFN_VALID (1UL << 0) -#define MIGRATE_PFN_MIGRATE (1UL << 1) -#define MIGRATE_PFN_WRITE (1UL << 3) -#define MIGRATE_PFN_COMPOUND (1UL << 4) -#define MIGRATE_PFN_SHIFT 6 +#define MIGRATE_PFN_VALID (1UL << 0) +#define MIGRATE_PFN_MIGRATE (1UL << 1) +#define MIGRATE_PFN_WRITE (1UL << 3) +#define MIGRATE_PFN_COMPOUND (1UL << 4) +#define MIGRATE_PFN_DEVICE_PRIVATE (1UL << 5) +#define MIGRATE_PFN_SHIFT 6static inline struct page *migrate_pfn_to_page (unsigned long mpfn) {
@@ -142,6 +143,9 @@ static inline unsigned long migrate_pfn(unsigned long pfn)static inline unsigned long migrate_pfn_from_page (struct page *page) { +if (is_device_private_page (page)) +return migrate_pfn (page_to_pfn (page)) | +MIGRATE_PFN_DEVICE_PRIVATE ;return migrate_pfn (page_to_pfn (page)); }
lib/test_hmm.c +5 -1
@@ -1387,11 +1387,15 @@ static void dmirror_device_evict_chunk(struct dmirror_chunk *chunk)unsigned long *src_pfns;unsigned long *dst_pfns;unsigned int order =0 ; +unsigned long flags =0 ; src_pfns =kvcalloc (npages,sizeof (*src_pfns),GFP_KERNEL | __GFP_NOFAIL); dst_pfns =kvcalloc (npages,sizeof (*dst_pfns),GFP_KERNEL | __GFP_NOFAIL); -migrate_device_range (src_pfns,migrate_pfn (start_pfn), npages); +if (chunk->pagemap.type ==MEMORY_DEVICE_PRIVATE ) + flags |=MIGRATE_PFN_DEVICE_PRIVATE ; + +migrate_device_range (src_pfns,migrate_pfn (start_pfn) | flags, npages);for (i =0 ; i < npages; i++) {struct page *dpage, *spage;
Signature · 1 line
2.34.1
David Hildenbrand (Arm)
maintainerRe: [PATCH v6 04/13] mm/migrate_device: Add migrate PFN flag to track device private pages
Quoted 40 lines · Jordan Niethe
A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have normal PFN and must be handled separately.
Prepare for this by adding a
MIGRATE_PFN_DEVICE_PRIVATEflag to indicate that a migrate pfn contains a PFN for a device private page.Acked-by Felix Kuehling <[email protected]>Signed-off-by Jordan Niethe <[email protected]>Signed-off-by Alistair Popple <[email protected]>---
v1:
- Update for HMM huge page support
- Update existing drivers to useMIGRATE_PFN_DEVICE
v2:
- Include changes tomigrate_pfn_from_page()
- Rename toMIGRATE_PFN_DEVICE_PRIVATE
- drm/amd: Checkadev->gmc.xgmi.connected_to_cpu
-lib/test_hmm.c: Checkchunk->pagemap.type==MEMORY_DEVICE_PRIVATEv3:
- Useadev->kfd.pgmap.type==MEMORY_DEVICE_PRIVATEv4:
- No change--- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 7 ++++++- drivers/gpu/drm/nouveau/nouveau_dmem.c | 3 ++- drivers/gpu/drm/xe/xe_svm.c | 2 +- include/linux/migrate.h | 14 +++++++++----- lib/test_hmm.c | 6 +++++- 5 files changed, 23 insertions(+), 9 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +0
-0@@ -212,7 +212,12 @@ svm_migrate_copy_done(struct amdgpu_device *adev, struct dma_fence *mfence)unsigned long
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c svm_migrate_copy_done(struct amdgpu_device *adev, struct dma_fence *mfence) · line 221
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +6
-1svm_migrate_addr_to_mpfn(struct amdgpu_device *adev, unsigned long addr) { -return migrate_pfn ((addr + adev->kfd.pgmap.range.start) >>PAGE_SHIFT ); +unsigned long flags =0 ; + +if (adev->kfd.pgmap.type ==MEMORY_DEVICE_PRIVATE ) + flags |=MIGRATE_PFN_DEVICE_PRIVATE ; +return migrate_pfn ((addr + adev->kfd.pgmap.range.start) >>PAGE_SHIFT ) | + flags; }
Just pack it into a single line (checkpatch should no longer complain), or alternatively, indent "flags" properly.
Shouldn't migrate_pfn really be called pfn_to_migrate_pfn()?
Also, looks like a "addr_to_migrate_pfn()" might be a reasonable helper, which might also reduce the line lenght :)
But now I wonder: could't migrate_pfn() detect internally that this is MIGRATE_PFN_DEVICE_PRIVATE, similar to how migrate_pfn_from_page() does it? After all, there must be a "struct page/struct folio" there, or am I wrong?
Signature · 3 lines
Cheers, David
PATCH v6 5/13 mm/page_vma_mapped: Add flag to page_vma_mapped_walk::flags to track device private pages
In reply to Jordan NietheA future change will remove device private pages from the physical address space. This will mean that device private pages no longer have normal PFN and must be handled separately.
Prepare for this by adding a PVMW_DEVICE_PRIVATE flag to page_vma_mapped_walk::flags. This indicates that page_vma_mapped_walk::pfn contains a device private offset rather than a normal pfn.
Once the device private pages are removed from the physical address space this flag will be used to ensure a device private offset is returned.
---
v1:
- Update for HMM huge page support
v2:
- Move adding device_private param to check_pmd() until final patch
v3:
- Track device private offset in pvmw::flags instead of pvmw::pfn
v4:
- No change
--- include/linux/rmap.h | 24 ++++++++++++++++++++++-- mm/page_vma_mapped.c | 4 ++-- mm/rmap.c | 4 ++-- mm/vmscan.c | 2 +- 4 files changed, 27 insertions(+), 7 deletions(-)
include/linux/rmap.h +22 -2
@@ -921,6 +921,8 @@ struct page *make_device_exclusive(struct mm_struct *mm, unsigned long addr,#define PVMW_SYNC (1 << 0)/* Look for migration entries rather than present PTEs */ #define PVMW_MIGRATION (1 << 1) +/* pvmw::pfn is a device private offset */ +#define PVMW_DEVICE_PRIVATE (1 << 2)/* Result flags */
@@ -939,14 +941,32 @@ struct page_vma_mapped_walk {unsigned int flags; }; +static inline unsigned long page_vma_walk_flags (const struct folio *folio, +unsigned long flags) +{ +if (folio_is_device_private (folio)) +return flags |PVMW_DEVICE_PRIVATE ; +return flags; +} + +static inline unsigned long folio_page_vma_walk_pfn (const struct folio *folio) +{ +return folio_pfn (folio); +} + +static inline struct folio *page_vma_walk_pfn_to_folio (struct page_vma_mapped_walk *pvmw) +{ +return pfn_folio (pvmw->pfn); +} +#define DEFINE_FOLIO_VMA_WALK (name, _folio, _vma, _address, _flags) \ struct page_vma_mapped_walk name = { \ - .pfn = folio_pfn(_folio), \ + .pfn = folio_page_vma_walk_pfn(_folio), \ .nr_pages = folio_nr_pages(_folio), \ .pgoff = folio_pgoff(_folio), \ .vma = _vma, \ .address = _address, \ - .flags = _flags, \ + .flags = page_vma_walk_flags(_folio, _flags), \ }static inline void page_vma_mapped_walk_done (struct page_vma_mapped_walk *pvmw)
mm/page_vma_mapped.c +2 -2
@@ -350,10 +350,10 @@ unsigned long page_mapped_in_vma(const struct page *page, {const struct folio *folio =page_folio (page);struct page_vma_mapped_walk pvmw = { - .pfn =page_to_pfn (page), + .pfn =folio_page_vma_walk_pfn (folio), .nr_pages =1 , .vma = vma, - .flags =PVMW_SYNC , + .flags =page_vma_walk_flags (folio,PVMW_SYNC ), }; pvmw.address =vma_address (vma,page_pgoff (folio, page),1 );
mm/rmap.c +2 -2
@@ -1871,7 +1871,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,* if page table locking is skipped: use TTU_SYNC to wait for that. */ if (flags &TTU_SYNC ) - pvmw.flags =PVMW_SYNC ; + pvmw.flags =page_vma_walk_flags (folio,PVMW_SYNC );/* * For THP, we have to assume the worse case ie pmd for invalidation.
@@ -2298,7 +2298,7 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma,* if page table locking is skipped: use TTU_SYNC to wait for that. */ if (flags &TTU_SYNC ) - pvmw.flags =PVMW_SYNC ; + pvmw.flags =page_vma_walk_flags (folio,PVMW_SYNC );/* * For THP, we have to assume the worse case ie pmd for invalidation.
mm/vmscan.c +1 -1
@@ -4203,7 +4203,7 @@ bool lru_gen_look_around(struct page_vma_mapped_walk *pvmw)pte_t *pte = pvmw->pte;unsigned long addr = pvmw->address;struct vm_area_struct *vma = pvmw->vma; -struct folio *folio =pfn_folio (pvmw->pfn); +struct folio *folio =page_vma_walk_pfn_to_folio (pvmw);struct mem_cgroup *memcg =folio_memcg (folio);struct pglist_data *pgdat =folio_pgdat (folio);struct lruvec *lruvec =mem_cgroup_lruvec (memcg, pgdat);
Signature · 1 line
2.34.1
David Hildenbrand (Arm)
maintainerRe: [PATCH v6 05/13] mm/page_vma_mapped: Add flag to page_vma_mapped_walk::flags to track device private pages
Quoted 68 lines · Jordan Niethe
A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have normal PFN and must be handled separately.
Prepare for this by adding a
PVMW_DEVICE_PRIVATEflag topage_vma_mapped_walk::flags. This indicates thatpage_vma_mapped_walk::pfncontains a device private offset rather than a normal pfn.Once the device private pages are removed from the physical address space this flag will be used to ensure a device private offset is returned.
Reviewed-by Zi Yan <[email protected]>Signed-off-by Jordan Niethe <[email protected]>Signed-off-by Alistair Popple <[email protected]>---
v1:
- Update for HMM huge page support
v2:
- Move addingdevice_privateparam tocheck_pmd()until final patch
v3:
- Track device private offset inpvmw::flagsinstead ofpvmw::pfn
v4:
- No change--- include/linux/rmap.h | 24 ++++++++++++++++++++++-- mm/page_vma_mapped.c | 4 ++-- mm/rmap.c | 4 ++-- mm/vmscan.c | 2 +- 4 files changed, 27 insertions(+), 7 deletions(-)include/linux/rmap.h +20
-0@@ -921,6 +921,8 @@ struct page *make_device_exclusive(struct mm_struct *mm, unsigned long addr,#define PVMW_SYNC (1 << 0)/* Look for migration entries rather than present PTEs */ #define PVMW_MIGRATION (1 << 1) +/* pvmw::pfn is a device private offset */ +#define PVMW_DEVICE_PRIVATE (1 << 2)/* Result flags */ @@ -939,14 +941,32 @@ struct page_vma_mapped_walk {unsigned int flags; }; +static inline unsigned long page_vma_walk_flags (const struct folio *folio, +unsigned long flags) +{ +if (folio_is_device_private (folio)) +return flags |PVMW_DEVICE_PRIVATE ; +return flags; +} + +static inline unsigned long folio_page_vma_walk_pfn (const struct folio *folio) +{ +return folio_pfn (folio); +} + +static inline struct folio *page_vma_walk_pfn_to_folio (struct page_vma_mapped_walk *pvmw) +{ +return pfn_folio (pvmw->pfn); +} +#define DEFINE_FOLIO_VMA_WALK (name, _folio, _vma, _address, _flags) \
include/linux/rmap.h struct page_vma_mapped_walk { · line 970
Quoted 10 lines
include/linux/rmap.h +2
-2struct page_vma_mapped_walk name = { \ - .pfn =folio_pfn (_folio), \ + .pfn =folio_page_vma_walk_pfn (_folio), \ .nr_pages =folio_nr_pages (_folio), \ .pgoff =folio_pgoff (_folio), \ .vma = _vma, \ .address = _address, \ - .flags = _flags, \ + .flags =page_vma_walk_flags (_folio, _flags), \ }
That's all rather horrible ...
I was asking myself recently, why something that is called "page_vma_mapped_walk" consume a pfn. It's just a horrible interface.
* DEFINE_FOLIO_VMA_WALK() users obviously receive a folio.
* mm/migrate_device.c just abuses page_vma_mapped_walk() to make set_pmd_migration_entry() work. But we have a folio.
* page_mapped_in_vma() has a page/folio.
mapping_wrprotect_range_one() and pfn_mkclean_range() are the real issues. They all end up calling page_vma_mkclean_one(), which does not operate on pages/folios.
Ideally, the odd pfn case would use it's own simplified infrastructure.
So, could we simply add a folio+page pointer in case we have one, and use that one if set, leaving leaving the pfn unset?
Then, the pfn would only be set for the mapping_wrprotect_range_one/pfn_mkclean_range case. I don't think device-private folios would ever have to mess with that.
Then, you just always have a folio+page and don't even have to worry about the pfn?
Signature · 3 lines
Cheers, David
Alistair Popple
reviewerRe: [PATCH v6 05/13] mm/page_vma_mapped: Add flag to page_vma_mapped_walk::flags to track device private pages
On 2026-03-07 at 02:44 +1100, "David Hildenbrand (Arm)" <[email protected]> wrote...
Quoted 83 lines · Jordan Niethe
Quoted 68 lines
A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have normal PFN and must be handled separately.
Prepare for this by adding a
PVMW_DEVICE_PRIVATEflag topage_vma_mapped_walk::flags. This indicates thatpage_vma_mapped_walk::pfncontains a device private offset rather than a normal pfn.Once the device private pages are removed from the physical address space this flag will be used to ensure a device private offset is returned.
Reviewed-by Zi Yan <[email protected]>Signed-off-by Jordan Niethe <[email protected]>Signed-off-by Alistair Popple <[email protected]>---
v1:
- Update for HMM huge page support
v2:
- Move addingdevice_privateparam tocheck_pmd()until final patch
v3:
- Track device private offset inpvmw::flagsinstead ofpvmw::pfn
v4:
- No change--- include/linux/rmap.h | 24 ++++++++++++++++++++++-- mm/page_vma_mapped.c | 4 ++-- mm/rmap.c | 4 ++-- mm/vmscan.c | 2 +- 4 files changed, 27 insertions(+), 7 deletions(-)include/linux/rmap.h +20
-0@@ -921,6 +921,8 @@ struct page *make_device_exclusive(struct mm_struct *mm, unsigned long addr,#define PVMW_SYNC (1 << 0)/* Look for migration entries rather than present PTEs */ #define PVMW_MIGRATION (1 << 1) +/* pvmw::pfn is a device private offset */ +#define PVMW_DEVICE_PRIVATE (1 << 2)/* Result flags */ @@ -939,14 +941,32 @@ struct page_vma_mapped_walk {unsigned int flags; }; +static inline unsigned long page_vma_walk_flags (const struct folio *folio, +unsigned long flags) +{ +if (folio_is_device_private (folio)) +return flags |PVMW_DEVICE_PRIVATE ; +return flags; +} + +static inline unsigned long folio_page_vma_walk_pfn (const struct folio *folio) +{ +return folio_pfn (folio); +} + +static inline struct folio *page_vma_walk_pfn_to_folio (struct page_vma_mapped_walk *pvmw) +{ +return pfn_folio (pvmw->pfn); +} +#define DEFINE_FOLIO_VMA_WALK (name, _folio, _vma, _address, _flags) \include/linux/rmap.h struct page_vma_mapped_walk { · line 970
Quoted 10 lines
include/linux/rmap.h +2
-2struct page_vma_mapped_walk name = { \ - .pfn =folio_pfn (_folio), \ + .pfn =folio_page_vma_walk_pfn (_folio), \ .nr_pages =folio_nr_pages (_folio), \ .pgoff =folio_pgoff (_folio), \ .vma = _vma, \ .address = _address, \ - .flags = _flags, \ + .flags =page_vma_walk_flags (_folio, _flags), \ }That's all rather horrible ...
Quoted 2 lines
I was asking myself recently, why something that is called "
page_vma_mapped_walk" consume a pfn. It's just a horrible interface.
I don't disagree, and in fact it used to consume a page until 2aff7a4755be ("mm:
Convert page_vma_mapped_walk to work on PFNs"). If this was a page it would basically resolve all the hackiness of this patch because we would no longer have to pass PFN context around. So I wonder if there would be any opposition to changing this back to taking a page?
Quoted 17 lines
*
DEFINE_FOLIO_VMA_WALK()users obviously receive a folio.
*mm/migrate_device.cjust abusespage_vma_mapped_walk()to makeset_pmd_migration_entry()work. But we have a folio.
*page_mapped_in_vma()has a page/folio.
mapping_wrprotect_range_one()andpfn_mkclean_range()are the real issues. They all end up callingpage_vma_mkclean_one(), which does not operate on pages/folios.Ideally, the odd pfn case would use it's own simplified infrastructure.
So, could we simply add a folio+page pointer in case we have one, and use that one if set, leaving leaving the pfn unset?
Quoted 7 lines
Then, the pfn would only be set for the mapping_wrprotect_range_one/pfn_mkclean_range case. I don't think device-private folios would ever have to mess with that.
Then, you just always have a folio+page and don't even have to worry about the pfn?
That sounds reasonable to me. We were hesitant to add a page back to the interface given it had been removed previously but lets try implementing this to see what it looks like.
- Alistair
Quoted 4 lines
Signature · 3 lines
Cheers, David
David Hildenbrand (Arm)
maintainerRe: [PATCH v6 05/13] mm/page_vma_mapped: Add flag to page_vma_mapped_walk::flags to track device private pages
Quoted 15 lines
Quoted 15 lines
include/linux/rmap.h struct page_vma_mapped_walk { · line 970
Quoted 11 lines
#define
DEFINE_FOLIO_VMA_WALK(name, _folio, _vma, _address, _flags)\include/linux/rmap.h +2
-2struct page_vma_mapped_walk name = { \ - .pfn =folio_pfn (_folio), \ + .pfn =folio_page_vma_walk_pfn (_folio), \ .nr_pages =folio_nr_pages (_folio), \ .pgoff =folio_pgoff (_folio), \ .vma = _vma, \ .address = _address, \ - .flags = _flags, \ + .flags =page_vma_walk_flags (_folio, _flags), \ }That's all rather horrible ...
Quoted 8 lines
Quoted 2 lines
I was asking myself recently, why something that is called "
page_vma_mapped_walk" consume a pfn. It's just a horrible interface.I don't disagree, and in fact it used to consume a page until
2aff7a4755be("mm:
Convertpage_vma_mapped_walkto work on PFNs"). If this was a page it would basically resolve all the hackiness of this patch because we would no longer have to pass PFN context around. So I wonder if there would be any opposition to changing this back to taking a page?
Are there cases where we pass a struct-page-less PFN?
The offenders are pfn_mkclean_range() and mapping_wrprotect_range().
pfn_mkclean_range() is only used by fs/dax.c
At least the caller immediately does a
dax_flush(dax_dev, page_address(pfn_to_page(pfn)), count * PAGE_SIZE);
Afterwards where, apparently, a page for the PFN exists? :)
mapping_wrprotect_range() is only used by drivers/video/fbdev/core/fb_defio.c
fb_deferred_io_work() just calls page_to_pfn(page). Huh?
Best to explore the history what's going on there.
My best guess is that they don't want to modify page state. But that can be expressed by the helper functions and doesn't require us to have such a weird implementation.
Quoted 23 lines
Quoted 23 lines
*
DEFINE_FOLIO_VMA_WALK()users obviously receive a folio.
*mm/migrate_device.cjust abusespage_vma_mapped_walk()to makeset_pmd_migration_entry()work. But we have a folio.
*page_mapped_in_vma()has a page/folio.
mapping_wrprotect_range_one()andpfn_mkclean_range()are the real issues. They all end up callingpage_vma_mkclean_one(), which does not operate on pages/folios.Ideally, the odd pfn case would use it's own simplified infrastructure.
So, could we simply add a folio+page pointer in case we have one, and use that one if set, leaving leaving the pfn unset?
Then, the pfn would only be set for the mapping_wrprotect_range_one/pfn_mkclean_range case. I don't think device-private folios would ever have to mess with that.
Quoted 6 lines
Quoted 2 lines
Then, you just always have a folio+page and don't even have to worry about the pfn?
That sounds reasonable to me. We were hesitant to add a page back to the interface given it had been removed previously but lets try implementing this to see what it looks like.
Thanks!
Signature · 3 lines
Cheers, David
PATCH v6 6/13 mm: Add helpers to create migration entries from struct pages
In reply to Jordan NietheTo create a new migration entry for a given struct page, that page is first converted to its pfn, before passing the pfn to make_readable_migration_entry() (and friends).
A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have a pfn and must be handled separately.
Prepare for this with a new set of helpers:
- make_readable_migration_entry_from_page()
- make_readable_exclusive_migration_entry_from_page()
- make_writable_migration_entry_from_page()
These helpers take a struct page as parameter instead of a pfn. This will allow more flexibility for handling the swap offset field differently for device private pages.
---
v1:
- New to series
v2:
- Add flags param
v3:
- No change
v4:
- s/make_writeable_migration_entry_from_page/make_writable_migration_entry_from_page/ for the !CONFIG_MIGRATION case
--- include/linux/leafops.h | 14 ++++++++++++++ include/linux/swapops.h | 34 ++++++++++++++++++++++++++++++++++ mm/huge_memory.c | 29 +++++++++++++++++------------ mm/hugetlb.c | 15 +++++++++------ mm/memory.c | 5 +++-- mm/migrate_device.c | 12 ++++++------ mm/mprotect.c | 10 +++++++--- mm/rmap.c | 12 ++++++------ 8 files changed, 96 insertions(+), 35 deletions(-)
include/linux/leafops.h +14 -0
@@ -363,6 +363,20 @@ static inline unsigned long softleaf_to_pfn(softleaf_t entry)return swp_offset (entry) &SWP_PFN_MASK ; } +/** +* softleaf_to_flags() - Obtain flags encoded within leaf entry. +* @entry: Leaf entry, softleaf_has_pfn(@entry) must return true. +* +* Returns: The flags associated with the leaf entry. +*/ +static inline unsigned long softleaf_to_flags (softleaf_t entry) +{ +VM_WARN_ON_ONCE (!softleaf_has_pfn (entry)); + +/* Temporary until swp_entry_t eliminated. */ +return swp_offset (entry) & (SWP_MIG_YOUNG |SWP_MIG_DIRTY ); +} +/** * softleaf_to_page() - Obtains struct page for PFN encoded within leaf entry. * @entry: Leaf entry, softleaf_has_pfn(@entry) must return true.
include/linux/swapops.h +34 -0
@@ -173,16 +173,34 @@ static inline swp_entry_t make_readable_migration_entry(pgoff_t offset)return swp_entry (SWP_MIGRATION_READ , offset); } +static inline swp_entry_t make_readable_migration_entry_from_page (struct page *page, +pgoff_t flags) +{ +return swp_entry (SWP_MIGRATION_READ ,page_to_pfn (page) | flags); +} +static inline swp_entry_t make_readable_exclusive_migration_entry (pgoff_t offset) {return swp_entry (SWP_MIGRATION_READ_EXCLUSIVE , offset); } +static inline swp_entry_t make_readable_exclusive_migration_entry_from_page (struct page *page, +pgoff_t flags) +{ +return swp_entry (SWP_MIGRATION_READ_EXCLUSIVE ,page_to_pfn (page) | flags); +} +static inline swp_entry_t make_writable_migration_entry (pgoff_t offset) {return swp_entry (SWP_MIGRATION_WRITE , offset); } +static inline swp_entry_t make_writable_migration_entry_from_page (struct page *page, +pgoff_t flags) +{ +return swp_entry (SWP_MIGRATION_WRITE ,page_to_pfn (page) | flags); +} +/* * Returns whether the host has large enough swap offset field to support * carrying over pgtable A/D bits for page migrations. The result is
@@ -222,11 +240,27 @@ static inline swp_entry_t make_readable_migration_entry(pgoff_t offset)return swp_entry (0 ,0 ); } +static inline swp_entry_t make_readable_migration_entry_from_page (struct page *page,pgoff_t flags) +{ +return swp_entry (0 ,0 ); +} + +static inline swp_entry_t make_writable_migration_entry_from_page (struct page *page,pgoff_t flags) +{ +return swp_entry (0 ,0 ); +} +static inline swp_entry_t make_readable_exclusive_migration_entry (pgoff_t offset) {return swp_entry (0 ,0 ); } +static inline swp_entry_t make_readable_exclusive_migration_entry_from_page (struct page *page, +pgoff_t flags) +{ +return swp_entry (0 ,0 ); +} +static inline swp_entry_t make_writable_migration_entry (pgoff_t offset) {return swp_entry (0 ,0 );
mm/huge_memory.c +17 -12
@@ -1800,7 +1800,8 @@ static void copy_huge_non_present_pmd(if (softleaf_is_migration_write (entry) ||softleaf_is_migration_read_exclusive (entry)) { - entry =make_readable_migration_entry (swp_offset (entry)); + entry =make_readable_migration_entry_from_page (softleaf_to_page (entry), +softleaf_to_flags (entry)); pmd =swp_entry_to_pmd (entry);if (pmd_swp_soft_dirty (*src_pmd)) pmd =pmd_swp_mksoft_dirty (pmd);
@@ -2524,9 +2525,13 @@ static void change_non_present_huge_pmd(struct mm_struct *mm,* just be safe and disable write */ if (folio_test_anon (folio)) - entry =make_readable_exclusive_migration_entry (swp_offset (entry)); + entry =make_readable_exclusive_migration_entry_from_page ( +softleaf_to_page (entry), +softleaf_to_flags (entry));else - entry =make_readable_migration_entry (swp_offset (entry)); + entry =make_readable_migration_entry_from_page ( +softleaf_to_page (entry), +softleaf_to_flags (entry)); newpmd =swp_entry_to_pmd (entry);if (pmd_swp_soft_dirty (*pmd)) newpmd =pmd_swp_mksoft_dirty (newpmd);
@@ -3183,14 +3188,14 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,for (i =0 , addr = haddr; i <HPAGE_PMD_NR ; i++, addr +=PAGE_SIZE ) {if (write) - swp_entry =make_writable_migration_entry ( -page_to_pfn (page + i)); + swp_entry =make_writable_migration_entry_from_page ( + page + i,0 );else if (anon_exclusive) - swp_entry =make_readable_exclusive_migration_entry ( -page_to_pfn (page + i)); + swp_entry =make_readable_exclusive_migration_entry_from_page ( + page + i,0 );else - swp_entry =make_readable_migration_entry ( -page_to_pfn (page + i)); + swp_entry =make_readable_migration_entry_from_page ( + page + i,0 );if (young) swp_entry =make_migration_entry_young (swp_entry);if (dirty)
@@ -4890,11 +4895,11 @@ int set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw,if (pmd_dirty (pmdval))folio_mark_dirty (folio);if (pmd_write (pmdval)) - entry =make_writable_migration_entry (page_to_pfn (page)); + entry =make_writable_migration_entry_from_page (page,0 );else if (anon_exclusive) - entry =make_readable_exclusive_migration_entry (page_to_pfn (page)); + entry =make_readable_exclusive_migration_entry_from_page (page,0 );else - entry =make_readable_migration_entry (page_to_pfn (page)); + entry =make_readable_migration_entry_from_page (page,0 );if (pmd_young (pmdval)) entry =make_migration_entry_young (entry);if (pmd_dirty (pmdval))
mm/hugetlb.c +9 -6
@@ -4955,8 +4955,9 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,* COW mappings require pages in both * parent and child to be set to read. */ - softleaf =make_readable_migration_entry ( -swp_offset (softleaf)); + softleaf =make_readable_migration_entry_from_page ( +softleaf_to_page (softleaf), +softleaf_to_flags (softleaf)); entry =swp_entry_to_pte (softleaf);if (userfaultfd_wp (src_vma) && uffd_wp) entry =pte_swp_mkuffd_wp (entry);
@@ -6491,11 +6492,13 @@ long hugetlb_change_protection(struct vm_area_struct *vma,if (softleaf_is_migration_write (entry)) {if (folio_test_anon (folio)) - entry =make_readable_exclusive_migration_entry ( -swp_offset (entry)); + entry =make_readable_exclusive_migration_entry_from_page ( +softleaf_to_page (entry), +softleaf_to_flags (entry));else - entry =make_readable_migration_entry ( -swp_offset (entry)); + entry =make_readable_migration_entry_from_page ( +softleaf_to_page (entry), +softleaf_to_flags (entry)); newpte =swp_entry_to_pte (entry); pages++; }
mm/memory.c +3 -2
@@ -963,8 +963,9 @@ copy_nonpresent_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,* to be set to read. A previously exclusive entry is * now shared. */ - entry =make_readable_migration_entry ( -swp_offset (entry)); + entry =make_readable_migration_entry_from_page ( +softleaf_to_page (entry), +softleaf_to_flags (entry)); pte =softleaf_to_pte (entry);if (pte_swp_soft_dirty (orig_pte)) pte =pte_swp_mksoft_dirty (pte);
mm/migrate_device.c +6 -6
@@ -432,14 +432,14 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,/* Setup special migration page table entry */ if (mpfn &MIGRATE_PFN_WRITE ) - entry =make_writable_migration_entry ( -page_to_pfn (page)); + entry =make_writable_migration_entry_from_page ( + page,0 );else if (anon_exclusive) - entry =make_readable_exclusive_migration_entry ( -page_to_pfn (page)); + entry =make_readable_exclusive_migration_entry_from_page ( + page,0 );else - entry =make_readable_migration_entry ( -page_to_pfn (page)); + entry =make_readable_migration_entry_from_page ( + page,0 );if (pte_present (pte)) {if (pte_young (pte)) entry =make_migration_entry_young (entry);
mm/mprotect.c +7 -3
@@ -328,10 +328,14 @@ static long change_pte_range(struct mmu_gather *tlb,* just be safe and disable write */ if (folio_test_anon (folio)) - entry =make_readable_exclusive_migration_entry ( -swp_offset (entry)); + entry =make_readable_exclusive_migration_entry_from_page ( +softleaf_to_page (entry), +softleaf_to_flags (entry));else - entry =make_readable_migration_entry (swp_offset (entry)); + entry =make_readable_migration_entry_from_page ( +softleaf_to_page (entry), +softleaf_to_flags (entry)); + newpte =swp_entry_to_pte (entry);if (pte_swp_soft_dirty (oldpte)) newpte =pte_swp_mksoft_dirty (newpte);
mm/rmap.c +6 -6
@@ -2536,14 +2536,14 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma,* pte is removed and then restart fault handling. */ if (writable) - entry =make_writable_migration_entry ( -page_to_pfn (subpage)); + entry =make_writable_migration_entry_from_page ( + subpage,0 );else if (anon_exclusive) - entry =make_readable_exclusive_migration_entry ( -page_to_pfn (subpage)); + entry =make_readable_exclusive_migration_entry_from_page ( + subpage,0 );else - entry =make_readable_migration_entry ( -page_to_pfn (subpage)); + entry =make_readable_migration_entry_from_page ( + subpage,0 );if (likely (pte_present (pteval))) {if (pte_young (pteval)) entry =make_migration_entry_young (entry);
Signature · 1 line
2.34.1
David Hildenbrand (Arm)
maintainerRe: [PATCH v6 06/13] mm: Add helpers to create migration entries from struct pages
Quoted 8 lines · Jordan Niethe
To create a new migration entry for a given struct page, that page is first converted to its pfn, before passing the pfn to
make_readable_migration_entry()(and friends).A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have a pfn and must be handled separately.
Quoted 5 lines
Prepare for this with a new set of helpers:
-
make_readable_migration_entry_from_page()
-make_readable_exclusive_migration_entry_from_page()
-make_writable_migration_entry_from_page()
This is pretty horrible. And everything I see in successive patches around that is not any better.
Seriously, look at how terrible make_readable_exclusive_migration_entry_from_page() is. make_readable_exclusive_migration_device_private_entry is not any better, but at least doesn't have this questionable flags parameter.
Correct me if I am wrong: all we want is:
make_readable_migration_entry() etc. to create something that softleaf_to_page() / softleaf_to_folio() can properly convert to a folio, right?
So maybe we should convert make_readable_migration_entry() and friends to consume a page (not add new functions ...), and let it internally figure out how to communicate in the entry that what we are dealing with is not an ordinary pfn, but a special device-private entry.
Quoted 34 lines
Signed-off-by Jordan Niethe <[email protected]>---
v1:
- New to series
v2:
- Add flags param
v3:
- No change
v4:
- s/make_writeable_migration_entry_from_page/make_writable_migration_entry_from_page/ for the !CONFIG_MIGRATION case--- include/linux/leafops.h | 14 ++++++++++++++ include/linux/swapops.h | 34 ++++++++++++++++++++++++++++++++++ mm/huge_memory.c | 29 +++++++++++++++++------------ mm/hugetlb.c | 15 +++++++++------ mm/memory.c | 5 +++-- mm/migrate_device.c | 12 ++++++------ mm/mprotect.c | 10 +++++++--- mm/rmap.c | 12 ++++++------ 8 files changed, 96 insertions(+), 35 deletions(-)include/linux/leafops.h +3
-0@@ -363,6 +363,20 @@ static inline unsigned long softleaf_to_pfn(softleaf_t entry)return swp_offset (entry) &SWP_PFN_MASK ; } +/** +* softleaf_to_flags() - Obtain flags encoded within leaf entry. +* @entry: Leaf entry, softleaf_has_pfn(@entry) must return true.
include/linux/leafops.h static inline unsigned long softleaf_to_pfn(softleaf_t entry) · line 378
Quoted 10 lines
include/linux/leafops.h +10
-0+* +* Returns: The flags associated with the leaf entry. +*/ +static inline unsigned long softleaf_to_flags (softleaf_t entry) +{ +VM_WARN_ON_ONCE (!softleaf_has_pfn (entry)); + +/* Temporary until swp_entry_t eliminated. */ +return swp_offset (entry) & (SWP_MIG_YOUNG |SWP_MIG_DIRTY ); +}
The whole flags stuff does not really belong in this patch. If there are cleanups to be had, perform them separately, please.
Signature · 3 lines
Cheers, David
PATCH v6 7/13 mm: Add a new swap type for migration entries of device private pages
In reply to Jordan NietheA future change will remove device private pages from the physical address space. This will mean that device private pages no longer have pfns and must be handled separately.
When migrating a device private page a migration entry is created for that page. This includes the pfn for that page. Once device private pages begin using device memory offsets instead of pfns we will need to be able to determine which kind of value is in the entry so we can associate it with the correct page.
Introduce new swap types that correspond to the existing migration entries:
- SWP_MIGRATION_DEVICE_READ -> SWP_MIGRATION_READ
- SWP_MIGRATION_DEVICE_WRITE -> SWP_MIGRATION_WRITE
- SWP_MIGRATION_DEVICE_READ_EXCLUSIVE -> SWP_MIGRATION_READ_EXCLUSIVE
The SWP_MIGRATION_DEVICE swap types are meant as specializations of the SWP_MIGRATION types - they are equivalent except the new entries contain device private offsets.
Forgo creating new predicates for these new types in favour of new softleaf predicates that will be introduced in a subsequent patch. Currently the softleaf infrastructure does not have the means for creating new entries so provide swap entry helpers to that end.
Actually using these creation helpers is deferred until a later patch when the softleaf predicates have been updated, otherwise the existing checks for migration entries would be broken.
Note that SWP_DEVICE_NUM is increasing from 3 to 6. This reduces the maximum number of swap files in the worst case (i.e. CONFIG_DEVICE_PRIVATE, CONFIG_MIGRATION, CONFIG_MEMORY_FAILURE) from 24 to 21.
---
v1:
- Update for softleaf infrastructure
- Handle make_readable_migration_entry_from_page() and friends
- s/make_device_migration_readable_exclusive_migration_entry/make_readable_exclusive_migration_device_private_entry
- s/is_device_migration_readable_exclusive_entry/is_readable_exclusive_device_private_migration_entry/
v2:
- Add softleaf_is_migration_device_private_read()
v3:
- Move softleaf changes to new patch
- Update commit message to explain the change reduces the number of
swap files.
- Move creating the device private migration changes to a separate
patch
- Remove predicates - we'll rely on softleaf predicates entirely
--- include/linux/swap.h | 8 +++++++- include/linux/swapops.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-)
include/linux/swap.h +7 -1
@@ -74,12 +74,18 @@ static inline int current_is_kswapd(void)* * When a page is mapped by the device for exclusive access we set the CPU page * table entries to a special SWP_DEVICE_EXCLUSIVE entry. +* +* Because device private pages do not use regular PFNs, special migration +* entries are also needed. */ #ifdef CONFIG_DEVICE_PRIVATE -#define SWP_DEVICE_NUM 3 +#define SWP_DEVICE_NUM 6#define SWP_DEVICE_WRITE (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM)#define SWP_DEVICE_READ (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+1)#define SWP_DEVICE_EXCLUSIVE (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+2) +#define SWP_MIGRATION_DEVICE_READ (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+3) +#define SWP_MIGRATION_DEVICE_READ_EXCLUSIVE (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+4) +#define SWP_MIGRATION_DEVICE_WRITE (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+5)#else #define SWP_DEVICE_NUM 0#endif
include/linux/swapops.h +30 -0
@@ -148,6 +148,21 @@ static inline swp_entry_t make_device_exclusive_entry(pgoff_t offset) return swp_entry(SWP_DEVICE_EXCLUSIVE, offset); } +static inline swp_entry_t make_readable_migration_device_private_entry (pgoff_t offset) +{ +return swp_entry (SWP_MIGRATION_DEVICE_READ , offset); +} + +static inline swp_entry_t make_writable_migration_device_private_entry (pgoff_t offset) +{ +return swp_entry (SWP_MIGRATION_DEVICE_WRITE , offset); +} + +static inline swp_entry_t make_readable_exclusive_migration_device_private_entry (pgoff_t offset) +{ +return swp_entry (SWP_MIGRATION_DEVICE_READ_EXCLUSIVE , offset); +} +#else /* CONFIG_DEVICE_PRIVATE */ static inline swp_entry_t make_readable_device_private_entry (pgoff_t offset) {
@@ -164,6 +179,21 @@ static inline swp_entry_t make_device_exclusive_entry(pgoff_t offset) return swp_entry(0, 0); } +static inline swp_entry_t make_readable_migration_device_private_entry (pgoff_t offset) +{ +return swp_entry (0 ,0 ); +} + +static inline swp_entry_t make_writable_migration_device_private_entry (pgoff_t offset) +{ +return swp_entry (0 ,0 ); +} + +static inline swp_entry_t make_readable_exclusive_migration_device_private_entry (pgoff_t offset) +{ +return swp_entry (0 ,0 ); +} +#endif /* CONFIG_DEVICE_PRIVATE */ #ifdef CONFIG_MIGRATION
Signature · 1 line
2.34.1
PATCH v6 8/13 mm: Add softleaf support for device private migration entries
In reply to Jordan NietheAdd equivalent softleaf entries for the device private migration swap entries:
- SWP_MIGRATION_DEVICE_READ -> SOFTLEAF_MIGRATION_DEVICE_PRIVATE_READ
- SWP_MIGRATION_DEVICE_WRITE -> SOFTLEAF_MIGRATION_DEVICE_PRIVATE_WRITE
- SWP_MIGRATION_DEVICE_READ_EXCLUSIVE -> SOFTLEAF_MIGRATION_DEVICE_PRIVATE_READ_EXCLUSIVE
As with their SWP_MIGRATION_DEVICE_xxx kin, the SOFTLEAF_MIGRATION_DEVICE_PRIVATE_xxx types are used as specializations of the SWP_MIGRATION_DEVICE_xxx types.
The new entry types have the following relationships:
- SOFTLEAF_MIGRATION_DEVICE_READ is-a SOFTLEAF_MIGRATION_READ
- SOFTLEAF_MIGRATION_READ !is-a SOFTLEAF_MIGRATION_DEVICE_READ
Update the existing softleaf_is_migration_xxx() predicates to reflect this relationship.
It is possible to distinguish the between a SOFTLEAF_MIGRATION_DEVICE__xxx and a SOFTLEAF_MIGRATION_xxx type using the softleaf_is_migration_device_private_xxx() predicates.
In practice, the only reason for introducing this new type is so we know when to not call pfn_to_page() on the swap entry offset once the device private pages are removed from the physical address space. That is the only time that the difference matters.
Creating these new entries will occur in a subsequent patch.
---
v3:
- Separated from previous patch
- s/SOFTLEAF_MIGRATION_DEVICE_/SOFTLEAF_MIGRATION_DEVICE_PRIVATE_/
- Update comment for softleaf_is_migration_read()
--- include/linux/leafops.h | 90 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 80 insertions(+), 10 deletions(-)
include/linux/leafops.h +80 -10
@@ -28,6 +28,9 @@ enum softleaf_type {SOFTLEAF_DEVICE_PRIVATE_READ ,SOFTLEAF_DEVICE_PRIVATE_WRITE ,SOFTLEAF_DEVICE_EXCLUSIVE , +SOFTLEAF_MIGRATION_DEVICE_PRIVATE_READ , +SOFTLEAF_MIGRATION_DEVICE_PRIVATE_READ_EXCLUSIVE , +SOFTLEAF_MIGRATION_DEVICE_PRIVATE_WRITE ,/* H/W posion types. */ SOFTLEAF_HWPOISON,/* Marker types. */
@@ -165,6 +168,12 @@ static inline enum softleaf_type softleaf_type(softleaf_t entry)return SOFTLEAF_DEVICE_PRIVATE_READ ;case SWP_DEVICE_EXCLUSIVE :return SOFTLEAF_DEVICE_EXCLUSIVE ; +case SWP_MIGRATION_DEVICE_READ : +return SOFTLEAF_MIGRATION_DEVICE_PRIVATE_READ ; +case SWP_MIGRATION_DEVICE_WRITE : +return SOFTLEAF_MIGRATION_DEVICE_PRIVATE_WRITE ; +case SWP_MIGRATION_DEVICE_READ_EXCLUSIVE : +return SOFTLEAF_MIGRATION_DEVICE_PRIVATE_READ_EXCLUSIVE ;#endif #ifdef CONFIG_MEMORY_FAILURE case SWP_HWPOISON :
@@ -190,28 +199,88 @@ static inline bool softleaf_is_swap(softleaf_t entry)return softleaf_type (entry) ==SOFTLEAF_SWAP ; } +/** +* softleaf_is_migration_device_private() - Is this leaf entry a migration +* device private entry? +* @entry: Leaf entry. +* +* Returns: true if the leaf entry is a device private entry, otherwise false. +*/ +static inline bool softleaf_is_migration_device_private (softleaf_t entry) +{ +switch (softleaf_type (entry)) { +case SOFTLEAF_MIGRATION_DEVICE_PRIVATE_READ : +case SOFTLEAF_MIGRATION_DEVICE_PRIVATE_WRITE : +case SOFTLEAF_MIGRATION_DEVICE_PRIVATE_READ_EXCLUSIVE : +return true; +default : +return false; + } +} + +/** +* softleaf_is_migration_device_private_write() - Is this leaf entry a writable +* device private migration entry? +* @entry: Leaf entry. +* +* Returns: true if the leaf entry is a writable device private migration entry, +* otherwise false. +*/ +static inline bool softleaf_is_migration_device_private_write (softleaf_t entry) +{ +return softleaf_type (entry) ==SOFTLEAF_MIGRATION_DEVICE_PRIVATE_WRITE ; +} + +/** +* softleaf_is_migration_device_private_read() - Is this leaf entry a readable +* device private migration entry? +* @entry: Leaf entry. +* +* Returns: true if the leaf entry is an readable device private migration +* entry, otherwise false. +*/ +static inline bool softleaf_is_migration_device_private_read (softleaf_t entry) +{ +return softleaf_type (entry) ==SOFTLEAF_MIGRATION_DEVICE_PRIVATE_READ ; +} + +/** +* softleaf_is_migration_read_exclusive() - Is this leaf entry an exclusive +* readable device private migration entry? +* @entry: Leaf entry. +* +* Returns: true if the leaf entry is an exclusive readable device private +* migration entry, otherwise false. +*/ +static inline bool softleaf_is_migration_device_private_read_exclusive (softleaf_t entry) +{ +return softleaf_type (entry) ==SOFTLEAF_MIGRATION_DEVICE_PRIVATE_READ_EXCLUSIVE ; +} +/** * softleaf_is_migration_write() - Is this leaf entry a writable migration entry? * @entry: Leaf entry. * -* Returns: true if the leaf entry is a writable migration entry, otherwise -* false. +* Returns: true if the leaf entry is a writable migration entry or a writable +* device private migration entry, otherwise false. */ static inline bool softleaf_is_migration_write (softleaf_t entry) { -return softleaf_type (entry) ==SOFTLEAF_MIGRATION_WRITE ; +return softleaf_type (entry) ==SOFTLEAF_MIGRATION_WRITE || +softleaf_is_migration_device_private_write (entry); }/** * softleaf_is_migration_read() - Is this leaf entry a readable migration entry? * @entry: Leaf entry. * -* Returns: true if the leaf entry is a readable migration entry, otherwise -* false. +* Returns: true if the leaf entry is a readable migration entry or a readable +* device private migration entry, otherwise false. */ static inline bool softleaf_is_migration_read (softleaf_t entry) { -return softleaf_type (entry) ==SOFTLEAF_MIGRATION_READ ; +return softleaf_type (entry) ==SOFTLEAF_MIGRATION_READ || +softleaf_is_migration_device_private_read (entry); }/**
@@ -219,12 +288,13 @@ static inline bool softleaf_is_migration_read(softleaf_t entry)* readable migration entry? * @entry: Leaf entry. * -* Returns: true if the leaf entry is an exclusive readable migration entry, -* otherwise false. +* Returns: true if the leaf entry is an exclusive readable migration entry or +* exclusive readable device private migration entry, otherwise false. */ static inline bool softleaf_is_migration_read_exclusive (softleaf_t entry) { -return softleaf_type (entry) ==SOFTLEAF_MIGRATION_READ_EXCLUSIVE ; +return softleaf_type (entry) ==SOFTLEAF_MIGRATION_READ_EXCLUSIVE || +softleaf_is_migration_device_private_read_exclusive (entry); }/**
@@ -241,7 +311,7 @@ static inline bool softleaf_is_migration(softleaf_t entry)case SOFTLEAF_MIGRATION_WRITE :return true;default : -return false; +return softleaf_is_migration_device_private (entry); } }
Signature · 1 line
2.34.1
PATCH v6 9/13 mm: Begin creating device private migration entries
In reply to Jordan NietheUpdate the migration entry creation helpers to automatically create device private migration entries when invoked on device private pages.
The corresponding softleaf predicates have already been updated to expect both migration and device private migration entries.
---
v3:
- Provided as an individual patch
--- include/linux/swapops.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
include/linux/swapops.h +12 -0
@@ -206,6 +206,10 @@ static inline swp_entry_t make_readable_migration_entry(pgoff_t offset)static inline swp_entry_t make_readable_migration_entry_from_page (struct page *page,pgoff_t flags) { +if (is_device_private_page (page)) +return make_readable_migration_device_private_entry ( +page_to_pfn (page) | flags); +return swp_entry (SWP_MIGRATION_READ ,page_to_pfn (page) | flags); }
@@ -217,6 +221,10 @@ static inline swp_entry_t make_readable_exclusive_migration_entry(pgoff_t offsetstatic inline swp_entry_t make_readable_exclusive_migration_entry_from_page (struct page *page,pgoff_t flags) { +if (is_device_private_page (page)) +return make_readable_exclusive_migration_device_private_entry ( +page_to_pfn (page) | flags); +return swp_entry (SWP_MIGRATION_READ_EXCLUSIVE ,page_to_pfn (page) | flags); }
@@ -228,6 +236,10 @@ static inline swp_entry_t make_writable_migration_entry(pgoff_t offset)static inline swp_entry_t make_writable_migration_entry_from_page (struct page *page,pgoff_t flags) { +if (is_device_private_page (page)) +return make_writable_migration_device_private_entry ( +page_to_pfn (page) | flags); +return swp_entry (SWP_MIGRATION_WRITE ,page_to_pfn (page) | flags); }
Signature · 1 line
2.34.1
PATCH v6 10/13 mm: Add helpers to create device private entries from struct pages
In reply to Jordan NietheTo create a new device private entry for a given struct page, that page is first converted to its pfn, before passing the pfn to make_writable_device_private_entry() (and friends).
A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have a pfn and must be handled separately.
Prepare for this with a new set of helpers:
- make_readable_device_private_entry_from_page()
- make_writable_device_private_entry_from_page()
These helpers take a struct page as parameter instead of a pfn. This will allow more flexibility for handling the swap offset field differently for device private pages.
---
v1:
- New to series
v2:
- Add flag param
v3:
- No change
--- include/linux/swapops.h | 24 ++++++++++++++++++++++++ mm/huge_memory.c | 14 ++++++-------- mm/migrate.c | 6 ++---- mm/migrate_device.c | 12 ++++-------- 4 files changed, 36 insertions(+), 20 deletions(-)
include/linux/swapops.h +24 -0
@@ -138,11 +138,23 @@ static inline swp_entry_t make_readable_device_private_entry(pgoff_t offset)return swp_entry (SWP_DEVICE_READ , offset); } +static inline swp_entry_t make_readable_device_private_entry_from_page (struct page *page, +pgoff_t flags) +{ +return swp_entry (SWP_DEVICE_READ ,page_to_pfn (page) | flags); +} +static inline swp_entry_t make_writable_device_private_entry (pgoff_t offset) {return swp_entry (SWP_DEVICE_WRITE , offset); } +static inline swp_entry_t make_writable_device_private_entry_from_page (struct page *page, +pgoff_t flags) +{ +return swp_entry (SWP_DEVICE_WRITE ,page_to_pfn (page) | flags); +} +static inline swp_entry_t make_device_exclusive_entry (pgoff_t offset) {return swp_entry (SWP_DEVICE_EXCLUSIVE , offset);
@@ -169,11 +181,23 @@ static inline swp_entry_t make_readable_device_private_entry(pgoff_t offset)return swp_entry (0 ,0 ); } +static inline swp_entry_t make_readable_device_private_entry_from_page (struct page *page, +pgoff_t flags) +{ +return swp_entry (0 ,0 ); +} +static inline swp_entry_t make_writable_device_private_entry (pgoff_t offset) {return swp_entry (0 ,0 ); } +static inline swp_entry_t make_writable_device_private_entry_from_page (struct page *page, +pgoff_t flags) +{ +return swp_entry (0 ,0 ); +} +static inline swp_entry_t make_device_exclusive_entry (pgoff_t offset) {return swp_entry (0 ,0 );
mm/huge_memory.c +6 -8
@@ -3219,11 +3219,11 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,* is false. */ if (write) - swp_entry =make_writable_device_private_entry ( -page_to_pfn (page + i)); + swp_entry =make_writable_device_private_entry_from_page ( + page + i,0 );else - swp_entry =make_readable_device_private_entry ( -page_to_pfn (page + i)); + swp_entry =make_readable_device_private_entry_from_page ( + page + i,0 );/* * Young and dirty bits are not progated via swp_entry */
@@ -4950,11 +4950,9 @@ void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new)swp_entry_t entry;if (pmd_write (pmde)) - entry =make_writable_device_private_entry ( -page_to_pfn (new)); + entry =make_writable_device_private_entry_from_page (new,0 );else - entry =make_readable_device_private_entry ( -page_to_pfn (new)); + entry =make_readable_device_private_entry_from_page (new,0 ); pmde =swp_entry_to_pmd (entry);if (pmd_swp_soft_dirty (*pvmw->pmd))
mm/migrate.c +2 -4
@@ -399,11 +399,9 @@ static bool remove_migration_pte(struct folio *folio,if (unlikely (is_device_private_page (new))) {if (pte_write (pte)) - entry =make_writable_device_private_entry ( -page_to_pfn (new)); + entry =make_writable_device_private_entry_from_page (new,0 );else - entry =make_readable_device_private_entry ( -page_to_pfn (new)); + entry =make_readable_device_private_entry_from_page (new,0 ); pte =softleaf_to_pte (entry);if (pte_swp_soft_dirty (old_pte)) pte =pte_swp_mksoft_dirty (pte);
mm/migrate_device.c +4 -8
@@ -836,11 +836,9 @@ static int migrate_vma_insert_huge_pmd_page(struct migrate_vma *migrate,swp_entry_t swp_entry;if (vma->vm_flags &VM_WRITE ) - swp_entry =make_writable_device_private_entry ( -page_to_pfn (page)); + swp_entry =make_writable_device_private_entry_from_page (page,0 );else - swp_entry =make_readable_device_private_entry ( -page_to_pfn (page)); + swp_entry =make_readable_device_private_entry_from_page (page,0 ); entry =swp_entry_to_pmd (swp_entry); }else { if (folio_is_zone_device(folio) &&
@@ -1033,11 +1031,9 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate,swp_entry_t swp_entry;if (vma->vm_flags &VM_WRITE ) - swp_entry =make_writable_device_private_entry ( -page_to_pfn (page)); + swp_entry =make_writable_device_private_entry_from_page (page,0 );else - swp_entry =make_readable_device_private_entry ( -page_to_pfn (page)); + swp_entry =make_readable_device_private_entry_from_page (page,0 ); entry =swp_entry_to_pte (swp_entry); }else { if (folio_is_zone_device(folio) &&
Signature · 1 line
2.34.1
PATCH v6 11/13 mm/util: Add flag to track device private pages in page snapshots
In reply to Jordan NietheA future change will remove device private pages from the physical address space. This will mean that device private pages no longer have normal pfns and must be handled separately.
Add a new flag PAGE_SNAPSHOT_DEVICE_PRIVATE to track when the pfn of a page snapshot is a device private page.
---
v1:
- No change
v2:
- No change
v3:
- No change
v4:
- Move logical continuation to previous line
--- fs/proc/page.c | 6 ++++-- include/linux/mm.h | 7 ++++--- mm/util.c | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-)
fs/proc/page.c +4 -2
@@ -191,10 +191,12 @@ u64 stable_page_flags(const struct page *page) folio_test_large_rmappable(folio)) {/* Note: we indicate any THPs here, not just PMD-sized ones */ u |=1 <<KPF_THP ; - } else if (is_huge_zero_pfn(ps.pfn)) { + } else if (!(ps.flags & PAGE_SNAPSHOT_DEVICE_PRIVATE) && + is_huge_zero_pfn(ps.pfn)) { u |=1 <<KPF_ZERO_PAGE ; u |=1 <<KPF_THP ; - } else if (is_zero_pfn(ps.pfn)) { + } else if (!(ps.flags & PAGE_SNAPSHOT_DEVICE_PRIVATE) && + is_zero_pfn(ps.pfn)) { u |=1 <<KPF_ZERO_PAGE ; }
include/linux/mm.h +4 -3
@@ -4627,9 +4627,10 @@ static inline bool page_pool_page_is_pp(const struct page *page) }#endif -#define PAGE_SNAPSHOT_FAITHFUL (1 << 0) -#define PAGE_SNAPSHOT_PG_BUDDY (1 << 1) -#define PAGE_SNAPSHOT_PG_IDLE (1 << 2) +#define PAGE_SNAPSHOT_FAITHFUL (1 << 0) +#define PAGE_SNAPSHOT_PG_BUDDY (1 << 1) +#define PAGE_SNAPSHOT_PG_IDLE (1 << 2) +#define PAGE_SNAPSHOT_DEVICE_PRIVATE (1 << 3)struct page_snapshot {struct folio folio_snapshot;
mm/util.c +3 -0
@@ -1218,6 +1218,9 @@ static void set_ps_flags(struct page_snapshot *ps, const struct folio *folio,if (folio_test_idle (folio)) ps->flags |=PAGE_SNAPSHOT_PG_IDLE ; + +if (is_device_private_page (page)) + ps->flags |=PAGE_SNAPSHOT_DEVICE_PRIVATE ; }/**
Signature · 1 line
2.34.1
David Hildenbrand (Arm)
maintainerRe: [PATCH v6 11/13] mm/util: Add flag to track device private pages in page snapshots
Quoted 66 lines · Jordan Niethe
A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have normal pfns and must be handled separately.
Add a new flag
PAGE_SNAPSHOT_DEVICE_PRIVATEto track when the pfn of a page snapshot is a device private page.Signed-off-by Jordan Niethe <[email protected]>Signed-off-by Alistair Popple <[email protected]>---
v1:
- No change
v2:
- No change
v3:
- No change
v4:
- Move logical continuation to previous line--- fs/proc/page.c | 6 ++++-- include/linux/mm.h | 7 ++++--- mm/util.c | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-)fs/proc/page.c +4
-2@@ -191,10 +191,12 @@ u64 stable_page_flags(const struct page *page) folio_test_large_rmappable(folio)) {/* Note: we indicate any THPs here, not just PMD-sized ones */ u |=1 <<KPF_THP ; - } else if (is_huge_zero_pfn(ps.pfn)) { + } else if (!(ps.flags & PAGE_SNAPSHOT_DEVICE_PRIVATE) && + is_huge_zero_pfn(ps.pfn)) { u |=1 <<KPF_ZERO_PAGE ; u |=1 <<KPF_THP ; - } else if (is_zero_pfn(ps.pfn)) { + } else if (!(ps.flags & PAGE_SNAPSHOT_DEVICE_PRIVATE) && + is_zero_pfn(ps.pfn)) { u |=1 <<KPF_ZERO_PAGE ; }include/linux/mm.h +4
-3@@ -4627,9 +4627,10 @@ static inline bool page_pool_page_is_pp(const struct page *page) }#endif -#define PAGE_SNAPSHOT_FAITHFUL (1 << 0) -#define PAGE_SNAPSHOT_PG_BUDDY (1 << 1) -#define PAGE_SNAPSHOT_PG_IDLE (1 << 2) +#define PAGE_SNAPSHOT_FAITHFUL (1 << 0) +#define PAGE_SNAPSHOT_PG_BUDDY (1 << 1) +#define PAGE_SNAPSHOT_PG_IDLE (1 << 2) +#define PAGE_SNAPSHOT_DEVICE_PRIVATE (1 << 3)struct page_snapshot {struct folio folio_snapshot;mm/util.c +0
-0
mm/util.c static void set_ps_flags(struct page_snapshot *ps, const struct folio *folio, · line 1223
Quoted 6 lines
mm/util.c +3
-0@@ -1218,6 +1218,9 @@ static void set_ps_flags(struct page_snapshot *ps, const struct folio *folio,if (folio_test_idle (folio)) ps->flags |=PAGE_SNAPSHOT_PG_IDLE ; + +if (is_device_private_page (page)) + ps->flags |=PAGE_SNAPSHOT_DEVICE_PRIVATE ;
stable_page_flags() has access to the page and can simply test that instead?
Signature · 3 lines
Cheers, David
David Hildenbrand (Arm)
maintainerRe: [PATCH v6 11/13] mm/util: Add flag to track device private pages in page snapshots
Quoted 68 lines · David Hildenbrand (Arm)
Quoted 67 lines · Jordan Niethe
A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have normal pfns and must be handled separately.
Add a new flag
PAGE_SNAPSHOT_DEVICE_PRIVATEto track when the pfn of a page snapshot is a device private page.Signed-off-by Jordan Niethe <[email protected]>Signed-off-by Alistair Popple <[email protected]>---
v1:
- No change
v2:
- No change
v3:
- No change
v4:
- Move logical continuation to previous line--- fs/proc/page.c | 6 ++++-- include/linux/mm.h | 7 ++++--- mm/util.c | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-)fs/proc/page.c +4
-2@@ -191,10 +191,12 @@ u64 stable_page_flags(const struct page *page) folio_test_large_rmappable(folio)) {/* Note: we indicate any THPs here, not just PMD-sized ones */ u |=1 <<KPF_THP ; - } else if (is_huge_zero_pfn(ps.pfn)) { + } else if (!(ps.flags & PAGE_SNAPSHOT_DEVICE_PRIVATE) && + is_huge_zero_pfn(ps.pfn)) { u |=1 <<KPF_ZERO_PAGE ; u |=1 <<KPF_THP ; - } else if (is_zero_pfn(ps.pfn)) { + } else if (!(ps.flags & PAGE_SNAPSHOT_DEVICE_PRIVATE) && + is_zero_pfn(ps.pfn)) { u |=1 <<KPF_ZERO_PAGE ; }include/linux/mm.h +4
-3@@ -4627,9 +4627,10 @@ static inline bool page_pool_page_is_pp(const struct page *page) }#endif -#define PAGE_SNAPSHOT_FAITHFUL (1 << 0) -#define PAGE_SNAPSHOT_PG_BUDDY (1 << 1) -#define PAGE_SNAPSHOT_PG_IDLE (1 << 2) +#define PAGE_SNAPSHOT_FAITHFUL (1 << 0) +#define PAGE_SNAPSHOT_PG_BUDDY (1 << 1) +#define PAGE_SNAPSHOT_PG_IDLE (1 << 2) +#define PAGE_SNAPSHOT_DEVICE_PRIVATE (1 << 3)struct page_snapshot {struct folio folio_snapshot;mm/util.c +0
-0@@ -1218,6 +1218,9 @@ static void set_ps_flags(struct page_snapshot *ps, const struct folio *folio,
Quoted 8 lines
mm/util.c static void set_ps_flags(struct page_snapshot *ps, const struct folio *folio, · line 1223
Quoted 5 lines
mm/util.c +3
-0if (folio_test_idle (folio)) ps->flags |=PAGE_SNAPSHOT_PG_IDLE ; + +if (is_device_private_page (page)) + ps->flags |=PAGE_SNAPSHOT_DEVICE_PRIVATE ;
stable_page_flags()has access to the page and can simply test that instead?
Or maybe even better, if the pfn has no meaning, set it to 0 or -1, or anything that will make the other code just ignore it.
Signature · 3 lines
Cheers, David
PATCH v6 12/13 mm/hmm: Add flag to track device private pages
In reply to Jordan NietheA future change will remove device private pages from the physical address space. This will mean that device private pages no longer have normal pfns and must be handled separately.
Prepare for this by adding a HMM_PFN_DEVICE_PRIVATE flag to indicate that a hmm_pfn contains a PFN for a device private page.
---
v1:
- Update HMM_PFN_ORDER_SHIFT
- Handle hmm_vma_handle_absent_pmd()
v2:
- No change
v3:
- No change
--- include/linux/hmm.h | 4 +++- mm/hmm.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-)
include/linux/hmm.h +3 -1
@@ -23,6 +23,7 @@ struct mmu_interval_notifier;* HMM_PFN_WRITE - if the page memory can be written to (requires HMM_PFN_VALID) * HMM_PFN_ERROR - accessing the pfn is impossible and the device should * fail. ie poisoned memory, special pages, no vma, etc +* HMM_PFN_DEVICE_PRIVATE - the pfn field contains a DEVICE_PRIVATE pfn. * HMM_PFN_P2PDMA - P2P page * HMM_PFN_P2PDMA_BUS - Bus mapped P2P transfer * HMM_PFN_DMA_MAPPED - Flag preserved on input-to-output transformation
@@ -40,6 +41,7 @@ enum hmm_pfn_flags {HMM_PFN_VALID =1UL << (BITS_PER_LONG -1 ),HMM_PFN_WRITE =1UL << (BITS_PER_LONG -2 ),HMM_PFN_ERROR =1UL << (BITS_PER_LONG -3 ), +HMM_PFN_DEVICE_PRIVATE =1UL << (BITS_PER_LONG -7 ),/* * Sticky flags, carried from input to output, * don't forget to update HMM_PFN_INOUT_FLAGS
@@ -48,7 +50,7 @@ enum hmm_pfn_flags {HMM_PFN_P2PDMA =1UL << (BITS_PER_LONG -5 ),HMM_PFN_P2PDMA_BUS =1UL << (BITS_PER_LONG -6 ), -HMM_PFN_ORDER_SHIFT = (BITS_PER_LONG -11 ), +HMM_PFN_ORDER_SHIFT = (BITS_PER_LONG -12 ),/* Input flags */ HMM_PFN_REQ_FAULT = HMM_PFN_VALID,
mm/hmm.c +3 -2
@@ -267,7 +267,7 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr,if (softleaf_is_device_private (entry) &&page_pgmap (softleaf_to_page (entry))->owner == range->dev_private_owner) { - cpu_flags =HMM_PFN_VALID ; + cpu_flags =HMM_PFN_VALID |HMM_PFN_DEVICE_PRIVATE ;if (softleaf_is_device_private_write (entry)) cpu_flags |=HMM_PFN_WRITE ; new_pfn_flags =softleaf_to_pfn (entry) | cpu_flags;
@@ -347,7 +347,8 @@ static int hmm_vma_handle_absent_pmd(struct mm_walk *walk, unsigned long start, softleaf_to_folio(entry)->pgmap->owner == range->dev_private_owner) {unsigned long cpu_flags =HMM_PFN_VALID | -hmm_pfn_flags_order (PMD_SHIFT -PAGE_SHIFT ); +hmm_pfn_flags_order (PMD_SHIFT -PAGE_SHIFT ) | +HMM_PFN_DEVICE_PRIVATE ;unsigned long pfn =softleaf_to_pfn (entry);unsigned long i;
Signature · 1 line
2.34.1
David Hildenbrand (Arm)
maintainerRe: [PATCH v6 12/13] mm/hmm: Add flag to track device private pages
Quoted 9 lines · Jordan Niethe
A future change will remove device private pages from the physical address space. This will mean that device private pages no longer have normal pfns and must be handled separately.
Prepare for this by adding a
HMM_PFN_DEVICE_PRIVATEflag to indicate that ahmm_pfncontains a PFN for a device private page.Signed-off-by Jordan Niethe <[email protected]>Signed-off-by Alistair Popple <[email protected]>
That makes sense to me.
Signature · 3 lines
Cheers, David
PATCH v6 13/13 mm: Remove device private pages from the physical address space
In reply to Jordan NietheThe existing design of device private memory imposes limitations which render it non functional for certain systems and configurations where the physical address space is limited.
Device private memory is implemented by first reserving a region of the physical address space. This is a problem. The physical address space is not a resource that is directly under the kernel's control. Availability of suitable physical address space is constrained by the underlying hardware and firmware and may not always be available.
Device private memory assumes that it will be able to reserve a device memory sized chunk of physical address space. However, there is nothing guaranteeing that this will succeed, and there a number of factors that increase the likelihood of failure. We need to consider what else may exist in the physical address space. It is observed that certain VM configurations place very large PCI windows immediately after RAM. Large enough that there is no physical address space available at all for device private memory. This is more likely to occur on 43 bit physical width systems which have less physical address space.
Instead of using the physical address space, introduce a device private address space and allocate devices regions from there to represent the device private pages.
Introduce a new interface memremap_device_private_pagemap() that allocates a requested amount of device private address space and creates the necessary device private pages.
To support this new interface, struct dev_pagemap needs some changes:
- Add a new dev_pagemap::nr_pages field as an input parameter.
- Add a new dev_pagemap::pages array to store the device private pages.
When using memremap_device_private_pagemap(), rather then passing in dev_pagemap::ranges[dev_pagemap::nr_ranges] of physical address space to be remapped, dev_pagemap::nr_ranges will always be 1, and the device private range that is reserved is returned in dev_pagemap::range.
Forbid calling memremap_pages() with dev_pagemap::ranges::type = MEMORY_DEVICE_PRIVATE.
Represent this device private address space using a new device_private_pgmap_tree maple tree. This tree maps a given device private address to a struct dev_pagemap, where a specific device private page may then be looked up in that dev_pagemap::pages array.
Device private address space can be reclaimed and the assoicated device private pages freed using the corresponding new memunmap_device_private_pagemap() interface.
Because the device private pages now live outside the physical address space, they no longer have a normal PFN. This means that page_to_pfn(), et al. are no longer meaningful.
Introduce helpers:
- device_private_page_to_offset()
- device_private_folio_to_offset()
to take a given device private page / folio and return its offset within the device private address space.
Update the places where we previously converted a device private page to a PFN to use these new helpers. When we encounter a device private offset, instead of looking up its page within the pagemap use device_private_offset_to_page() instead.
Update the existing users:
- lib/test_hmm.c
- ppc ultravisor
- drm/amd/amdkfd
- gpu/drm/xe
- gpu/drm/nouveau
to use the new memremap_device_private_pagemap() interface.
---
v1:
- Include NUMA node paramater for memremap_device_private_pagemap()
- Add devm_memremap_device_private_pagemap() and friends
- Update existing users of memremap_pages():
- ppc ultravisor
- drm/amd/amdkfd
- gpu/drm/xe
- gpu/drm/nouveau
- Update for HMM huge page support
- Guard device_private_offset_to_page and friends with CONFIG_ZONE_DEVICE
v2:
- Make sure last member of struct dev_pagemap remains DECLARE_FLEX_ARRAY(struct range, ranges);
v3:
- Use numa_mem_id() if memremap_device_private_pagemap is called with NUMA_NO_NODE. This fixes a null pointer deref in lruvec_stat_mod_folio().
- drm/xe: Remove call to devm_release_mem_region() in xe_pagemap_destroy_work()
- s/VM_BUG/VM_WARN/
v4:
- Use devm_memunmap_device_private_pagemap() in xe_pagemap_destroy_work()
- Replace ^ with != for PVMW_DEVICE_PRIVATE comparisions
- Minor style changes
- remove discussion of aarch64 from commit message - not relevant post eeb8fdfcf090 ("arm64: Expose the end of the linear map in PHYSMEM_END")
v6:
- Fix maybe unused in kgd2kfd_init_zone_device()
- Replace division by PAGE_SIZE with DIV_ROUND_UP() when setting nr_pages. This mirrors the align up that previously happened in get_free_mem_region()
--- Documentation/mm/hmm.rst | 11 +- arch/powerpc/kvm/book3s_hv_uvmem.c | 41 ++--- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 23 +-- drivers/gpu/drm/nouveau/nouveau_dmem.c | 35 ++-- drivers/gpu/drm/xe/xe_svm.c | 30 +--- include/linux/hmm.h | 3 + include/linux/leafops.h | 16 +- include/linux/memremap.h | 64 +++++++- include/linux/migrate.h | 6 +- include/linux/mm.h | 2 + include/linux/rmap.h | 5 + include/linux/swapops.h | 10 +- lib/test_hmm.c | 70 ++++---- mm/debug.c | 9 +- mm/memremap.c | 196 ++++++++++++++++++----- mm/mm_init.c | 8 +- mm/page_vma_mapped.c | 22 ++- mm/rmap.c | 43 +++-- mm/util.c | 5 +- 19 files changed, 397 insertions(+), 202 deletions(-)
Documentation/mm/hmm.rst +3 -8
@@ -276,17 +276,12 @@ These can be allocated and freed with:: struct resource *res; struct dev_pagemap pagemap; - res = request_free_mem_region(&iomem_resource, /* number of bytes */, - "name of driver resource"); pagemap.type = MEMORY_DEVICE_PRIVATE; - pagemap.range.start = res->start; - pagemap.range.end = res->end; - pagemap.nr_range = 1; + pagemap.nr_pages = /* number of pages */; pagemap.ops = &device_devmem_ops; - memremap_pages(&pagemap, numa_node_id()); + memremap_device_private_pagemap(&pagemap, numa_node_id()); - memunmap_pages(&pagemap); - release_mem_region(pagemap.range.start, range_len(&pagemap.range)); + memunmap_device_private_pagemap(&pagemap); There are also devm_request_free_mem_region(), devm_memremap_pages(), devm_memunmap_pages(), and devm_release_mem_region() when the resources can
arch/powerpc/kvm/book3s_hv_uvmem.c +13 -28
100 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +12 -11
@@ -1030,9 +1030,9 @@ int kgd2kfd_init_zone_device(struct amdgpu_device *adev) {struct amdgpu_kfd_dev *kfddev = &adev->kfd;struct dev_pagemap *pgmap; -struct resource *res =NULL ;unsigned long size;void *r; +int ret =0 ;/* Page migration works on gfx9 or newer */ if (amdgpu_ip_version (adev,GC_HWIP ,0 ) <IP_VERSION (9 ,0 ,1 ))
@@ -1053,11 +1053,7 @@ int kgd2kfd_init_zone_device(struct amdgpu_device *adev) pgmap->range.end = adev->gmc.aper_base + adev->gmc.aper_size -1 ; pgmap->type =MEMORY_DEVICE_COHERENT ; }else { - res =devm_request_free_mem_region (adev->dev, &iomem_resource, size); -if (IS_ERR (res)) -return PTR_ERR (res); - pgmap->range.start = res->start; - pgmap->range.end = res->end; + pgmap->nr_pages =DIV_ROUND_UP (size,PAGE_SIZE ); pgmap->type =MEMORY_DEVICE_PRIVATE ; }
@@ -1068,14 +1064,19 @@ int kgd2kfd_init_zone_device(struct amdgpu_device *adev)/* Device manager releases device-specific resources, memory region and * pgmap when driver disconnects from device. */ - r =devm_memremap_pages (adev->dev, pgmap); -if (IS_ERR (r)) { +if (pgmap->type ==MEMORY_DEVICE_PRIVATE ) { + ret =devm_memremap_device_private_pagemap (adev->dev, pgmap); + }else { + r =devm_memremap_pages (adev->dev, pgmap); +if (IS_ERR (r)) + ret =PTR_ERR (r); + } + +if (ret) {pr_err ("failed to register HMM device memory\n" ); -if (pgmap->type ==MEMORY_DEVICE_PRIVATE ) -devm_release_mem_region (adev->dev, res->start,resource_size (res));/* Disable SVM support capability */ pgmap->type =0 ; -return PTR_ERR (r); +return ret; } pr_debug("reserve %ldMB system memory for VRAM pages struct\n",
drivers/gpu/drm/nouveau/nouveau_dmem.c +9 -26
@@ -109,7 +109,7 @@ static struct nouveau_drm *page_to_drm(struct page *page)unsigned long nouveau_dmem_page_addr (struct page *page) {struct nouveau_dmem_chunk *chunk =nouveau_page_to_chunk (page); -unsigned long off = (page_to_pfn (page) <<PAGE_SHIFT ) - +unsigned long off = (device_private_page_to_offset (page) <<PAGE_SHIFT ) - chunk->pagemap.range.start;return chunk->bo->offset + off;
@@ -297,9 +297,7 @@ nouveau_dmem_chunk_alloc(struct nouveau_drm *drm, struct page **ppage, bool is_large) {struct nouveau_dmem_chunk *chunk; -struct resource *res;struct page *page; -void *ptr;unsigned long i, pfn_first, pfn;int ret;
@@ -309,39 +307,28 @@ nouveau_dmem_chunk_alloc(struct nouveau_drm *drm, struct page **ppage, goto out; } -/* Allocate unused physical address space for device private pages. */ - res =request_free_mem_region (&iomem_resource,DMEM_CHUNK_SIZE *NR_CHUNKS , -"nouveau_dmem" ); -if (IS_ERR (res)) { - ret =PTR_ERR (res); - goto out_free; - } - chunk->drm = drm; chunk->pagemap.type =MEMORY_DEVICE_PRIVATE ; - chunk->pagemap.range.start = res->start; - chunk->pagemap.range.end = res->end; chunk->pagemap.nr_range =1 ; + chunk->pagemap.nr_pages =DIV_ROUND_UP (DMEM_CHUNK_SIZE *NR_CHUNKS ,PAGE_SIZE ); chunk->pagemap.ops = &nouveau_dmem_pagemap_ops; chunk->pagemap.owner = drm->dev; ret =nouveau_bo_new_pin (&drm->client,NOUVEAU_GEM_DOMAIN_VRAM ,DMEM_CHUNK_SIZE , &chunk->bo);if (ret) - goto out_release; + goto out_free; - ptr =memremap_pages (&chunk->pagemap,numa_node_id ()); -if (IS_ERR (ptr)) { - ret =PTR_ERR (ptr); + ret =memremap_device_private_pagemap (&chunk->pagemap,numa_node_id ()); +if (ret) goto out_bo_free; - }mutex_lock (&drm->dmem->mutex);list_add (&chunk->list, &drm->dmem->chunks);mutex_unlock (&drm->dmem->mutex); pfn_first = chunk->pagemap.range.start >>PAGE_SHIFT ; - page =pfn_to_page (pfn_first); + page =device_private_offset_to_page (pfn_first);spin_lock (&drm->dmem->lock); pfn = pfn_first;
@@ -350,12 +337,12 @@ nouveau_dmem_chunk_alloc(struct nouveau_drm *drm, struct page **ppage,if (!IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ) || !is_large) {for (j =0 ; j <DMEM_CHUNK_NPAGES -1 ; j++, pfn++) { - page =pfn_to_page (pfn); + page =device_private_offset_to_page (pfn); page->zone_device_data = drm->dmem->free_pages; drm->dmem->free_pages = page; } }else { - page =pfn_to_page (pfn); + page =device_private_offset_to_page (pfn); page->zone_device_data = drm->dmem->free_folios; drm->dmem->free_folios =page_folio (page); pfn +=DMEM_CHUNK_NPAGES ;
@@ -382,8 +369,6 @@ nouveau_dmem_chunk_alloc(struct nouveau_drm *drm, struct page **ppage, out_bo_free:nouveau_bo_unpin_del (&chunk->bo); -out_release: -release_mem_region (chunk->pagemap.range.start,range_len (&chunk->pagemap.range)); out_free:kfree (chunk); out:
@@ -543,9 +528,7 @@ nouveau_dmem_fini(struct nouveau_drm *drm)nouveau_bo_unpin_del (&chunk->bo);WARN_ON (chunk->callocated);list_del (&chunk->list); -memunmap_pages (&chunk->pagemap); -release_mem_region (chunk->pagemap.range.start, -range_len (&chunk->pagemap.range)); +memunmap_device_private_pagemap (&chunk->pagemap);kfree (chunk); }
drivers/gpu/drm/xe/xe_svm.c +7 -23
@@ -452,7 +452,7 @@ static u64 xe_page_to_dpa(struct page *page)struct xe_pagemap *xpagemap =xe_page_to_pagemap (page);struct xe_vram_region *vr =xe_pagemap_to_vr (xpagemap);u64 hpa_base = xpagemap->hpa_base; -u64 pfn =page_to_pfn (page); +u64 pfn =device_private_page_to_offset (page);u64 offset;u64 dpa;
@@ -1699,9 +1699,7 @@ static void xe_pagemap_destroy_work(struct work_struct *work)* will do shortly. */ if (drm_dev_enter (drm, &idx)) { -devm_memunmap_pages (drm->dev, pagemap); -devm_release_mem_region (drm->dev, pagemap->range.start, - pagemap->range.end - pagemap->range.start +1 ); +devm_memunmap_device_private_pagemap (drm->dev, pagemap);drm_dev_exit (idx); }
@@ -1745,8 +1743,6 @@ static struct xe_pagemap *xe_pagemap_create(struct xe_device *xe, struct xe_vramstruct xe_pagemap *xpagemap;struct dev_pagemap *pagemap;struct drm_pagemap *dpagemap; -struct resource *res; -void *addr;int err; xpagemap =kzalloc (sizeof (*xpagemap),GFP_KERNEL );
@@ -1763,36 +1759,24 @@ static struct xe_pagemap *xe_pagemap_create(struct xe_device *xe, struct xe_vramif (err) goto out_no_dpagemap; - res =devm_request_free_mem_region (dev, &iomem_resource, - vr->usable_size); -if (IS_ERR (res)) { - err =PTR_ERR (res); - goto out_err; - } - err =drm_pagemap_acquire_owner (&xpagemap->peer, &xe_owner_list, xe_has_interconnect);if (err) - goto out_no_owner; + goto out_err; pagemap->type =MEMORY_DEVICE_PRIVATE ; - pagemap->range.start = res->start; - pagemap->range.end = res->end; pagemap->nr_range =1 ; + pagemap->nr_pages =DIV_ROUND_UP (vr->usable_size,PAGE_SIZE ); pagemap->owner = xpagemap->peer.owner; pagemap->ops =drm_pagemap_pagemap_ops_get (); - addr =devm_memremap_pages (dev, pagemap); -if (IS_ERR (addr)) { - err =PTR_ERR (addr); + err =devm_memremap_device_private_pagemap (dev, pagemap); +if (err) goto out_no_pages; - } - xpagemap->hpa_base = res->start; + xpagemap->hpa_base = pagemap->range.start;return xpagemap; out_no_pages:drm_pagemap_release_owner (&xpagemap->peer); -out_no_owner: -devm_release_mem_region (dev, res->start, res->end - res->start +1 ); out_err:drm_pagemap_put (dpagemap);return ERR_PTR (err);
include/linux/hmm.h +3 -0
@@ -68,6 +68,9 @@ enum hmm_pfn_flags {*/ static inline struct page *hmm_pfn_to_page (unsigned long hmm_pfn) { +if (hmm_pfn &HMM_PFN_DEVICE_PRIVATE ) +return device_private_offset_to_page (hmm_pfn & ~HMM_PFN_FLAGS ); +return pfn_to_page (hmm_pfn & ~HMM_PFN_FLAGS ); }
include/linux/leafops.h +14 -2
@@ -455,7 +455,13 @@ static inline unsigned long softleaf_to_flags(softleaf_t entry)*/ static inline struct page *softleaf_to_page (softleaf_t entry) { -struct page *page =pfn_to_page (softleaf_to_pfn (entry)); +struct page *page; + +if (softleaf_is_migration_device_private (entry) || +softleaf_is_device_private (entry)) + page =device_private_entry_to_page (entry); +else + page =pfn_to_page (softleaf_to_pfn (entry));VM_WARN_ON_ONCE (!softleaf_has_pfn (entry));/*
@@ -475,7 +481,13 @@ static inline struct page *softleaf_to_page(softleaf_t entry)*/ static inline struct folio *softleaf_to_folio (softleaf_t entry) { -struct folio *folio =pfn_folio (softleaf_to_pfn (entry)); +struct folio *folio; + +if (softleaf_is_migration_device_private (entry) || +softleaf_is_device_private (entry)) + folio =page_folio (device_private_entry_to_page (entry)); +else + folio =pfn_folio (softleaf_to_pfn (entry));VM_WARN_ON_ONCE (!softleaf_has_pfn (entry));/*
include/linux/memremap.h +62 -2
108 lines not on this page · raw message
include/linux/migrate.h +5 -1
@@ -133,6 +133,10 @@ static inline struct page *migrate_pfn_to_page(unsigned long mpfn) {if (!(mpfn &MIGRATE_PFN_VALID ))return NULL ; + +if (mpfn &MIGRATE_PFN_DEVICE_PRIVATE ) +return device_private_offset_to_page (mpfn >>MIGRATE_PFN_SHIFT ); +return pfn_to_page (mpfn >>MIGRATE_PFN_SHIFT ); }
@@ -144,7 +148,7 @@ static inline unsigned long migrate_pfn(unsigned long pfn)static inline unsigned long migrate_pfn_from_page (struct page *page) {if (is_device_private_page (page)) -return migrate_pfn (page_to_pfn (page)) | +return migrate_pfn (device_private_page_to_offset (page)) |MIGRATE_PFN_DEVICE_PRIVATE ;return migrate_pfn (page_to_pfn (page)); }
include/linux/mm.h +2 -0
@@ -2042,6 +2042,8 @@ static inline unsigned long memdesc_section(memdesc_flags_t mdf)*/ static inline unsigned long folio_pfn (const struct folio *folio) { +VM_WARN_ON (folio_is_device_private (folio)); +return page_to_pfn (&folio->page); }
include/linux/rmap.h +5 -0
@@ -951,11 +951,16 @@ static inline unsigned long page_vma_walk_flags(const struct folio *folio,static inline unsigned long folio_page_vma_walk_pfn (const struct folio *folio) { +if (folio_is_device_private (folio)) +return device_private_folio_to_offset (folio); +return folio_pfn (folio); }static inline struct folio *page_vma_walk_pfn_to_folio (struct page_vma_mapped_walk *pvmw) { +if (pvmw->flags &PVMW_DEVICE_PRIVATE ) +return page_folio (device_private_offset_to_page (pvmw->pfn));return pfn_folio (pvmw->pfn); }
include/linux/swapops.h +5 -5
@@ -141,7 +141,7 @@ static inline swp_entry_t make_readable_device_private_entry(pgoff_t offset)static inline swp_entry_t make_readable_device_private_entry_from_page (struct page *page,pgoff_t flags) { -return swp_entry (SWP_DEVICE_READ ,page_to_pfn (page) | flags); +return swp_entry (SWP_DEVICE_READ ,device_private_page_to_offset (page) | flags); }static inline swp_entry_t make_writable_device_private_entry (pgoff_t offset)
@@ -152,7 +152,7 @@ static inline swp_entry_t make_writable_device_private_entry(pgoff_t offset)static inline swp_entry_t make_writable_device_private_entry_from_page (struct page *page,pgoff_t flags) { -return swp_entry (SWP_DEVICE_WRITE ,page_to_pfn (page) | flags); +return swp_entry (SWP_DEVICE_WRITE ,device_private_page_to_offset (page) | flags); }static inline swp_entry_t make_device_exclusive_entry (pgoff_t offset)
@@ -232,7 +232,7 @@ static inline swp_entry_t make_readable_migration_entry_from_page(struct page *p {if (is_device_private_page (page))return make_readable_migration_device_private_entry ( -page_to_pfn (page) | flags); +device_private_page_to_offset (page) | flags);return swp_entry (SWP_MIGRATION_READ ,page_to_pfn (page) | flags); }
@@ -247,7 +247,7 @@ static inline swp_entry_t make_readable_exclusive_migration_entry_from_page(stru {if (is_device_private_page (page))return make_readable_exclusive_migration_device_private_entry ( -page_to_pfn (page) | flags); +device_private_page_to_offset (page) | flags);return swp_entry (SWP_MIGRATION_READ_EXCLUSIVE ,page_to_pfn (page) | flags); }
@@ -262,7 +262,7 @@ static inline swp_entry_t make_writable_migration_entry_from_page(struct page *p {if (is_device_private_page (page))return make_writable_migration_device_private_entry ( -page_to_pfn (page) | flags); +device_private_page_to_offset (page) | flags);return swp_entry (SWP_MIGRATION_WRITE ,page_to_pfn (page) | flags); }
lib/test_hmm.c +41 -29
151 lines not on this page · raw message
mm/debug.c +6 -3
@@ -77,9 +77,11 @@ static void __dump_folio(const struct folio *folio, const struct page *page,if (page_mapcount_is_type (mapcount)) mapcount =0 ; -pr_warn ("page: refcount:%d mapcount:%d mapping:%p index:%#lx pfn:%#lx\n" , +pr_warn ("page: refcount:%d mapcount:%d mapping:%p index:%#lx %spfn:%#lx\n" ,folio_ref_count (folio), mapcount, mapping, - folio->index + idx, pfn); + folio->index + idx, +folio_is_device_private (folio) ?"device " :"" , + pfn);if (folio_test_large (folio)) {int pincount =0 ;
@@ -113,7 +115,8 @@ static void __dump_folio(const struct folio *folio, const struct page *page,* inaccuracy here due to racing. */ pr_warn ("%sflags: %pGp%s\n" , type, &folio->flags, -is_migrate_cma_folio (folio, pfn) ?" CMA" :"" ); + (!folio_is_device_private (folio) && +is_migrate_cma_folio (folio, pfn)) ?" CMA" :"" );if (page_has_type (&folio->page))pr_warn ("page_type: %x(%s)\n" , folio->page.page_type >>24 ,page_type_name (folio->page.page_type));
mm/memremap.c +154 -42
255 lines not on this page · raw message
mm/mm_init.c +4 -4
@@ -1004,9 +1004,9 @@ static void __init memmap_init(void) }#ifdef CONFIG_ZONE_DEVICE -static void __ref __init_zone_device_page (struct page *page,unsigned long pfn, -unsigned long zone_idx,int nid, -struct dev_pagemap *pgmap) +void __ref __init_zone_device_page (struct page *page,unsigned long pfn, +unsigned long zone_idx,int nid, +struct dev_pagemap *pgmap) {__init_single_page (page, pfn, zone_idx, nid);
@@ -1038,7 +1038,7 @@ static void __ref __init_zone_device_page(struct page *page, unsigned long pfn,* Please note that MEMINIT_HOTPLUG path doesn't clear memmap * because this is done early in section_activate() */ -if (pageblock_aligned (pfn)) { +if (pgmap->type !=MEMORY_DEVICE_PRIVATE &&pageblock_aligned (pfn)) {init_pageblock_migratetype (page,MIGRATE_MOVABLE , false);cond_resched (); }
mm/page_vma_mapped.c +19 -3
@@ -107,6 +107,7 @@ static bool map_pte(struct page_vma_mapped_walk *pvmw, pmd_t *pmdvalp,static bool check_pte (struct page_vma_mapped_walk *pvmw,unsigned long pte_nr) {unsigned long pfn; +bool device_private = false;pte_t ptent =ptep_get (pvmw->pte);if (pvmw->flags &PVMW_MIGRATION ) {
@@ -115,6 +116,9 @@ static bool check_pte(struct page_vma_mapped_walk *pvmw, unsigned long pte_nr)if (!softleaf_is_migration (entry))return false; +if (softleaf_is_migration_device_private (entry)) + device_private = true; + pfn =softleaf_to_pfn (entry); }else if (pte_present (ptent)) { pfn =pte_pfn (ptent);
@@ -127,8 +131,14 @@ static bool check_pte(struct page_vma_mapped_walk *pvmw, unsigned long pte_nr)return false; pfn =softleaf_to_pfn (entry); + +if (softleaf_is_device_private (entry)) + device_private = true; } +if (device_private != (bool )(pvmw->flags &PVMW_DEVICE_PRIVATE )) +return false; +if ((pfn + pte_nr -1 ) < pvmw->pfn)return false;if (pfn > (pvmw->pfn + pvmw->nr_pages -1 ))
@@ -137,8 +147,11 @@ static bool check_pte(struct page_vma_mapped_walk *pvmw, unsigned long pte_nr) }/* Returns true if the two ranges overlap. Careful to not overflow. */ -static bool check_pmd (unsigned long pfn,struct page_vma_mapped_walk *pvmw) +static bool check_pmd (unsigned long pfn,bool device_private,struct page_vma_mapped_walk *pvmw) { +if (device_private != (bool )(pvmw->flags &PVMW_DEVICE_PRIVATE )) +return false; +if ((pfn +HPAGE_PMD_NR -1 ) < pvmw->pfn)return false;if (pfn > pvmw->pfn + pvmw->nr_pages -1 )
@@ -254,14 +267,17 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw) entry =softleaf_from_pmd (pmde);if (!softleaf_is_migration (entry) || - !check_pmd (softleaf_to_pfn (entry), pvmw)) + !check_pmd (softleaf_to_pfn (entry), +softleaf_is_device_private (entry) || +softleaf_is_migration_device_private (entry), + pvmw))return not_found (pvmw);return true; }if (likely (pmd_trans_huge (pmde))) {if (pvmw->flags &PVMW_MIGRATION )return not_found (pvmw); -if (!check_pmd (pmd_pfn (pmde), pvmw)) +if (!check_pmd (pmd_pfn (pmde), false, pvmw))return not_found (pvmw);return true; }
mm/rmap.c +29 -14
99 lines not on this page · raw message
mm/util.c +4 -1
@@ -1244,7 +1244,10 @@ void snapshot_page(struct page_snapshot *ps, const struct page *page)struct folio *foliop;int loops =5 ; - ps->pfn =page_to_pfn (page); +if (is_device_private_page (page)) + ps->pfn =device_private_page_to_offset (page); +else + ps->pfn =page_to_pfn (page); ps->flags =PAGE_SNAPSHOT_FAITHFUL ; again:
Signature · 1 line
2.34.1
David Hildenbrand (Arm)
maintainerRe: [PATCH v6 13/13] mm: Remove device private pages from the physical address space
Quoted 113 lines · Jordan Niethe
The existing design of device private memory imposes limitations which render it non functional for certain systems and configurations where the physical address space is limited.
Device private memory is implemented by first reserving a region of the physical address space. This is a problem. The physical address space is not a resource that is directly under the kernel's control. Availability of suitable physical address space is constrained by the underlying hardware and firmware and may not always be available.
Device private memory assumes that it will be able to reserve a device memory sized chunk of physical address space. However, there is nothing guaranteeing that this will succeed, and there a number of factors that increase the likelihood of failure. We need to consider what else may exist in the physical address space. It is observed that certain VM configurations place very large PCI windows immediately after RAM. Large enough that there is no physical address space available at all for device private memory. This is more likely to occur on 43 bit physical width systems which have less physical address space.
Instead of using the physical address space, introduce a device private address space and allocate devices regions from there to represent the device private pages.
Introduce a new interface
memremap_device_private_pagemap()that allocates a requested amount of device private address space and creates the necessary device private pages.To support this new interface, struct
dev_pagemapneeds some changes:- Add a new
dev_pagemap::nr_pagesfield as an input parameter.
- Add a newdev_pagemap::pagesarray to store the device private pages.When using
memremap_device_private_pagemap(), rather then passing in dev_pagemap::ranges[dev_pagemap::nr_ranges] of physical address space to be remapped,dev_pagemap::nr_rangeswill always be 1, and the device private range that is reserved is returned indev_pagemap::range.Forbid calling
memremap_pages()withdev_pagemap::ranges::type=MEMORY_DEVICE_PRIVATE.Represent this device private address space using a new
device_private_pgmap_treemaple tree. This tree maps a given device private address to a structdev_pagemap, where a specific device private page may then be looked up in thatdev_pagemap::pagesarray.Device private address space can be reclaimed and the assoicated device private pages freed using the corresponding new
memunmap_device_private_pagemap()interface.Because the device private pages now live outside the physical address space, they no longer have a normal PFN. This means that
page_to_pfn(), et al. are no longer meaningful.Introduce helpers:
-
device_private_page_to_offset()
-device_private_folio_to_offset()to take a given device private page / folio and return its offset within the device private address space.
Update the places where we previously converted a device private page to a PFN to use these new helpers. When we encounter a device private offset, instead of looking up its page within the pagemap use
device_private_offset_to_page()instead.Update the existing users:
-
lib/test_hmm.c
- ppc ultravisor
- drm/amd/amdkfd
- gpu/drm/xe
- gpu/drm/nouveauto use the new
memremap_device_private_pagemap()interface.Acked-by Felix Kuehling <[email protected]>Reviewed-by Zi Yan <[email protected]> # for MM changesSigned-off-by Jordan Niethe <[email protected]>Signed-off-by Alistair Popple <[email protected]>---
v1:
- Include NUMA node paramater formemremap_device_private_pagemap()
- Adddevm_memremap_device_private_pagemap()and friends
- Update existing users ofmemremap_pages():
- ppc ultravisor
- drm/amd/amdkfd
- gpu/drm/xe
- gpu/drm/nouveau
- Update for HMM huge page support
- Guarddevice_private_offset_to_pageand friends withCONFIG_ZONE_DEVICEv2:
- Make sure last member of structdev_pagemapremainsDECLARE_FLEX_ARRAY(struct range, ranges);v3:
- Usenuma_mem_id()ifmemremap_device_private_pagemapis called withNUMA_NO_NODE. This fixes a null pointer deref inlruvec_stat_mod_folio().
- drm/xe: Remove call todevm_release_mem_region()inxe_pagemap_destroy_work()
- s/VM_BUG/VM_WARN/v4:
- Usedevm_memunmap_device_private_pagemap()inxe_pagemap_destroy_work()
- Replace ^ with != forPVMW_DEVICE_PRIVATEcomparisions
- Minor style changes
- remove discussion of aarch64 from commit message - not relevant posteeb8fdfcf090("arm64: Expose the end of the linear map inPHYSMEM_END")
Quoted 6 lines
v6:
- Fix maybe unused inkgd2kfd_init_zone_device()
- Replace division byPAGE_SIZEwithDIV_ROUND_UP()when settingnr_pages. This mirrors the align up that previously happened inget_free_mem_region()
---
There is just too much in this patch to review it reasonably.
You should probably have a patch that just introduces the helpers and have them just do what we to today.
E.g., device_private_page_to_offset() would just do a pfn_to_page().
Then you can convert individual core-mm pieces that I people can review them making their brain hurt.
Afterwards, you can have a patch that does the real "mm: Remove device private pages from the physical address space" and doesn't have to touch too many core-mm pieces.
[...]
Quoted 5 lines
mm/util.c +0
-0
mm/util.c void snapshot_page(struct page_snapshot *ps, const struct page *page) · line 1251
Quoted 9 lines
mm/util.c +4
-1@@ -1244,7 +1244,10 @@ void snapshot_page(struct page_snapshot *ps, const struct page *page)struct folio *foliop;int loops =5 ; - ps->pfn =page_to_pfn (page); +if (is_device_private_page (page)) + ps->pfn =device_private_page_to_offset (page); +else + ps->pfn =page_to_pfn (page); ps->flags =PAGE_SNAPSHOT_FAITHFUL ;
Why is that not done by the caller?
Signature · 3 lines
Cheers, David
✗ CI.checkpatch: warning for Remove device private pages from physical address space (rev9)
In reply to Jordan Niethe== Series Details ==
== Series Details ==
Series: Remove device private pages from physical address space (rev9)
URL : https://patchwork.freedesktop.org/series/159738/
State : warning
== Summary ==
+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master 1f57ba1afceae32108bd24770069f764d940a0e4
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 8da79889c3c65d44032f8a722f8e3d63f6025de1
Author: Jordan Niethe <[email protected]> Date: Mon Feb 2 22:36:42 2026 +1100
mm: Remove device private pages from the physical address space
The existing design of device private memory imposes limitations which render it non functional for certain systems and configurations where the physical address space is limited.
Device private memory is implemented by first reserving a region of the physical address space. This is a problem. The physical address space is not a resource that is directly under the kernel's control. Availability of suitable physical address space is constrained by the underlying hardware and firmware and may not always be available.
Device private memory assumes that it will be able to reserve a device memory sized chunk of physical address space. However, there is nothing guaranteeing that this will succeed, and there a number of factors that increase the likelihood of failure. We need to consider what else may exist in the physical address space. It is observed that certain VM configurations place very large PCI windows immediately after RAM. Large enough that there is no physical address space available at all for device private memory. This is more likely to occur on 43 bit physical width systems which have less physical address space.
Instead of using the physical address space, introduce a device private address space and allocate devices regions from there to represent the device private pages.
Introduce a new interface memremap_device_private_pagemap() that allocates a requested amount of device private address space and creates the necessary device private pages.
To support this new interface, struct dev_pagemap needs some changes:
- Add a new dev_pagemap::nr_pages field as an input parameter.
- Add a new dev_pagemap::pages array to store the device private pages.
When using memremap_device_private_pagemap(), rather then passing in dev_pagemap::ranges[dev_pagemap::nr_ranges] of physical address space to be remapped, dev_pagemap::nr_ranges will always be 1, and the device private range that is reserved is returned in dev_pagemap::range.
Forbid calling memremap_pages() with dev_pagemap::ranges::type = MEMORY_DEVICE_PRIVATE.
Represent this device private address space using a new device_private_pgmap_tree maple tree. This tree maps a given device private address to a struct dev_pagemap, where a specific device private page may then be looked up in that dev_pagemap::pages array.
Device private address space can be reclaimed and the assoicated device private pages freed using the corresponding new memunmap_device_private_pagemap() interface.
Because the device private pages now live outside the physical address space, they no longer have a normal PFN. This means that page_to_pfn(), et al. are no longer meaningful.
Introduce helpers:
- device_private_page_to_offset()
- device_private_folio_to_offset()
to take a given device private page / folio and return its offset within the device private address space.
Update the places where we previously converted a device private page to a PFN to use these new helpers. When we encounter a device private offset, instead of looking up its page within the pagemap use device_private_offset_to_page() instead.
Update the existing users:
- lib/test_hmm.c
- ppc ultravisor
- drm/amd/amdkfd
- gpu/drm/xe
- gpu/drm/nouveau
to use the new memremap_device_private_pagemap() interface.
+ /mt/dim checkpatch b80983450d283269c8f38c96b66f0f97322be346 drm-intel dbd6d09163f6 mm/migrate_device: Introduce migrate_pfn_from_page() helper e2d454de7920 drm/amdkfd: Use migrate pfns internally4199ec5cfab2 mm/migrate_device: Make migrate_device_{pfns, range}() take mpfns -:215: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #215: FILE: mm/migrate_device.c:1394:
+int migrate_device_range(unsigned long *src_mpfns, unsigned long start,
unsigned long npages)
-:235: CHECK:SPACING: spaces preferred around that '+' (ctx:VxV) #235: FILE: mm/migrate_device.c:1408:
+ src_mpfns[i+j] = 0;
^
-:279: CHECK:SPACING: spaces preferred around that '+' (ctx:VxV) #279: FILE: mm/migrate_device.c:1444:
+ src_mpfns[i+j] = 0;
^
total: 0 errors, 0 warnings, 3 checks, 220 lines checkedd0a1d952dd5b mm/migrate_device: Add migrate PFN flag to track device private pages c760c14b2084 mm/page_vma_mapped: Add flag to page_vma_mapped_walk::flags to track device private pages e0dff233fe01 mm: Add helpers to create migration entries from struct pages
-:137: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#137: FILE: mm/huge_memory.c:2528:
+ entry = make_readable_exclusive_migration_entry_from_page(
-:142: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #142: FILE: mm/huge_memory.c:2532:
+ entry = make_readable_migration_entry_from_page(
-:154: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #154: FILE: mm/huge_memory.c:3191:
+ swp_entry = make_writable_migration_entry_from_page(
-:159: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #159: FILE: mm/huge_memory.c:3194:
+ swp_entry = make_readable_exclusive_migration_entry_from_page(
-:164: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #164: FILE: mm/huge_memory.c:3197:
+ swp_entry = make_readable_migration_entry_from_page(
-:194: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #194: FILE: mm/hugetlb.c:4958:
+ softleaf = make_readable_migration_entry_from_page(
-:206: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #206: FILE: mm/hugetlb.c:6495:
+ entry = make_readable_exclusive_migration_entry_from_page(
-:212: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #212: FILE: mm/hugetlb.c:6499:
+ entry = make_readable_migration_entry_from_page(
-:228: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #228: FILE: mm/memory.c:966:
+ entry = make_readable_migration_entry_from_page(
-:244: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #244: FILE: mm/migrate_device.c:435:
+ entry = make_writable_migration_entry_from_page(
-:249: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #249: FILE: mm/migrate_device.c:438:
+ entry = make_readable_exclusive_migration_entry_from_page(
-:254: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #254: FILE: mm/migrate_device.c:441:
+ entry = make_readable_migration_entry_from_page(
-:269: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #269: FILE: mm/mprotect.c:331:
+ entry = make_readable_exclusive_migration_entry_from_page(
-:274: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #274: FILE: mm/mprotect.c:335:
+ entry = make_readable_migration_entry_from_page(
-:291: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #291: FILE: mm/rmap.c:2539:
+ entry = make_writable_migration_entry_from_page(
-:296: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #296: FILE: mm/rmap.c:2542:
+ entry = make_readable_exclusive_migration_entry_from_page(
-:301: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #301: FILE: mm/rmap.c:2545:
+ entry = make_readable_migration_entry_from_page(
total: 0 errors, 0 warnings, 17 checks, 235 lines checkedc5522dca6574 mm: Add a new swap type for migration entries of device private pages -:63: CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
#63: FILE: include/linux/swap.h:86:
+#define SWP_MIGRATION_DEVICE_READ (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+3)
^
-:63: CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
#63: FILE: include/linux/swap.h:86:
+#define SWP_MIGRATION_DEVICE_READ (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+3)
^
-:63: CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
#63: FILE: include/linux/swap.h:86:
+#define SWP_MIGRATION_DEVICE_READ (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+3)
^
-:64: CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
#64: FILE: include/linux/swap.h:87:
+#define SWP_MIGRATION_DEVICE_READ_EXCLUSIVE (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+4)
^
-:64: CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
#64: FILE: include/linux/swap.h:87:
+#define SWP_MIGRATION_DEVICE_READ_EXCLUSIVE (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+4)
^
-:64: CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
#64: FILE: include/linux/swap.h:87:
+#define SWP_MIGRATION_DEVICE_READ_EXCLUSIVE (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+4)
^
-:65: CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
#65: FILE: include/linux/swap.h:88:
+#define SWP_MIGRATION_DEVICE_WRITE (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+5)
^
-:65: CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
#65: FILE: include/linux/swap.h:88:
+#define SWP_MIGRATION_DEVICE_WRITE (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+5)
^
-:65: CHECK:SPACING: spaces preferred around that '+' (ctx:VxV)
#65: FILE: include/linux/swap.h:88:
+#define SWP_MIGRATION_DEVICE_WRITE (MAX_SWAPFILES+SWP_HWPOISON_NUM+SWP_MIGRATION_NUM+5)
^
total: 0 errors, 0 warnings, 9 checks, 61 lines checked161b6167faf2 mm: Add softleaf support for device private migration entries
-:11: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #11:
- SWP_MIGRATION_DEVICE_READ_EXCLUSIVE -> SOFTLEAF_MIGRATION_DEVICE_PRIVATE_READ_EXCLUSIVE
total: 0 errors, 1 warnings, 0 checks, 139 lines checked 9d7d8b795b67 mm: Begin creating device private migration entries -:23: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #23: FILE: include/linux/swapops.h:210:
+ return make_readable_migration_device_private_entry(
-:34: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #34: FILE: include/linux/swapops.h:225:
+ return make_readable_exclusive_migration_device_private_entry(
-:45: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #45: FILE: include/linux/swapops.h:240:
+ return make_writable_migration_device_private_entry(
total: 0 errors, 0 warnings, 3 checks, 30 lines checked 821827c1f136 mm: Add helpers to create device private entries from struct pages -:88: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#88: FILE: mm/huge_memory.c:3222:
+ swp_entry = make_writable_device_private_entry_from_page(
-:93: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #93: FILE: mm/huge_memory.c:3225:
+ swp_entry = make_readable_device_private_entry_from_page(
total: 0 errors, 0 warnings, 2 checks, 113 lines checked 03b96f89c997 mm/util: Add flag to track device private pages in page snapshots 829c19d4d197 mm/hmm: Add flag to track device private pages 8da79889c3c6 mm: Remove device private pages from the physical address space -:580: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #580: FILE: include/linux/memremap.h:306:
+static inline int devm_memremap_device_private_pagemap(struct device *dev,
+ struct dev_pagemap *pgmap)
-:592: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #592: FILE: include/linux/memremap.h:318:
+static inline void devm_memunmap_device_private_pagemap(struct device *dev,
+ struct dev_pagemap *pgmap)
-:909: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #909: FILE: mm/debug.c:81:
+ pr_warn("page: refcount:%d mapcount:%d mapping:%p index:%#lx %spfn:%#lx\n",
folio_ref_count(folio), mapcount, mapping,
-:1067: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1067: FILE: mm/memremap.c:388:
+ ret = devm_add_action_or_reset(dev, devm_memremap_device_private_pagemap_release,
+ pgmap);
total: 0 errors, 0 warnings, 4 checks, 1172 lines checked
Patchwork
CI✓ CI.KUnit: success for Remove device private pages from physical address space (rev9)
In reply to Jordan Niethe== Series Details ==
== Series Details ==
Series: Remove device private pages from physical address space (rev9)
URL : https://patchwork.freedesktop.org/series/159738/
State : success
== Summary ==
+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig [21:17:08] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig [21:17:12] Building KUnit Kernel ... Populating config with: $ make ARCH=um O=.kunit olddefconfig Building with: $ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48 [21:17:44] Starting KUnit Kernel (1/1)... [21:17:44] ============================================================ Running tests with: $ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt [21:17:44] ================== guc_buf (11 subtests) =================== [21:17:44] [PASSED] test_smallest [21:17:44] [PASSED] test_largest [21:17:44] [PASSED] test_granular [21:17:44] [PASSED] test_unique [21:17:44] [PASSED] test_overlap [21:17:44] [PASSED] test_reusable [21:17:44] [PASSED] test_too_big [21:17:44] [PASSED] test_flush [21:17:44] [PASSED] test_lookup [21:17:44] [PASSED] test_data [21:17:44] [PASSED] test_class [21:17:44] ===================== [PASSED] guc_buf ===================== [21:17:44] =================== guc_dbm (7 subtests) =================== [21:17:44] [PASSED] test_empty [21:17:44] [PASSED] test_default [21:17:44] ======================== test_size ======================== [21:17:44] [PASSED] 4 [21:17:44] [PASSED] 8 [21:17:44] [PASSED] 32 [21:17:44] [PASSED] 256 [21:17:44] ==================== [PASSED] test_size ==================== [21:17:44] ======================= test_reuse ======================== [21:17:44] [PASSED] 4 [21:17:44] [PASSED] 8 [21:17:44] [PASSED] 32 [21:17:44] [PASSED] 256 [21:17:44] =================== [PASSED] test_reuse ==================== [21:17:44] =================== test_range_overlap ==================== [21:17:44] [PASSED] 4 [21:17:44] [PASSED] 8 [21:17:44] [PASSED] 32 [21:17:44] [PASSED] 256 [21:17:44] =============== [PASSED] test_range_overlap ================ [21:17:44] =================== test_range_compact ==================== [21:17:44] [PASSED] 4 [21:17:44] [PASSED] 8 [21:17:44] [PASSED] 32 [21:17:44] [PASSED] 256 [21:17:44] =============== [PASSED] test_range_compact ================ [21:17:44] ==================== test_range_spare ===================== [21:17:44] [PASSED] 4 [21:17:44] [PASSED] 8 [21:17:44] [PASSED] 32 [21:17:44] [PASSED] 256 [21:17:44] ================ [PASSED] test_range_spare ================= [21:17:44] ===================== [PASSED] guc_dbm ===================== [21:17:44] =================== guc_idm (6 subtests) =================== [21:17:44] [PASSED] bad_init [21:17:44] [PASSED] no_init [21:17:44] [PASSED] init_fini [21:17:44] [PASSED] check_used [21:17:44] [PASSED] check_quota [21:17:44] [PASSED] check_all [21:17:44] ===================== [PASSED] guc_idm ===================== [21:17:44] ================== no_relay (3 subtests) =================== [21:17:44] [PASSED] xe_drops_guc2pf_if_not_ready [21:17:44] [PASSED] xe_drops_guc2vf_if_not_ready [21:17:44] [PASSED] xe_rejects_send_if_not_ready [21:17:44] ==================== [PASSED] no_relay ===================== [21:17:44] ================== pf_relay (14 subtests) ================== [21:17:44] [PASSED] pf_rejects_guc2pf_too_short [21:17:44] [PASSED] pf_rejects_guc2pf_too_long [21:17:44] [PASSED] pf_rejects_guc2pf_no_payload [21:17:44] [PASSED] pf_fails_no_payload [21:17:44] [PASSED] pf_fails_bad_origin [21:17:44] [PASSED] pf_fails_bad_type [21:17:44] [PASSED] pf_txn_reports_error [21:17:44] [PASSED] pf_txn_sends_pf2guc [21:17:44] [PASSED] pf_sends_pf2guc [21:17:44] [SKIPPED] pf_loopback_nop [21:17:44] [SKIPPED] pf_loopback_echo [21:17:44] [SKIPPED] pf_loopback_fail [21:17:44] [SKIPPED] pf_loopback_busy [21:17:44] [SKIPPED] pf_loopback_retry [21:17:44] ==================== [PASSED] pf_relay ===================== [21:17:44] ================== vf_relay (3 subtests) =================== [21:17:44] [PASSED] vf_rejects_guc2vf_too_short [21:17:44] [PASSED] vf_rejects_guc2vf_too_long [21:17:44] [PASSED] vf_rejects_guc2vf_no_payload [21:17:44] ==================== [PASSED] vf_relay ===================== [21:17:44] ================ pf_gt_config (6 subtests) ================= [21:17:44] [PASSED] fair_contexts_1vf [21:17:44] [PASSED] fair_doorbells_1vf [21:17:44] [PASSED] fair_ggtt_1vf [21:17:44] ====================== fair_contexts ====================== [21:17:44] [PASSED] 1 VF [21:17:44] [PASSED] 2 VFs [21:17:44] [PASSED] 3 VFs [21:17:44] [PASSED] 4 VFs [21:17:44] [PASSED] 5 VFs [21:17:44] [PASSED] 6 VFs [21:17:44] [PASSED] 7 VFs [21:17:44] [PASSED] 8 VFs [21:17:44] [PASSED] 9 VFs [21:17:44] [PASSED] 10 VFs [21:17:44] [PASSED] 11 VFs [21:17:44] [PASSED] 12 VFs [21:17:44] [PASSED] 13 VFs [21:17:44] [PASSED] 14 VFs [21:17:44] [PASSED] 15 VFs [21:17:44] [PASSED] 16 VFs [21:17:44] [PASSED] 17 VFs [21:17:44] [PASSED] 18 VFs [21:17:44] [PASSED] 19 VFs [21:17:44] [PASSED] 20 VFs [21:17:44] [PASSED] 21 VFs [21:17:44] [PASSED] 22 VFs [21:17:44] [PASSED] 23 VFs [21:17:44] [PASSED] 24 VFs [21:17:44] [PASSED] 25 VFs [21:17:44] [PASSED] 26 VFs [21:17:44] [PASSED] 27 VFs [21:17:44] [PASSED] 28 VFs [21:17:44] [PASSED] 29 VFs [21:17:44] [PASSED] 30 VFs [21:17:44] [PASSED] 31 VFs [21:17:44] [PASSED] 32 VFs [21:17:44] [PASSED] 33 VFs [21:17:44] [PASSED] 34 VFs [21:17:44] [PASSED] 35 VFs [21:17:44] [PASSED] 36 VFs [21:17:44] [PASSED] 37 VFs [21:17:44] [PASSED] 38 VFs [21:17:44] [PASSED] 39 VFs [21:17:44] [PASSED] 40 VFs [21:17:44] [PASSED] 41 VFs [21:17:44] [PASSED] 42 VFs [21:17:44] [PASSED] 43 VFs [21:17:44] [PASSED] 44 VFs [21:17:44] [PASSED] 45 VFs [21:17:44] [PASSED] 46 VFs [21:17:44] [PASSED] 47 VFs [21:17:44] [PASSED] 48 VFs [21:17:44] [PASSED] 49 VFs [21:17:44] [PASSED] 50 VFs [21:17:44] [PASSED] 51 VFs [21:17:44] [PASSED] 52 VFs [21:17:44] [PASSED] 53 VFs [21:17:44] [PASSED] 54 VFs [21:17:44] [PASSED] 55 VFs [21:17:44] [PASSED] 56 VFs [21:17:44] [PASSED] 57 VFs [21:17:44] [PASSED] 58 VFs [21:17:44] [PASSED] 59 VFs [21:17:44] [PASSED] 60 VFs [21:17:44] [PASSED] 61 VFs [21:17:44] [PASSED] 62 VFs [21:17:44] [PASSED] 63 VFs [21:17:44] ================== [PASSED] fair_contexts ================== [21:17:44] ===================== fair_doorbells ====================== [21:17:44] [PASSED] 1 VF [21:17:44] [PASSED] 2 VFs [21:17:44] [PASSED] 3 VFs [21:17:44] [PASSED] 4 VFs [21:17:44] [PASSED] 5 VFs [21:17:44] [PASSED] 6 VFs [21:17:44] [PASSED] 7 VFs [21:17:44] [PASSED] 8 VFs [21:17:44] [PASSED] 9 VFs [21:17:44] [PASSED] 10 VFs [21:17:44] [PASSED] 11 VFs [21:17:44] [PASSED] 12 VFs [21:17:44] [PASSED] 13 VFs [21:17:44] [PASSED] 14 VFs [21:17:44] [PASSED] 15 VFs [21:17:44] [PASSED] 16 VFs [21:17:44] [PASSED] 17 VFs [21:17:44] [PASSED] 18 VFs [21:17:44] [PASSED] 19 VFs [21:17:44] [PASSED] 20 VFs [21:17:44] [PASSED] 21 VFs [21:17:44] [PASSED] 22 VFs [21:17:44] [PASSED] 23 VFs [21:17:44] [PASSED] 24 VFs [21:17:44] [PASSED] 25 VFs [21:17:44] [PASSED] 26 VFs [21:17:44] [PASSED] 27 VFs [21:17:44] [PASSED] 28 VFs [21:17:44] [PASSED] 29 VFs [21:17:44] [PASSED] 30 VFs [21:17:44] [PASSED] 31 VFs [21:17:44] [PASSED] 32 VFs [21:17:44] [PASSED] 33 VFs [21:17:44] [PASSED] 34 VFs [21:17:44] [PASSED] 35 VFs [21:17:44] [PASSED] 36 VFs [21:17:44] [PASSED] 37 VFs [21:17:44] [PASSED] 38 VFs [21:17:44] [PASSED] 39 VFs [21:17:44] [PASSED] 40 VFs [21:17:44] [PASSED] 41 VFs [21:17:44] [PASSED] 42 VFs [21:17:44] [PASSED] 43 VFs [21:17:44] [PASSED] 44 VFs [21:17:44] [PASSED] 45 VFs [21:17:44] [PASSED] 46 VFs [21:17:44] [PASSED] 47 VFs [21:17:44] [PASSED] 48 VFs [21:17:44] [PASSED] 49 VFs [21:17:44] [PASSED] 50 VFs [21:17:44] [PASSED] 51 VFs [21:17:44] [PASSED] 52 VFs [21:17:44] [PASSED] 53 VFs [21:17:44] [PASSED] 54 VFs [21:17:44] [PASSED] 55 VFs [21:17:44] [PASSED] 56 VFs [21:17:44] [PASSED] 57 VFs [21:17:44] [PASSED] 58 VFs [21:17:44] [PASSED] 59 VFs [21:17:44] [PASSED] 60 VFs [21:17:44] [PASSED] 61 VFs [21:17:44] [PASSED] 62 VFs [21:17:44] [PASSED] 63 VFs [21:17:44] ================= [PASSED] fair_doorbells ================== [21:17:44] ======================== fair_ggtt ======================== [21:17:44] [PASSED] 1 VF [21:17:44] [PASSED] 2 VFs [21:17:44] [PASSED] 3 VFs [21:17:44] [PASSED] 4 VFs [21:17:44] [PASSED] 5 VFs [21:17:44] [PASSED] 6 VFs [21:17:44] [PASSED] 7 VFs [21:17:44] [PASSED] 8 VFs [21:17:44] [PASSED] 9 VFs [21:17:44] [PASSED] 10 VFs [21:17:44] [PASSED] 11 VFs [21:17:44] [PASSED] 12 VFs [21:17:44] [PASSED] 13 VFs [21:17:44] [PASSED] 14 VFs [21:17:44] [PASSED] 15 VFs [21:17:44] [PASSED] 16 VFs [21:17:44] [PASSED] 17 VFs [21:17:44] [PASSED] 18 VFs [21:17:44] [PASSED] 19 VFs [21:17:44] [PASSED] 20 VFs [21:17:44] [PASSED] 21 VFs [21:17:44] [PASSED] 22 VFs [21:17:44] [PASSED] 23 VFs [21:17:44] [PASSED] 24 VFs [21:17:44] [PASSED] 25 VFs [21:17:44] [PASSED] 26 VFs [21:17:44] [PASSED] 27 VFs [21:17:44] [PASSED] 28 VFs [21:17:44] [PASSED] 29 VFs [21:17:44] [PASSED] 30 VFs [21:17:44] [PASSED] 31 VFs [21:17:44] [PASSED] 32 VFs [21:17:44] [PASSED] 33 VFs [21:17:44] [PASSED] 34 VFs [21:17:44] [PASSED] 35 VFs [21:17:44] [PASSED] 36 VFs [21:17:44] [PASSED] 37 VFs [21:17:44] [PASSED] 38 VFs [21:17:44] [PASSED] 39 VFs [21:17:44] [PASSED] 40 VFs [21:17:44] [PASSED] 41 VFs [21:17:44] [PASSED] 42 VFs [21:17:44] [PASSED] 43 VFs [21:17:44] [PASSED] 44 VFs [21:17:44] [PASSED] 45 VFs [21:17:44] [PASSED] 46 VFs [21:17:44] [PASSED] 47 VFs [21:17:44] [PASSED] 48 VFs [21:17:44] [PASSED] 49 VFs [21:17:44] [PASSED] 50 VFs [21:17:44] [PASSED] 51 VFs [21:17:44] [PASSED] 52 VFs [21:17:44] [PASSED] 53 VFs [21:17:44] [PASSED] 54 VFs [21:17:44] [PASSED] 55 VFs [21:17:44] [PASSED] 56 VFs [21:17:44] [PASSED] 57 VFs [21:17:44] [PASSED] 58 VFs [21:17:44] [PASSED] 59 VFs [21:17:44] [PASSED] 60 VFs [21:17:44] [PASSED] 61 VFs [21:17:44] [PASSED] 62 VFs [21:17:44] [PASSED] 63 VFs [21:17:44] ==================== [PASSED] fair_ggtt ==================== [21:17:44] ================== [PASSED] pf_gt_config =================== [21:17:44] ===================== lmtt (1 subtest) ===================== [21:17:44] ======================== test_ops ========================= [21:17:44] [PASSED] 2-level [21:17:44] [PASSED] multi-level [21:17:44] ==================== [PASSED] test_ops ===================== [21:17:44] ====================== [PASSED] lmtt ======================= [21:17:44] ================= pf_service (11 subtests) ================= [21:17:44] [PASSED] pf_negotiate_any [21:17:44] [PASSED] pf_negotiate_base_match [21:17:44] [PASSED] pf_negotiate_base_newer [21:17:44] [PASSED] pf_negotiate_base_next [21:17:44] [SKIPPED] pf_negotiate_base_older [21:17:44] [PASSED] pf_negotiate_base_prev [21:17:44] [PASSED] pf_negotiate_latest_match [21:17:44] [PASSED] pf_negotiate_latest_newer [21:17:44] [PASSED] pf_negotiate_latest_next [21:17:44] [SKIPPED] pf_negotiate_latest_older [21:17:44] [SKIPPED] pf_negotiate_latest_prev [21:17:44] =================== [PASSED] pf_service ==================== [21:17:44] ================= xe_guc_g2g (2 subtests) ================== [21:17:44] ============== xe_live_guc_g2g_kunit_default ============== [21:17:44] ========= [SKIPPED] xe_live_guc_g2g_kunit_default ========== [21:17:44] ============== xe_live_guc_g2g_kunit_allmem =============== [21:17:44] ========== [SKIPPED] xe_live_guc_g2g_kunit_allmem ========== [21:17:44] =================== [SKIPPED] xe_guc_g2g =================== [21:17:44] =================== xe_mocs (2 subtests) =================== [21:17:44] ================ xe_live_mocs_kernel_kunit ================ [21:17:44] =========== [SKIPPED] xe_live_mocs_kernel_kunit ============ [21:17:44] ================ xe_live_mocs_reset_kunit ================= [21:17:44] ============ [SKIPPED] xe_live_mocs_reset_kunit ============ [21:17:44] ==================== [SKIPPED] xe_mocs ===================== [21:17:44] ================= xe_migrate (2 subtests) ================== [21:17:44] ================= xe_migrate_sanity_kunit ================= [21:17:44] ============ [SKIPPED] xe_migrate_sanity_kunit ============= [21:17:44] ================== xe_validate_ccs_kunit ================== [21:17:44] ============= [SKIPPED] xe_validate_ccs_kunit ============== [21:17:44] =================== [SKIPPED] xe_migrate =================== [21:17:44] ================== xe_dma_buf (1 subtest) ================== [21:17:44] ==================== xe_dma_buf_kunit ===================== [21:17:44] ================ [SKIPPED] xe_dma_buf_kunit ================ [21:17:44] =================== [SKIPPED] xe_dma_buf =================== [21:17:44] ================= xe_bo_shrink (1 subtest) ================= [21:17:44] =================== xe_bo_shrink_kunit ==================== [21:17:44] =============== [SKIPPED] xe_bo_shrink_kunit =============== [21:17:44] ================== [SKIPPED] xe_bo_shrink ================== [21:17:44] ==================== xe_bo (2 subtests) ==================== [21:17:44] ================== xe_ccs_migrate_kunit =================== [21:17:44] ============== [SKIPPED] xe_ccs_migrate_kunit ============== [21:17:44] ==================== xe_bo_evict_kunit ==================== [21:17:44] =============== [SKIPPED] xe_bo_evict_kunit ================ [21:17:44] ===================== [SKIPPED] xe_bo ====================== [21:17:44] ==================== args (13 subtests) ==================== [21:17:44] [PASSED] count_args_test [21:17:44] [PASSED] call_args_example [21:17:44] [PASSED] call_args_test [21:17:44] [PASSED] drop_first_arg_example [21:17:44] [PASSED] drop_first_arg_test [21:17:44] [PASSED] first_arg_example [21:17:44] [PASSED] first_arg_test [21:17:44] [PASSED] last_arg_example [21:17:44] [PASSED] last_arg_test [21:17:44] [PASSED] pick_arg_example [21:17:44] [PASSED] if_args_example [21:17:44] [PASSED] if_args_test [21:17:44] [PASSED] sep_comma_example [21:17:44] ====================== [PASSED] args ======================= [21:17:44] =================== xe_pci (3 subtests) ==================== [21:17:44] ==================== check_graphics_ip ==================== [21:17:44] [PASSED] 12.00 Xe_LP [21:17:44] [PASSED] 12.10 Xe_LP+ [21:17:44] [PASSED] 12.55 Xe_HPG [21:17:44] [PASSED] 12.60 Xe_HPC [21:17:44] [PASSED] 12.70 Xe_LPG [21:17:44] [PASSED] 12.71 Xe_LPG [21:17:44] [PASSED] 12.74 Xe_LPG+ [21:17:44] [PASSED] 20.01 Xe2_HPG [21:17:44] [PASSED] 20.02 Xe2_HPG [21:17:44] [PASSED] 20.04 Xe2_LPG [21:17:44] [PASSED] 30.00 Xe3_LPG [21:17:44] [PASSED] 30.01 Xe3_LPG [21:17:44] [PASSED] 30.03 Xe3_LPG [21:17:44] [PASSED] 30.04 Xe3_LPG [21:17:44] [PASSED] 30.05 Xe3_LPG [21:17:44] [PASSED] 35.11 Xe3p_XPC [21:17:44] ================ [PASSED] check_graphics_ip ================ [21:17:44] ===================== check_media_ip ====================== [21:17:44] [PASSED] 12.00 Xe_M [21:17:44] [PASSED] 12.55 Xe_HPM [21:17:44] [PASSED] 13.00 Xe_LPM+ [21:17:44] [PASSED] 13.01 Xe2_HPM [21:17:44] [PASSED] 20.00 Xe2_LPM [21:17:44] [PASSED] 30.00 Xe3_LPM [21:17:44] [PASSED] 30.02 Xe3_LPM [21:17:44] [PASSED] 35.00 Xe3p_LPM [21:17:44] [PASSED] 35.03 Xe3p_HPM [21:17:44] ================= [PASSED] check_media_ip ================== [21:17:44] =================== check_platform_desc =================== [21:17:44] [PASSED] 0x9A60 (TIGERLAKE) [21:17:44] [PASSED] 0x9A68 (TIGERLAKE) [21:17:44] [PASSED] 0x9A70 (TIGERLAKE) [21:17:44] [PASSED] 0x9A40 (TIGERLAKE) [21:17:44] [PASSED] 0x9A49 (TIGERLAKE) [21:17:44] [PASSED] 0x9A59 (TIGERLAKE) [21:17:44] [PASSED] 0x9A78 (TIGERLAKE) [21:17:44] [PASSED] 0x9AC0 (TIGERLAKE) [21:17:44] [PASSED] 0x9AC9 (TIGERLAKE) [21:17:44] [PASSED] 0x9AD9 (TIGERLAKE) [21:17:44] [PASSED] 0x9AF8 (TIGERLAKE) [21:17:44] [PASSED] 0x4C80 (ROCKETLAKE) [21:17:44] [PASSED] 0x4C8A (ROCKETLAKE) [21:17:44] [PASSED] 0x4C8B (ROCKETLAKE) [21:17:44] [PASSED] 0x4C8C (ROCKETLAKE) [21:17:44] [PASSED] 0x4C90 (ROCKETLAKE) [21:17:44] [PASSED] 0x4C9A (ROCKETLAKE) [21:17:44] [PASSED] 0x4680 (ALDERLAKE_S) [21:17:44] [PASSED] 0x4682 (ALDERLAKE_S) [21:17:44] [PASSED] 0x4688 (ALDERLAKE_S) [21:17:44] [PASSED] 0x468A (ALDERLAKE_S) [21:17:44] [PASSED] 0x468B (ALDERLAKE_S) [21:17:44] [PASSED] 0x4690 (ALDERLAKE_S) [21:17:44] [PASSED] 0x4692 (ALDERLAKE_S) [21:17:44] [PASSED] 0x4693 (ALDERLAKE_S) [21:17:44] [PASSED] 0x46A0 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46A1 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46A2 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46A3 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46A6 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46A8 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46AA (ALDERLAKE_P) [21:17:44] [PASSED] 0x462A (ALDERLAKE_P) [21:17:44] [PASSED] 0x4626 (ALDERLAKE_P) [21:17:44] [PASSED] 0x4628 (ALDERLAKE_P) stty: 'standard input': Inappropriate ioctl for device [21:17:44] [PASSED] 0x46B0 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46B1 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46B2 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46B3 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46C0 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46C1 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46C2 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46C3 (ALDERLAKE_P) [21:17:44] [PASSED] 0x46D0 (ALDERLAKE_N) [21:17:44] [PASSED] 0x46D1 (ALDERLAKE_N) [21:17:44] [PASSED] 0x46D2 (ALDERLAKE_N) [21:17:44] [PASSED] 0x46D3 (ALDERLAKE_N) [21:17:44] [PASSED] 0x46D4 (ALDERLAKE_N) [21:17:44] [PASSED] 0xA721 (ALDERLAKE_P) [21:17:44] [PASSED] 0xA7A1 (ALDERLAKE_P) [21:17:44] [PASSED] 0xA7A9 (ALDERLAKE_P) [21:17:44] [PASSED] 0xA7AC (ALDERLAKE_P) [21:17:44] [PASSED] 0xA7AD (ALDERLAKE_P) [21:17:44] [PASSED] 0xA720 (ALDERLAKE_P) [21:17:44] [PASSED] 0xA7A0 (ALDERLAKE_P) [21:17:44] [PASSED] 0xA7A8 (ALDERLAKE_P) [21:17:44] [PASSED] 0xA7AA (ALDERLAKE_P) [21:17:44] [PASSED] 0xA7AB (ALDERLAKE_P) [21:17:44] [PASSED] 0xA780 (ALDERLAKE_S) [21:17:44] [PASSED] 0xA781 (ALDERLAKE_S) [21:17:44] [PASSED] 0xA782 (ALDERLAKE_S) [21:17:44] [PASSED] 0xA783 (ALDERLAKE_S) [21:17:44] [PASSED] 0xA788 (ALDERLAKE_S) [21:17:44] [PASSED] 0xA789 (ALDERLAKE_S) [21:17:44] [PASSED] 0xA78A (ALDERLAKE_S) [21:17:44] [PASSED] 0xA78B (ALDERLAKE_S) [21:17:44] [PASSED] 0x4905 (DG1) [21:17:44] [PASSED] 0x4906 (DG1) [21:17:44] [PASSED] 0x4907 (DG1) [21:17:44] [PASSED] 0x4908 (DG1) [21:17:44] [PASSED] 0x4909 (DG1) [21:17:44] [PASSED] 0x56C0 (DG2) [21:17:44] [PASSED] 0x56C2 (DG2) [21:17:44] [PASSED] 0x56C1 (DG2) [21:17:44] [PASSED] 0x7D51 (METEORLAKE) [21:17:44] [PASSED] 0x7DD1 (METEORLAKE) [21:17:44] [PASSED] 0x7D41 (METEORLAKE) [21:17:44] [PASSED] 0x7D67 (METEORLAKE) [21:17:44] [PASSED] 0xB640 (METEORLAKE) [21:17:44] [PASSED] 0x56A0 (DG2) [21:17:44] [PASSED] 0x56A1 (DG2) [21:17:44] [PASSED] 0x56A2 (DG2) [21:17:44] [PASSED] 0x56BE (DG2) [21:17:44] [PASSED] 0x56BF (DG2) [21:17:44] [PASSED] 0x5690 (DG2) [21:17:44] [PASSED] 0x5691 (DG2) [21:17:44] [PASSED] 0x5692 (DG2) [21:17:44] [PASSED] 0x56A5 (DG2) [21:17:44] [PASSED] 0x56A6 (DG2) [21:17:44] [PASSED] 0x56B0 (DG2) [21:17:44] [PASSED] 0x56B1 (DG2) [21:17:44] [PASSED] 0x56BA (DG2) [21:17:44] [PASSED] 0x56BB (DG2) [21:17:44] [PASSED] 0x56BC (DG2) [21:17:44] [PASSED] 0x56BD (DG2) [21:17:44] [PASSED] 0x5693 (DG2) [21:17:44] [PASSED] 0x5694 (DG2) [21:17:44] [PASSED] 0x5695 (DG2) [21:17:44] [PASSED] 0x56A3 (DG2) [21:17:44] [PASSED] 0x56A4 (DG2) [21:17:44] [PASSED] 0x56B2 (DG2) [21:17:44] [PASSED] 0x56B3 (DG2) [21:17:44] [PASSED] 0x5696 (DG2) [21:17:44] [PASSED] 0x5697 (DG2) [21:17:44] [PASSED] 0xB69 (PVC) [21:17:44] [PASSED] 0xB6E (PVC) [21:17:44] [PASSED] 0xBD4 (PVC) [21:17:44] [PASSED] 0xBD5 (PVC) [21:17:44] [PASSED] 0xBD6 (PVC) [21:17:44] [PASSED] 0xBD7 (PVC) [21:17:44] [PASSED] 0xBD8 (PVC) [21:17:44] [PASSED] 0xBD9 (PVC) [21:17:44] [PASSED] 0xBDA (PVC) [21:17:44] [PASSED] 0xBDB (PVC) [21:17:44] [PASSED] 0xBE0 (PVC) [21:17:44] [PASSED] 0xBE1 (PVC) [21:17:44] [PASSED] 0xBE5 (PVC) [21:17:44] [PASSED] 0x7D40 (METEORLAKE) [21:17:44] [PASSED] 0x7D45 (METEORLAKE) [21:17:44] [PASSED] 0x7D55 (METEORLAKE) [21:17:44] [PASSED] 0x7D60 (METEORLAKE) [21:17:44] [PASSED] 0x7DD5 (METEORLAKE) [21:17:44] [PASSED] 0x6420 (LUNARLAKE) [21:17:44] [PASSED] 0x64A0 (LUNARLAKE) [21:17:44] [PASSED] 0x64B0 (LUNARLAKE) [21:17:44] [PASSED] 0xE202 (BATTLEMAGE) [21:17:44] [PASSED] 0xE209 (BATTLEMAGE) [21:17:44] [PASSED] 0xE20B (BATTLEMAGE) [21:17:44] [PASSED] 0xE20C (BATTLEMAGE) [21:17:44] [PASSED] 0xE20D (BATTLEMAGE) [21:17:44] [PASSED] 0xE210 (BATTLEMAGE) [21:17:44] [PASSED] 0xE211 (BATTLEMAGE) [21:17:44] [PASSED] 0xE212 (BATTLEMAGE) [21:17:44] [PASSED] 0xE216 (BATTLEMAGE) [21:17:44] [PASSED] 0xE220 (BATTLEMAGE) [21:17:44] [PASSED] 0xE221 (BATTLEMAGE) [21:17:44] [PASSED] 0xE222 (BATTLEMAGE) [21:17:44] [PASSED] 0xE223 (BATTLEMAGE) [21:17:44] [PASSED] 0xB080 (PANTHERLAKE) [21:17:44] [PASSED] 0xB081 (PANTHERLAKE) [21:17:44] [PASSED] 0xB082 (PANTHERLAKE) [21:17:44] [PASSED] 0xB083 (PANTHERLAKE) [21:17:44] [PASSED] 0xB084 (PANTHERLAKE) [21:17:44] [PASSED] 0xB085 (PANTHERLAKE) [21:17:44] [PASSED] 0xB086 (PANTHERLAKE) [21:17:44] [PASSED] 0xB087 (PANTHERLAKE) [21:17:44] [PASSED] 0xB08F (PANTHERLAKE) [21:17:44] [PASSED] 0xB090 (PANTHERLAKE) [21:17:44] [PASSED] 0xB0A0 (PANTHERLAKE) [21:17:44] [PASSED] 0xB0B0 (PANTHERLAKE) [21:17:44] [PASSED] 0xFD80 (PANTHERLAKE) [21:17:44] [PASSED] 0xFD81 (PANTHERLAKE) [21:17:44] [PASSED] 0xD740 (NOVALAKE_S) [21:17:44] [PASSED] 0xD741 (NOVALAKE_S) [21:17:44] [PASSED] 0xD742 (NOVALAKE_S) [21:17:44] [PASSED] 0xD743 (NOVALAKE_S) [21:17:44] [PASSED] 0xD744 (NOVALAKE_S) [21:17:44] [PASSED] 0xD745 (NOVALAKE_S) [21:17:44] [PASSED] 0x674C (CRESCENTISLAND) [21:17:44] =============== [PASSED] check_platform_desc =============== [21:17:44] ===================== [PASSED] xe_pci ====================== [21:17:44] =================== xe_rtp (2 subtests) ==================== [21:17:44] =============== xe_rtp_process_to_sr_tests ================ [21:17:44] [PASSED] coalesce-same-reg [21:17:44] [PASSED] no-match-no-add [21:17:44] [PASSED] match-or [21:17:44] [PASSED] match-or-xfail [21:17:44] [PASSED] no-match-no-add-multiple-rules [21:17:44] [PASSED] two-regs-two-entries [21:17:44] [PASSED] clr-one-set-other [21:17:44] [PASSED] set-field [21:17:44] [PASSED] conflict-duplicate [21:17:44] [PASSED] conflict-not-disjoint [21:17:44] [PASSED] conflict-reg-type [21:17:44] =========== [PASSED] xe_rtp_process_to_sr_tests ============ [21:17:44] ================== xe_rtp_process_tests =================== [21:17:44] [PASSED] active1 [21:17:44] [PASSED] active2 [21:17:44] [PASSED] active-inactive [21:17:44] [PASSED] inactive-active [21:17:44] [PASSED] inactive-1st_or_active-inactive [21:17:44] [PASSED] inactive-2nd_or_active-inactive [21:17:44] [PASSED] inactive-last_or_active-inactive [21:17:44] [PASSED] inactive-no_or_active-inactive [21:17:44] ============== [PASSED] xe_rtp_process_tests =============== [21:17:44] ===================== [PASSED] xe_rtp ====================== [21:17:44] ==================== xe_wa (1 subtest) ===================== [21:17:44] ======================== xe_wa_gt ========================= [21:17:44] [PASSED] TIGERLAKE B0 [21:17:44] [PASSED] DG1 A0 [21:17:44] [PASSED] DG1 B0 [21:17:44] [PASSED] ALDERLAKE_S A0 [21:17:44] [PASSED] ALDERLAKE_S B0 [21:17:44] [PASSED] ALDERLAKE_S C0 [21:17:44] [PASSED] ALDERLAKE_S D0 [21:17:44] [PASSED] ALDERLAKE_P A0 [21:17:44] [PASSED] ALDERLAKE_P B0 [21:17:44] [PASSED] ALDERLAKE_P C0 [21:17:44] [PASSED] ALDERLAKE_S RPLS D0 [21:17:44] [PASSED] ALDERLAKE_P RPLU E0 [21:17:44] [PASSED] DG2 G10 C0 [21:17:44] [PASSED] DG2 G11 B1 [21:17:44] [PASSED] DG2 G12 A1 [21:17:44] [PASSED] METEORLAKE 12.70(Xe_LPG) A0 13.00(Xe_LPM+) A0 [21:17:44] [PASSED] METEORLAKE 12.71(Xe_LPG) A0 13.00(Xe_LPM+) A0 [21:17:44] [PASSED] METEORLAKE 12.74(Xe_LPG+) A0 13.00(Xe_LPM+) A0 [21:17:44] [PASSED] LUNARLAKE 20.04(Xe2_LPG) A0 20.00(Xe2_LPM) A0 [21:17:44] [PASSED] LUNARLAKE 20.04(Xe2_LPG) B0 20.00(Xe2_LPM) A0 [21:17:44] [PASSED] BATTLEMAGE 20.01(Xe2_HPG) A0 13.01(Xe2_HPM) A1 [21:17:44] [PASSED] PANTHERLAKE 30.00(Xe3_LPG) A0 30.00(Xe3_LPM) A0 [21:17:44] ==================== [PASSED] xe_wa_gt ===================== [21:17:44] ====================== [PASSED] xe_wa ====================== [21:17:44] ============================================================ [21:17:44] Testing complete. Ran 512 tests: passed: 494, skipped: 18 [21:17:44] Elapsed time: 36.339s total, 4.211s configuring, 31.611s building, 0.463s running
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/tests/.kunitconfig [21:17:45] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig [21:17:46] Building KUnit Kernel ... Populating config with: $ make ARCH=um O=.kunit olddefconfig Building with: $ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48 [21:18:12] Starting KUnit Kernel (1/1)... [21:18:12] ============================================================ Running tests with: $ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt [21:18:12] ============ drm_test_pick_cmdline (2 subtests) ============ [21:18:12] [PASSED] drm_test_pick_cmdline_res_1920_1080_60 [21:18:12] =============== drm_test_pick_cmdline_named =============== [21:18:12] [PASSED] NTSC [21:18:12] [PASSED] NTSC-J [21:18:12] [PASSED] PAL [21:18:12] [PASSED] PAL-M [21:18:12] =========== [PASSED] drm_test_pick_cmdline_named =========== [21:18:12] ============== [PASSED] drm_test_pick_cmdline ============== [21:18:12] == drm_test_atomic_get_connector_for_encoder (1 subtest) === [21:18:12] [PASSED] drm_test_drm_atomic_get_connector_for_encoder [21:18:12] ==== [PASSED] drm_test_atomic_get_connector_for_encoder ==== [21:18:12] =========== drm_validate_clone_mode (2 subtests) =========== [21:18:12] ============== drm_test_check_in_clone_mode =============== [21:18:12] [PASSED] in_clone_mode [21:18:12] [PASSED] not_in_clone_mode [21:18:12] ========== [PASSED] drm_test_check_in_clone_mode =========== [21:18:12] =============== drm_test_check_valid_clones =============== [21:18:12] [PASSED] not_in_clone_mode [21:18:12] [PASSED] valid_clone [21:18:12] [PASSED] invalid_clone [21:18:12] =========== [PASSED] drm_test_check_valid_clones =========== [21:18:12] ============= [PASSED] drm_validate_clone_mode ============= [21:18:12] ============= drm_validate_modeset (1 subtest) ============= [21:18:12] [PASSED] drm_test_check_connector_changed_modeset [21:18:12] ============== [PASSED] drm_validate_modeset =============== [21:18:12] ====== drm_test_bridge_get_current_state (2 subtests) ====== [21:18:12] [PASSED] drm_test_drm_bridge_get_current_state_atomic [21:18:12] [PASSED] drm_test_drm_bridge_get_current_state_legacy [21:18:12] ======== [PASSED] drm_test_bridge_get_current_state ======== [21:18:12] ====== drm_test_bridge_helper_reset_crtc (3 subtests) ====== [21:18:12] [PASSED] drm_test_drm_bridge_helper_reset_crtc_atomic [21:18:12] [PASSED] drm_test_drm_bridge_helper_reset_crtc_atomic_disabled [21:18:12] [PASSED] drm_test_drm_bridge_helper_reset_crtc_legacy [21:18:12] ======== [PASSED] drm_test_bridge_helper_reset_crtc ======== [21:18:12] ============== drm_bridge_alloc (2 subtests) =============== [21:18:12] [PASSED] drm_test_drm_bridge_alloc_basic [21:18:12] [PASSED] drm_test_drm_bridge_alloc_get_put [21:18:12] ================ [PASSED] drm_bridge_alloc ================= [21:18:12] ================== drm_buddy (9 subtests) ================== [21:18:12] [PASSED] drm_test_buddy_alloc_limit [21:18:12] [PASSED] drm_test_buddy_alloc_optimistic [21:18:12] [PASSED] drm_test_buddy_alloc_pessimistic [21:18:12] [PASSED] drm_test_buddy_alloc_pathological [21:18:12] [PASSED] drm_test_buddy_alloc_contiguous [21:18:12] [PASSED] drm_test_buddy_alloc_clear [21:18:12] [PASSED] drm_test_buddy_alloc_range_bias [21:18:12] [PASSED] drm_test_buddy_fragmentation_performance [21:18:12] [PASSED] drm_test_buddy_alloc_exceeds_max_order [21:18:12] ==================== [PASSED] drm_buddy ==================== [21:18:12] ============= drm_cmdline_parser (40 subtests) ============= [21:18:12] [PASSED] drm_test_cmdline_force_d_only [21:18:12] [PASSED] drm_test_cmdline_force_D_only_dvi [21:18:12] [PASSED] drm_test_cmdline_force_D_only_hdmi [21:18:12] [PASSED] drm_test_cmdline_force_D_only_not_digital [21:18:12] [PASSED] drm_test_cmdline_force_e_only [21:18:12] [PASSED] drm_test_cmdline_res [21:18:12] [PASSED] drm_test_cmdline_res_vesa [21:18:12] [PASSED] drm_test_cmdline_res_vesa_rblank [21:18:12] [PASSED] drm_test_cmdline_res_rblank [21:18:12] [PASSED] drm_test_cmdline_res_bpp [21:18:12] [PASSED] drm_test_cmdline_res_refresh [21:18:12] [PASSED] drm_test_cmdline_res_bpp_refresh [21:18:12] [PASSED] drm_test_cmdline_res_bpp_refresh_interlaced [21:18:12] [PASSED] drm_test_cmdline_res_bpp_refresh_margins [21:18:12] [PASSED] drm_test_cmdline_res_bpp_refresh_force_off [21:18:12] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on [21:18:12] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on_analog [21:18:12] [PASSED] drm_test_cmdline_res_bpp_refresh_force_on_digital [21:18:12] [PASSED] drm_test_cmdline_res_bpp_refresh_interlaced_margins_force_on [21:18:12] [PASSED] drm_test_cmdline_res_margins_force_on [21:18:12] [PASSED] drm_test_cmdline_res_vesa_margins [21:18:12] [PASSED] drm_test_cmdline_name [21:18:12] [PASSED] drm_test_cmdline_name_bpp [21:18:12] [PASSED] drm_test_cmdline_name_option [21:18:12] [PASSED] drm_test_cmdline_name_bpp_option [21:18:12] [PASSED] drm_test_cmdline_rotate_0 [21:18:12] [PASSED] drm_test_cmdline_rotate_90 [21:18:12] [PASSED] drm_test_cmdline_rotate_180 [21:18:12] [PASSED] drm_test_cmdline_rotate_270 [21:18:12] [PASSED] drm_test_cmdline_hmirror [21:18:12] [PASSED] drm_test_cmdline_vmirror [21:18:12] [PASSED] drm_test_cmdline_margin_options [21:18:12] [PASSED] drm_test_cmdline_multiple_options [21:18:12] [PASSED] drm_test_cmdline_bpp_extra_and_option [21:18:12] [PASSED] drm_test_cmdline_extra_and_option [21:18:12] [PASSED] drm_test_cmdline_freestanding_options [21:18:12] [PASSED] drm_test_cmdline_freestanding_force_e_and_options [21:18:12] [PASSED] drm_test_cmdline_panel_orientation [21:18:12] ================ drm_test_cmdline_invalid ================= [21:18:12] [PASSED] margin_only [21:18:12] [PASSED] interlace_only [21:18:12] [PASSED] res_missing_x [21:18:12] [PASSED] res_missing_y [21:18:12] [PASSED] res_bad_y [21:18:12] [PASSED] res_missing_y_bpp [21:18:12] [PASSED] res_bad_bpp [21:18:12] [PASSED] res_bad_refresh [21:18:12] [PASSED] res_bpp_refresh_force_on_off [21:18:12] [PASSED] res_invalid_mode [21:18:12] [PASSED] res_bpp_wrong_place_mode [21:18:12] [PASSED] name_bpp_refresh [21:18:12] [PASSED] name_refresh [21:18:12] [PASSED] name_refresh_wrong_mode [21:18:12] [PASSED] name_refresh_invalid_mode [21:18:12] [PASSED] rotate_multiple [21:18:12] [PASSED] rotate_invalid_val [21:18:12] [PASSED] rotate_truncated [21:18:12] [PASSED] invalid_option [21:18:12] [PASSED] invalid_tv_option [21:18:12] [PASSED] truncated_tv_option [21:18:12] ============ [PASSED] drm_test_cmdline_invalid ============= [21:18:12] =============== drm_test_cmdline_tv_options =============== [21:18:12] [PASSED] NTSC [21:18:12] [PASSED] NTSC_443 [21:18:12] [PASSED] NTSC_J [21:18:12] [PASSED] PAL [21:18:12] [PASSED] PAL_M [21:18:12] [PASSED] PAL_N [21:18:12] [PASSED] SECAM [21:18:12] [PASSED] MONO_525 [21:18:12] [PASSED] MONO_625 [21:18:12] =========== [PASSED] drm_test_cmdline_tv_options =========== [21:18:12] =============== [PASSED] drm_cmdline_parser ================ [21:18:12] ========== drmm_connector_hdmi_init (20 subtests) ========== [21:18:12] [PASSED] drm_test_connector_hdmi_init_valid [21:18:12] [PASSED] drm_test_connector_hdmi_init_bpc_8 [21:18:12] [PASSED] drm_test_connector_hdmi_init_bpc_10 [21:18:12] [PASSED] drm_test_connector_hdmi_init_bpc_12 [21:18:12] [PASSED] drm_test_connector_hdmi_init_bpc_invalid [21:18:12] [PASSED] drm_test_connector_hdmi_init_bpc_null [21:18:12] [PASSED] drm_test_connector_hdmi_init_formats_empty [21:18:12] [PASSED] drm_test_connector_hdmi_init_formats_no_rgb [21:18:12] === drm_test_connector_hdmi_init_formats_yuv420_allowed === [21:18:12] [PASSED] supported_formats=0x9 yuv420_allowed=1 [21:18:12] [PASSED] supported_formats=0x9 yuv420_allowed=0 [21:18:12] [PASSED] supported_formats=0x3 yuv420_allowed=1 [21:18:12] [PASSED] supported_formats=0x3 yuv420_allowed=0 [21:18:12] === [PASSED] drm_test_connector_hdmi_init_formats_yuv420_allowed === [21:18:12] [PASSED] drm_test_connector_hdmi_init_null_ddc [21:18:12] [PASSED] drm_test_connector_hdmi_init_null_product [21:18:12] [PASSED] drm_test_connector_hdmi_init_null_vendor [21:18:12] [PASSED] drm_test_connector_hdmi_init_product_length_exact [21:18:12] [PASSED] drm_test_connector_hdmi_init_product_length_too_long [21:18:12] [PASSED] drm_test_connector_hdmi_init_product_valid [21:18:12] [PASSED] drm_test_connector_hdmi_init_vendor_length_exact [21:18:12] [PASSED] drm_test_connector_hdmi_init_vendor_length_too_long [21:18:12] [PASSED] drm_test_connector_hdmi_init_vendor_valid [21:18:12] ========= drm_test_connector_hdmi_init_type_valid ========= [21:18:12] [PASSED] HDMI-A [21:18:12] [PASSED] HDMI-B [21:18:12] ===== [PASSED] drm_test_connector_hdmi_init_type_valid ===== [21:18:12] ======== drm_test_connector_hdmi_init_type_invalid ======== [21:18:12] [PASSED] Unknown [21:18:12] [PASSED] VGA [21:18:12] [PASSED] DVI-I [21:18:12] [PASSED] DVI-D [21:18:12] [PASSED] DVI-A [21:18:12] [PASSED] Composite [21:18:12] [PASSED] SVIDEO [21:18:12] [PASSED] LVDS [21:18:12] [PASSED] Component [21:18:12] [PASSED] DIN [21:18:12] [PASSED] DP [21:18:12] [PASSED] TV [21:18:12] [PASSED] eDP [21:18:12] [PASSED] Virtual [21:18:12] [PASSED] DSI [21:18:12] [PASSED] DPI [21:18:12] [PASSED] Writeback [21:18:12] [PASSED] SPI [21:18:12] [PASSED] USB [21:18:12] ==== [PASSED] drm_test_connector_hdmi_init_type_invalid ==== [21:18:12] ============ [PASSED] drmm_connector_hdmi_init ============= [21:18:12] ============= drmm_connector_init (3 subtests) ============= [21:18:12] [PASSED] drm_test_drmm_connector_init [21:18:12] [PASSED] drm_test_drmm_connector_init_null_ddc [21:18:12] ========= drm_test_drmm_connector_init_type_valid ========= [21:18:12] [PASSED] Unknown [21:18:12] [PASSED] VGA [21:18:12] [PASSED] DVI-I [21:18:12] [PASSED] DVI-D [21:18:12] [PASSED] DVI-A [21:18:12] [PASSED] Composite [21:18:12] [PASSED] SVIDEO [21:18:12] [PASSED] LVDS [21:18:12] [PASSED] Component [21:18:12] [PASSED] DIN [21:18:12] [PASSED] DP [21:18:12] [PASSED] HDMI-A [21:18:12] [PASSED] HDMI-B [21:18:12] [PASSED] TV [21:18:12] [PASSED] eDP [21:18:12] [PASSED] Virtual [21:18:12] [PASSED] DSI [21:18:12] [PASSED] DPI [21:18:12] [PASSED] Writeback [21:18:12] [PASSED] SPI [21:18:12] [PASSED] USB [21:18:12] ===== [PASSED] drm_test_drmm_connector_init_type_valid ===== [21:18:12] =============== [PASSED] drmm_connector_init =============== [21:18:12] ========= drm_connector_dynamic_init (6 subtests) ========== [21:18:12] [PASSED] drm_test_drm_connector_dynamic_init [21:18:12] [PASSED] drm_test_drm_connector_dynamic_init_null_ddc [21:18:12] [PASSED] drm_test_drm_connector_dynamic_init_not_added [21:18:12] [PASSED] drm_test_drm_connector_dynamic_init_properties [21:18:12] ===== drm_test_drm_connector_dynamic_init_type_valid ====== [21:18:12] [PASSED] Unknown [21:18:12] [PASSED] VGA [21:18:12] [PASSED] DVI-I [21:18:12] [PASSED] DVI-D [21:18:12] [PASSED] DVI-A [21:18:12] [PASSED] Composite [21:18:12] [PASSED] SVIDEO [21:18:12] [PASSED] LVDS [21:18:12] [PASSED] Component [21:18:12] [PASSED] DIN [21:18:12] [PASSED] DP [21:18:12] [PASSED] HDMI-A [21:18:12] [PASSED] HDMI-B [21:18:12] [PASSED] TV [21:18:12] [PASSED] eDP [21:18:12] [PASSED] Virtual [21:18:12] [PASSED] DSI [21:18:12] [PASSED] DPI [21:18:12] [PASSED] Writeback [21:18:12] [PASSED] SPI [21:18:12] [PASSED] USB [21:18:12] = [PASSED] drm_test_drm_connector_dynamic_init_type_valid == [21:18:12] ======== drm_test_drm_connector_dynamic_init_name ========= [21:18:12] [PASSED] Unknown [21:18:12] [PASSED] VGA [21:18:12] [PASSED] DVI-I [21:18:12] [PASSED] DVI-D [21:18:12] [PASSED] DVI-A [21:18:12] [PASSED] Composite [21:18:12] [PASSED] SVIDEO [21:18:12] [PASSED] LVDS [21:18:12] [PASSED] Component [21:18:12] [PASSED] DIN [21:18:12] [PASSED] DP [21:18:12] [PASSED] HDMI-A [21:18:12] [PASSED] HDMI-B [21:18:12] [PASSED] TV [21:18:12] [PASSED] eDP [21:18:12] [PASSED] Virtual [21:18:12] [PASSED] DSI [21:18:12] [PASSED] DPI [21:18:12] [PASSED] Writeback [21:18:12] [PASSED] SPI [21:18:12] [PASSED] USB [21:18:12] ==== [PASSED] drm_test_drm_connector_dynamic_init_name ===== [21:18:12] =========== [PASSED] drm_connector_dynamic_init ============ [21:18:12] ==== drm_connector_dynamic_register_early (4 subtests) ===== [21:18:12] [PASSED] drm_test_drm_connector_dynamic_register_early_on_list [21:18:12] [PASSED] drm_test_drm_connector_dynamic_register_early_defer [21:18:12] [PASSED] drm_test_drm_connector_dynamic_register_early_no_init [21:18:12] [PASSED] drm_test_drm_connector_dynamic_register_early_no_mode_object [21:18:12] ====== [PASSED] drm_connector_dynamic_register_early ======= [21:18:12] ======= drm_connector_dynamic_register (7 subtests) ======== [21:18:12] [PASSED] drm_test_drm_connector_dynamic_register_on_list [21:18:12] [PASSED] drm_test_drm_connector_dynamic_register_no_defer [21:18:12] [PASSED] drm_test_drm_connector_dynamic_register_no_init [21:18:12] [PASSED] drm_test_drm_connector_dynamic_register_mode_object [21:18:12] [PASSED] drm_test_drm_connector_dynamic_register_sysfs [21:18:12] [PASSED] drm_test_drm_connector_dynamic_register_sysfs_name [21:18:12] [PASSED] drm_test_drm_connector_dynamic_register_debugfs [21:18:12] ========= [PASSED] drm_connector_dynamic_register ========== [21:18:12] = drm_connector_attach_broadcast_rgb_property (2 subtests) = [21:18:12] [PASSED] drm_test_drm_connector_attach_broadcast_rgb_property [21:18:12] [PASSED] drm_test_drm_connector_attach_broadcast_rgb_property_hdmi_connector [21:18:12] === [PASSED] drm_connector_attach_broadcast_rgb_property === [21:18:12] ========== drm_get_tv_mode_from_name (2 subtests) ========== [21:18:12] ========== drm_test_get_tv_mode_from_name_valid =========== [21:18:12] [PASSED] NTSC [21:18:12] [PASSED] NTSC-443 [21:18:12] [PASSED] NTSC-J [21:18:12] [PASSED] PAL [21:18:12] [PASSED] PAL-M [21:18:12] [PASSED] PAL-N [21:18:12] [PASSED] SECAM [21:18:12] [PASSED] Mono [21:18:12] ====== [PASSED] drm_test_get_tv_mode_from_name_valid ======= [21:18:12] [PASSED] drm_test_get_tv_mode_from_name_truncated [21:18:12] ============ [PASSED] drm_get_tv_mode_from_name ============ [21:18:12] = drm_test_connector_hdmi_compute_mode_clock (12 subtests) = [21:18:12] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb [21:18:12] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc [21:18:12] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc_vic_1 [21:18:12] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc [21:18:12] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc_vic_1 [21:18:12] [PASSED] drm_test_drm_hdmi_compute_mode_clock_rgb_double [21:18:12] = drm_test_connector_hdmi_compute_mode_clock_yuv420_valid = [21:18:12] [PASSED] VIC 96 [21:18:12] [PASSED] VIC 97 [21:18:12] [PASSED] VIC 101 [21:18:12] [PASSED] VIC 102 [21:18:12] [PASSED] VIC 106 [21:18:12] [PASSED] VIC 107 [21:18:12] === [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv420_valid === [21:18:12] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv420_10_bpc [21:18:12] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv420_12_bpc [21:18:12] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv422_8_bpc [21:18:12] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv422_10_bpc [21:18:12] [PASSED] drm_test_connector_hdmi_compute_mode_clock_yuv422_12_bpc [21:18:12] === [PASSED] drm_test_connector_hdmi_compute_mode_clock ==== [21:18:12] == drm_hdmi_connector_get_broadcast_rgb_name (2 subtests) == [21:18:12] === drm_test_drm_hdmi_connector_get_broadcast_rgb_name ==== [21:18:12] [PASSED] Automatic [21:18:12] [PASSED] Full [21:18:12] [PASSED] Limited 16:235 [21:18:12] === [PASSED] drm_test_drm_hdmi_connector_get_broadcast_rgb_name === [21:18:12] [PASSED] drm_test_drm_hdmi_connector_get_broadcast_rgb_name_invalid [21:18:12] ==== [PASSED] drm_hdmi_connector_get_broadcast_rgb_name ==== [21:18:12] == drm_hdmi_connector_get_output_format_name (2 subtests) == [21:18:12] === drm_test_drm_hdmi_connector_get_output_format_name ==== [21:18:12] [PASSED] RGB [21:18:12] [PASSED] YUV 4:2:0 [21:18:12] [PASSED] YUV 4:2:2 [21:18:12] [PASSED] YUV 4:4:4 [21:18:12] === [PASSED] drm_test_drm_hdmi_connector_get_output_format_name === [21:18:12] [PASSED] drm_test_drm_hdmi_connector_get_output_format_name_invalid [21:18:12] ==== [PASSED] drm_hdmi_connector_get_output_format_name ==== [21:18:12] ============= drm_damage_helper (21 subtests) ============== [21:18:12] [PASSED] drm_test_damage_iter_no_damage [21:18:12] [PASSED] drm_test_damage_iter_no_damage_fractional_src [21:18:12] [PASSED] drm_test_damage_iter_no_damage_src_moved [21:18:12] [PASSED] drm_test_damage_iter_no_damage_fractional_src_moved [21:18:12] [PASSED] drm_test_damage_iter_no_damage_not_visible [21:18:12] [PASSED] drm_test_damage_iter_no_damage_no_crtc [21:18:12] [PASSED] drm_test_damage_iter_no_damage_no_fb [21:18:12] [PASSED] drm_test_damage_iter_simple_damage [21:18:12] [PASSED] drm_test_damage_iter_single_damage [21:18:12] [PASSED] drm_test_damage_iter_single_damage_intersect_src [21:18:12] [PASSED] drm_test_damage_iter_single_damage_outside_src [21:18:12] [PASSED] drm_test_damage_iter_single_damage_fractional_src [21:18:12] [PASSED] drm_test_damage_iter_single_damage_intersect_fractional_src [21:18:12] [PASSED] drm_test_damage_iter_single_damage_outside_fractional_src [21:18:12] [PASSED] drm_test_damage_iter_single_damage_src_moved [21:18:12] [PASSED] drm_test_damage_iter_single_damage_fractional_src_moved [21:18:12] [PASSED] drm_test_damage_iter_damage [21:18:12] [PASSED] drm_test_damage_iter_damage_one_intersect [21:18:12] [PASSED] drm_test_damage_iter_damage_one_outside [21:18:12] [PASSED] drm_test_damage_iter_damage_src_moved [21:18:12] [PASSED] drm_test_damage_iter_damage_not_visible [21:18:12] ================ [PASSED] drm_damage_helper ================ [21:18:12] ============== drm_dp_mst_helper (3 subtests) ============== [21:18:12] ============== drm_test_dp_mst_calc_pbn_mode ============== [21:18:12] [PASSED] Clock 154000 BPP 30 DSC disabled [21:18:12] [PASSED] Clock 234000 BPP 30 DSC disabled [21:18:12] [PASSED] Clock 297000 BPP 24 DSC disabled [21:18:12] [PASSED] Clock 332880 BPP 24 DSC enabled [21:18:12] [PASSED] Clock 324540 BPP 24 DSC enabled [21:18:12] ========== [PASSED] drm_test_dp_mst_calc_pbn_mode ========== [21:18:12] ============== drm_test_dp_mst_calc_pbn_div =============== [21:18:12] [PASSED] Link rate 2000000 lane count 4 [21:18:12] [PASSED] Link rate 2000000 lane count 2 [21:18:12] [PASSED] Link rate 2000000 lane count 1 [21:18:12] [PASSED] Link rate 1350000 lane count 4 [21:18:12] [PASSED] Link rate 1350000 lane count 2 [21:18:12] [PASSED] Link rate 1350000 lane count 1 [21:18:12] [PASSED] Link rate 1000000 lane count 4 [21:18:12] [PASSED] Link rate 1000000 lane count 2 [21:18:12] [PASSED] Link rate 1000000 lane count 1 [21:18:12] [PASSED] Link rate 810000 lane count 4 [21:18:12] [PASSED] Link rate 810000 lane count 2 [21:18:12] [PASSED] Link rate 810000 lane count 1 [21:18:12] [PASSED] Link rate 540000 lane count 4 [21:18:12] [PASSED] Link rate 540000 lane count 2 [21:18:12] [PASSED] Link rate 540000 lane count 1 [21:18:12] [PASSED] Link rate 270000 lane count 4 [21:18:12] [PASSED] Link rate 270000 lane count 2 [21:18:12] [PASSED] Link rate 270000 lane count 1 [21:18:12] [PASSED] Link rate 162000 lane count 4 [21:18:12] [PASSED] Link rate 162000 lane count 2 [21:18:12] [PASSED] Link rate 162000 lane count 1 [21:18:12] ========== [PASSED] drm_test_dp_mst_calc_pbn_div =========== [21:18:12] ========= drm_test_dp_mst_sideband_msg_req_decode ========= [21:18:12] [PASSED] DP_ENUM_PATH_RESOURCES with port number [21:18:12] [PASSED] DP_POWER_UP_PHY with port number [21:18:12] [PASSED] DP_POWER_DOWN_PHY with port number [21:18:12] [PASSED] DP_ALLOCATE_PAYLOAD with SDP stream sinks [21:18:12] [PASSED] DP_ALLOCATE_PAYLOAD with port number [21:18:12] [PASSED] DP_ALLOCATE_PAYLOAD with VCPI [21:18:12] [PASSED] DP_ALLOCATE_PAYLOAD with PBN [21:18:12] [PASSED] DP_QUERY_PAYLOAD with port number [21:18:12] [PASSED] DP_QUERY_PAYLOAD with VCPI [21:18:12] [PASSED] DP_REMOTE_DPCD_READ with port number [21:18:12] [PASSED] DP_REMOTE_DPCD_READ with DPCD address [21:18:12] [PASSED] DP_REMOTE_DPCD_READ with max number of bytes [21:18:12] [PASSED] DP_REMOTE_DPCD_WRITE with port number [21:18:12] [PASSED] DP_REMOTE_DPCD_WRITE with DPCD address [21:18:12] [PASSED] DP_REMOTE_DPCD_WRITE with data array [21:18:12] [PASSED] DP_REMOTE_I2C_READ with port number [21:18:12] [PASSED] DP_REMOTE_I2C_READ with I2C device ID [21:18:12] [PASSED] DP_REMOTE_I2C_READ with transactions array [21:18:12] [PASSED] DP_REMOTE_I2C_WRITE with port number [21:18:12] [PASSED] DP_REMOTE_I2C_WRITE with I2C device ID [21:18:12] [PASSED] DP_REMOTE_I2C_WRITE with data array [21:18:12] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream ID [21:18:12] [PASSED] DP_QUERY_STREAM_ENC_STATUS with client ID [21:18:12] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream event [21:18:12] [PASSED] DP_QUERY_STREAM_ENC_STATUS with valid stream event [21:18:12] [PASSED] DP_QUERY_STREAM_ENC_STATUS with stream behavior [21:18:12] [PASSED] DP_QUERY_STREAM_ENC_STATUS with a valid stream behavior [21:18:12] ===== [PASSED] drm_test_dp_mst_sideband_msg_req_decode ===== [21:18:12] ================ [PASSED] drm_dp_mst_helper ================ [21:18:12] ================== drm_exec (7 subtests) =================== [21:18:12] [PASSED] sanitycheck [21:18:12] [PASSED] test_lock [21:18:12] [PASSED] test_lock_unlock [21:18:12] [PASSED] test_duplicates [21:18:12] [PASSED] test_prepare [21:18:12] [PASSED] test_prepare_array [21:18:12] [PASSED] test_multiple_loops [21:18:12] ==================== [PASSED] drm_exec ===================== [21:18:12] =========== drm_format_helper_test (17 subtests) =========== [21:18:12] ============== drm_test_fb_xrgb8888_to_gray8 ============== [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ========== [PASSED] drm_test_fb_xrgb8888_to_gray8 ========== [21:18:12] ============= drm_test_fb_xrgb8888_to_rgb332 ============== [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb332 ========== [21:18:12] ============= drm_test_fb_xrgb8888_to_rgb565 ============== [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb565 ========== [21:18:12] ============ drm_test_fb_xrgb8888_to_xrgb1555 ============= [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ======== [PASSED] drm_test_fb_xrgb8888_to_xrgb1555 ========= [21:18:12] ============ drm_test_fb_xrgb8888_to_argb1555 ============= [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ======== [PASSED] drm_test_fb_xrgb8888_to_argb1555 ========= [21:18:12] ============ drm_test_fb_xrgb8888_to_rgba5551 ============= [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ======== [PASSED] drm_test_fb_xrgb8888_to_rgba5551 ========= [21:18:12] ============= drm_test_fb_xrgb8888_to_rgb888 ============== [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ========= [PASSED] drm_test_fb_xrgb8888_to_rgb888 ========== [21:18:12] ============= drm_test_fb_xrgb8888_to_bgr888 ============== [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ========= [PASSED] drm_test_fb_xrgb8888_to_bgr888 ========== [21:18:12] ============ drm_test_fb_xrgb8888_to_argb8888 ============= [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ======== [PASSED] drm_test_fb_xrgb8888_to_argb8888 ========= [21:18:12] =========== drm_test_fb_xrgb8888_to_xrgb2101010 =========== [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ======= [PASSED] drm_test_fb_xrgb8888_to_xrgb2101010 ======= [21:18:12] =========== drm_test_fb_xrgb8888_to_argb2101010 =========== [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ======= [PASSED] drm_test_fb_xrgb8888_to_argb2101010 ======= [21:18:12] ============== drm_test_fb_xrgb8888_to_mono =============== [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ========== [PASSED] drm_test_fb_xrgb8888_to_mono =========== [21:18:12] ==================== drm_test_fb_swab ===================== [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ================ [PASSED] drm_test_fb_swab ================= [21:18:12] ============ drm_test_fb_xrgb8888_to_xbgr8888 ============= [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ======== [PASSED] drm_test_fb_xrgb8888_to_xbgr8888 ========= [21:18:12] ============ drm_test_fb_xrgb8888_to_abgr8888 ============= [21:18:12] [PASSED] single_pixel_source_buffer [21:18:12] [PASSED] single_pixel_clip_rectangle [21:18:12] [PASSED] well_known_colors [21:18:12] [PASSED] destination_pitch [21:18:12] ======== [PASSED] drm_test_fb_xrgb8888_to_abgr8888 ========= [21:18:12] ================= drm_test_fb_clip_offset ================= [21:18:12] [PASSED] pass through [21:18:12] [PASSED] horizontal offset [21:18:12] [PASSED] vertical offset [21:18:12] [PASSED] horizontal and vertical offset [21:18:12] [PASSED] horizontal offset (custom pitch) [21:18:12] [PASSED] vertical offset (custom pitch) [21:18:12] [PASSED] horizontal and vertical offset (custom pitch) [21:18:12] ============= [PASSED] drm_test_fb_clip_offset ============= [21:18:12] =================== drm_test_fb_memcpy ==================== [21:18:12] [PASSED] single_pixel_source_buffer: XR24 little-endian (0x34325258) [21:18:12] [PASSED] single_pixel_source_buffer: XRA8 little-endian (0x38415258) [21:18:12] [PASSED] single_pixel_source_buffer: YU24 little-endian (0x34325559) [21:18:12] [PASSED] single_pixel_clip_rectangle: XB24 little-endian (0x34324258) [21:18:12] [PASSED] single_pixel_clip_rectangle: XRA8 little-endian (0x38415258) [21:18:12] [PASSED] single_pixel_clip_rectangle: YU24 little-endian (0x34325559) [21:18:12] [PASSED] well_known_colors: XB24 little-endian (0x34324258) [21:18:12] [PASSED] well_known_colors: XRA8 little-endian (0x38415258) [21:18:12] [PASSED] well_known_colors: YU24 little-endian (0x34325559) [21:18:12] [PASSED] destination_pitch: XB24 little-endian (0x34324258) [21:18:12] [PASSED] destination_pitch: XRA8 little-endian (0x38415258) [21:18:12] [PASSED] destination_pitch: YU24 little-endian (0x34325559) [21:18:12] =============== [PASSED] drm_test_fb_memcpy ================ [21:18:12] ============= [PASSED] drm_format_helper_test ============== [21:18:12] ================= drm_format (18 subtests) ================= [21:18:12] [PASSED] drm_test_format_block_width_invalid [21:18:12] [PASSED] drm_test_format_block_width_one_plane [21:18:12] [PASSED] drm_test_format_block_width_two_plane [21:18:12] [PASSED] drm_test_format_block_width_three_plane [21:18:12] [PASSED] drm_test_format_block_width_tiled [21:18:12] [PASSED] drm_test_format_block_height_invalid [21:18:12] [PASSED] drm_test_format_block_height_one_plane [21:18:12] [PASSED] drm_test_format_block_height_two_plane [21:18:12] [PASSED] drm_test_format_block_height_three_plane [21:18:12] [PASSED] drm_test_format_block_height_tiled [21:18:12] [PASSED] drm_test_format_min_pitch_invalid [21:18:12] [PASSED] drm_test_format_min_pitch_one_plane_8bpp [21:18:12] [PASSED] drm_test_format_min_pitch_one_plane_16bpp [21:18:12] [PASSED] drm_test_format_min_pitch_one_plane_24bpp [21:18:12] [PASSED] drm_test_format_min_pitch_one_plane_32bpp [21:18:12] [PASSED] drm_test_format_min_pitch_two_plane [21:18:12] [PASSED] drm_test_format_min_pitch_three_plane_8bpp [21:18:12] [PASSED] drm_test_format_min_pitch_tiled [21:18:12] =================== [PASSED] drm_format ==================== [21:18:12] ============== drm_framebuffer (10 subtests) =============== [21:18:12] ========== drm_test_framebuffer_check_src_coords ========== [21:18:12] [PASSED] Success: source fits into fb [21:18:12] [PASSED] Fail: overflowing fb with x-axis coordinate [21:18:12] [PASSED] Fail: overflowing fb with y-axis coordinate [21:18:12] [PASSED] Fail: overflowing fb with source width [21:18:12] [PASSED] Fail: overflowing fb with source height [21:18:12] ====== [PASSED] drm_test_framebuffer_check_src_coords ====== [21:18:12] [PASSED] drm_test_framebuffer_cleanup [21:18:12] =============== drm_test_framebuffer_create =============== [21:18:12] [PASSED] ABGR8888 normal sizes [21:18:12] [PASSED] ABGR8888 max sizes [21:18:12] [PASSED] ABGR8888 pitch greater than min required [21:18:12] [PASSED] ABGR8888 pitch less than min required [21:18:12] [PASSED] ABGR8888 Invalid width [21:18:12] [PASSED] ABGR8888 Invalid buffer handle [21:18:12] [PASSED] No pixel format [21:18:12] [PASSED] ABGR8888 Width 0 [21:18:12] [PASSED] ABGR8888 Height 0 [21:18:12] [PASSED] ABGR8888 Out of bound height * pitch combination [21:18:12] [PASSED] ABGR8888 Large buffer offset [21:18:12] [PASSED] ABGR8888 Buffer offset for inexistent plane [21:18:12] [PASSED] ABGR8888 Invalid flag [21:18:12] [PASSED] ABGR8888 Set DRM_MODE_FB_MODIFIERS without modifiers [21:18:12] [PASSED] ABGR8888 Valid buffer modifier [21:18:12] [PASSED] ABGR8888 Invalid buffer modifier(DRM_FORMAT_MOD_SAMSUNG_64_32_TILE) [21:18:12] [PASSED] ABGR8888 Extra pitches without DRM_MODE_FB_MODIFIERS [21:18:12] [PASSED] ABGR8888 Extra pitches with DRM_MODE_FB_MODIFIERS [21:18:12] [PASSED] NV12 Normal sizes [21:18:12] [PASSED] NV12 Max sizes [21:18:12] [PASSED] NV12 Invalid pitch [21:18:12] [PASSED] NV12 Invalid modifier/missing DRM_MODE_FB_MODIFIERS flag [21:18:12] [PASSED] NV12 different modifier per-plane [21:18:12] [PASSED] NV12 with DRM_FORMAT_MOD_SAMSUNG_64_32_TILE [21:18:12] [PASSED] NV12 Valid modifiers without DRM_MODE_FB_MODIFIERS [21:18:12] [PASSED] NV12 Modifier for inexistent plane [21:18:12] [PASSED] NV12 Handle for inexistent plane [21:18:12] [PASSED] NV12 Handle for inexistent plane without DRM_MODE_FB_MODIFIERS [21:18:12] [PASSED] YVU420 DRM_MODE_FB_MODIFIERS set without modifier [21:18:12] [PASSED] YVU420 Normal sizes [21:18:12] [PASSED] YVU420 Max sizes [21:18:12] [PASSED] YVU420 Invalid pitch [21:18:12] [PASSED] YVU420 Different pitches [21:18:12] [PASSED] YVU420 Different buffer offsets/pitches [21:18:12] [PASSED] YVU420 Modifier set just for plane 0, without DRM_MODE_FB_MODIFIERS [21:18:12] [PASSED] YVU420 Modifier set just for planes 0, 1, without DRM_MODE_FB_MODIFIERS [21:18:12] [PASSED] YVU420 Modifier set just for plane 0, 1, with DRM_MODE_FB_MODIFIERS [21:18:12] [PASSED] YVU420 Valid modifier [21:18:12] [PASSED] YVU420 Different modifiers per plane [21:18:12] [PASSED] YVU420 Modifier for inexistent plane [21:18:12] [PASSED] YUV420_10BIT Invalid modifier(DRM_FORMAT_MOD_LINEAR) [21:18:12] [PASSED] X0L2 Normal sizes [21:18:12] [PASSED] X0L2 Max sizes [21:18:12] [PASSED] X0L2 Invalid pitch [21:18:12] [PASSED] X0L2 Pitch greater than minimum required [21:18:12] [PASSED] X0L2 Handle for inexistent plane [21:18:12] [PASSED] X0L2 Offset for inexistent plane, without DRM_MODE_FB_MODIFIERS set [21:18:12] [PASSED] X0L2 Modifier without DRM_MODE_FB_MODIFIERS set [21:18:12] [PASSED] X0L2 Valid modifier [21:18:12] [PASSED] X0L2 Modifier for inexistent plane [21:18:12] =========== [PASSED] drm_test_framebuffer_create =========== [21:18:12] [PASSED] drm_test_framebuffer_free [21:18:12] [PASSED] drm_test_framebuffer_init [21:18:12] [PASSED] drm_test_framebuffer_init_bad_format [21:18:12] [PASSED] drm_test_framebuffer_init_dev_mismatch [21:18:12] [PASSED] drm_test_framebuffer_lookup [21:18:12] [PASSED] drm_test_framebuffer_lookup_inexistent [21:18:12] [PASSED] drm_test_framebuffer_modifiers_not_supported [21:18:12] ================= [PASSED] drm_framebuffer ================= [21:18:12] ================ drm_gem_shmem (8 subtests) ================ [21:18:12] [PASSED] drm_gem_shmem_test_obj_create [21:18:12] [PASSED] drm_gem_shmem_test_obj_create_private [21:18:12] [PASSED] drm_gem_shmem_test_pin_pages [21:18:12] [PASSED] drm_gem_shmem_test_vmap [21:18:12] [PASSED] drm_gem_shmem_test_get_sg_table [21:18:12] [PASSED] drm_gem_shmem_test_get_pages_sgt [21:18:12] [PASSED] drm_gem_shmem_test_madvise [21:18:12] [PASSED] drm_gem_shmem_test_purge [21:18:12] ================== [PASSED] drm_gem_shmem ================== [21:18:12] === drm_atomic_helper_connector_hdmi_check (27 subtests) === [21:18:12] [PASSED] drm_test_check_broadcast_rgb_auto_cea_mode [21:18:12] [PASSED] drm_test_check_broadcast_rgb_auto_cea_mode_vic_1 [21:18:12] [PASSED] drm_test_check_broadcast_rgb_full_cea_mode [21:18:12] [PASSED] drm_test_check_broadcast_rgb_full_cea_mode_vic_1 [21:18:12] [PASSED] drm_test_check_broadcast_rgb_limited_cea_mode [21:18:12] [PASSED] drm_test_check_broadcast_rgb_limited_cea_mode_vic_1 [21:18:12] ====== drm_test_check_broadcast_rgb_cea_mode_yuv420 ======= [21:18:12] [PASSED] Automatic [21:18:12] [PASSED] Full [21:18:12] [PASSED] Limited 16:235 [21:18:12] == [PASSED] drm_test_check_broadcast_rgb_cea_mode_yuv420 === [21:18:12] [PASSED] drm_test_check_broadcast_rgb_crtc_mode_changed [21:18:12] [PASSED] drm_test_check_broadcast_rgb_crtc_mode_not_changed [21:18:12] [PASSED] drm_test_check_disable_connector [21:18:12] [PASSED] drm_test_check_hdmi_funcs_reject_rate [21:18:12] [PASSED] drm_test_check_max_tmds_rate_bpc_fallback_rgb [21:18:12] [PASSED] drm_test_check_max_tmds_rate_bpc_fallback_yuv420 [21:18:12] [PASSED] drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422 [21:18:12] [PASSED] drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv420 [21:18:12] [PASSED] drm_test_check_driver_unsupported_fallback_yuv420 [21:18:12] [PASSED] drm_test_check_output_bpc_crtc_mode_changed [21:18:12] [PASSED] drm_test_check_output_bpc_crtc_mode_not_changed [21:18:12] [PASSED] drm_test_check_output_bpc_dvi [21:18:12] [PASSED] drm_test_check_output_bpc_format_vic_1 [21:18:12] [PASSED] drm_test_check_output_bpc_format_display_8bpc_only [21:18:12] [PASSED] drm_test_check_output_bpc_format_display_rgb_only [21:18:12] [PASSED] drm_test_check_output_bpc_format_driver_8bpc_only [21:18:12] [PASSED] drm_test_check_output_bpc_format_driver_rgb_only [21:18:12] [PASSED] drm_test_check_tmds_char_rate_rgb_8bpc [21:18:12] [PASSED] drm_test_check_tmds_char_rate_rgb_10bpc [21:18:12] [PASSED] drm_test_check_tmds_char_rate_rgb_12bpc [21:18:12] ===== [PASSED] drm_atomic_helper_connector_hdmi_check ====== [21:18:12] === drm_atomic_helper_connector_hdmi_reset (6 subtests) ==== [21:18:12] [PASSED] drm_test_check_broadcast_rgb_value [21:18:12] [PASSED] drm_test_check_bpc_8_value [21:18:12] [PASSED] drm_test_check_bpc_10_value [21:18:12] [PASSED] drm_test_check_bpc_12_value [21:18:12] [PASSED] drm_test_check_format_value [21:18:12] [PASSED] drm_test_check_tmds_char_value [21:18:12] ===== [PASSED] drm_atomic_helper_connector_hdmi_reset ====== [21:18:12] = drm_atomic_helper_connector_hdmi_mode_valid (4 subtests) = [21:18:12] [PASSED] drm_test_check_mode_valid [21:18:12] [PASSED] drm_test_check_mode_valid_reject [21:18:12] [PASSED] drm_test_check_mode_valid_reject_rate [21:18:12] [PASSED] drm_test_check_mode_valid_reject_max_clock [21:18:12] === [PASSED] drm_atomic_helper_connector_hdmi_mode_valid === [21:18:12] = drm_atomic_helper_connector_hdmi_infoframes (5 subtests) = [21:18:12] [PASSED] drm_test_check_infoframes [21:18:12] [PASSED] drm_test_check_reject_avi_infoframe [21:18:12] [PASSED] drm_test_check_reject_hdr_infoframe_bpc_8 [21:18:12] [PASSED] drm_test_check_reject_hdr_infoframe_bpc_10 [21:18:12] [PASSED] drm_test_check_reject_audio_infoframe [21:18:12] === [PASSED] drm_atomic_helper_connector_hdmi_infoframes === [21:18:12] ================= drm_managed (2 subtests) ================= [21:18:12] [PASSED] drm_test_managed_release_action [21:18:12] [PASSED] drm_test_managed_run_action [21:18:12] =================== [PASSED] drm_managed =================== [21:18:12] =================== drm_mm (6 subtests) ==================== [21:18:12] [PASSED] drm_test_mm_init [21:18:12] [PASSED] drm_test_mm_debug [21:18:12] [PASSED] drm_test_mm_align32 [21:18:12] [PASSED] drm_test_mm_align64 [21:18:12] [PASSED] drm_test_mm_lowest [21:18:12] [PASSED] drm_test_mm_highest [21:18:12] ===================== [PASSED] drm_mm ====================== [21:18:12] ============= drm_modes_analog_tv (5 subtests) ============= [21:18:12] [PASSED] drm_test_modes_analog_tv_mono_576i [21:18:12] [PASSED] drm_test_modes_analog_tv_ntsc_480i [21:18:12] [PASSED] drm_test_modes_analog_tv_ntsc_480i_inlined [21:18:12] [PASSED] drm_test_modes_analog_tv_pal_576i [21:18:12] [PASSED] drm_test_modes_analog_tv_pal_576i_inlined [21:18:12] =============== [PASSED] drm_modes_analog_tv =============== [21:18:12] ============== drm_plane_helper (2 subtests) =============== [21:18:12] =============== drm_test_check_plane_state ================ [21:18:12] [PASSED] clipping_simple [21:18:12] [PASSED] clipping_rotate_reflect [21:18:12] [PASSED] positioning_simple [21:18:12] [PASSED] upscaling [21:18:12] [PASSED] downscaling [21:18:12] [PASSED] rounding1 [21:18:12] [PASSED] rounding2 [21:18:12] [PASSED] rounding3 [21:18:12] [PASSED] rounding4 [21:18:12] =========== [PASSED] drm_test_check_plane_state ============ [21:18:12] =========== drm_test_check_invalid_plane_state ============ [21:18:12] [PASSED] positioning_invalid [21:18:12] [PASSED] upscaling_invalid [21:18:12] [PASSED] downscaling_invalid [21:18:12] ======= [PASSED] drm_test_check_invalid_plane_state ======== [21:18:12] ================ [PASSED] drm_plane_helper ================= [21:18:12] ====== drm_connector_helper_tv_get_modes (1 subtest) ======= [21:18:12] ====== drm_test_connector_helper_tv_get_modes_check ======= [21:18:12] [PASSED] None [21:18:12] [PASSED] PAL [21:18:12] [PASSED] NTSC [21:18:12] [PASSED] Both, NTSC Default [21:18:12] [PASSED] Both, PAL Default [21:18:12] [PASSED] Both, NTSC Default, with PAL on command-line [21:18:12] [PASSED] Both, PAL Default, with NTSC on command-line [21:18:12] == [PASSED] drm_test_connector_helper_tv_get_modes_check === [21:18:12] ======== [PASSED] drm_connector_helper_tv_get_modes ======== [21:18:12] ================== drm_rect (9 subtests) =================== [21:18:12] [PASSED] drm_test_rect_clip_scaled_div_by_zero [21:18:12] [PASSED] drm_test_rect_clip_scaled_not_clipped [21:18:12] [PASSED] drm_test_rect_clip_scaled_clipped [21:18:12] [PASSED] drm_test_rect_clip_scaled_signed_vs_unsigned [21:18:12] ================= drm_test_rect_intersect ================= [21:18:12] [PASSED] top-left x bottom-right: 2x2+1+1 x 2x2+0+0 [21:18:12] [PASSED] top-right x bottom-left: 2x2+0+0 x 2x2+1-1 [21:18:12] [PASSED] bottom-left x top-right: 2x2+1-1 x 2x2+0+0 [21:18:12] [PASSED] bottom-right x top-left: 2x2+0+0 x 2x2+1+1 [21:18:12] [PASSED] right x left: 2x1+0+0 x 3x1+1+0 [21:18:12] [PASSED] left x right: 3x1+1+0 x 2x1+0+0 [21:18:12] [PASSED] up x bottom: 1x2+0+0 x 1x3+0-1 [21:18:12] [PASSED] bottom x up: 1x3+0-1 x 1x2+0+0 [21:18:12] [PASSED] touching corner: 1x1+0+0 x 2x2+1+1 [21:18:12] [PASSED] touching side: 1x1+0+0 x 1x1+1+0 [21:18:12] [PASSED] equal rects: 2x2+0+0 x 2x2+0+0 [21:18:12] [PASSED] inside another: 2x2+0+0 x 1x1+1+1 [21:18:12] [PASSED] far away: 1x1+0+0 x 1x1+3+6 [21:18:12] [PASSED] points intersecting: 0x0+5+10 x 0x0+5+10 [21:18:12] [PASSED] points not intersecting: 0x0+0+0 x 0x0+5+10 stty: 'standard input': Inappropriate ioctl for device [21:18:12] ============= [PASSED] drm_test_rect_intersect ============= [21:18:12] ================ drm_test_rect_calc_hscale ================ [21:18:12] [PASSED] normal use [21:18:12] [PASSED] out of max range [21:18:12] [PASSED] out of min range [21:18:12] [PASSED] zero dst [21:18:12] [PASSED] negative src [21:18:12] [PASSED] negative dst [21:18:12] ============ [PASSED] drm_test_rect_calc_hscale ============ [21:18:12] ================ drm_test_rect_calc_vscale ================ [21:18:12] [PASSED] normal use [21:18:12] [PASSED] out of max range [21:18:12] [PASSED] out of min range [21:18:12] [PASSED] zero dst [21:18:12] [PASSED] negative src [21:18:12] [PASSED] negative dst [21:18:12] ============ [PASSED] drm_test_rect_calc_vscale ============ [21:18:12] ================== drm_test_rect_rotate =================== [21:18:12] [PASSED] reflect-x [21:18:12] [PASSED] reflect-y [21:18:12] [PASSED] rotate-0 [21:18:12] [PASSED] rotate-90 [21:18:12] [PASSED] rotate-180 [21:18:12] [PASSED] rotate-270 [21:18:12] ============== [PASSED] drm_test_rect_rotate =============== [21:18:12] ================ drm_test_rect_rotate_inv ================= [21:18:12] [PASSED] reflect-x [21:18:12] [PASSED] reflect-y [21:18:12] [PASSED] rotate-0 [21:18:12] [PASSED] rotate-90 [21:18:12] [PASSED] rotate-180 [21:18:12] [PASSED] rotate-270 [21:18:12] ============ [PASSED] drm_test_rect_rotate_inv ============= [21:18:12] ==================== [PASSED] drm_rect ===================== [21:18:12] ============ drm_sysfb_modeset_test (1 subtest) ============ [21:18:12] ============ drm_test_sysfb_build_fourcc_list ============= [21:18:12] [PASSED] no native formats [21:18:12] [PASSED] XRGB8888 as native format [21:18:12] [PASSED] remove duplicates [21:18:12] [PASSED] convert alpha formats [21:18:12] [PASSED] random formats [21:18:12] ======== [PASSED] drm_test_sysfb_build_fourcc_list ========= [21:18:12] ============= [PASSED] drm_sysfb_modeset_test ============== [21:18:12] ================== drm_fixp (2 subtests) =================== [21:18:12] [PASSED] drm_test_int2fixp [21:18:12] [PASSED] drm_test_sm2fixp [21:18:12] ==================== [PASSED] drm_fixp ===================== [21:18:12] ============================================================ [21:18:12] Testing complete. Ran 630 tests: passed: 630 [21:18:12] Elapsed time: 27.607s total, 1.672s configuring, 25.517s building, 0.379s running
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/ttm/tests/.kunitconfig [21:18:12] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig [21:18:14] Building KUnit Kernel ... Populating config with: $ make ARCH=um O=.kunit olddefconfig Building with: $ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=48 [21:18:23] Starting KUnit Kernel (1/1)... [21:18:23] ============================================================ Running tests with: $ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt [21:18:23] ================= ttm_device (5 subtests) ================== [21:18:23] [PASSED] ttm_device_init_basic [21:18:23] [PASSED] ttm_device_init_multiple [21:18:23] [PASSED] ttm_device_fini_basic [21:18:23] [PASSED] ttm_device_init_no_vma_man [21:18:23] ================== ttm_device_init_pools ================== [21:18:23] [PASSED] No DMA allocations, no DMA32 required [21:18:23] [PASSED] DMA allocations, DMA32 required [21:18:23] [PASSED] No DMA allocations, DMA32 required [21:18:23] [PASSED] DMA allocations, no DMA32 required [21:18:23] ============== [PASSED] ttm_device_init_pools ============== [21:18:23] =================== [PASSED] ttm_device ==================== [21:18:23] ================== ttm_pool (8 subtests) =================== [21:18:23] ================== ttm_pool_alloc_basic =================== [21:18:23] [PASSED] One page [21:18:23] [PASSED] More than one page [21:18:23] [PASSED] Above the allocation limit [21:18:23] [PASSED] One page, with coherent DMA mappings enabled [21:18:23] [PASSED] Above the allocation limit, with coherent DMA mappings enabled [21:18:23] ============== [PASSED] ttm_pool_alloc_basic =============== [21:18:23] ============== ttm_pool_alloc_basic_dma_addr ============== [21:18:23] [PASSED] One page [21:18:23] [PASSED] More than one page [21:18:23] [PASSED] Above the allocation limit [21:18:23] [PASSED] One page, with coherent DMA mappings enabled [21:18:23] [PASSED] Above the allocation limit, with coherent DMA mappings enabled [21:18:23] ========== [PASSED] ttm_pool_alloc_basic_dma_addr ========== [21:18:23] [PASSED] ttm_pool_alloc_order_caching_match [21:18:23] [PASSED] ttm_pool_alloc_caching_mismatch [21:18:23] [PASSED] ttm_pool_alloc_order_mismatch [21:18:23] [PASSED] ttm_pool_free_dma_alloc [21:18:23] [PASSED] ttm_pool_free_no_dma_alloc [21:18:23] [PASSED] ttm_pool_fini_basic [21:18:23] ==================== [PASSED] ttm_pool ===================== [21:18:23] ================ ttm_resource (8 subtests) ================= [21:18:23] ================= ttm_resource_init_basic ================= [21:18:23] [PASSED] Init resource in TTM_PL_SYSTEM [21:18:23] [PASSED] Init resource in TTM_PL_VRAM [21:18:23] [PASSED] Init resource in a private placement [21:18:23] [PASSED] Init resource in TTM_PL_SYSTEM, set placement flags [21:18:23] ============= [PASSED] ttm_resource_init_basic ============= [21:18:23] [PASSED] ttm_resource_init_pinned [21:18:23] [PASSED] ttm_resource_fini_basic [21:18:23] [PASSED] ttm_resource_manager_init_basic [21:18:23] [PASSED] ttm_resource_manager_usage_basic [21:18:23] [PASSED] ttm_resource_manager_set_used_basic [21:18:23] [PASSED] ttm_sys_man_alloc_basic [21:18:23] [PASSED] ttm_sys_man_free_basic [21:18:23] ================== [PASSED] ttm_resource =================== [21:18:23] =================== ttm_tt (15 subtests) =================== [21:18:23] ==================== ttm_tt_init_basic ==================== [21:18:23] [PASSED] Page-aligned size [21:18:23] [PASSED] Extra pages requested [21:18:23] ================ [PASSED] ttm_tt_init_basic ================ [21:18:23] [PASSED] ttm_tt_init_misaligned [21:18:23] [PASSED] ttm_tt_fini_basic [21:18:23] [PASSED] ttm_tt_fini_sg [21:18:23] [PASSED] ttm_tt_fini_shmem [21:18:23] [PASSED] ttm_tt_create_basic [21:18:23] [PASSED] ttm_tt_create_invalid_bo_type [21:18:23] [PASSED] ttm_tt_create_ttm_exists [21:18:23] [PASSED] ttm_tt_create_failed [21:18:23] [PASSED] ttm_tt_destroy_basic [21:18:23] [PASSED] ttm_tt_populate_null_ttm [21:18:23] [PASSED] ttm_tt_populate_populated_ttm [21:18:23] [PASSED] ttm_tt_unpopulate_basic [21:18:23] [PASSED] ttm_tt_unpopulate_empty_ttm [21:18:23] [PASSED] ttm_tt_swapin_basic [21:18:23] ===================== [PASSED] ttm_tt ====================== [21:18:23] =================== ttm_bo (14 subtests) =================== [21:18:23] =========== ttm_bo_reserve_optimistic_no_ticket =========== [21:18:23] [PASSED] Cannot be interrupted and sleeps [21:18:23] [PASSED] Cannot be interrupted, locks straight away [21:18:23] [PASSED] Can be interrupted, sleeps [21:18:23] ======= [PASSED] ttm_bo_reserve_optimistic_no_ticket ======= [21:18:23] [PASSED] ttm_bo_reserve_locked_no_sleep [21:18:23] [PASSED] ttm_bo_reserve_no_wait_ticket [21:18:23] [PASSED] ttm_bo_reserve_double_resv [21:18:23] [PASSED] ttm_bo_reserve_interrupted [21:18:23] [PASSED] ttm_bo_reserve_deadlock [21:18:23] [PASSED] ttm_bo_unreserve_basic [21:18:23] [PASSED] ttm_bo_unreserve_pinned [21:18:23] [PASSED] ttm_bo_unreserve_bulk [21:18:23] [PASSED] ttm_bo_fini_basic [21:18:24] [PASSED] ttm_bo_fini_shared_resv [21:18:24] [PASSED] ttm_bo_pin_basic [21:18:24] [PASSED] ttm_bo_pin_unpin_resource [21:18:24] [PASSED] ttm_bo_multiple_pin_one_unpin [21:18:24] ===================== [PASSED] ttm_bo ====================== [21:18:24] ============== ttm_bo_validate (21 subtests) =============== [21:18:24] ============== ttm_bo_init_reserved_sys_man =============== [21:18:24] [PASSED] Buffer object for userspace [21:18:24] [PASSED] Kernel buffer object [21:18:24] [PASSED] Shared buffer object [21:18:24] ========== [PASSED] ttm_bo_init_reserved_sys_man =========== [21:18:24] ============== ttm_bo_init_reserved_mock_man ============== [21:18:24] [PASSED] Buffer object for userspace [21:18:24] [PASSED] Kernel buffer object [21:18:24] [PASSED] Shared buffer object [21:18:24] ========== [PASSED] ttm_bo_init_reserved_mock_man ========== [21:18:24] [PASSED] ttm_bo_init_reserved_resv [21:18:24] ================== ttm_bo_validate_basic ================== [21:18:24] [PASSED] Buffer object for userspace [21:18:24] [PASSED] Kernel buffer object [21:18:24] [PASSED] Shared buffer object [21:18:24] ============== [PASSED] ttm_bo_validate_basic ============== [21:18:24] [PASSED] ttm_bo_validate_invalid_placement [21:18:24] ============= ttm_bo_validate_same_placement ============== [21:18:24] [PASSED] System manager [21:18:24] [PASSED] VRAM manager [21:18:24] ========= [PASSED] ttm_bo_validate_same_placement ========== [21:18:24] [PASSED] ttm_bo_validate_failed_alloc [21:18:24] [PASSED] ttm_bo_validate_pinned [21:18:24] [PASSED] ttm_bo_validate_busy_placement [21:18:24] ================ ttm_bo_validate_multihop ================= [21:18:24] [PASSED] Buffer object for userspace [21:18:24] [PASSED] Kernel buffer object [21:18:24] [PASSED] Shared buffer object [21:18:24] ============ [PASSED] ttm_bo_validate_multihop ============= [21:18:24] ========== ttm_bo_validate_no_placement_signaled ========== [21:18:24] [PASSED] Buffer object in system domain, no page vector [21:18:24] [PASSED] Buffer object in system domain with an existing page vector [21:18:24] ====== [PASSED] ttm_bo_validate_no_placement_signaled ====== [21:18:24] ======== ttm_bo_validate_no_placement_not_signaled ======== [21:18:24] [PASSED] Buffer object for userspace [21:18:24] [PASSED] Kernel buffer object [21:18:24] [PASSED] Shared buffer object [21:18:24] ==== [PASSED] ttm_bo_validate_no_placement_not_signaled ==== [21:18:24] [PASSED] ttm_bo_validate_move_fence_signaled [21:18:24] ========= ttm_bo_validate_move_fence_not_signaled ========= [21:18:24] [PASSED] Waits for GPU [21:18:24] [PASSED] Tries to lock straight away [21:18:24] ===== [PASSED] ttm_bo_validate_move_fence_not_signaled ===== [21:18:24] [PASSED] ttm_bo_validate_happy_evict [21:18:24] [PASSED] ttm_bo_validate_all_pinned_evict [21:18:24] [PASSED] ttm_bo_validate_allowed_only_evict [21:18:24] [PASSED] ttm_bo_validate_deleted_evict [21:18:24] [PASSED] ttm_bo_validate_busy_domain_evict [21:18:24] [PASSED] ttm_bo_validate_evict_gutting [21:18:24] [PASSED] ttm_bo_validate_recrusive_evict stty: 'standard input': Inappropriate ioctl for device [21:18:24] ================= [PASSED] ttm_bo_validate ================= [21:18:24] ============================================================ [21:18:24] Testing complete. Ran 101 tests: passed: 101 [21:18:24] Elapsed time: 11.397s total, 1.638s configuring, 9.492s building, 0.220s running
+ cleanup
++ stat -c %u:%g /kernel
+ chown -R 1003:1003 /kernel
Patchwork
CI✓ Xe.CI.BAT: success for Remove device private pages from physical address space (rev9)
In reply to Jordan Niethe== Series Details ==
== Series Details ==
Series: Remove device private pages from physical address space (rev9)
URL : https://patchwork.freedesktop.org/series/159738/
State : success
== Summary ==
CI Bug Log - changes from xe-4484-a68485eec77211a46da7bdb6a0f862e4b365f1e3_BAT -> xe-pw-159738v9_BAT
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Participating hosts (12 -> 12)
------------------------------
No changes in participating hosts
Changes
-------
No changes found
Build changes
-------------
* Linux: xe-4484-a68485eec77211a46da7bdb6a0f862e4b365f1e3 -> xe-pw-159738v9
IGT_8729: 8729
xe-4484-a68485eec77211a46da7bdb6a0f862e4b365f1e3: a68485eec77211a46da7bdb6a0f862e4b365f1e3
xe-pw-159738v9: 159738v9
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/xe-pw-159738v9/index.html
David Hildenbrand (Arm)
maintainerQuoted 14 lines
By removing the device private pages from the physical address space, this series also opens up the possibility to moving away from tracking device private memory using struct pages in the future. This is desirable as on systems with large amounts of memory these device private struct pages use a signifiant amount of memory and take a significant amount of time to initialize.
Changes in v6
-------------
- Fix maybe unused inkgd2kfd_init_zone_device()
- Replace division byPAGE_SIZEwithDIV_ROUND_UP()when settingnr_pages. This mirrors the align up that previously happened inget_free_mem_region()
Quoted 4 lines
Note removed previous discussion in the cover letter relating to aarch64 and
memremap_pages()as this was actually already addressed in commiteeb8fdfcf090("arm64: Expose the end of the linear map inPHYSMEM_END").
Now that I stumbled over v6, same comment; planning on taking a look soon.
Signature · 3 lines
Cheers, David
David Hildenbrand (Arm)
maintainerQuoted 70 lines · Jordan Niethe
Introduction
------------The existing design of device private memory imposes limitations which render it non functional for certain systems and configurations where the physical address space is limited.
Limited available address space
-------------------------------Device private memory is implemented by first reserving a region of the physical address space. This is a problem. The physical address space is not a resource that is directly under the kernel's control. Availability of suitable physical address space is constrained by the underlying hardware and firmware and may not always be available.
Device private memory assumes that it will be able to reserve a device memory sized chunk of physical address space. However, there is nothing guaranteeing that this will succeed, and there a number of factors that increase the likelihood of failure. We need to consider what else may exist in the physical address space. It is observed that certain VM configurations place very large PCI windows immediately after RAM. Large enough that there is no physical address space available at all for device private memory. This is more likely to occur on 43 bit physical width systems which have less physical address space.
The fundamental issue is the physical address space is not a resource the kernel can rely on being to allocate from at will.
New implementation
------------------This series changes device private memory so that it does not require allocation of physical address space and these problems are avoided. Instead of using the physical address space, we introduce a "device private address space" and allocate from there.
A consequence of placing the device private pages outside of the physical address space is that they no longer have a PFN. However, it is still necessary to be able to look up a corresponding device private page from a device private PTE entry, which means that we still require some way to index into this device private address space. Instead of a PFN, device private pages use an offset into this device private address space to look up device private struct pages.
The problem that then needs to be addressed is how to avoid confusing these device private offsets with PFNs. It is the limited usage of the device private pages themselves which make this possible. A device private page is only used for userspace mappings, we do not need to be concerned with them being used within the mm more broadly. This means that the only way that the core kernel looks up these pages is via the page table, where their PTE already indicates if they refer to a device private page via their swap type, e.g.
SWP_DEVICE_WRITE. We can use this information to determine if the PTE contains a PFN which should be looked up in the page map, or a device private offset which should be looked up elsewhere.This applies when we are creating PTE entries for device private pages - because they have their own type there are already must be handled separately, so it is a small step to convert them to a device private PFN now too.
The first part of the series updates callers where device private offsets might now be encountered to track this extra state.
The last patch contains the bulk of the work where we change how we convert between device private pages to device private offsets and then use a new interface for allocating device private pages without the need for reserving physical address space.
Quoted 6 lines
By removing the device private pages from the physical address space, this series also opens up the possibility to moving away from tracking device private memory using struct pages in the future. This is desirable as on systems with large amounts of memory these device private struct pages use a signifiant amount of memory and take a significant amount of time to initialize.
I now went through all of the patches (skimming a bit over some parts that need splitting or rework).
In general, a noble goal and a reasonable approach.
But I get the sense that we are just hacking in yet another zone-device thing. This series certainly makes core-mm more complicated. I provided some inputs on how to make some things less hacky, and will provide further input as you move forward.
We really have to minimize the impact, otherwise we'll just keep breaking stuff all the time when we forget a single test for device-private pages in one magical path.
I am not 100% sure how much the additional tests for device-private pages all over the place will cost us. At least it can get compiled out, but most distros will just always have it compiled in.
Signature · 3 lines
Cheers, David
Alistair Popple
reviewerOn 2026-03-07 at 03:16 +1100, "David Hildenbrand (Arm)" <[email protected]> wrote...
Quoted 78 lines · Jordan Niethe
Quoted 70 lines
Introduction
------------The existing design of device private memory imposes limitations which render it non functional for certain systems and configurations where the physical address space is limited.
Limited available address space
-------------------------------Device private memory is implemented by first reserving a region of the physical address space. This is a problem. The physical address space is not a resource that is directly under the kernel's control. Availability of suitable physical address space is constrained by the underlying hardware and firmware and may not always be available.
Device private memory assumes that it will be able to reserve a device memory sized chunk of physical address space. However, there is nothing guaranteeing that this will succeed, and there a number of factors that increase the likelihood of failure. We need to consider what else may exist in the physical address space. It is observed that certain VM configurations place very large PCI windows immediately after RAM. Large enough that there is no physical address space available at all for device private memory. This is more likely to occur on 43 bit physical width systems which have less physical address space.
The fundamental issue is the physical address space is not a resource the kernel can rely on being to allocate from at will.
New implementation
------------------This series changes device private memory so that it does not require allocation of physical address space and these problems are avoided. Instead of using the physical address space, we introduce a "device private address space" and allocate from there.
A consequence of placing the device private pages outside of the physical address space is that they no longer have a PFN. However, it is still necessary to be able to look up a corresponding device private page from a device private PTE entry, which means that we still require some way to index into this device private address space. Instead of a PFN, device private pages use an offset into this device private address space to look up device private struct pages.
The problem that then needs to be addressed is how to avoid confusing these device private offsets with PFNs. It is the limited usage of the device private pages themselves which make this possible. A device private page is only used for userspace mappings, we do not need to be concerned with them being used within the mm more broadly. This means that the only way that the core kernel looks up these pages is via the page table, where their PTE already indicates if they refer to a device private page via their swap type, e.g.
SWP_DEVICE_WRITE. We can use this information to determine if the PTE contains a PFN which should be looked up in the page map, or a device private offset which should be looked up elsewhere.This applies when we are creating PTE entries for device private pages - because they have their own type there are already must be handled separately, so it is a small step to convert them to a device private PFN now too.
The first part of the series updates callers where device private offsets might now be encountered to track this extra state.
The last patch contains the bulk of the work where we change how we convert between device private pages to device private offsets and then use a new interface for allocating device private pages without the need for reserving physical address space.
Quoted 6 lines
By removing the device private pages from the physical address space, this series also opens up the possibility to moving away from tracking device private memory using struct pages in the future. This is desirable as on systems with large amounts of memory these device private struct pages use a signifiant amount of memory and take a significant amount of time to initialize.
Quoted 2 lines
I now went through all of the patches (skimming a bit over some parts that need splitting or rework).
Thanks David for taking the time to do a thorough review. I will let Jordan respond to most of the comments but wanted to add some of my own as I helped with the initial idea.
Quoted 6 lines
In general, a noble goal and a reasonable approach.
But I get the sense that we are just hacking in yet another zone-device thing. This series certainly makes core-mm more complicated. I provided some inputs on how to make some things less hacky, and will provide further input as you move forward.
I disagree - this isn't hacking in another/new zone-device thing it is cleaning up/reworking a pre-existing zone-device thing (DEVICE_PRIVATE pages). My initial hope was it wouldn't actually involve too much churn on the core-mm side.
It seems that didn't work quite as well as hoped as there are a few places in core-mm where we use raw pfns without actually accessing them rather than using the page/folio. Notably page_vma_mapped in patch 5.
But overall this is about replacing pfn_to_page()/page_to_pfn() with device-private specific variants, as callers *must* already know when they are dealing with a device-private pfn and treat it specially today (whether explicitly or implicitly). Callers/callees already can't just treat a device-private pfn normally as accessing the pfn will cause machine checks and the associated page is a zone-device page so doesn't behave like a normal struct page.
Quoted 3 lines
We really have to minimize the impact, otherwise we'll just keep breaking stuff all the time when we forget a single test for device-private pages in one magical path.
As noted above this is already the case - all paths whether explicitly or implicitly (or just fogotten ... hard to tell) need to consider device-private pages and possibly treat them differently. Even today some magical path that somehow gets a device-private pfn/page and tries to use it as a normal page/pfn will probably break as they don't actually correspond to physical addresses that actually exist and the struct pages are special.
So any core-mm churn is really just making this more explicit, but this series doesn't add any new requirements.
My bigger aim here is to use this as a stepping stone to removing device-private pages as they just contain a bunch of redundant information from a device driver perspective that introduces a lot of metadata management overhead.
Quoted 3 lines
I am not 100% sure how much the additional tests for device-private pages all over the place will cost us. At least it can get compiled out, but most distros will just always have it compiled in.
I didn't notice too many extra checks outside of the migration entry path. But if perf is a concern there I think we could move those checks to device-private specific paths. From memory Jordan did this more as a convenience. Will go look a bit deeper for any other checks we might have added.
- Alistair
Quoted 4 lines
Signature · 3 lines
Cheers, David
David Hildenbrand (Arm)
maintainerQuoted 88 lines · Alistair Popple
On 2026-03-07 at 03:16 +1100, "David Hildenbrand (Arm)" <[email protected]> wrote...
Quoted 78 lines · Jordan Niethe
Quoted 70 lines
Introduction
------------The existing design of device private memory imposes limitations which render it non functional for certain systems and configurations where the physical address space is limited.
Limited available address space
-------------------------------Device private memory is implemented by first reserving a region of the physical address space. This is a problem. The physical address space is not a resource that is directly under the kernel's control. Availability of suitable physical address space is constrained by the underlying hardware and firmware and may not always be available.
Device private memory assumes that it will be able to reserve a device memory sized chunk of physical address space. However, there is nothing guaranteeing that this will succeed, and there a number of factors that increase the likelihood of failure. We need to consider what else may exist in the physical address space. It is observed that certain VM configurations place very large PCI windows immediately after RAM. Large enough that there is no physical address space available at all for device private memory. This is more likely to occur on 43 bit physical width systems which have less physical address space.
The fundamental issue is the physical address space is not a resource the kernel can rely on being to allocate from at will.
New implementation
------------------This series changes device private memory so that it does not require allocation of physical address space and these problems are avoided. Instead of using the physical address space, we introduce a "device private address space" and allocate from there.
A consequence of placing the device private pages outside of the physical address space is that they no longer have a PFN. However, it is still necessary to be able to look up a corresponding device private page from a device private PTE entry, which means that we still require some way to index into this device private address space. Instead of a PFN, device private pages use an offset into this device private address space to look up device private struct pages.
The problem that then needs to be addressed is how to avoid confusing these device private offsets with PFNs. It is the limited usage of the device private pages themselves which make this possible. A device private page is only used for userspace mappings, we do not need to be concerned with them being used within the mm more broadly. This means that the only way that the core kernel looks up these pages is via the page table, where their PTE already indicates if they refer to a device private page via their swap type, e.g.
SWP_DEVICE_WRITE. We can use this information to determine if the PTE contains a PFN which should be looked up in the page map, or a device private offset which should be looked up elsewhere.This applies when we are creating PTE entries for device private pages - because they have their own type there are already must be handled separately, so it is a small step to convert them to a device private PFN now too.
The first part of the series updates callers where device private offsets might now be encountered to track this extra state.
The last patch contains the bulk of the work where we change how we convert between device private pages to device private offsets and then use a new interface for allocating device private pages without the need for reserving physical address space.
Quoted 6 lines
By removing the device private pages from the physical address space, this series also opens up the possibility to moving away from tracking device private memory using struct pages in the future. This is desirable as on systems with large amounts of memory these device private struct pages use a signifiant amount of memory and take a significant amount of time to initialize.
Quoted 2 lines
I now went through all of the patches (skimming a bit over some parts that need splitting or rework).
Thanks David for taking the time to do a thorough review. I will let Jordan respond to most of the comments but wanted to add some of my own as I helped with the initial idea.
Quoted 2 lines
In general, a noble goal and a reasonable approach.
Quoted 8 lines
Quoted 4 lines
But I get the sense that we are just hacking in yet another zone-device thing. This series certainly makes core-mm more complicated. I provided some inputs on how to make some things less hacky, and will provide further input as you move forward.
I disagree - this isn't hacking in another/new zone-device thing it is cleaning up/reworking a pre-existing zone-device thing (
DEVICE_PRIVATEpages). My initial hope was it wouldn't actually involve too much churn on the core-mm side.
... and there is quite some.
stuff like make_readable_exclusive_migration_entry_from_page() must be reworked.
Maybe after some reworks it will no longer look like a hack.
Right now it does.
Quoted 4 lines
It seems that didn't work quite as well as hoped as there are a few places in core-mm where we use raw pfns without actually accessing them rather than using the page/folio. Notably
page_vma_mappedin patch 5.
Yes. I provided ideas on how to minimize the impact.
Again, maybe if done right it will be okay-ish.
It will likely still be error prone, but I have no idea how on earth we could possible catch reliably for an "unsigned long" pfn whether it is a PFN (it's right there in the name ...) or something completely different.
We don't want another pfn_t, it would be too much churn to convert most of MM.
Quoted 13 lines
But overall this is about replacing pfn_to_page()/page_to_pfn() with device-private specific variants, as callers *must* already know when they are dealing with a device-private pfn and treat it specially today (whether explicitly or implicitly). Callers/callees already can't just treat a device-private pfn normally as accessing the pfn will cause machine checks and the associated page is a zone-device page so doesn't behave like a normal struct page.
Quoted 3 lines
We really have to minimize the impact, otherwise we'll just keep breaking stuff all the time when we forget a single test for device-private pages in one magical path.
Quoted 6 lines
As noted above this is already the case - all paths whether explicitly or implicitly (or just fogotten ... hard to tell) need to consider device-private pages and possibly treat them differently. Even today some magical path that somehow gets a device-private pfn/page and tries to use it as a normal page/pfn will probably break as they don't actually correspond to physical addresses that actually exist and the struct pages are special.
Well, so far a PFN is a PFN, and when you actually have a *page* (after pfn_to_page() etc) you can just test for these cases.
The page is actually sufficient to make a decision.
With a PFN you have to carry auxiliary information.
Quoted 3 lines
So any core-mm churn is really just making this more explicit, but this series doesn't add any new requirements.
Again, maybe it can be done in a better way. I did not enjoy some of the code changes I was reading.
Quoted 5 lines
My bigger aim here is to use this as a stepping stone to removing device-private pages as they just contain a bunch of redundant information from a device driver perspective that introduces a lot of metadata management overhead.
Quoted 8 lines
Quoted 3 lines
I am not 100% sure how much the additional tests for device-private pages all over the place will cost us. At least it can get compiled out, but most distros will just always have it compiled in.
I didn't notice too many extra checks outside of the migration entry path. But if perf is a concern there I think we could move those checks to device-private specific paths. From memory Jordan did this more as a convenience. Will go look a bit deeper for any other checks we might have added.
I meant in stuff like page_vma_mapped. Probably not the hottest path, and maybe the impact can be reduced by reworking it.
Signature · 3 lines
Cheers, David
Alistair Popple
reviewerOn 2026-03-18 at 19:44 +1100, "David Hildenbrand (Arm)" <[email protected]> wrote...
Quoted 94 lines · Alistair Popple
Quoted 93 lines
On 2026-03-07 at 03:16 +1100, "David Hildenbrand (Arm)" <[email protected]> wrote...
Quoted 78 lines · Jordan Niethe
Quoted 70 lines
Introduction
------------The existing design of device private memory imposes limitations which render it non functional for certain systems and configurations where the physical address space is limited.
Limited available address space
-------------------------------Device private memory is implemented by first reserving a region of the physical address space. This is a problem. The physical address space is not a resource that is directly under the kernel's control. Availability of suitable physical address space is constrained by the underlying hardware and firmware and may not always be available.
Device private memory assumes that it will be able to reserve a device memory sized chunk of physical address space. However, there is nothing guaranteeing that this will succeed, and there a number of factors that increase the likelihood of failure. We need to consider what else may exist in the physical address space. It is observed that certain VM configurations place very large PCI windows immediately after RAM. Large enough that there is no physical address space available at all for device private memory. This is more likely to occur on 43 bit physical width systems which have less physical address space.
The fundamental issue is the physical address space is not a resource the kernel can rely on being to allocate from at will.
New implementation
------------------This series changes device private memory so that it does not require allocation of physical address space and these problems are avoided. Instead of using the physical address space, we introduce a "device private address space" and allocate from there.
A consequence of placing the device private pages outside of the physical address space is that they no longer have a PFN. However, it is still necessary to be able to look up a corresponding device private page from a device private PTE entry, which means that we still require some way to index into this device private address space. Instead of a PFN, device private pages use an offset into this device private address space to look up device private struct pages.
The problem that then needs to be addressed is how to avoid confusing these device private offsets with PFNs. It is the limited usage of the device private pages themselves which make this possible. A device private page is only used for userspace mappings, we do not need to be concerned with them being used within the mm more broadly. This means that the only way that the core kernel looks up these pages is via the page table, where their PTE already indicates if they refer to a device private page via their swap type, e.g.
SWP_DEVICE_WRITE. We can use this information to determine if the PTE contains a PFN which should be looked up in the page map, or a device private offset which should be looked up elsewhere.This applies when we are creating PTE entries for device private pages - because they have their own type there are already must be handled separately, so it is a small step to convert them to a device private PFN now too.
The first part of the series updates callers where device private offsets might now be encountered to track this extra state.
The last patch contains the bulk of the work where we change how we convert between device private pages to device private offsets and then use a new interface for allocating device private pages without the need for reserving physical address space.
Quoted 6 lines
By removing the device private pages from the physical address space, this series also opens up the possibility to moving away from tracking device private memory using struct pages in the future. This is desirable as on systems with large amounts of memory these device private struct pages use a signifiant amount of memory and take a significant amount of time to initialize.
Quoted 2 lines
I now went through all of the patches (skimming a bit over some parts that need splitting or rework).
Thanks David for taking the time to do a thorough review. I will let Jordan respond to most of the comments but wanted to add some of my own as I helped with the initial idea.
Quoted 6 lines
In general, a noble goal and a reasonable approach.
But I get the sense that we are just hacking in yet another zone-device thing. This series certainly makes core-mm more complicated. I provided some inputs on how to make some things less hacky, and will provide further input as you move forward.
Quoted 8 lines
Quoted 3 lines
I disagree - this isn't hacking in another/new zone-device thing it is cleaning up/reworking a pre-existing zone-device thing (
DEVICE_PRIVATEpages). My initial hope was it wouldn't actually involve too much churn on the core-mm side.... and there is quite some.
stuff like
make_readable_exclusive_migration_entry_from_page()must be reworked.
Yeah, I was displeased to (re)discover the migration entry business when we fleshed this series out. The idea was basically that raw device-private pfns can't be used sensibly by anything in the core-mm anyway so presumably nothing was.
That turned out to be only somewhat true. The exceptions are:
1. page_vma_mapped which I think we have a solution for based on the comments to patch 5.
2. migration entries which obviously we will have to see if we can rework.
3. hmm_range_fault()
4. page snapshots, although that's actually only used to test zero_pfn so we could probably drop that if we just guarantee device private offsets are always invalid pfns.
Quoted 3 lines
Maybe after some reworks it will no longer look like a hack.
Right now it does.
Fair enough.
Quoted 5 lines
Quoted 4 lines
It seems that didn't work quite as well as hoped as there are a few places in core-mm where we use raw pfns without actually accessing them rather than using the page/folio. Notably
page_vma_mappedin patch 5.
Quoted 7 lines
Yes. I provided ideas on how to minimize the impact.
Again, maybe if done right it will be okay-ish.
It will likely still be error prone, but I have no idea how on earth we could possible catch reliably for an "unsigned long" pfn whether it is a PFN (it's right there in the name ...) or something completely different.
The idea was (at least for device-private) that you never needed the PFN, only the page. Ie: that calling page_to_pfn() on a device-private page could, conceptually at least, just crash the kernel because it should never happen.
Obviously we identified some exceptions to that rule, the biggest being migration entries, hence the helpers for those.
Quoted 2 lines
We don't want another
pfn_t, it would be too much churn to convert most of MM.
Given I removed pfn_t I don't need convincing of that :-)
Quoted 27 lines
Quoted 13 lines
But overall this is about replacing pfn_to_page()/page_to_pfn() with device-private specific variants, as callers *must* already know when they are dealing with a device-private pfn and treat it specially today (whether explicitly or implicitly). Callers/callees already can't just treat a device-private pfn normally as accessing the pfn will cause machine checks and the associated page is a zone-device page so doesn't behave like a normal struct page.
Quoted 3 lines
We really have to minimize the impact, otherwise we'll just keep breaking stuff all the time when we forget a single test for device-private pages in one magical path.
Quoted 6 lines
As noted above this is already the case - all paths whether explicitly or implicitly (or just fogotten ... hard to tell) need to consider device-private pages and possibly treat them differently. Even today some magical path that somehow gets a device-private pfn/page and tries to use it as a normal page/pfn will probably break as they don't actually correspond to physical addresses that actually exist and the struct pages are special.
Well, so far a PFN is a PFN, and when you actually have a *page* (after
pfn_to_page()etc) you can just test for these cases.The page is actually sufficient to make a decision. With a PFN you have to carry auxiliary information.
Quoted 1 line
Quoted 5 lines
Quoted 2 lines
So any core-mm churn is really just making this more explicit, but this series doesn't add any new requirements.
Again, maybe it can be done in a better way. I did not enjoy some of the code changes I was reading.
Ok. Was there anything outside the exceptions above that you did not enjoy?
One idea we did have was to make the PFNs "obviously" invalid PFNs, for example by setting the MSB which exceeds the physical addressing capabilities of every arch/platform. That would allow dropping the hmm and page-snapshot flags although is still a bit of a hack.
Ultimately one of the issues we are trying to resolve is that to get a PFN range we use get_free_mem_region(), which essentially just returns a random unused PFN range from the platform/arch perspective so an architecture may not recognise them as valid pfns and hence may not have allocated enough vmemmap space for them. That results in pfn_to_page() overflowing into something else (usually user space VAs, at least in the case of RISC-V).
Quoted 9 lines
Quoted 9 lines
My bigger aim here is to use this as a stepping stone to removing device-private pages as they just contain a bunch of redundant information from a device driver perspective that introduces a lot of metadata management overhead.
Quoted 3 lines
I am not 100% sure how much the additional tests for device-private pages all over the place will cost us. At least it can get compiled out, but most distros will just always have it compiled in.
Quoted 6 lines
Quoted 4 lines
I didn't notice too many extra checks outside of the migration entry path. But if perf is a concern there I think we could move those checks to device-private specific paths. From memory Jordan did this more as a convenience. Will go look a bit deeper for any other checks we might have added.
I meant in stuff like
page_vma_mapped. Probably not the hottest path, and maybe the impact can be reduced by reworking it.
Ok, lets see what the rework looks like. Thanks again for looking.
Quoted 4 lines
Signature · 3 lines
Cheers, David
David Hildenbrand (Arm)
maintainerQuoted 23 lines · Alistair Popple
On 2026-03-18 at 19:44 +1100, "David Hildenbrand (Arm)" <[email protected]> wrote...
Quoted 8 lines · Alistair Popple
Quoted 7 lines
On 2026-03-07 at 03:16 +1100, "David Hildenbrand (Arm)" <[email protected]> wrote...
Thanks David for taking the time to do a thorough review. I will let Jordan respond to most of the comments but wanted to add some of my own as I helped with the initial idea.
Quoted 8 lines
Quoted 3 lines
I disagree - this isn't hacking in another/new zone-device thing it is cleaning up/reworking a pre-existing zone-device thing (
DEVICE_PRIVATEpages). My initial hope was it wouldn't actually involve too much churn on the core-mm side.... and there is quite some.
stuff like
make_readable_exclusive_migration_entry_from_page()must be reworked.Yeah, I was displeased to (re)discover the migration entry business when we fleshed this series out. The idea was basically that raw device-private pfns can't be used sensibly by anything in the core-mm anyway so presumably nothing was.
Quoted 4 lines
That turned out to be only somewhat true. The exceptions are:
1.
page_vma_mappedwhich I think we have a solution for based on the comments to patch 5.
Yes, if we just have the page/folio we are in a better position. I *suspect* that we want to pass a page range, as the other two weird cases might pass a page, that, in the future might not be a folio anymore.
Quoted 2 lines
2. migration entries which obviously we will have to see if we can rework.
Please look into encoding this internally, using one of the highest PFN bits or sth like that. We don't have to support this on all weird architectures.
Quoted 2 lines
3.
hmm_range_fault()
Yes.
Quoted 4 lines
4. page snapshots, although that's actually only used to test
zero_pfnso we could probably drop that if we just guarantee device private offsets are always invalid pfns.
Right, I think that can be more reasonably cleaned up.
[...]
Quoted 9 lines
Quoted 4 lines
It will likely still be error prone, but I have no idea how on earth we could possible catch reliably for an "unsigned long" pfn whether it is a PFN (it's right there in the name ...) or something completely different.
The idea was (at least for device-private) that you never needed the PFN, only the page. Ie: that calling
page_to_pfn()on a device-private page could, conceptually at least, just crash the kernel because it should never happen.
Quoted 7 lines
Obviously we identified some exceptions to that rule, the biggest being migration entries, hence the helpers for those.
Quoted 2 lines
We don't want another
pfn_t, it would be too much churn to convert most of MM.Given I removed
pfn_tI don't need convincing of that :-)
:)
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
So any core-mm churn is really just making this more explicit, but this series doesn't add any new requirements.
Again, maybe it can be done in a better way. I did not enjoy some of the code changes I was reading.
Ok. Was there anything outside the exceptions above that you did not enjoy?
The last patch was hard to review and I am not sure what else is hiding in there. As said, breaking the patch into logical pieces will make this a lot easier to review.
Quoted 5 lines
One idea we did have was to make the PFNs "obviously" invalid PFNs, for example by setting the MSB which exceeds the physical addressing capabilities of every
arch/platform. That would allow dropping the hmm and page-snapshot flags although is still a bit of a hack.
I mean, that might be cleaner, because *maybe* one could just teach pfn_valid() about that? Or have another, more lightweight helper that really just checks for "ordinary" vs. "special" pfns. Needs some thought.
Using the highest bit as "this is not an ordinary pfn" might just do. Maybe some highmem considerations (making sure we don't run into weird stuff).
Quoted 7 lines
Ultimately one of the issues we are trying to resolve is that to get a PFN range we use
get_free_mem_region(), which essentially just returns a random unused PFN range from the platform/arch perspective so an architecture may not recognise them as valid pfns and hence may not have allocated enough vmemmap space for them. That results inpfn_to_page()overflowing into something else (usually user space VAs, at least in the case of RISC-V).
Yes, I think it's a noble goal :)
Signature · 3 lines
Cheers, David