Skip to contentSkip to conversation

highmem: Make __kunmap_{local,atomic}() take "const void *"

PATCH Superseded Fabio M. De Francesco 3 participants 4 messages Jun 14, 2022 – Jun 15, 2022

Subsystems (2)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 highmem: Make __kunmap_{local,atomic}() take "const void *"

Sometimes __kunmap_{local,atomic}() should take pointers to const void. Currently their prototypes take pointers to void, therefore compilations break in cases like the above-mentioned.

This is the output of GCC-12 when it encounters one those cases:

./linux/fs/btrfs/zstd.c:547:33: warning: passing
argument 1 of '__kunmap_local' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

  547 |   kunmap_local(workspace->in_buf.src);
      |                ~~~~~~~~~~~~~~~~~^~~~
./linux/include/linux/highmem-internal.h:284:17:
note: in definition of macro 'kunmap_local'
  284 |  __kunmap_local(__addr);     \
      |                 ^~~~~~
./linux/include/linux/highmem-internal.h:92:41:
note: expected 'void *' but argument is of type 'const void *'
   92 | static inline void __kunmap_local(void *vaddr)
      |                                   ~~~~~~^~~~~

Make __kunmap_{local,atomic}() take pointers to const void.

---
 include/linux/highmem-internal.h | 10 +++++-----
 mm/highmem.c                     |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
include/linux/highmem-internal.h +5 -5
index cddb42ff0473..034b1106d022 100644
@@ -8,7 +8,7 @@
 #ifdef CONFIG_KMAP_LOCAL
 void *__kmap_local_pfn_prot(unsigned long pfn, pgprot_t prot);
 void *__kmap_local_page_prot(struct page *page, pgprot_t prot);
-void kunmap_local_indexed(void *vaddr);
+void kunmap_local_indexed(const void *vaddr);
 void kmap_local_fork(struct task_struct *tsk);
 void __kmap_local_sched_out(void);
 void __kmap_local_sched_in(void);
@@ -89,7 +89,7 @@ static inline void *kmap_local_pfn(unsigned long pfn)
 	return __kmap_local_pfn_prot(pfn, kmap_prot);
 }
 
-static inline void __kunmap_local(void *vaddr)
+static inline void __kunmap_local(const void *vaddr)
 {
 	kunmap_local_indexed(vaddr);
 }
@@ -121,7 +121,7 @@ static inline void *kmap_atomic_pfn(unsigned long pfn)
 	return __kmap_local_pfn_prot(pfn, kmap_prot);
 }
 
-static inline void __kunmap_atomic(void *addr)
+static inline void __kunmap_atomic(const void *addr)
 {
 	kunmap_local_indexed(addr);
 	pagefault_enable();
@@ -197,7 +197,7 @@ static inline void *kmap_local_pfn(unsigned long pfn)
 	return kmap_local_page(pfn_to_page(pfn));
 }
 
-static inline void __kunmap_local(void *addr)
+static inline void __kunmap_local(const void *addr)
 {
 #ifdef ARCH_HAS_FLUSH_ON_KUNMAP
 	kunmap_flush_on_unmap(addr);
@@ -224,7 +224,7 @@ static inline void *kmap_atomic_pfn(unsigned long pfn)
 	return kmap_atomic(pfn_to_page(pfn));
 }
 
-static inline void __kunmap_atomic(void *addr)
+static inline void __kunmap_atomic(const void *addr)
 {
 #ifdef ARCH_HAS_FLUSH_ON_KUNMAP
 	kunmap_flush_on_unmap(addr);
mm/highmem.c +1 -1
index 1a692997fac4..e32083e4ce0d 100644
@@ -561,7 +561,7 @@ void *__kmap_local_page_prot(struct page *page, pgprot_t prot)
 }
 EXPORT_SYMBOL(__kmap_local_page_prot);
 
-void kunmap_local_indexed(void *vaddr)
+void kunmap_local_indexed(const void *vaddr)
 {
 	unsigned long addr = (unsigned long) vaddr & PAGE_MASK;
 	pte_t *kmap_pte;
Signature · 1 line
2.36.1
#1 lore raw
Quoted 3 lines · Fabio M. De Francesco

Sometimes __kunmap_{local,atomic}() should take pointers to const void. Currently their prototypes take pointers to void, therefore compilations break in cases like the above-mentioned.

I think the compilation problem is just a symptom of the real issue. kunmap_local() has no reason to change the vaddr parameter and therefore it is correct to declare it a const.

This allows callers to also maintain vaddr as a const value to be passed back to kumap_local() if they wish.

Ira

Quoted 92 lines

This is the output of GCC-12 when it encounters one those cases:

./linux/fs/btrfs/zstd.c:547:33: warning: passing
argument 1 of '__kunmap_local' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

  547 |   kunmap_local(workspace->in_buf.src);
      |                ~~~~~~~~~~~~~~~~~^~~~
./linux/include/linux/highmem-internal.h:284:17:
note: in definition of macro 'kunmap_local'
  284 |  __kunmap_local(__addr);     \
      |                 ^~~~~~
./linux/include/linux/highmem-internal.h:92:41:
note: expected 'void *' but argument is of type 'const void *'
   92 | static inline void __kunmap_local(void *vaddr)
      |                                   ~~~~~~^~~~~

Make __kunmap_{local,atomic}() take pointers to const void.

---
 include/linux/highmem-internal.h | 10 +++++-----
 mm/highmem.c                     |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
include/linux/highmem-internal.h +5 -5
index cddb42ff0473..034b1106d022 100644
@@ -8,7 +8,7 @@
 #ifdef CONFIG_KMAP_LOCAL
 void *__kmap_local_pfn_prot(unsigned long pfn, pgprot_t prot);
 void *__kmap_local_page_prot(struct page *page, pgprot_t prot);
-void kunmap_local_indexed(void *vaddr);
+void kunmap_local_indexed(const void *vaddr);
 void kmap_local_fork(struct task_struct *tsk);
 void __kmap_local_sched_out(void);
 void __kmap_local_sched_in(void);
@@ -89,7 +89,7 @@ static inline void *kmap_local_pfn(unsigned long pfn)
 	return __kmap_local_pfn_prot(pfn, kmap_prot);
 }
 
-static inline void __kunmap_local(void *vaddr)
+static inline void __kunmap_local(const void *vaddr)
 {
 	kunmap_local_indexed(vaddr);
 }
@@ -121,7 +121,7 @@ static inline void *kmap_atomic_pfn(unsigned long pfn)
 	return __kmap_local_pfn_prot(pfn, kmap_prot);
 }
 
-static inline void __kunmap_atomic(void *addr)
+static inline void __kunmap_atomic(const void *addr)
 {
 	kunmap_local_indexed(addr);
 	pagefault_enable();
@@ -197,7 +197,7 @@ static inline void *kmap_local_pfn(unsigned long pfn)
 	return kmap_local_page(pfn_to_page(pfn));
 }
 
-static inline void __kunmap_local(void *addr)
+static inline void __kunmap_local(const void *addr)
 {
 #ifdef ARCH_HAS_FLUSH_ON_KUNMAP
 	kunmap_flush_on_unmap(addr);
@@ -224,7 +224,7 @@ static inline void *kmap_atomic_pfn(unsigned long pfn)
 	return kmap_atomic(pfn_to_page(pfn));
 }
 
-static inline void __kunmap_atomic(void *addr)
+static inline void __kunmap_atomic(const void *addr)
 {
 #ifdef ARCH_HAS_FLUSH_ON_KUNMAP
 	kunmap_flush_on_unmap(addr);
mm/highmem.c +1 -1
index 1a692997fac4..e32083e4ce0d 100644
@@ -561,7 +561,7 @@ void *__kmap_local_page_prot(struct page *page, pgprot_t prot)
 }
 EXPORT_SYMBOL(__kmap_local_page_prot);
 
-void kunmap_local_indexed(void *vaddr)
+void kunmap_local_indexed(const void *vaddr)
 {
 	unsigned long addr = (unsigned long) vaddr & PAGE_MASK;
 	pte_t *kmap_pte;
Signature · 1 line
2.36.1
#2 lore raw
In reply to Fabio M. De Francesco
Thank you for the patch! Perhaps something to improve:

Hi "Fabio,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v5.19-rc2 next-20220615] [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/intel-lab-lkp/linux/commits/Fabio-M-De-Francesco/highmem-Make-__kunmap_-local-atomic-take-const-void/20220614-222749
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
config: parisc-defconfig (https://download.01.org/0day-ci/archive/20220615/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 11.3.0

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
# https://github.com/intel-lab-lkp/linux/commit/558ba1aeb12cc7940165f07160e51afb0bc1a64b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Fabio-M-De-Francesco/highmem-Make-__kunmap_-local-atomic-take-const-void/20220614-222749 git checkout 558ba1aeb12cc7940165f07160e51afb0bc1a64b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=parisc SHELL=/bin/bash fs/

If you fix the issue, kindly add following tag where applicable

All warnings (new ones prefixed by >>):

In file included from include/linux/highmem.h:13,

                    from include/linux/bvec.h:10,
                    from include/linux/blk_types.h:10,
                    from include/linux/writeback.h:13,
                    from include/linux/backing-dev.h:16,
                    from fs/open.c:16:
   include/linux/highmem-internal.h: In function '__kunmap_local':
>> include/linux/highmem-internal.h:203:31: warning: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     203 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from include/linux/bvec.h:10,
                    from include/linux/blk_types.h:10,
                    from include/linux/writeback.h:13,
                    from include/linux/backing-dev.h:16,
                    from fs/open.c:16:
   arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
      78 | static inline void kunmap_flush_on_unmap(void *addr)
         |                                          ~~~~~~^~~~
   In file included from include/linux/highmem.h:13,
                    from include/linux/bvec.h:10,
                    from include/linux/blk_types.h:10,
                    from include/linux/writeback.h:13,
                    from include/linux/backing-dev.h:16,
                    from fs/open.c:16:
   include/linux/highmem-internal.h: In function '__kunmap_atomic':
   include/linux/highmem-internal.h:230:31: warning: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     230 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from include/linux/bvec.h:10,
                    from include/linux/blk_types.h:10,
                    from include/linux/writeback.h:13,
                    from include/linux/backing-dev.h:16,
                    from fs/open.c:16:

arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
78 | static inline void kunmap_flush_on_unmap(void *addr)
| ~~~~~~^~~~
--
In file included from include/linux/highmem.h:13,

                    from fs/pipe.c:21:
   include/linux/highmem-internal.h: In function '__kunmap_local':
>> include/linux/highmem-internal.h:203:31: warning: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     203 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from fs/pipe.c:21:
   arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
      78 | static inline void kunmap_flush_on_unmap(void *addr)
         |                                          ~~~~~~^~~~
   In file included from include/linux/highmem.h:13,
                    from fs/pipe.c:21:
   include/linux/highmem-internal.h: In function '__kunmap_atomic':
   include/linux/highmem-internal.h:230:31: warning: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     230 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from fs/pipe.c:21:

arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
78 | static inline void kunmap_flush_on_unmap(void *addr)
| ~~~~~~^~~~
fs/pipe.c: At top level:
fs/pipe.c:757:15: warning: no previous prototype for 'account_pipe_buffers' [-Wmissing-prototypes]
757 | unsigned long account_pipe_buffers(struct user_struct *user,
| ^~~~~~~~~~~~~~~~~~~~
fs/pipe.c:763:6: warning: no previous prototype for 'too_many_pipe_buffers_soft' [-Wmissing-prototypes]
763 | bool too_many_pipe_buffers_soft(unsigned long user_bufs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/pipe.c:770:6: warning: no previous prototype for 'too_many_pipe_buffers_hard' [-Wmissing-prototypes]
770 | bool too_many_pipe_buffers_hard(unsigned long user_bufs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/pipe.c:777:6: warning: no previous prototype for 'pipe_is_unprivileged_user' [-Wmissing-prototypes]
777 | bool pipe_is_unprivileged_user(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
fs/pipe.c:1253:5: warning: no previous prototype for 'pipe_resize_ring' [-Wmissing-prototypes]
1253 | int pipe_resize_ring(struct pipe_inode_info *pipe, unsigned int nr_slots)
| ^~~~~~~~~~~~~~~~
--
In file included from include/linux/highmem.h:13,

                    from include/linux/bvec.h:10,
                    from include/linux/blk_types.h:10,
                    from include/linux/blkdev.h:9,
                    from include/linux/blk-mq.h:5,
                    from fs/io_uring.c:60:
   include/linux/highmem-internal.h: In function '__kunmap_local':
>> include/linux/highmem-internal.h:203:31: warning: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     203 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from include/linux/bvec.h:10,
                    from include/linux/blk_types.h:10,
                    from include/linux/blkdev.h:9,
                    from include/linux/blk-mq.h:5,
                    from fs/io_uring.c:60:
   arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
      78 | static inline void kunmap_flush_on_unmap(void *addr)
         |                                          ~~~~~~^~~~
   In file included from include/linux/highmem.h:13,
                    from include/linux/bvec.h:10,
                    from include/linux/blk_types.h:10,
                    from include/linux/blkdev.h:9,
                    from include/linux/blk-mq.h:5,
                    from fs/io_uring.c:60:
   include/linux/highmem-internal.h: In function '__kunmap_atomic':
   include/linux/highmem-internal.h:230:31: warning: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     230 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from include/linux/bvec.h:10,
                    from include/linux/blk_types.h:10,
                    from include/linux/blkdev.h:9,
                    from include/linux/blk-mq.h:5,
                    from fs/io_uring.c:60:
   arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
      78 | static inline void kunmap_flush_on_unmap(void *addr)
         |                                          ~~~~~~^~~~
   fs/io_uring.c: In function '__io_submit_flush_completions':
   fs/io_uring.c:3196:40: warning: variable 'prev' set but not used [-Wunused-but-set-variable]
    3196 |         struct io_wq_work_node *node, *prev;
         |                                        ^~~~
--
   In file included from include/linux/highmem.h:13,
                    from include/linux/bvec.h:10,
                    from include/linux/skbuff.h:17,
                    from include/net/net_namespace.h:40,
                    from include/linux/inet.h:42,
                    from include/linux/sunrpc/msg_prot.h:200,
                    from include/linux/sunrpc/auth.h:14,
                    from include/linux/sunrpc/svc.h:18,
                    from include/linux/sunrpc/svc_xprt.h:11,
                    from fs/nfsd/export.c:19:
   include/linux/highmem-internal.h: In function '__kunmap_local':
>> include/linux/highmem-internal.h:203:31: warning: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     203 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from include/linux/bvec.h:10,
                    from include/linux/skbuff.h:17,
                    from include/net/net_namespace.h:40,
                    from include/linux/inet.h:42,
                    from include/linux/sunrpc/msg_prot.h:200,
                    from include/linux/sunrpc/auth.h:14,
                    from include/linux/sunrpc/svc.h:18,
                    from include/linux/sunrpc/svc_xprt.h:11,
                    from fs/nfsd/export.c:19:
   arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
      78 | static inline void kunmap_flush_on_unmap(void *addr)
         |                                          ~~~~~~^~~~
   In file included from include/linux/highmem.h:13,
                    from include/linux/bvec.h:10,
                    from include/linux/skbuff.h:17,
                    from include/net/net_namespace.h:40,
                    from include/linux/inet.h:42,
                    from include/linux/sunrpc/msg_prot.h:200,
                    from include/linux/sunrpc/auth.h:14,
                    from include/linux/sunrpc/svc.h:18,
                    from include/linux/sunrpc/svc_xprt.h:11,
                    from fs/nfsd/export.c:19:
   include/linux/highmem-internal.h: In function '__kunmap_atomic':
   include/linux/highmem-internal.h:230:31: warning: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     230 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from include/linux/bvec.h:10,
                    from include/linux/skbuff.h:17,
                    from include/net/net_namespace.h:40,
                    from include/linux/inet.h:42,
                    from include/linux/sunrpc/msg_prot.h:200,
                    from include/linux/sunrpc/auth.h:14,
                    from include/linux/sunrpc/svc.h:18,
                    from include/linux/sunrpc/svc_xprt.h:11,
                    from fs/nfsd/export.c:19:
   arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
      78 | static inline void kunmap_flush_on_unmap(void *addr)
         |                                          ~~~~~~^~~~
   fs/nfsd/export.c: In function 'exp_rootfh':
   fs/nfsd/export.c:979:34: warning: variable 'inode' set but not used [-Wunused-but-set-variable]
     979 |         struct inode            *inode;
         |                                  ^~~~~
--
   In file included from include/linux/highmem.h:13,
                    from include/linux/pagemap.h:11,
                    from include/linux/nfs_fs.h:24,
                    from fs/nfs/nfstrace.c:5:
   include/linux/highmem-internal.h: In function '__kunmap_local':
>> include/linux/highmem-internal.h:203:31: warning: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     203 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from include/linux/pagemap.h:11,
                    from include/linux/nfs_fs.h:24,
                    from fs/nfs/nfstrace.c:5:
   arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
      78 | static inline void kunmap_flush_on_unmap(void *addr)
         |                                          ~~~~~~^~~~
   In file included from include/linux/highmem.h:13,
                    from include/linux/pagemap.h:11,
                    from include/linux/nfs_fs.h:24,
                    from fs/nfs/nfstrace.c:5:
   include/linux/highmem-internal.h: In function '__kunmap_atomic':
   include/linux/highmem-internal.h:230:31: warning: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     230 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from include/linux/pagemap.h:11,
                    from include/linux/nfs_fs.h:24,
                    from fs/nfs/nfstrace.c:5:
   arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
      78 | static inline void kunmap_flush_on_unmap(void *addr)
         |                                          ~~~~~~^~~~
   In file included from fs/nfs/nfstrace.h:1670,
                    from fs/nfs/nfstrace.c:10:

include/trace/define_trace.h: At top level:
include/trace/define_trace.h:95:42: fatal error: ./nfstrace.h: No such file or directory
95 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
| ^
compilation terminated.
--
In file included from include/linux/highmem.h:13,

                    from include/linux/bvec.h:10,
                    from include/linux/skbuff.h:17,
                    from include/net/net_namespace.h:40,
                    from include/linux/inet.h:42,
                    from include/linux/sunrpc/msg_prot.h:200,
                    from include/linux/nfs4.h:19,
                    from fs/nfsd/export.h:11,
                    from fs/nfsd/trace.h:13,
                    from fs/nfsd/trace.c:4:
   include/linux/highmem-internal.h: In function '__kunmap_local':
>> include/linux/highmem-internal.h:203:31: warning: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     203 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from include/linux/bvec.h:10,
                    from include/linux/skbuff.h:17,
                    from include/net/net_namespace.h:40,
                    from include/linux/inet.h:42,
                    from include/linux/sunrpc/msg_prot.h:200,
                    from include/linux/nfs4.h:19,
                    from fs/nfsd/export.h:11,
                    from fs/nfsd/trace.h:13,
                    from fs/nfsd/trace.c:4:
   arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
      78 | static inline void kunmap_flush_on_unmap(void *addr)
         |                                          ~~~~~~^~~~
   In file included from include/linux/highmem.h:13,
                    from include/linux/bvec.h:10,
                    from include/linux/skbuff.h:17,
                    from include/net/net_namespace.h:40,
                    from include/linux/inet.h:42,
                    from include/linux/sunrpc/msg_prot.h:200,
                    from include/linux/nfs4.h:19,
                    from fs/nfsd/export.h:11,
                    from fs/nfsd/trace.h:13,
                    from fs/nfsd/trace.c:4:
   include/linux/highmem-internal.h: In function '__kunmap_atomic':
   include/linux/highmem-internal.h:230:31: warning: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     230 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from include/linux/bvec.h:10,
                    from include/linux/skbuff.h:17,
                    from include/net/net_namespace.h:40,
                    from include/linux/inet.h:42,
                    from include/linux/sunrpc/msg_prot.h:200,
                    from include/linux/nfs4.h:19,
                    from fs/nfsd/export.h:11,
                    from fs/nfsd/trace.h:13,
                    from fs/nfsd/trace.c:4:
   arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
      78 | static inline void kunmap_flush_on_unmap(void *addr)
         |                                          ~~~~~~^~~~
   In file included from fs/nfsd/trace.h:1152,
                    from fs/nfsd/trace.c:4:

include/trace/define_trace.h: At top level:
include/trace/define_trace.h:95:42: fatal error: ./trace.h: No such file or directory
95 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
| ^
compilation terminated.

vim +203 include/linux/highmem-internal.h

f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  199  
558ba1aeb12cc7 Fabio M. De Francesco 2022-06-14  200  static inline void __kunmap_local(const void *addr)
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  201  {
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  202  #ifdef ARCH_HAS_FLUSH_ON_KUNMAP
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18 @203  	kunmap_flush_on_unmap(addr);
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  204  #endif
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  205  }
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  206  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp
#3 lore raw
In reply to Fabio M. De Francesco
Thank you for the patch! Yet something to improve:

Hi "Fabio,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on linus/master v5.19-rc2 next-20220615] [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/intel-lab-lkp/linux/commits/Fabio-M-De-Francesco/highmem-Make-__kunmap_-local-atomic-take-const-void/20220614-222749
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
config: parisc-allyesconfig (https://download.01.org/0day-ci/archive/20220616/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 11.3.0

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
# https://github.com/intel-lab-lkp/linux/commit/558ba1aeb12cc7940165f07160e51afb0bc1a64b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Fabio-M-De-Francesco/highmem-Make-__kunmap_-local-atomic-take-const-void/20220614-222749 git checkout 558ba1aeb12cc7940165f07160e51afb0bc1a64b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=parisc SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable

All errors (new ones prefixed by >>):

In file included from include/linux/highmem.h:13,

                    from include/linux/bvec.h:10,
                    from include/linux/skbuff.h:17,
                    from drivers/net/wwan/t7xx/t7xx_hif_cldma.h:25,
                    from drivers/net/wwan/t7xx/t7xx_modem_ops.h:25,
                    from drivers/net/wwan/t7xx/t7xx_pci.c:39:
   include/linux/highmem-internal.h: In function '__kunmap_local':
>> include/linux/highmem-internal.h:203:31: error: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     203 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from include/linux/bvec.h:10,
                    from include/linux/skbuff.h:17,
                    from drivers/net/wwan/t7xx/t7xx_hif_cldma.h:25,
                    from drivers/net/wwan/t7xx/t7xx_modem_ops.h:25,
                    from drivers/net/wwan/t7xx/t7xx_pci.c:39:
   arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
      78 | static inline void kunmap_flush_on_unmap(void *addr)
         |                                          ~~~~~~^~~~
   In file included from include/linux/highmem.h:13,
                    from include/linux/bvec.h:10,
                    from include/linux/skbuff.h:17,
                    from drivers/net/wwan/t7xx/t7xx_hif_cldma.h:25,
                    from drivers/net/wwan/t7xx/t7xx_modem_ops.h:25,
                    from drivers/net/wwan/t7xx/t7xx_pci.c:39:
   include/linux/highmem-internal.h: In function '__kunmap_atomic':
   include/linux/highmem-internal.h:230:31: error: passing argument 1 of 'kunmap_flush_on_unmap' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     230 |         kunmap_flush_on_unmap(addr);
         |                               ^~~~
   In file included from include/linux/cacheflush.h:5,
                    from include/linux/highmem.h:8,
                    from include/linux/bvec.h:10,
                    from include/linux/skbuff.h:17,
                    from drivers/net/wwan/t7xx/t7xx_hif_cldma.h:25,
                    from drivers/net/wwan/t7xx/t7xx_modem_ops.h:25,
                    from drivers/net/wwan/t7xx/t7xx_pci.c:39:

arch/parisc/include/asm/cacheflush.h:78:48: note: expected 'void *' but argument is of type 'const void *'
78 | static inline void kunmap_flush_on_unmap(void *addr)
| ~~~~~~^~~~
cc1: all warnings being treated as errors

vim +203 include/linux/highmem-internal.h

f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  199  
558ba1aeb12cc7 Fabio M. De Francesco 2022-06-14  200  static inline void __kunmap_local(const void *addr)
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  201  {
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  202  #ifdef ARCH_HAS_FLUSH_ON_KUNMAP
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18 @203  	kunmap_flush_on_unmap(addr);
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  204  #endif
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  205  }
f3ba3c710ac5a3 Thomas Gleixner       2020-11-18  206  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp