Re: [RFC PATCH 2/2] mm,drm/ttm: Use VM_PFNMAP for TTM vmas

2021-03-23 Thread Jason Gunthorpe
On Tue, Mar 23, 2021 at 04:46:00PM +0100, Thomas Hellström (Intel) wrote: > > > +static inline bool is_cow_mapping(vm_flags_t flags) > > > +{ > > > + return (flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE; > > > +} > > Most driver places are just banning VM_SHARED. > > > > I see you copied

Re: [RFC PATCH 2/2] mm,drm/ttm: Use VM_PFNMAP for TTM vmas

2021-03-23 Thread Intel
On 3/23/21 3:04 PM, Jason Gunthorpe wrote: On Tue, Mar 23, 2021 at 12:47:24PM +0100, Daniel Vetter wrote: +static inline bool is_cow_mapping(vm_flags_t flags) Bit a bikeshed, but I wonder whether the public interface shouldn't be vma_is_cow_mapping. Or whether this shouldn't be rejected

Re: [RFC PATCH 2/2] mm,drm/ttm: Use VM_PFNMAP for TTM vmas

2021-03-23 Thread Intel
On 3/23/21 3:00 PM, Jason Gunthorpe wrote: On Sun, Mar 21, 2021 at 07:45:29PM +0100, Thomas Hellström (Intel) wrote: To block fast gup we need to make sure TTM ptes are always special. With MIXEDMAP we, on architectures that don't support pte_special, insert normal ptes, but OTOH on those

Re: [RFC PATCH 2/2] mm,drm/ttm: Use VM_PFNMAP for TTM vmas

2021-03-23 Thread Jason Gunthorpe
On Tue, Mar 23, 2021 at 12:47:24PM +0100, Daniel Vetter wrote: > > +static inline bool is_cow_mapping(vm_flags_t flags) > > Bit a bikeshed, but I wonder whether the public interface shouldn't be > vma_is_cow_mapping. Or whether this shouldn't be rejected somewhere else, > since at least in

Re: [RFC PATCH 2/2] mm,drm/ttm: Use VM_PFNMAP for TTM vmas

2021-03-23 Thread Jason Gunthorpe
On Sun, Mar 21, 2021 at 07:45:29PM +0100, Thomas Hellström (Intel) wrote: > To block fast gup we need to make sure TTM ptes are always special. > With MIXEDMAP we, on architectures that don't support pte_special, > insert normal ptes, but OTOH on those architectures, fast is not > supported. > At

Re: [RFC PATCH 2/2] mm,drm/ttm: Use VM_PFNMAP for TTM vmas

2021-03-23 Thread Christian König
Am 22.03.21 um 09:13 schrieb Thomas Hellström (Intel): Hi! On 3/22/21 8:47 AM, Christian König wrote: Am 21.03.21 um 19:45 schrieb Thomas Hellström (Intel): To block fast gup we need to make sure TTM ptes are always special. With MIXEDMAP we, on architectures that don't support

Re: [RFC PATCH 2/2] mm,drm/ttm: Use VM_PFNMAP for TTM vmas

2021-03-23 Thread Daniel Vetter
On Sun, Mar 21, 2021 at 07:45:29PM +0100, Thomas Hellström (Intel) wrote: > To block fast gup we need to make sure TTM ptes are always special. > With MIXEDMAP we, on architectures that don't support pte_special, > insert normal ptes, but OTOH on those architectures, fast is not > supported. > At

Re: [RFC PATCH 2/2] mm,drm/ttm: Use VM_PFNMAP for TTM vmas

2021-03-22 Thread Intel
Hi! On 3/22/21 8:47 AM, Christian König wrote: Am 21.03.21 um 19:45 schrieb Thomas Hellström (Intel): To block fast gup we need to make sure TTM ptes are always special. With MIXEDMAP we, on architectures that don't support pte_special, insert normal ptes, but OTOH on those architectures, fast

Re: [RFC PATCH 2/2] mm,drm/ttm: Use VM_PFNMAP for TTM vmas

2021-03-22 Thread Christian König
Am 21.03.21 um 19:45 schrieb Thomas Hellström (Intel): To block fast gup we need to make sure TTM ptes are always special. With MIXEDMAP we, on architectures that don't support pte_special, insert normal ptes, but OTOH on those architectures, fast is not supported. At the same time, the function

[RFC PATCH 2/2] mm,drm/ttm: Use VM_PFNMAP for TTM vmas

2021-03-21 Thread Intel
To block fast gup we need to make sure TTM ptes are always special. With MIXEDMAP we, on architectures that don't support pte_special, insert normal ptes, but OTOH on those architectures, fast is not supported. At the same time, the function documentation to vm_normal_page() suggests that ptes