Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-09 Thread Ira Weiny
On Wed, Dec 09, 2020 at 08:14:15PM +, Matthew Wilcox wrote: > On Wed, Dec 09, 2020 at 11:47:56AM -0800, Dan Williams wrote: > > On Tue, Dec 8, 2020 at 8:03 PM Matthew Wilcox wrote: > > > On Tue, Dec 08, 2020 at 06:22:50PM -0800, Ira Weiny wrote: > > > > Therefore, I tend to agree with Dan that

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-09 Thread Dan Williams
On Wed, Dec 9, 2020 at 12:14 PM Matthew Wilcox wrote: [..] > If we put in into a separate patch, someone will suggest backing out the > patch which tells us that there's a problem. You know, like this guy ... > https://lore.kernel.org/linux-mm/CAPcyv4jNVroYmirzKw_=cseixoeacdl3m1wc4xjd_tfv3h+...@m

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-09 Thread Matthew Wilcox
On Wed, Dec 09, 2020 at 11:47:56AM -0800, Dan Williams wrote: > On Tue, Dec 8, 2020 at 8:03 PM Matthew Wilcox wrote: > > On Tue, Dec 08, 2020 at 06:22:50PM -0800, Ira Weiny wrote: > > > Therefore, I tend to agree with Dan that if anything is to be done it > > > should be > > > a WARN_ON() which i

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-09 Thread Dan Williams
On Tue, Dec 8, 2020 at 8:03 PM Matthew Wilcox wrote: > > On Tue, Dec 08, 2020 at 06:22:50PM -0800, Ira Weiny wrote: > > Right now we have a mixed bag. zero_user() [and it's variants, circa 2008] > > does a BUG_ON.[0] While the other ones do nothing; clear_highpage(), > > clear_user_highpage(), c

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Matthew Wilcox
On Tue, Dec 08, 2020 at 06:22:50PM -0800, Ira Weiny wrote: > Right now we have a mixed bag. zero_user() [and it's variants, circa 2008] > does a BUG_ON.[0] While the other ones do nothing; clear_highpage(), > clear_user_highpage(), copy_user_highpage(), and copy_highpage(). Erm, those functions

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Ira Weiny
On Tue, Dec 08, 2020 at 03:40:52PM -0800, Dan Williams wrote: > On Tue, Dec 8, 2020 at 2:49 PM Darrick J. Wong > wrote: > [..] > > > So what's your preferred poison? > > > > > > 1. Corrupt random data in whatever's been mapped into the next page (which > > >is what the helpers currently do) >

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Dan Williams
On Tue, Dec 8, 2020 at 2:49 PM Darrick J. Wong wrote: [..] > > So what's your preferred poison? > > > > 1. Corrupt random data in whatever's been mapped into the next page (which > >is what the helpers currently do) > > Please no. My assertion is that the kernel can't know it's corruption, it

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Matthew Wilcox
On Tue, Dec 08, 2020 at 02:45:55PM -0800, Darrick J. Wong wrote: > On Tue, Dec 08, 2020 at 10:32:34PM +, Matthew Wilcox wrote: > > On Tue, Dec 08, 2020 at 02:23:10PM -0800, Dan Williams wrote: > > > On Tue, Dec 8, 2020 at 1:51 PM Matthew Wilcox wrote: > > > > > > > > On Tue, Dec 08, 2020 at 01

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Darrick J. Wong
On Tue, Dec 08, 2020 at 10:32:34PM +, Matthew Wilcox wrote: > On Tue, Dec 08, 2020 at 02:23:10PM -0800, Dan Williams wrote: > > On Tue, Dec 8, 2020 at 1:51 PM Matthew Wilcox wrote: > > > > > > On Tue, Dec 08, 2020 at 01:32:55PM -0800, Ira Weiny wrote: > > > > On Mon, Dec 07, 2020 at 03:49:55PM

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Matthew Wilcox
On Tue, Dec 08, 2020 at 02:23:10PM -0800, Dan Williams wrote: > On Tue, Dec 8, 2020 at 1:51 PM Matthew Wilcox wrote: > > > > On Tue, Dec 08, 2020 at 01:32:55PM -0800, Ira Weiny wrote: > > > On Mon, Dec 07, 2020 at 03:49:55PM -0800, Dan Williams wrote: > > > > On Mon, Dec 7, 2020 at 3:40 PM Matthew

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Dan Williams
On Tue, Dec 8, 2020 at 1:51 PM Matthew Wilcox wrote: > > On Tue, Dec 08, 2020 at 01:32:55PM -0800, Ira Weiny wrote: > > On Mon, Dec 07, 2020 at 03:49:55PM -0800, Dan Williams wrote: > > > On Mon, Dec 7, 2020 at 3:40 PM Matthew Wilcox wrote: > > > > > > > > On Mon, Dec 07, 2020 at 03:34:44PM -0800

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Dan Williams
On Tue, Dec 8, 2020 at 1:33 PM Ira Weiny wrote: > > On Mon, Dec 07, 2020 at 03:49:55PM -0800, Dan Williams wrote: > > On Mon, Dec 7, 2020 at 3:40 PM Matthew Wilcox wrote: > > > > > > On Mon, Dec 07, 2020 at 03:34:44PM -0800, Dan Williams wrote: > > > > On Mon, Dec 7, 2020 at 3:27 PM Matthew Wilco

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Matthew Wilcox
On Tue, Dec 08, 2020 at 01:32:55PM -0800, Ira Weiny wrote: > On Mon, Dec 07, 2020 at 03:49:55PM -0800, Dan Williams wrote: > > On Mon, Dec 7, 2020 at 3:40 PM Matthew Wilcox wrote: > > > > > > On Mon, Dec 07, 2020 at 03:34:44PM -0800, Dan Williams wrote: > > > > On Mon, Dec 7, 2020 at 3:27 PM Matth

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Ira Weiny
On Mon, Dec 07, 2020 at 03:49:55PM -0800, Dan Williams wrote: > On Mon, Dec 7, 2020 at 3:40 PM Matthew Wilcox wrote: > > > > On Mon, Dec 07, 2020 at 03:34:44PM -0800, Dan Williams wrote: > > > On Mon, Dec 7, 2020 at 3:27 PM Matthew Wilcox wrote: > > > > > > > > On Mon, Dec 07, 2020 at 02:57:03PM

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Matthew Wilcox
On Tue, Dec 08, 2020 at 08:38:14AM -0800, Ira Weiny wrote: > On Tue, Dec 08, 2020 at 12:23:16PM +, Matthew Wilcox wrote: > > On Mon, Dec 07, 2020 at 02:57:03PM -0800, ira.we...@intel.com wrote: > > > Placing these functions in 'highmem.h' is suboptimal especially with the > > > changes being pr

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Ira Weiny
On Tue, Dec 08, 2020 at 12:23:16PM +, Matthew Wilcox wrote: > On Mon, Dec 07, 2020 at 02:57:03PM -0800, ira.we...@intel.com wrote: > > Placing these functions in 'highmem.h' is suboptimal especially with the > > changes being proposed in the functionality of kmap. From a caller > > perspective

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-08 Thread Matthew Wilcox
On Mon, Dec 07, 2020 at 02:57:03PM -0800, ira.we...@intel.com wrote: > Placing these functions in 'highmem.h' is suboptimal especially with the > changes being proposed in the functionality of kmap. From a caller > perspective including/using 'highmem.h' implies that the functions > defined in tha

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-07 Thread Dan Williams
On Mon, Dec 7, 2020 at 3:40 PM Matthew Wilcox wrote: > > On Mon, Dec 07, 2020 at 03:34:44PM -0800, Dan Williams wrote: > > On Mon, Dec 7, 2020 at 3:27 PM Matthew Wilcox wrote: > > > > > > On Mon, Dec 07, 2020 at 02:57:03PM -0800, ira.we...@intel.com wrote: > > > > +static inline void memcpy_page(

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-07 Thread Matthew Wilcox
On Mon, Dec 07, 2020 at 03:34:44PM -0800, Dan Williams wrote: > On Mon, Dec 7, 2020 at 3:27 PM Matthew Wilcox wrote: > > > > On Mon, Dec 07, 2020 at 02:57:03PM -0800, ira.we...@intel.com wrote: > > > +static inline void memcpy_page(struct page *dst_page, size_t dst_off, > > > +

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-07 Thread Dan Williams
On Mon, Dec 7, 2020 at 3:27 PM Matthew Wilcox wrote: > > On Mon, Dec 07, 2020 at 02:57:03PM -0800, ira.we...@intel.com wrote: > > +static inline void memcpy_page(struct page *dst_page, size_t dst_off, > > +struct page *src_page, size_t src_off, > > +

Re: [PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-07 Thread Matthew Wilcox
On Mon, Dec 07, 2020 at 02:57:03PM -0800, ira.we...@intel.com wrote: > +static inline void memcpy_page(struct page *dst_page, size_t dst_off, > +struct page *src_page, size_t src_off, > +size_t len) > +{ > + char *dst = kmap_local_page(dst

[PATCH V2 2/2] mm/highmem: Lift memcpy_[to|from]_page to core

2020-12-07 Thread ira . weiny
From: Ira Weiny Working through a conversion to a call such as kmap_thread() revealed many places where the pattern kmap/memcpy/kunmap occurred. Eric Biggers, Matthew Wilcox, Christoph Hellwig, Dan Williams, and Al Viro all suggested putting this code into helper functions. Al Viro further poin