Subject: linux-next: build warning after merge of the mm tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 20 Mar 2023 14:47:21 +1100

Hi all,

After merging the mm tree, today's linux-next build (sparc64 defconfig)
produced this warning:

In file included from include/linux/wait.h:11,
                 from include/linux/swait.h:8,
                 from include/linux/completion.h:12,
                 from include/linux/mm_types.h:14,
                 from include/linux/uio.h:10,
                 from include/linux/vmalloc.h:12,
                 from include/asm-generic/io.h:994,
                 from arch/sparc/include/asm/io.h:22,
                 from arch/sparc/vdso/vclock_gettime.c:18:
arch/sparc/include/asm/current.h:18:30: warning: call-clobbered register used for global register variable
   18 | register struct task_struct *current asm("g4");
      |                              ^~~~~~~

I guess the immediate cause is commit

  4e29dd9708cb ("mm: vmalloc: convert vread() to vread_iter()")

from the mm that included linux/uio.h into include/linux/vmalloc.h.
Though there may be a deeper old cause that may need addressing in the
longer term.

Indeed, this patch (obviously) makes the warning go away (and
presumably speeds up the build ever so slightly :-)).

From: Stephen Rothwell <[email-masked]>
Date: Mon, 20 Mar 2023 14:02:18 +1100
Subject: [PATCH] mm: vmalloc: fix sparc64 warning

This fixes this warning from a sparc64 defconfig build:

In file included from /home/sfr/next/next/include/linux/wait.h:11,
                 from /home/sfr/next/next/include/linux/swait.h:8,
                 from /home/sfr/next/next/include/linux/completion.h:12,
                 from /home/sfr/next/next/include/linux/mm_types.h:14,
                 from /home/sfr/next/next/include/linux/uio.h:10,
                 from /home/sfr/next/next/include/linux/vmalloc.h:12,
                 from /home/sfr/next/next/include/asm-generic/io.h:994,
                 from /home/sfr/next/next/arch/sparc/include/asm/io.h:22,
                 from /home/sfr/next/next/arch/sparc/vdso/vclock_gettime.c:18:
/home/sfr/next/next/arch/sparc/include/asm/current.h:18:30: warning: call-clobbered register used for global register variable
   18 | register struct task_struct *current asm("g4");
      |                              ^~~~~~~

Fixes: 4e29dd9708cb ("mm: vmalloc: convert vread() to vread_iter()")
Signed-off-by: Stephen Rothwell <[email-masked]>
---
 include/linux/vmalloc.h | 2 +-
 mm/vmalloc.c            | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 6beb2ace6a7a..c187c4d9bc33 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -9,12 +9,12 @@
 #include <asm/page.h>		/* pgprot_t */
 #include <linux/rbtree.h>
 #include <linux/overflow.h>
-#include <linux/uio.h>
 
 #include <asm/vmalloc.h>
 
 struct vm_area_struct;		/* vma defining user mapping in mm_types.h */
 struct notifier_block;		/* in notifier.h */
+struct iov_iter;		/* in uio.h */
 
 /* bits in flags of vmalloc's vm_struct below */
 #define VM_IOREMAP		0x00000001	/* ioremap() and friends */
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index f19509a6eef4..6e5647937dab 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -40,6 +40,7 @@
 #include <linux/hugetlb.h>
 #include <linux/sched/mm.h>
 #include <linux/rwsem.h>
+#include <linux/uio.h>
 #include <asm/tlbflush.h>
 #include <asm/shmparam.h>
 
-- 
2.39.2

-- 
Cheers,
Stephen Rothwell