Re: [Nouveau] [PATCH v2 2/5] mm/hmm: add output flags for PMD/PUD page mapping

2020-06-30 Thread Jason Gunthorpe
On Tue, Jun 30, 2020 at 10:23:43PM +0100, Matthew Wilcox wrote: > On Tue, Jun 30, 2020 at 12:57:34PM -0700, Ralph Campbell wrote: > > hmm_range_fault() returns an array of page frame numbers and flags for > > how the pages are mapped in the requested process' page tables. The PFN > > can be used

Re: [Nouveau] [PATCH v2 2/5] mm/hmm: add output flags for PMD/PUD page mapping

2020-06-30 Thread Matthew Wilcox
On Tue, Jun 30, 2020 at 12:57:34PM -0700, Ralph Campbell wrote: > hmm_range_fault() returns an array of page frame numbers and flags for > how the pages are mapped in the requested process' page tables. The PFN > can be used to get the struct page with hmm_pfn_to_page() and the page > size order

[Nouveau] [PATCH v2 3/5] nouveau: fix mapping 2MB sysmem pages

2020-06-30 Thread Ralph Campbell
The nvif_object_ioctl() method NVIF_VMM_V0_PFNMAP wasn't correctly setting the hardware specific GPU page table entries for 2MB sized pages. Fix this by adding functions to set and clear PD0 GPU page table entries. Signed-off-by: Ralph Campbell --- drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c

[Nouveau] [PATCH v2 0/5] mm/hmm/nouveau: add PMD system memory mapping

2020-06-30 Thread Ralph Campbell
The goal for this series is to introduce the hmm_range_fault() output array flags HMM_PFN_PMD and HMM_PFN_PUD. This allows a device driver to know that a given 4K PFN is actually mapped by the CPU using either a PMD sized or PUD sized CPU page table entry and therefore the device driver can safely

[Nouveau] [PATCH v2 1/5] nouveau/hmm: fault one page at a time

2020-06-30 Thread Ralph Campbell
The SVM page fault handler groups faults into a range of contiguous virtual addresses and requests hmm_range_fault() to populate and return the page frame number of system memory mapped by the CPU. In preparation for supporting large pages to be mapped by the GPU, process faults one page at a

[Nouveau] [PATCH v2 2/5] mm/hmm: add output flags for PMD/PUD page mapping

2020-06-30 Thread Ralph Campbell
hmm_range_fault() returns an array of page frame numbers and flags for how the pages are mapped in the requested process' page tables. The PFN can be used to get the struct page with hmm_pfn_to_page() and the page size order can be determined with compound_order(page) but if the page is larger

[Nouveau] [PATCH v2 5/5] hmm: add tests for HMM_PFN_PMD flag

2020-06-30 Thread Ralph Campbell
Add a sanity test for hmm_range_fault() returning the HMM_PFN_PMD flag. Signed-off-by: Ralph Campbell --- lib/test_hmm.c | 4 ++ lib/test_hmm_uapi.h| 4 ++ tools/testing/selftests/vm/hmm-tests.c | 76 ++ 3 files changed, 84

[Nouveau] [PATCH v2 4/5] nouveau/hmm: support mapping large sysmem pages

2020-06-30 Thread Ralph Campbell
Nouveau currently only supports mapping PAGE_SIZE sized pages of system memory when shared virtual memory (SVM) is enabled. Use the new HMM_PFN_PMD flag that hmm_range_fault() returns to support mapping system memory pages that are PMD_SIZE. Signed-off-by: Ralph Campbell ---