Skip to contentSkip to conversation

Begin converting kmap calls to kmap_local_page()

PATCH New [email protected] 2 participants 6 messages Dec 10, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover Begin converting kmap calls to kmap_local_page()

From: Ira Weiny <[email protected]>

Changes from V2[1]:
Update this cover letter
Update commit messages
From Matthew Wilcox
Put functions in highmem.h rather than pagemap.h
Investigate 0-day build errors.
AFAICT the patches were applied to the wrong tree and caused build errors.

There are many places in the kernel where kmap is used for a simple memory operation like memcpy, memset, or memmove and then the page is unmapped.

This kmap/mem*/kunmap pattern is mixed between kmap and kmap_atomic uses. All of them could use kmap_atomic() which is faster. However, kmap_atomic() is being deprecated in favor of kmap_local_page().

Use kmap_local_page() in the existing page operations. Lift memcpy_[to|from]_page to highmem.h. Remove memzero_page() and use zero_user() instead. Add memcpy_page(), memmove_page(), and memset_page() to be used in future patches. Finally, add BUG_ON()s to check for any miss use of the API and prevent data corruption in the same way zero_user() does.

This is V3 to get into 5.11 so that we can start to convert all the various subsystems in 5.12.[2]

These are based on tip/core/mm. I'm sending to Andrew and Thomas but I'm expecting these to go through tip/core/mm via Thomas if that is ok with Andrew.

[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/

Ira Weiny (2):
mm/highmem: Remove deprecated kmap_atomic
mm/highmem: Lift memcpy_[to|from]_page to core

 include/linux/highmem.h | 81 ++++++++++++++++++++++++++++++++++-------
 lib/iov_iter.c          | 26 ++-----------
 2 files changed, 70 insertions(+), 37 deletions(-)
Signature · 1 line
2.28.0.rc0.12.gb6a658bd00c9
#1 lore raw

PATCH v3 1/2 mm/highmem: Remove deprecated kmap_atomic

From: Ira Weiny <[email protected]>

kmap_atomic() is being deprecated in favor of kmap_local_page().

Replace the uses of kmap_atomic() within the highmem code.

---
 include/linux/highmem.h | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
include/linux/highmem.h +14 -14
index f597830f26b4..3bfe6a12d14d 100644
@@ -146,9 +146,9 @@ static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
 #ifndef clear_user_highpage
 static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
 {
-	void *addr = kmap_atomic(page);
+	void *addr = kmap_local_page(page);
 	clear_user_page(addr, vaddr, page);
-	kunmap_atomic(addr);
+	kunmap_local(addr);
 }
 #endif
 
@@ -199,16 +199,16 @@ alloc_zeroed_user_highpage_movable(struct vm_area_struct *vma,
 
 static inline void clear_highpage(struct page *page)
 {
-	void *kaddr = kmap_atomic(page);
+	void *kaddr = kmap_local_page(page);
 	clear_page(kaddr);
-	kunmap_atomic(kaddr);
+	kunmap_local(kaddr);
 }
 
 static inline void zero_user_segments(struct page *page,
 	unsigned start1, unsigned end1,
 	unsigned start2, unsigned end2)
 {
-	void *kaddr = kmap_atomic(page);
+	void *kaddr = kmap_local_page(page);
 
 	BUG_ON(end1 > PAGE_SIZE || end2 > PAGE_SIZE);
 
@@ -218,7 +218,7 @@ static inline void zero_user_segments(struct page *page,
 	if (end2 > start2)
 		memset(kaddr + start2, 0, end2 - start2);
 
-	kunmap_atomic(kaddr);
+	kunmap_local(kaddr);
 	flush_dcache_page(page);
 }
 
@@ -241,11 +241,11 @@ static inline void copy_user_highpage(struct page *to, struct page *from,
 {
 	char *vfrom, *vto;
 
-	vfrom = kmap_atomic(from);
-	vto = kmap_atomic(to);
+	vfrom = kmap_local_page(from);
+	vto = kmap_local_page(to);
 	copy_user_page(vto, vfrom, vaddr, to);
-	kunmap_atomic(vto);
-	kunmap_atomic(vfrom);
+	kunmap_local(vto);
+	kunmap_local(vfrom);
 }
 
 #endif
@@ -256,11 +256,11 @@ static inline void copy_highpage(struct page *to, struct page *from)
 {
 	char *vfrom, *vto;
 
-	vfrom = kmap_atomic(from);
-	vto = kmap_atomic(to);
+	vfrom = kmap_local_page(from);
+	vto = kmap_local_page(to);
 	copy_page(vto, vfrom);
-	kunmap_atomic(vto);
-	kunmap_atomic(vfrom);
+	kunmap_local(vto);
+	kunmap_local(vfrom);
 }
 
 #endif
Signature · 1 line
2.28.0.rc0.12.gb6a658bd00c9
#2 lore raw

Re: [PATCH V3 1/2] mm/highmem: Remove deprecated kmap_atomic

I love your patch! Yet something to improve:

Hi,

I love your patch! Yet something to improve:

[auto build test ERROR on hch-configfs/for-next]
[also build test ERROR on linus/master hnaz-linux-mm/master v5.10-rc7] [cannot apply to mmotm/master next-20201210]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/ira-weiny-intel-com/mm-highmem-Remove-deprecated-kmap_atomic/20201211-021920
base:   git://git.infradead.org/users/hch/configfs.git for-next
config: x86_64-rhel (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/d52646012878888c6a3172a07cd8bdf3d0c39723
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review ira-weiny-intel-com/mm-highmem-Remove-deprecated-kmap_atomic/20201211-021920
        git checkout d52646012878888c6a3172a07cd8bdf3d0c39723
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

In file included from include/linux/pagemap.h:11,

                    from include/linux/blkdev.h:14,
                    from include/linux/blk-cgroup.h:23,
                    from include/linux/writeback.h:14,
                    from include/linux/memcontrol.h:22,
                    from include/linux/swap.h:9,
                    from include/linux/suspend.h:5,
                    from arch/x86/kernel/asm-offsets.c:13:
   include/linux/highmem.h: In function 'clear_user_highpage':
>> include/linux/highmem.h:229:15: error: implicit declaration of function 'kmap_local_page'; did you mean 'kmap_to_page'? [-Werror=implicit-function-declaration]
     229 |  void *addr = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~
         |               kmap_to_page
   include/linux/highmem.h:229:15: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>> include/linux/highmem.h:231:2: error: implicit declaration of function 'kunmap_local' [-Werror=implicit-function-declaration]
     231 |  kunmap_local(addr);
         |  ^~~~~~~~~~~~
   include/linux/highmem.h: In function 'clear_highpage':
   include/linux/highmem.h:282:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     282 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'zero_user_segments':
   include/linux/highmem.h:291:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     291 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'copy_user_highpage':
   include/linux/highmem.h:324:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     324 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:325:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     325 |  vto = kmap_local_page(to);
         |      ^
   include/linux/highmem.h: In function 'copy_highpage':
   include/linux/highmem.h:339:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     339 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:340:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     340 |  vto = kmap_local_page(to);
         |      ^

cc1: some warnings being treated as errors
--
In file included from arch/x86/kvm/vmx/vmx.c:16:
include/linux/highmem.h: In function 'clear_user_highpage':

>> include/linux/highmem.h:229:15: error: implicit declaration of function 'kmap_local_page'; did you mean 'kmap_to_page'? [-Werror=implicit-function-declaration]
     229 |  void *addr = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~
         |               kmap_to_page
   include/linux/highmem.h:229:15: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>> include/linux/highmem.h:231:2: error: implicit declaration of function 'kunmap_local' [-Werror=implicit-function-declaration]
     231 |  kunmap_local(addr);
         |  ^~~~~~~~~~~~
   include/linux/highmem.h: In function 'clear_highpage':
   include/linux/highmem.h:282:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     282 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'zero_user_segments':
   include/linux/highmem.h:291:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     291 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'copy_user_highpage':
   include/linux/highmem.h:324:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     324 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:325:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     325 |  vto = kmap_local_page(to);
         |      ^
   include/linux/highmem.h: In function 'copy_highpage':
   include/linux/highmem.h:339:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     339 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:340:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     340 |  vto = kmap_local_page(to);
         |      ^
   In file included from arch/x86/kvm/vmx/vmx.c:51:
   arch/x86/kvm/vmx/capabilities.h: At top level:
   arch/x86/kvm/vmx/capabilities.h:7:10: fatal error: lapic.h: No such file or directory
       7 | #include "lapic.h"
         |          ^~~~~~~~~

cc1: some warnings being treated as errors compilation terminated.
--
In file included from include/linux/pagemap.h:11,

                    from include/linux/blkdev.h:14,
                    from include/linux/blk-cgroup.h:23,
                    from include/linux/writeback.h:14,
                    from include/linux/memcontrol.h:22,
                    from include/linux/swap.h:9,
                    from include/linux/suspend.h:5,
                    from arch/x86/kernel/asm-offsets.c:13:
   include/linux/highmem.h: In function 'clear_user_highpage':
>> include/linux/highmem.h:229:15: error: implicit declaration of function 'kmap_local_page'; did you mean 'kmap_to_page'? [-Werror=implicit-function-declaration]
     229 |  void *addr = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~
         |               kmap_to_page
   include/linux/highmem.h:229:15: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>> include/linux/highmem.h:231:2: error: implicit declaration of function 'kunmap_local' [-Werror=implicit-function-declaration]
     231 |  kunmap_local(addr);
         |  ^~~~~~~~~~~~
   include/linux/highmem.h: In function 'clear_highpage':
   include/linux/highmem.h:282:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     282 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'zero_user_segments':
   include/linux/highmem.h:291:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     291 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'copy_user_highpage':
   include/linux/highmem.h:324:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     324 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:325:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     325 |  vto = kmap_local_page(to);
         |      ^
   include/linux/highmem.h: In function 'copy_highpage':
   include/linux/highmem.h:339:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     339 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:340:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     340 |  vto = kmap_local_page(to);
         |      ^

cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:117: arch/x86/kernel/asm-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1200: prepare0] Error 2
make[1]: Target 'modules_prepare' not remade because of errors.
make: *** [Makefile:185: __sub-make] Error 2
make: Target 'modules_prepare' not remade because of errors.
--
In file included from include/linux/pagemap.h:11,

                    from include/linux/blkdev.h:14,
                    from include/linux/blk-cgroup.h:23,
                    from include/linux/writeback.h:14,
                    from include/linux/memcontrol.h:22,
                    from include/linux/swap.h:9,
                    from include/linux/suspend.h:5,
                    from arch/x86/kernel/asm-offsets.c:13:
   include/linux/highmem.h: In function 'clear_user_highpage':
>> include/linux/highmem.h:229:15: error: implicit declaration of function 'kmap_local_page'; did you mean 'kmap_to_page'? [-Werror=implicit-function-declaration]
     229 |  void *addr = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~
         |               kmap_to_page
   include/linux/highmem.h:229:15: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>> include/linux/highmem.h:231:2: error: implicit declaration of function 'kunmap_local' [-Werror=implicit-function-declaration]
     231 |  kunmap_local(addr);
         |  ^~~~~~~~~~~~
   include/linux/highmem.h: In function 'clear_highpage':
   include/linux/highmem.h:282:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     282 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'zero_user_segments':
   include/linux/highmem.h:291:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     291 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'copy_user_highpage':
   include/linux/highmem.h:324:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     324 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:325:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     325 |  vto = kmap_local_page(to);
         |      ^
   include/linux/highmem.h: In function 'copy_highpage':
   include/linux/highmem.h:339:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     339 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:340:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     340 |  vto = kmap_local_page(to);
         |      ^

cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:117: arch/x86/kernel/asm-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1200: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:185: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.

vim +229 include/linux/highmem.h

223
224
225 /* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
226 #ifndef clear_user_highpage
227 static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
228 {

 > 229		void *addr = kmap_local_page(page);
   230		clear_user_page(addr, vaddr, page);
 > 231		kunmap_local(addr);

232 }
233 #endif
234

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#3 lore raw

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

In reply to [email protected]

From: Ira Weiny <[email protected]>

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 pointed out that these functions already existed in the iov_iter code.[1]

Various locations for the lifted functions were considered.

Headers like mm.h or string.h seem ok but don't really portray the functionality well. pagemap.h made some sense but is for page cache functionality.[2]

Another alternative would be to create a new header for the promoted memcpy functions, but it masks the fact that these are designed to copy to/from pages using the kernel direct mappings and complicates matters with a new header.

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 that header are only required when highmem is in use which is increasingly not the case with modern processors. However, highmem.h is where all the current functions like this reside (zero_user(), clear_highpage(), clear_user_highpage(), copy_user_highpage(), and copy_highpage()). So it makes the most sense even though it is distasteful for some.[3]

Lift memcpy_to_page() and memcpy_from_page() to pagemap.h.

Remove memzero_page() in favor of zero_user() to zero a page.

Add a memcpy_page(), memmove_page, and memset_page() to cover more kmap/mem*/kunmap. patterns.

Add BUG_ON bounds checks to ensure the newly lifted page memory operations do not result in corrupted data in neighbor pages and to make them consistent with zero_user().[4]

Finally use kmap_local_page() in all the new calls.

[1] https://lore.kernel.org/lkml/[email protected]/

    https://lore.kernel.org/lkml/[email protected]/

[2] https://lore.kernel.org/lkml/[email protected]/

[3] https://lore.kernel.org/lkml/[email protected]/#t

    https://lore.kernel.org/lkml/[email protected]/

[4] https://lore.kernel.org/lkml/[email protected]/

---
Changes for V3:
From Matthew Wilcox
Move calls to highmem.h
Add BUG_ON()

Changes for V2:
From Thomas Gleixner
Change kmap_atomic() to kmap_local_page() after basing on tip/core/mm
From Joonas Lahtinen
Reverse offset/val in memset_page()

---
 include/linux/highmem.h | 53 +++++++++++++++++++++++++++++++++++++++++
 lib/iov_iter.c          | 26 +++-----------------
 2 files changed, 56 insertions(+), 23 deletions(-)
include/linux/highmem.h +53 -0
index 3bfe6a12d14d..75b2ca0b050b 100644
@@ -265,4 +265,57 @@ static inline void copy_highpage(struct page *to, struct page *from)
 
 #endif
 
+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_page);
+	char *src = kmap_local_page(src_page);
+
+	BUG_ON(dst_off + len > PAGE_SIZE || src_off + len > PAGE_SIZE);
+	memcpy(dst + dst_off, src + src_off, len);
+	kunmap_local(src);
+	kunmap_local(dst);
+}
+
+static inline void memmove_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_page);
+	char *src = kmap_local_page(src_page);
+
+	BUG_ON(dst_off + len > PAGE_SIZE || src_off + len > PAGE_SIZE);
+	memmove(dst + dst_off, src + src_off, len);
+	kunmap_local(src);
+	kunmap_local(dst);
+}
+
+static inline void memcpy_from_page(char *to, struct page *page, size_t offset, size_t len)
+{
+	char *from = kmap_local_page(page);
+
+	BUG_ON(offset + len > PAGE_SIZE);
+	memcpy(to, from + offset, len);
+	kunmap_local(from);
+}
+
+static inline void memcpy_to_page(struct page *page, size_t offset, const char *from, size_t len)
+{
+	char *to = kmap_local_page(page);
+
+	BUG_ON(offset + len > PAGE_SIZE);
+	memcpy(to + offset, from, len);
+	kunmap_local(to);
+}
+
+static inline void memset_page(struct page *page, size_t offset, int val, size_t len)
+{
+	char *addr = kmap_local_page(page);
+
+	BUG_ON(offset + len > PAGE_SIZE);
+	memset(addr + offset, val, len);
+	kunmap_local(addr);
+}
+
 #endif /* _LINUX_HIGHMEM_H */
lib/iov_iter.c +3 -23
index 1635111c5bd2..8ed1f846fcc3 100644
@@ -5,6 +5,7 @@
 #include <linux/fault-inject-usercopy.h>
 #include <linux/uio.h>
 #include <linux/pagemap.h>
+#include <linux/highmem.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/splice.h>
@@ -466,27 +467,6 @@ void iov_iter_init(struct iov_iter *i, unsigned int direction,
 }
 EXPORT_SYMBOL(iov_iter_init);
 
-static void memcpy_from_page(char *to, struct page *page, size_t offset, size_t len)
-{
-	char *from = kmap_atomic(page);
-	memcpy(to, from + offset, len);
-	kunmap_atomic(from);
-}
-
-static void memcpy_to_page(struct page *page, size_t offset, const char *from, size_t len)
-{
-	char *to = kmap_atomic(page);
-	memcpy(to + offset, from, len);
-	kunmap_atomic(to);
-}
-
-static void memzero_page(struct page *page, size_t offset, size_t len)
-{
-	char *addr = kmap_atomic(page);
-	memset(addr + offset, 0, len);
-	kunmap_atomic(addr);
-}
-
 static inline bool allocated(struct pipe_buffer *buf)
 {
 	return buf->ops == &default_pipe_buf_ops;
@@ -964,7 +944,7 @@ static size_t pipe_zero(size_t bytes, struct iov_iter *i)
 
 	do {
 		size_t chunk = min_t(size_t, n, PAGE_SIZE - off);
-		memzero_page(pipe->bufs[i_head & p_mask].page, off, chunk);
+		zero_user(pipe->bufs[i_head & p_mask].page, off, chunk);
 		i->head = i_head;
 		i->iov_offset = off + chunk;
 		n -= chunk;
@@ -981,7 +961,7 @@ size_t iov_iter_zero(size_t bytes, struct iov_iter *i)
 		return pipe_zero(bytes, i);
 	iterate_and_advance(i, bytes, v,
 		clear_user(v.iov_base, v.iov_len),
-		memzero_page(v.bv_page, v.bv_offset, v.bv_len),
+		zero_user(v.bv_page, v.bv_offset, v.bv_len),
 		memset(v.iov_base, 0, v.iov_len)
 	)
 
Signature · 1 line
2.28.0.rc0.12.gb6a658bd00c9
#4 lore raw

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

I love your patch! Perhaps something to improve:

Hi,

I love your patch! Perhaps something to improve:

[auto build test WARNING on hch-configfs/for-next]
[also build test WARNING on linus/master hnaz-linux-mm/master v5.10-rc7] [cannot apply to mmotm/master next-20201210]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/ira-weiny-intel-com/mm-highmem-Remove-deprecated-kmap_atomic/20201211-021920
base:   git://git.infradead.org/users/hch/configfs.git for-next
config: i386-randconfig-s001-20201210 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-179-ga00755aa-dirty
        # https://github.com/0day-ci/linux/commit/9580f83142cf2df75ceb9e7dbe1939012818722c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review ira-weiny-intel-com/mm-highmem-Remove-deprecated-kmap_atomic/20201211-021920
        git checkout 9580f83142cf2df75ceb9e7dbe1939012818722c
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

In file included from include/linux/pagemap.h:11,

                    from include/linux/blkdev.h:14,
                    from include/linux/blk-cgroup.h:23,
                    from include/linux/writeback.h:14,
                    from include/linux/memcontrol.h:22,
                    from include/linux/swap.h:9,
                    from include/linux/suspend.h:5,
                    from arch/x86/kernel/asm-offsets.c:13:
   include/linux/highmem.h: In function 'clear_user_highpage':
   include/linux/highmem.h:229:15: error: implicit declaration of function 'kmap_local_page'; did you mean 'kmap_to_page'? [-Werror=implicit-function-declaration]
     229 |  void *addr = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~
         |               kmap_to_page
   include/linux/highmem.h:229:15: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   include/linux/highmem.h:231:2: error: implicit declaration of function 'kunmap_local' [-Werror=implicit-function-declaration]
     231 |  kunmap_local(addr);
         |  ^~~~~~~~~~~~
   include/linux/highmem.h: In function 'clear_highpage':
   include/linux/highmem.h:282:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     282 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'zero_user_segments':
   include/linux/highmem.h:291:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     291 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'copy_user_highpage':
   include/linux/highmem.h:324:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     324 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:325:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     325 |  vto = kmap_local_page(to);
         |      ^
   include/linux/highmem.h: In function 'copy_highpage':
   include/linux/highmem.h:339:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     339 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:340:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     340 |  vto = kmap_local_page(to);
         |      ^
   include/linux/highmem.h: In function 'memcpy_page':
>> include/linux/highmem.h:352:14: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     352 |  char *dst = kmap_local_page(dst_page);
         |              ^~~~~~~~~~~~~~~
   include/linux/highmem.h:353:14: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     353 |  char *src = kmap_local_page(src_page);
         |              ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'memmove_page':
   include/linux/highmem.h:365:14: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     365 |  char *dst = kmap_local_page(dst_page);
         |              ^~~~~~~~~~~~~~~
   include/linux/highmem.h:366:14: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     366 |  char *src = kmap_local_page(src_page);
         |              ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'memcpy_from_page':
   include/linux/highmem.h:376:15: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     376 |  char *from = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'memcpy_to_page':
   include/linux/highmem.h:385:13: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     385 |  char *to = kmap_local_page(page);
         |             ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'memset_page':
   include/linux/highmem.h:394:15: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     394 |  char *addr = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from include/linux/pagemap.h:11,
                    from include/linux/blkdev.h:14,
                    from include/linux/blk-cgroup.h:23,
                    from include/linux/writeback.h:14,
                    from include/linux/memcontrol.h:22,
                    from include/linux/swap.h:9,
                    from include/linux/suspend.h:5,
                    from arch/x86/kernel/asm-offsets.c:13:
   include/linux/highmem.h: In function 'clear_user_highpage':
   include/linux/highmem.h:229:15: error: implicit declaration of function 'kmap_local_page'; did you mean 'kmap_to_page'? [-Werror=implicit-function-declaration]
     229 |  void *addr = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~
         |               kmap_to_page
   include/linux/highmem.h:229:15: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   include/linux/highmem.h:231:2: error: implicit declaration of function 'kunmap_local' [-Werror=implicit-function-declaration]
     231 |  kunmap_local(addr);
         |  ^~~~~~~~~~~~
   include/linux/highmem.h: In function 'clear_highpage':
   include/linux/highmem.h:282:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     282 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'zero_user_segments':
   include/linux/highmem.h:291:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     291 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'copy_user_highpage':
   include/linux/highmem.h:324:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     324 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:325:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     325 |  vto = kmap_local_page(to);
         |      ^
   include/linux/highmem.h: In function 'copy_highpage':
   include/linux/highmem.h:339:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     339 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:340:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     340 |  vto = kmap_local_page(to);
         |      ^
   include/linux/highmem.h: In function 'memcpy_page':
>> include/linux/highmem.h:352:14: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     352 |  char *dst = kmap_local_page(dst_page);
         |              ^~~~~~~~~~~~~~~
   include/linux/highmem.h:353:14: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     353 |  char *src = kmap_local_page(src_page);
         |              ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'memmove_page':
   include/linux/highmem.h:365:14: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     365 |  char *dst = kmap_local_page(dst_page);
         |              ^~~~~~~~~~~~~~~
   include/linux/highmem.h:366:14: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     366 |  char *src = kmap_local_page(src_page);
         |              ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'memcpy_from_page':
   include/linux/highmem.h:376:15: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     376 |  char *from = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'memcpy_to_page':
   include/linux/highmem.h:385:13: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     385 |  char *to = kmap_local_page(page);
         |             ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'memset_page':
   include/linux/highmem.h:394:15: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     394 |  char *addr = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:117: arch/x86/kernel/asm-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1200: prepare0] Error 2
make[1]: Target 'modules_prepare' not remade because of errors.
make: *** [Makefile:185: __sub-make] Error 2
make: Target 'modules_prepare' not remade because of errors.
--
In file included from include/linux/pagemap.h:11,

                    from include/linux/blkdev.h:14,
                    from include/linux/blk-cgroup.h:23,
                    from include/linux/writeback.h:14,
                    from include/linux/memcontrol.h:22,
                    from include/linux/swap.h:9,
                    from include/linux/suspend.h:5,
                    from arch/x86/kernel/asm-offsets.c:13:
   include/linux/highmem.h: In function 'clear_user_highpage':
   include/linux/highmem.h:229:15: error: implicit declaration of function 'kmap_local_page'; did you mean 'kmap_to_page'? [-Werror=implicit-function-declaration]
     229 |  void *addr = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~
         |               kmap_to_page
   include/linux/highmem.h:229:15: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   include/linux/highmem.h:231:2: error: implicit declaration of function 'kunmap_local' [-Werror=implicit-function-declaration]
     231 |  kunmap_local(addr);
         |  ^~~~~~~~~~~~
   include/linux/highmem.h: In function 'clear_highpage':
   include/linux/highmem.h:282:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     282 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'zero_user_segments':
   include/linux/highmem.h:291:16: warning: initialization of 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     291 |  void *kaddr = kmap_local_page(page);
         |                ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'copy_user_highpage':
   include/linux/highmem.h:324:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     324 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:325:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     325 |  vto = kmap_local_page(to);
         |      ^
   include/linux/highmem.h: In function 'copy_highpage':
   include/linux/highmem.h:339:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     339 |  vfrom = kmap_local_page(from);
         |        ^
   include/linux/highmem.h:340:6: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     340 |  vto = kmap_local_page(to);
         |      ^
   include/linux/highmem.h: In function 'memcpy_page':
>> include/linux/highmem.h:352:14: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     352 |  char *dst = kmap_local_page(dst_page);
         |              ^~~~~~~~~~~~~~~
   include/linux/highmem.h:353:14: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     353 |  char *src = kmap_local_page(src_page);
         |              ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'memmove_page':
   include/linux/highmem.h:365:14: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     365 |  char *dst = kmap_local_page(dst_page);
         |              ^~~~~~~~~~~~~~~
   include/linux/highmem.h:366:14: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     366 |  char *src = kmap_local_page(src_page);
         |              ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'memcpy_from_page':
   include/linux/highmem.h:376:15: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     376 |  char *from = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'memcpy_to_page':
   include/linux/highmem.h:385:13: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     385 |  char *to = kmap_local_page(page);
         |             ^~~~~~~~~~~~~~~
   include/linux/highmem.h: In function 'memset_page':
   include/linux/highmem.h:394:15: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     394 |  char *addr = kmap_local_page(page);
         |               ^~~~~~~~~~~~~~~

cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:117: arch/x86/kernel/asm-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1200: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:185: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.

vim +352 include/linux/highmem.h

334
335 static inline void copy_highpage(struct page *to, struct page *from)
336 {
337 char *vfrom, *vto;
338

 > 339		vfrom = kmap_local_page(from);
   340		vto = kmap_local_page(to);
   341		copy_page(vto, vfrom);
   342		kunmap_local(vto);
   343		kunmap_local(vfrom);
   344	}
   345	
   346	#endif
   347	
   348	static inline void memcpy_page(struct page *dst_page, size_t dst_off,
   349				       struct page *src_page, size_t src_off,
   350				       size_t len)
   351	{
 > 352		char *dst = kmap_local_page(dst_page);

353 char *src = kmap_local_page(src_page);
354
355 BUG_ON(dst_off + len > PAGE_SIZE || src_off + len > PAGE_SIZE);
356 memcpy(dst + dst_off, src + src_off, len);
357 kunmap_local(src);
358 kunmap_local(dst);
359 }
360

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#5 lore raw

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

In reply to [email protected]
I love your patch! Perhaps something to improve:

Hi,

I love your patch! Perhaps something to improve:

[auto build test WARNING on hch-configfs/for-next]
[also build test WARNING on linus/master hnaz-linux-mm/master v5.10-rc7] [cannot apply to mmotm/master next-20201210]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/ira-weiny-intel-com/mm-highmem-Remove-deprecated-kmap_atomic/20201211-021920
base:   git://git.infradead.org/users/hch/configfs.git for-next
config: x86_64-randconfig-a004-20201209 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 1968804ac726e7674d5de22bc2204b45857da344)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/9580f83142cf2df75ceb9e7dbe1939012818722c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review ira-weiny-intel-com/mm-highmem-Remove-deprecated-kmap_atomic/20201211-021920 git checkout 9580f83142cf2df75ceb9e7dbe1939012818722c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

In file included from arch/x86/kernel/asm-offsets.c:13:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:22:
In file included from include/linux/writeback.h:14:
In file included from include/linux/blk-cgroup.h:23:
In file included from include/linux/blkdev.h:14:
In file included from include/linux/pagemap.h:11:
include/linux/highmem.h:229:15: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]

           void *addr = kmap_local_page(page);
                        ^
   include/linux/highmem.h:229:15: note: did you mean 'kmap_to_page'?
   include/linux/highmem.h:130:28: note: 'kmap_to_page' declared here
   static inline struct page *kmap_to_page(void *addr)
                              ^
   include/linux/highmem.h:229:8: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'int' [-Wint-conversion]
           void *addr = kmap_local_page(page);
                 ^      ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:231:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(addr);
           ^
   include/linux/highmem.h:282:16: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           void *kaddr = kmap_local_page(page);
                         ^
   include/linux/highmem.h:282:8: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'int' [-Wint-conversion]
           void *kaddr = kmap_local_page(page);
                 ^       ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:284:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(kaddr);
           ^
   include/linux/highmem.h:291:16: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           void *kaddr = kmap_local_page(page);
                         ^
   include/linux/highmem.h:291:8: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'int' [-Wint-conversion]
           void *kaddr = kmap_local_page(page);
                 ^       ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:301:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(kaddr);
           ^
   include/linux/highmem.h:324:10: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           vfrom = kmap_local_page(from);
                   ^
   include/linux/highmem.h:324:8: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
           vfrom = kmap_local_page(from);
                 ^ ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:325:6: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
           vto = kmap_local_page(to);
               ^ ~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:327:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(vto);
           ^
   include/linux/highmem.h:339:10: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           vfrom = kmap_local_page(from);
                   ^
   include/linux/highmem.h:339:8: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
           vfrom = kmap_local_page(from);
                 ^ ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:340:6: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
           vto = kmap_local_page(to);
               ^ ~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:342:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(vto);
           ^
   include/linux/highmem.h:352:14: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *dst = kmap_local_page(dst_page);
                       ^
>> include/linux/highmem.h:352:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *dst = kmap_local_page(dst_page);
                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:353:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *src = kmap_local_page(src_page);
                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:357:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(src);
           ^
   include/linux/highmem.h:365:14: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *dst = kmap_local_page(dst_page);
                       ^
   include/linux/highmem.h:365:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *dst = kmap_local_page(dst_page);
                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:366:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *src = kmap_local_page(src_page);
                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:370:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(src);
           ^
   include/linux/highmem.h:376:15: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *from = kmap_local_page(page);
                        ^
   include/linux/highmem.h:376:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *from = kmap_local_page(page);
                 ^      ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:380:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(from);
           ^
   include/linux/highmem.h:385:13: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *to = kmap_local_page(page);
                      ^
   include/linux/highmem.h:385:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *to = kmap_local_page(page);
                 ^    ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:389:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(to);
           ^
   include/linux/highmem.h:394:15: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *addr = kmap_local_page(page);
                        ^
   include/linux/highmem.h:394:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *addr = kmap_local_page(page);
                 ^      ~~~~~~~~~~~~~~~~~~~~~

fatal error: too many errors emitted, stopping now [-ferror-limit=]
14 warnings and 20 errors generated.
--
In file included from arch/x86/kernel/asm-offsets.c:13:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:22:
In file included from include/linux/writeback.h:14:
In file included from include/linux/blk-cgroup.h:23:
In file included from include/linux/blkdev.h:14:
In file included from include/linux/pagemap.h:11:
include/linux/highmem.h:229:15: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]

           void *addr = kmap_local_page(page);
                        ^
   include/linux/highmem.h:229:15: note: did you mean 'kmap_to_page'?
   include/linux/highmem.h:130:28: note: 'kmap_to_page' declared here
   static inline struct page *kmap_to_page(void *addr)
                              ^
   include/linux/highmem.h:229:8: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'int' [-Wint-conversion]
           void *addr = kmap_local_page(page);
                 ^      ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:231:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(addr);
           ^
   include/linux/highmem.h:282:16: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           void *kaddr = kmap_local_page(page);
                         ^
   include/linux/highmem.h:282:8: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'int' [-Wint-conversion]
           void *kaddr = kmap_local_page(page);
                 ^       ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:284:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(kaddr);
           ^
   include/linux/highmem.h:291:16: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           void *kaddr = kmap_local_page(page);
                         ^
   include/linux/highmem.h:291:8: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'int' [-Wint-conversion]
           void *kaddr = kmap_local_page(page);
                 ^       ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:301:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(kaddr);
           ^
   include/linux/highmem.h:324:10: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           vfrom = kmap_local_page(from);
                   ^
   include/linux/highmem.h:324:8: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
           vfrom = kmap_local_page(from);
                 ^ ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:325:6: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
           vto = kmap_local_page(to);
               ^ ~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:327:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(vto);
           ^
   include/linux/highmem.h:339:10: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           vfrom = kmap_local_page(from);
                   ^
   include/linux/highmem.h:339:8: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
           vfrom = kmap_local_page(from);
                 ^ ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:340:6: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
           vto = kmap_local_page(to);
               ^ ~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:342:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(vto);
           ^
   include/linux/highmem.h:352:14: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *dst = kmap_local_page(dst_page);
                       ^
>> include/linux/highmem.h:352:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *dst = kmap_local_page(dst_page);
                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:353:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *src = kmap_local_page(src_page);
                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:357:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(src);
           ^
   include/linux/highmem.h:365:14: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *dst = kmap_local_page(dst_page);
                       ^
   include/linux/highmem.h:365:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *dst = kmap_local_page(dst_page);
                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:366:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *src = kmap_local_page(src_page);
                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:370:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(src);
           ^
   include/linux/highmem.h:376:15: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *from = kmap_local_page(page);
                        ^
   include/linux/highmem.h:376:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *from = kmap_local_page(page);
                 ^      ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:380:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(from);
           ^
   include/linux/highmem.h:385:13: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *to = kmap_local_page(page);
                      ^
   include/linux/highmem.h:385:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *to = kmap_local_page(page);
                 ^    ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:389:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(to);
           ^
   include/linux/highmem.h:394:15: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *addr = kmap_local_page(page);
                        ^
   include/linux/highmem.h:394:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *addr = kmap_local_page(page);
                 ^      ~~~~~~~~~~~~~~~~~~~~~

fatal error: too many errors emitted, stopping now [-ferror-limit=]
14 warnings and 20 errors generated.
make[2]: *** [scripts/Makefile.build:117: arch/x86/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1200: prepare0] Error 2
make[1]: Target 'modules_prepare' not remade because of errors.
make: *** [Makefile:185: __sub-make] Error 2
make: Target 'modules_prepare' not remade because of errors.
--
In file included from arch/x86/kernel/asm-offsets.c:13:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:22:
In file included from include/linux/writeback.h:14:
In file included from include/linux/blk-cgroup.h:23:
In file included from include/linux/blkdev.h:14:
In file included from include/linux/pagemap.h:11:
include/linux/highmem.h:229:15: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]

           void *addr = kmap_local_page(page);
                        ^
   include/linux/highmem.h:229:15: note: did you mean 'kmap_to_page'?
   include/linux/highmem.h:130:28: note: 'kmap_to_page' declared here
   static inline struct page *kmap_to_page(void *addr)
                              ^
   include/linux/highmem.h:229:8: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'int' [-Wint-conversion]
           void *addr = kmap_local_page(page);
                 ^      ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:231:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(addr);
           ^
   include/linux/highmem.h:282:16: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           void *kaddr = kmap_local_page(page);
                         ^
   include/linux/highmem.h:282:8: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'int' [-Wint-conversion]
           void *kaddr = kmap_local_page(page);
                 ^       ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:284:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(kaddr);
           ^
   include/linux/highmem.h:291:16: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           void *kaddr = kmap_local_page(page);
                         ^
   include/linux/highmem.h:291:8: warning: incompatible integer to pointer conversion initializing 'void *' with an expression of type 'int' [-Wint-conversion]
           void *kaddr = kmap_local_page(page);
                 ^       ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:301:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(kaddr);
           ^
   include/linux/highmem.h:324:10: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           vfrom = kmap_local_page(from);
                   ^
   include/linux/highmem.h:324:8: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
           vfrom = kmap_local_page(from);
                 ^ ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:325:6: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
           vto = kmap_local_page(to);
               ^ ~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:327:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(vto);
           ^
   include/linux/highmem.h:339:10: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           vfrom = kmap_local_page(from);
                   ^
   include/linux/highmem.h:339:8: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
           vfrom = kmap_local_page(from);
                 ^ ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:340:6: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
           vto = kmap_local_page(to);
               ^ ~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:342:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(vto);
           ^
   include/linux/highmem.h:352:14: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *dst = kmap_local_page(dst_page);
                       ^
>> include/linux/highmem.h:352:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *dst = kmap_local_page(dst_page);
                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:353:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *src = kmap_local_page(src_page);
                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:357:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(src);
           ^
   include/linux/highmem.h:365:14: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *dst = kmap_local_page(dst_page);
                       ^
   include/linux/highmem.h:365:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *dst = kmap_local_page(dst_page);
                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:366:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *src = kmap_local_page(src_page);
                 ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:370:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(src);
           ^
   include/linux/highmem.h:376:15: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *from = kmap_local_page(page);
                        ^
   include/linux/highmem.h:376:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *from = kmap_local_page(page);
                 ^      ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:380:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(from);
           ^
   include/linux/highmem.h:385:13: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *to = kmap_local_page(page);
                      ^
   include/linux/highmem.h:385:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *to = kmap_local_page(page);
                 ^    ~~~~~~~~~~~~~~~~~~~~~
   include/linux/highmem.h:389:2: error: implicit declaration of function 'kunmap_local' [-Werror,-Wimplicit-function-declaration]
           kunmap_local(to);
           ^
   include/linux/highmem.h:394:15: error: implicit declaration of function 'kmap_local_page' [-Werror,-Wimplicit-function-declaration]
           char *addr = kmap_local_page(page);
                        ^
   include/linux/highmem.h:394:8: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
           char *addr = kmap_local_page(page);
                 ^      ~~~~~~~~~~~~~~~~~~~~~

fatal error: too many errors emitted, stopping now [-ferror-limit=] 14 warnings and 20 errors generated.
make[2]: *** [scripts/Makefile.build:117: arch/x86/kernel/asm-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1200: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:185: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.

vim +352 include/linux/highmem.h

347
348 static inline void memcpy_page(struct page *dst_page, size_t dst_off,
349 struct page *src_page, size_t src_off,
350 size_t len)
351 {

 > 352		char *dst = kmap_local_page(dst_page);

353 char *src = kmap_local_page(src_page);
354
355 BUG_ON(dst_off + len > PAGE_SIZE || src_off + len > PAGE_SIZE);
356 memcpy(dst + dst_off, src + src_off, len);
357 kunmap_local(src);
358 kunmap_local(dst);
359 }
360

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org