Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-19 Thread Christoph Hellwig
On Wed, Aug 19, 2020 at 04:22:29PM +0200, Tomasz Figa wrote: > > > FWIW, I asked back in time what the plan is for non-coherent > > > allocations and it seemed like DMA_ATTR_NON_CONSISTENT and > > > dma_sync_*() was supposed to be the right thing to go with. [2] The > > > same thread also explains

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-19 Thread Christoph Hellwig
On Wed, Aug 19, 2020 at 03:07:04PM +0100, Robin Murphy wrote: >> FWIW, I asked back in time what the plan is for non-coherent >> allocations and it seemed like DMA_ATTR_NON_CONSISTENT and >> dma_sync_*() was supposed to be the right thing to go with. [2] The >> same thread also explains why

Re: [Nouveau] [PATCH 05/28] media/v4l2: remove V4L2-FLAG-MEMORY-NON-CONSISTENT

2020-08-19 Thread Christoph Hellwig
On Wed, Aug 19, 2020 at 03:57:53PM +0200, Tomasz Figa wrote: > > > Could you explain what makes you think it's unused? It's a feature of > > > the UAPI generally supported by the videobuf2 framework and relied on > > > by Chromium OS to get any kind of reasonable performance when > > > accessing

Re: [Nouveau] a saner API for allocating DMA addressable pages v3

2020-09-25 Thread Christoph Hellwig
This is in dma-mapping for-next now. ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH 2/2] mm: remove extra ZONE_DEVICE struct page refcount

2020-09-26 Thread Christoph Hellwig
On Fri, Sep 25, 2020 at 01:44:42PM -0700, Ralph Campbell wrote: > ZONE_DEVICE struct pages have an extra reference count that complicates the > code for put_page() and several places in the kernel that need to check the > reference count to see that a page is not being used (gup, compaction, >

Re: [Nouveau] [PATCH 17/18] dma-iommu: implement ->alloc_noncoherent

2020-09-26 Thread Christoph Hellwig
On Fri, Sep 25, 2020 at 06:46:22PM +, Tomasz Figa wrote: > > +static void *iommu_dma_alloc_noncoherent(struct device *dev, size_t size, > > + dma_addr_t *handle, enum dma_data_direction dir, gfp_t gfp) > > +{ > > + if (!gfpflags_allow_blocking(gfp)) { > > + struct page

Re: [Nouveau] [PATCH 1/2] ext4/xfs: add page refcount helper

2020-09-26 Thread Christoph Hellwig
On Fri, Sep 25, 2020 at 01:44:41PM -0700, Ralph Campbell wrote: > error = ___wait_var_event(>_refcount, > - atomic_read(>_refcount) == 1, > + dax_layout_is_idle_page(page), > TASK_INTERRUPTIBLE, 0,

Re: [Nouveau] a saner API for allocating DMA addressable pages v3

2020-09-21 Thread Christoph Hellwig
, and chance you could retest it? On Tue, Sep 15, 2020 at 05:51:04PM +0200, Christoph Hellwig wrote: > Hi all, > > this series replaced the DMA_ATTR_NON_CONSISTENT flag to dma_alloc_attrs > with a separate new dma_alloc_pages API, which is available on all > platforms. In addition

Re: [Nouveau] [PATCH] mm: remove extra ZONE_DEVICE struct page refcount

2020-09-17 Thread Christoph Hellwig
On Mon, Sep 14, 2020 at 04:10:38PM -0700, Dan Williams wrote: > You also need to fix up ext4_break_layouts() and > xfs_break_dax_layouts() to expect ->_refcount is 0 instead of 1. This > also needs some fstests exposure. While we're at it, can we add a wait_fsdax_unref helper macro that hides the

Re: [Nouveau] [PATCH] mm: remove extra ZONE_DEVICE struct page refcount

2020-09-17 Thread Christoph Hellwig
> diff --git a/include/linux/mm.h b/include/linux/mm.h > index 517751310dd2..5a82037a4b26 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -1093,34 +1093,6 @@ static inline bool is_zone_device_page(const struct > page *page) > #ifdef CONFIG_DEV_PAGEMAP_OPS > void

Re: [Nouveau] [RFC PATCH v3 2/2] mm: remove extra ZONE_DEVICE struct page refcount

2020-10-02 Thread Christoph Hellwig
ompaction, > migration, etc.). Clean up the code so the reference count doesn't need to > be treated specially for ZONE_DEVICE. > > Signed-off-by: Ralph Campbell Looks good, Reviewed-by: Christoph Hellwig ___ Nouveau mailing list Nouveau@lists.

Re: [Nouveau] [RFC PATCH v3 1/2] ext4/xfs: add page refcount helper

2020-10-02 Thread Christoph Hellwig
Ralph Campbell Looks good: Reviewed-by: Christoph Hellwig ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH 08/18] dma-mapping: add a new dma_alloc_noncoherent API

2020-09-25 Thread Christoph Hellwig
On Fri, Sep 25, 2020 at 12:15:37PM +0100, Robin Murphy wrote: > On 2020-09-15 16:51, Christoph Hellwig wrote: > [...] >> +These APIs allow to allocate pages in the kernel direct mapping that are >> +guaranteed to be DMA addressable. This means that unlike >> dma_alloc_co

Re: [Nouveau] [RESEND PATCH 2/3] nouveau: fix mixed normal and device private page migration

2020-06-24 Thread Christoph Hellwig
On Mon, Jun 22, 2020 at 04:38:53PM -0700, Ralph Campbell wrote: > The OpenCL function clEnqueueSVMMigrateMem(), without any flags, will > migrate memory in the given address range to device private memory. The > source pages might already have been migrated to device private memory. > In that

Re: [Nouveau] [PATCH v3 3/6] mm: support THP migration to device private memory

2020-12-03 Thread Christoph Hellwig
[adding a few of the usual suspects] On Wed, Nov 11, 2020 at 03:38:42PM -0800, Ralph Campbell wrote: > There are 4 types of ZONE_DEVICE struct pages: > MEMORY_DEVICE_PRIVATE, MEMORY_DEVICE_FS_DAX, MEMORY_DEVICE_GENERIC, and > MEMORY_DEVICE_PCI_P2PDMA. > > Currently, memremap_pages() allocates

Re: [Nouveau] [PATCH v3 3/6] mm: support THP migration to device private memory

2020-12-02 Thread Christoph Hellwig
On Fri, Nov 20, 2020 at 04:01:33PM -0400, Jason Gunthorpe wrote: > On Wed, Nov 11, 2020 at 03:38:42PM -0800, Ralph Campbell wrote: > > > MEMORY_DEVICE_GENERIC: > > Struct pages are created in dev_dax_probe() and represent non-volatile > > memory. > > The device can be mmap()'ed which calls

Re: [Nouveau] [PATCH v3 3/6] mm: support THP migration to device private memory

2020-11-09 Thread Christoph Hellwig
On Fri, Nov 06, 2020 at 01:26:50PM -0800, Ralph Campbell wrote: > > On 11/6/20 12:03 AM, Christoph Hellwig wrote: >> I hate the extra pin count magic here. IMHO we really need to finish >> off the series to get rid of the extra references on the ZONE_DEVICE >> pages

Re: [Nouveau] [PATCH v3 2/6] mm/migrate: move migrate_vma_collect_skip()

2020-11-05 Thread Christoph Hellwig
On Thu, Nov 05, 2020 at 04:51:43PM -0800, Ralph Campbell wrote: > Move the definition of migrate_vma_collect_skip() to make it callable > by migrate_vma_collect_hole(). This helps make the next patch easier > to read. > > Signed-off-by: Ralph Campbell Looks good, Reviewed-by: Ch

Re: [Nouveau] [PATCH v3 2/6] mm/migrate: move migrate_vma_collect_skip()

2020-11-05 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH v3 3/6] mm: support THP migration to device private memory

2020-11-06 Thread Christoph Hellwig
I hate the extra pin count magic here. IMHO we really need to finish off the series to get rid of the extra references on the ZONE_DEVICE pages first. ___ Nouveau mailing list Nouveau@lists.freedesktop.org

Re: [Nouveau] [PATCH v3 4/6] mm/thp: add THP allocation helper

2020-11-06 Thread Christoph Hellwig
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > +extern struct page *alloc_transhugepage(struct vm_area_struct *vma, > + unsigned long addr); No need for the extern. And also here: do we actually need the stub, or can the caller make sure (using IS_ENABLED and

Re: [Nouveau] [PATCH RFC v1 5/6] xen-swiotlb: convert variables to arrays

2021-02-04 Thread Christoph Hellwig
So one thing that has been on my mind for a while: I'd really like to kill the separate dma ops in Xen swiotlb. If we compare xen-swiotlb to swiotlb the main difference seems to be: - additional reasons to bounce I/O vs the plain DMA capable - the possibility to do a hypercall on arm/arm64 -

Re: [Nouveau] [PATCH RFC v1 2/6] swiotlb: convert variables to arrays

2021-02-04 Thread Christoph Hellwig
On Wed, Feb 03, 2021 at 03:37:05PM -0800, Dongli Zhang wrote: > This patch converts several swiotlb related variables to arrays, in > order to maintain stat/status for different swiotlb buffers. Here are > variables involved: > > - io_tlb_start and io_tlb_end > - io_tlb_nslabs and io_tlb_used > -

Re: [Nouveau] [PATCH] drm/ttm: use dma_alloc_pages for the page pool

2021-05-11 Thread Christoph Hellwig
On Tue, May 11, 2021 at 09:35:20AM +0200, Christian König wrote: > We certainly going to need the drm_need_swiotlb() for userptr support > (unless we add some approach for drivers to opt out of swiotlb). swiotlb use is driven by three things: 1) addressing limitations of the device 2)

[Nouveau] [PATCH] drm/ttm: use dma_alloc_pages for the page pool

2021-05-11 Thread Christoph Hellwig
violation where the TTM pool assumes what kind of virtual address dma_alloc_attrs can return. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 1 - drivers/gpu/drm/amd

[Nouveau] RFC: use dma_alloc_noncoherent in ttm_pool_alloc_page

2021-05-11 Thread Christoph Hellwig
Hi all, the memory allocation for the TTM pool is a big mess with two allocation methods that both have issues, a layering violation and odd guessing of pools in the callers. This patch switches to the dma_alloc_noncoherent API instead fixing all of the above issues. Warning: i don't have any

Re: [Nouveau] [PATCH v6 04/15] swiotlb: Add restricted DMA pool initialization

2021-05-11 Thread Christoph Hellwig
> +#ifdef CONFIG_DMA_RESTRICTED_POOL > +#include > +#include > +#include > +#include > +#include > +#endif I don't think any of this belongs into swiotlb.c. Marking swiotlb_init_io_tlb_mem non-static and having all this code in a separate file is probably a better idea. > +#ifdef

Re: [Nouveau] [PATCH v6 01/15] swiotlb: Refactor swiotlb init functions

2021-05-11 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH v6 05/15] swiotlb: Add a new get_io_tlb_mem getter

2021-05-11 Thread Christoph Hellwig
> +static inline struct io_tlb_mem *get_io_tlb_mem(struct device *dev) > +{ > +#ifdef CONFIG_DMA_RESTRICTED_POOL > + if (dev && dev->dma_io_tlb_mem) > + return dev->dma_io_tlb_mem; > +#endif /* CONFIG_DMA_RESTRICTED_POOL */ > + > + return io_tlb_default_mem; Given that we're

Re: [Nouveau] [PATCH v6 08/15] swiotlb: Bounce data from/to restricted DMA pool if available

2021-05-11 Thread Christoph Hellwig
> +static inline bool is_dev_swiotlb_force(struct device *dev) > +{ > +#ifdef CONFIG_DMA_RESTRICTED_POOL > + if (dev->dma_io_tlb_mem) > + return true; > +#endif /* CONFIG_DMA_RESTRICTED_POOL */ > + return false; > +} > + > /* If SWIOTLB is active, use its maximum mapping

Re: [Nouveau] [PATCH v6 02/15] swiotlb: Refactor swiotlb_create_debugfs

2021-05-11 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH v5 01/16] swiotlb: Fix the type of index

2021-04-23 Thread Christoph Hellwig
On Thu, Apr 22, 2021 at 04:14:53PM +0800, Claire Chang wrote: > Fix the type of index from unsigned int to int since find_slots() might > return -1. > > Fixes: 0774983bc923 ("swiotlb: refactor swiotlb_tbl_map_single") > Signed-off-by: Claire Chang Looks good: Revie

Re: [Nouveau] [PATCH RFC v1 5/6] xen-swiotlb: convert variables to arrays

2021-02-07 Thread Christoph Hellwig
On Thu, Feb 04, 2021 at 09:40:23AM +0100, Christoph Hellwig wrote: > So one thing that has been on my mind for a while: I'd really like > to kill the separate dma ops in Xen swiotlb. If we compare xen-swiotlb > to swiotlb the main difference seems to be: > > - additional reason

Re: [Nouveau] [PATCH 0/9] Add support for SVM atomics in Nouveau

2021-02-10 Thread Christoph Hellwig
On Wed, Feb 10, 2021 at 01:59:13PM -0400, Jason Gunthorpe wrote: > Really what you want to do here is leave the CPU page in the VMA and > the page tables where it started and deny CPU access to the page. Then > all the proper machinery will continue to work. > > IMHO "migration" is the wrong idea

Re: [Nouveau] [PATCH v6 1/8] mm: Remove special swap entry functions

2021-03-15 Thread Christoph Hellwig
og should mention pfn_swap_entry_to_page() now. Otherwise looks good: Reviewed-by: Christoph Hellwig ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH v6 8/8] nouveau/svm: Implement atomic SVM access

2021-03-15 Thread Christoph Hellwig
> - /*XXX: atomic? */ > - return (fa->access == 0 || fa->access == 3) - > -(fb->access == 0 || fb->access == 3); > + /* Atomic access (2) has highest priority */ > + return (-1*(fa->access == 2) + (fa->access == 0 || fa->access == 3)) - > +(-1*(fb->access ==

Re: [Nouveau] [PATCH v6 3/8] mm/rmap: Split try_to_munlock from try_to_unmap

2021-03-15 Thread Christoph Hellwig
bell > > --- > > Christoph - I didn't add your Reviewed-by from v3 because removal of the > extra VM_LOCKED check in v4 changed things slightly. Let me know if > you're still ok for me to add it. Thanks. Still looks good to me: Reviewed-by: Christoph Hellwig _

Re: [Nouveau] [PATCH v6 5/8] mm: Device exclusive memory access

2021-03-15 Thread Christoph Hellwig
} Should the trylock_page go into try_to_protect to simplify the loop a little? Also I wonder if we need make_device_exclusive_range or should just open code the get_user_pages_remote + try_to_protect loop in the callers, as that might allow them to also deduct other information about the found pages. Otherwise looks good: Reviewed-by: Christoph Hellwig ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH v3 3/8] mm/rmap: Split try_to_munlock from try_to_unmap

2021-02-26 Thread Christoph Hellwig
break; Just return false here directly and remove the ret variable? Very nice cleanup! Reviewed-by: Christoph Hellwig ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH v3 4/8] mm/rmap: Split migration into its own function

2021-02-26 Thread Christoph Hellwig
Nice cleanup! Reviewed-by: Christoph Hellwig ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau

Re: [Nouveau] [PATCH v3 1/8] mm: Remove special swap entry functions

2021-02-26 Thread Christoph Hellwig
> - struct page *page = migration_entry_to_page(entry); > + struct page *page = pfn_to_page(swp_offset(entry)); I wonder if keeping a single special_entry_to_page() helper would still me a useful. But I'm not entirely sure. There are also two more open coded copies of

Re: [Nouveau] [PATCH v3 2/8] mm/swapops: Rework swap entry manipulation code

2021-02-26 Thread Christoph Hellwig
and to make the arguments similar for both a read and write entry > creation. > > Signed-off-by: Alistair Popple Looks good, Reviewed-by: Christoph Hellwig ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop

Re: [Nouveau] [PATCH v2 1/4] hmm: Device exclusive memory access

2021-02-19 Thread Christoph Hellwig
> page = migration_entry_to_page(swpent); > else if (is_device_private_entry(swpent)) > page = device_private_entry_to_page(swpent); > + else if (is_device_exclusive_entry(swpent)) > + page =

[Nouveau] misc vgaarb cleanups

2021-07-16 Thread Christoph Hellwig
Hi all, this series cleans up a bunch of lose ends in the vgaarb code. Diffstat: drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 +- drivers/gpu/drm/drm_irq.c |4 drivers/gpu/drm/i915/display/intel_vga.c |9 +- drivers/gpu/drm/nouveau/nouveau_vga.c |8 -

[Nouveau] [PATCH 2/7] vgaarb: remove vga_conflicts

2021-07-16 Thread Christoph Hellwig
vga_conflicts only has a single caller and none of the arch overrides mentioned in the comment. Just remove it and the thus dead check in the caller. Signed-off-by: Christoph Hellwig --- drivers/gpu/vga/vgaarb.c | 6 -- include/linux/vgaarb.h | 12 2 files changed, 18

[Nouveau] [PATCH 1/7] vgaarb: remove VGA_DEFAULT_DEVICE

2021-07-16 Thread Christoph Hellwig
The define is entirely unused. Signed-off-by: Christoph Hellwig --- include/linux/vgaarb.h | 6 -- 1 file changed, 6 deletions(-) diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h index dc6ddce92066..26ec8a057d2a 100644 --- a/include/linux/vgaarb.h +++ b/include/linux/vgaarb.h

[Nouveau] [PATCH 4/7] vgaarb: cleanup vgaarb.h

2021-07-16 Thread Christoph Hellwig
Merge the different CONFIG_VGA_ARB ifdef blocks, remove superflous externs, and regularize the stubs for !CONFIG_VGA_ARB. Signed-off-by: Christoph Hellwig --- include/linux/vgaarb.h | 90 -- 1 file changed, 42 insertions(+), 48 deletions(-) diff --git

[Nouveau] [PATCH 3/7] vgaarb: move the kerneldoc for vga_set_legacy_decoding to vgaarb.c

2021-07-16 Thread Christoph Hellwig
Kerneldoc comments should be at the implementation side, not in the header just declaring the prototype. Signed-off-by: Christoph Hellwig --- drivers/gpu/vga/vgaarb.c | 11 +++ include/linux/vgaarb.h | 13 - 2 files changed, 11 insertions(+), 13 deletions(-) diff --git

[Nouveau] [PATCH 5/7] vgaarb: provide a vga_client_unregister wrapper

2021-07-16 Thread Christoph Hellwig
Add a trivial wrapper for the unregister case that sets all fields to NULL. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/drm_irq.c | 4 ++-- drivers/gpu/drm/i915/display/intel_vga.c | 2 +- drivers/gpu/drm/nouveau

[Nouveau] [PATCH 7/7] vgaarb: don't pass a cookie to vga_client_register

2021-07-16 Thread Christoph Hellwig
The VGA arbitration is entirely based on pci_dev structures, so just pass that back to the set_vga_decode callback. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 drivers/gpu/drm/i915/display/intel_vga.c | 7 --- drivers/gpu/drm/nouveau

[Nouveau] [PATCH 6/7] vgaarb: remove the unused irq_set_state argument to vga_client_register

2021-07-16 Thread Christoph Hellwig
All callers pass NULL as the irq_set_state argument, so remove it and the ->irq_set_state member in struct vga_device. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/i915/display/intel_vga.c | 2 +- drivers/gpu/drm/nouv

Re: [Nouveau] [PATCH 6/8] mm: don't include in

2022-02-07 Thread Christoph Hellwig
On Mon, Feb 07, 2022 at 04:19:29PM -0500, Felix Kuehling wrote: > > Am 2022-02-07 um 01:32 schrieb Christoph Hellwig: >> Move the check for the actual pgmap types that need the free at refcount >> one behavior into the out of line helper, and thus avoid the need to >> p

Re: [Nouveau] [PATCH 7/8] mm: remove the extra ZONE_DEVICE struct page refcount

2022-02-08 Thread Christoph Hellwig
On Tue, Feb 08, 2022 at 07:30:11PM -0800, Dan Williams wrote: > Interesting. I had expected that to really fix the refcount problem > that fs/dax.c would need to start taking real page references as pages > were added to a mapping, just like page cache. I think we should do that eventually. But

Re: [Nouveau] [PATCH 6/8] mm: don't include in

2022-02-08 Thread Christoph Hellwig
On Tue, Feb 08, 2022 at 03:53:14PM -0800, Dan Williams wrote: > Yeah, same as Logan: > > mm/memcontrol.c: In function ‘get_mctgt_type’: > mm/memcontrol.c:5724:29: error: implicit declaration of function > ‘is_device_private_page’; did you mean > ‘is_device_private_entry’?

Re: [Nouveau] [PATCH 7/8] mm: remove the extra ZONE_DEVICE struct page refcount

2022-02-09 Thread Christoph Hellwig
On Wed, Feb 09, 2022 at 08:29:56AM -0400, Jason Gunthorpe wrote: > It is nice, but the other series are still impacted by the fsdax mess > - they still stuff pages into ptes without proper refcounts and have > to carry nonsense to dance around this problem. > > I certainly would be unhappy if the

Re: [Nouveau] [PATCH 6/8] mm: don't include in

2022-02-09 Thread Christoph Hellwig
On Mon, Feb 07, 2022 at 04:19:29PM -0500, Felix Kuehling wrote: > > Am 2022-02-07 um 01:32 schrieb Christoph Hellwig: >> Move the check for the actual pgmap types that need the free at refcount >> one behavior into the out of line helper, and thus avoid the need to >> p

Re: [Nouveau] [PATCH 13/27] mm: move the migrate_vma_* device migration code into it's own file

2022-02-10 Thread Christoph Hellwig
On Thu, Feb 10, 2022 at 09:35:10PM +1100, Alistair Popple wrote: > I got the following build error: > > /data/source/linux/mm/migrate_device.c: In function ‘migrate_vma_collect_pmd’: > /data/source/linux/mm/migrate_device.c:242:3: error: implicit declaration of > function ‘flush_tlb_range’; did

[Nouveau] start sorting out the ZONE_DEVICE refcount mess

2022-02-06 Thread Christoph Hellwig
Hi all, this series removes the offset by one refcount for ZONE_DEVICE pages that are freed back to the driver owning them, which is just device private ones for now, but also the planned device coherent pages and the ehanced p2p ones pending. It does not address the fsdax pages yet, which will

[Nouveau] [PATCH 1/8] mm: remove a pointless CONFIG_ZONE_DEVICE check in memremap_pages

2022-02-06 Thread Christoph Hellwig
memremap.c is only built when CONFIG_ZONE_DEVICE is set, so remove the superflous extra check. Signed-off-by: Christoph Hellwig --- mm/memremap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/memremap.c b/mm/memremap.c index 6aa5f0c2d11fda..5f04a0709e436e 100644

[Nouveau] [PATCH 2/8] mm: remove the __KERNEL__ guard from

2022-02-06 Thread Christoph Hellwig
__KERNEL__ ifdefs don't make sense outside of include/uapi/. Signed-off-by: Christoph Hellwig --- include/linux/mm.h | 4 1 file changed, 4 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 213cc569b19223..7b46174989b086 100644 --- a/include/linux/mm.h +++ b/include

[Nouveau] [PATCH 3/8] mm: remove pointless includes from

2022-02-06 Thread Christoph Hellwig
hmm.h pulls in the world for no good reason at all. Remove the includes and push a few ones into the users instead. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 1 + drivers/gpu/drm/nouveau/nouveau_dmem.c | 1 + include/linux/hmm.h | 9

[Nouveau] [PATCH 4/8] mm: move free_devmap_managed_page to memremap.c

2022-02-06 Thread Christoph Hellwig
free_devmap_managed_page has nothing to do with the code in swap.c, move it to live with the rest of the code for devmap handling. Signed-off-by: Christoph Hellwig --- include/linux/mm.h | 1 - mm/memremap.c | 21 + mm/swap.c | 23 --- 3

[Nouveau] [PATCH 5/8] mm: simplify freeing of devmap managed pages

2022-02-06 Thread Christoph Hellwig
Make put_devmap_managed_page return if it took charge of the page or not and remove the separate page_is_devmap_managed helper. Signed-off-by: Christoph Hellwig --- include/linux/mm.h | 34 ++ mm/memremap.c | 20 +--- mm/swap.c | 10

[Nouveau] [PATCH 6/8] mm: don't include in

2022-02-06 Thread Christoph Hellwig
Move the check for the actual pgmap types that need the free at refcount one behavior into the out of line helper, and thus avoid the need to pull memremap.h into mm.h. Signed-off-by: Christoph Hellwig --- arch/arm64/mm/mmu.c| 1 + drivers/gpu/drm/amd/amdkfd/kfd_priv.h

[Nouveau] [PATCH 8/8] fsdax: depend on ZONE_DEVICE || FS_DAX_LIMITED

2022-02-06 Thread Christoph Hellwig
Add a depends on ZONE_DEVICE support or the s390-specific limited DAX support, as one of the two is required at runtime for fsdax code to actually work. Signed-off-by: Christoph Hellwig --- fs/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/Kconfig b/fs/Kconfig index

[Nouveau] [PATCH 7/8] mm: remove the extra ZONE_DEVICE struct page refcount

2022-02-06 Thread Christoph Hellwig
, the PAGEMAP_OPS Kconfig symbol can go away and be replaced with a FS_DAX check for this hook in the put_page fastpath. Based on an earlier patch from Ralph Campbell . Signed-off-by: Christoph Hellwig --- arch/powerpc/kvm/book3s_hv_uvmem.c | 1 - drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 1

[Nouveau] start sorting out the ZONE_DEVICE refcount mess v2

2022-02-09 Thread Christoph Hellwig
Hi all, this series removes the offset by one refcount for ZONE_DEVICE pages that are freed back to the driver owning them, which is just device private ones for now, but also the planned device coherent pages and the ehanced p2p ones pending. It does not address the fsdax pages yet, which will

[Nouveau] [PATCH 23/27] tools: update hmm-test to support device coherent type

2022-02-09 Thread Christoph Hellwig
Popple Signed-off-by: Christoph Hellwig --- tools/testing/selftests/vm/hmm-tests.c | 123 - 1 file changed, 102 insertions(+), 21 deletions(-) diff --git a/tools/testing/selftests/vm/hmm-tests.c b/tools/testing/selftests/vm/hmm-tests.c index 203323967b507a..84ec8c4a1dc7b6

[Nouveau] [PATCH 25/27] mm: remove the vma check in migrate_vma_setup()

2022-02-09 Thread Christoph Hellwig
a valid vma isn't required. Signed-off-by: Alistair Popple Acked-by: Felix Kuehling Signed-off-by: Christoph Hellwig --- mm/migrate_device.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/mm/migrate_device.c b/mm/migrate_device.c index

[Nouveau] [PATCH 24/27] tools: update test_hmm script to support SP config

2022-02-09 Thread Christoph Hellwig
ling Reviewed-by: Alistair Popple Signed-off-by: Christoph Hellwig --- tools/testing/selftests/vm/test_hmm.sh | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/vm/test_hmm.sh b/tools/testing/selftests/vm/test_hmm.sh i

[Nouveau] [PATCH 26/27] mm/gup: migrate device coherent pages when pinning instead of failing

2022-02-09 Thread Christoph Hellwig
checks, moved migrate_device_page to migrate_device.c] Signed-off-by: Christoph Hellwig --- mm/gup.c| 37 ++- mm/internal.h | 1 + mm/migrate_device.c | 53 + 3 files changed, 85 insertions(+), 6

[Nouveau] [PATCH 27/27] tools: add hmm gup test for long term pinned device pages

2022-02-09 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- tools/testing/selftests/vm/Makefile| 2 +- tools/testing/selftests/vm/hmm-tests.c | 81 ++ 2 files changed, 82 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile

[Nouveau] [PATCH 14/27] mm: build migrate_vma_* for all configs with ZONE_DEVICE support

2022-02-09 Thread Christoph Hellwig
This code will be used for device coherent memory as well in a bit, so relax the ifdef a bit. Signed-off-by: Christoph Hellwig --- mm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/Kconfig b/mm/Kconfig index 6391d8d3a616f3..95d4aa3acaefe0 100644 --- a/mm/Kconfig

[Nouveau] [PATCH 15/27] mm: add zone device coherent type memory support

2022-02-09 Thread Christoph Hellwig
always be evicted. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling Reviewed-by: Alistair Popple [hch: rebased ontop of the refcount changes, removed is_dev_private_or_coherent_page] Signed-off-by: Christoph Hellwig --- include/linux/memremap.h | 14 ++ mm/memcontrol.c

[Nouveau] [PATCH 13/27] mm: move the migrate_vma_* device migration code into it's own file

2022-02-09 Thread Christoph Hellwig
Split the code used to migrate to and from ZONE_DEVICE memory from migrate.c into a new file. Signed-off-by: Christoph Hellwig --- mm/Kconfig | 3 + mm/Makefile | 1 + mm/migrate.c| 753 --- mm/migrate_device.c | 765

[Nouveau] [PATCH 05/27] mm: simplify freeing of devmap managed pages

2022-02-09 Thread Christoph Hellwig
Make put_devmap_managed_page return if it took charge of the page or not and remove the separate page_is_devmap_managed helper. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Chaitanya Kulkarni Reviewed-by: Dan Williams --- include

[Nouveau] [PATCH 04/27] mm: move free_devmap_managed_page to memremap.c

2022-02-09 Thread Christoph Hellwig
free_devmap_managed_page has nothing to do with the code in swap.c, move it to live with the rest of the code for devmap handling. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Chaitanya Kulkarni Reviewed-by: Muchun Song Reviewed

[Nouveau] [PATCH 06/27] mm: don't include in

2022-02-09 Thread Christoph Hellwig
Move the check for the actual pgmap types that need the free at refcount one behavior into the out of line helper, and thus avoid the need to pull memremap.h into mm.h. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Dan Williams Acked

[Nouveau] [PATCH 07/27] mm: remove the extra ZONE_DEVICE struct page refcount

2022-02-09 Thread Christoph Hellwig
, the PAGEMAP_OPS Kconfig symbol can go away and be replaced with a FS_DAX check for this hook in the put_page fastpath. Based on an earlier patch from Ralph Campbell . Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Ralph Campbell Reviewed-by: Jason Gunthorpe Reviewed-by: Dan

[Nouveau] [PATCH 21/27] lib: test_hmm add module param for zone device type

2022-02-09 Thread Christoph Hellwig
erra Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig --- lib/test_hmm.c | 73 - lib/test_hmm_uapi.h | 1 + 2 files changed, 53 insertions(+), 21 deletions(-) diff --git a/lib/test_hmm.c b/lib/test_hmm.c i

[Nouveau] [PATCH 22/27] lib: add support for device coherent type in test_hmm

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra Device Coherent type uses device memory that is coherently accesible by the CPU. This could be shown as SP (special purpose) memory range at the BIOS-e820 memory enumeration. If no SP memory is supported in system, this could be faked by setting CONFIG_EFI_FAKE_MEMMAP.

[Nouveau] [PATCH 08/27] fsdax: depend on ZONE_DEVICE || FS_DAX_LIMITED

2022-02-09 Thread Christoph Hellwig
Add a depends on ZONE_DEVICE support or the s390-specific limited DAX support, as one of the two is required at runtime for fsdax code to actually work. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe --- fs/Kconfig | 1 + 1 file changed, 1 insertion

[Nouveau] [PATCH 09/27] mm: generalize the pgmap based page_free infrastructure

2022-02-09 Thread Christoph Hellwig
Key off on the existence of ->page_free to prepare for adding support for more pgmap types that are device managed and thus need the free callback. Signed-off-by: Christoph Hellwig --- mm/memremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memremap.c b

[Nouveau] [PATCH 12/27] mm: refactor the ZONE_DEVICE handling in migrate_vma_pages

2022-02-09 Thread Christoph Hellwig
Make the flow a little more clear and prepare for adding a new ZONE_DEVICE memory type. Signed-off-by: Christoph Hellwig --- mm/migrate.c | 27 --- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 30ecd7223656c1

[Nouveau] [PATCH 10/27] mm: refactor check_and_migrate_movable_pages

2022-02-09 Thread Christoph Hellwig
Remove up to two levels of indentation by using continue statements and move variables to local scope where possible. Signed-off-by: Christoph Hellwig --- mm/gup.c | 81 ++-- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/mm

[Nouveau] [PATCH 11/27] mm: refactor the ZONE_DEVICE handling in migrate_vma_insert_page

2022-02-09 Thread Christoph Hellwig
Make the flow a little more clear and prepare for adding a new ZONE_DEVICE memory type. Signed-off-by: Christoph Hellwig --- mm/migrate.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 8e0370a73f8a43

[Nouveau] [PATCH 16/27] mm: add device coherent vma selection for memory migration

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra This case is used to migrate pages from device memory, back to system memory. Device coherent type memory is cache coherent from device and CPU point of view. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig

[Nouveau] [PATCH 17/27] mm/gup: fail get_user_pages for LONGTERM dev coherent type

2022-02-09 Thread Christoph Hellwig
the device migration pages support is added. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple [hch: rebased on previous cleanups, split the two checks] Signed-off-by: Christoph Hellwig --- mm/gup.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion

[Nouveau] [PATCH 18/27] drm/amdkfd: add SPM support for SVM

2022-02-09 Thread Christoph Hellwig
page map region. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 28 ++-- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b

[Nouveau] [PATCH 19/27] drm/amdkfd: coherent type as sys mem on migration to ram

2022-02-09 Thread Christoph Hellwig
Kuehling Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c index 2c51f2ac3b46ac..6646291d75d574 100644 --- a/drivers

[Nouveau] [PATCH 01/27] mm: remove a pointless CONFIG_ZONE_DEVICE check in memremap_pages

2022-02-09 Thread Christoph Hellwig
memremap.c is only built when CONFIG_ZONE_DEVICE is set, so remove the superflous extra check. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Chaitanya Kulkarni Reviewed-by: Muchun Song Reviewed-by: Dan Williams --- mm/memremap.c | 3

[Nouveau] [PATCH 02/27] mm: remove the __KERNEL__ guard from

2022-02-09 Thread Christoph Hellwig
__KERNEL__ ifdefs don't make sense outside of include/uapi/. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Chaitanya Kulkarni Reviewed-by: Muchun Song Reviewed-by: Dan Williams --- include/linux/mm.h | 4 1 file changed, 4

[Nouveau] [PATCH 03/27] mm: remove pointless includes from

2022-02-09 Thread Christoph Hellwig
hmm.h pulls in the world for no good reason at all. Remove the includes and push a few ones into the users instead. Signed-off-by: Christoph Hellwig Reviewed-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Chaitanya Kulkarni --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 1

[Nouveau] [PATCH 20/27] lib: test_hmm add ioctl to get zone device type

2022-02-09 Thread Christoph Hellwig
From: Alex Sierra new ioctl cmd added to query zone device type. This will be used once the test_hmm adds zone device coherent type. Signed-off-by: Alex Sierra Acked-by: Felix Kuehling Reviewed-by: Alistair Poppple Signed-off-by: Christoph Hellwig --- lib/test_hmm.c | 23

Re: [Nouveau] [PATCH 6/8] mm: don't include in

2022-02-09 Thread Christoph Hellwig
On Thu, Feb 10, 2022 at 01:10:47PM +1100, Alistair Popple wrote: > diff --git a/mm/gup.c b/mm/gup.c > index cbb49abb7992..8e85c9fb8df4 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -2007,7 +2007,6 @@ static long check_and_migrate_movable_pages(unsigned > long nr_pages, > if (!ret &&

Re: [Nouveau] [PATCH drm-misc-next 2/3] drm/gpuva_mgr: generalize dma_resv/extobj handling and GEM validation

2023-10-12 Thread Christoph Hellwig
On Thu, Oct 12, 2023 at 02:35:15PM +0200, Christian König wrote: > Additional to that from the software side Felix summarized it in the HMM > peer2peer discussion thread recently quite well. Do you have a pointer to that discussion?

[Nouveau] susetting the remaining swioltb couplin in DRM

2022-07-11 Thread Christoph Hellwig
Hi i915 and nouveau maintainers, any chance I could get some help to remove the remaining direct driver calls into swiotlb, namely swiotlb_max_segment and is_swiotlb_active. Either should not matter to a driver as they should be written to the DMA API. In the i915 case it seems like the driver

Re: [Nouveau] susetting the remaining swioltb couplin in DRM

2022-07-11 Thread Christoph Hellwig
On Mon, Jul 11, 2022 at 04:31:49PM -0400, Rodrigo Vivi wrote: > On Mon, Jul 11, 2022 at 10:26:14AM +0200, Christoph Hellwig wrote: > > Hi i915 and nouveau maintainers, > > > > any chance I could get some help to remove the remaining direct > > driver calls into swiotlb,

Re: [Nouveau] [RFC] drm/nouveau/ttm: Stop calling into swiotlb

2022-07-29 Thread Christoph Hellwig
Hi Lyude, and thanks for taking a look. > -#if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86) > - need_swiotlb = is_swiotlb_active(dev->dev); > -#endif > - > ret = ttm_device_init(>ttm.bdev, _bo_driver, drm->dev->dev, > - dev->anon_inode->i_mapping, >

Re: [Nouveau] [PATCH v2] mm: Take a page reference when removing device exclusive entries

2023-03-29 Thread Christoph Hellwig
s/page/folio/ in the entire commit log?

<    1   2   3   4   5   6   >