2024-01-23 11:24:01

by Tiwei Bie

[permalink] [raw]
Subject: [PATCH 0/5] um: Minor fixes and cleanups

A series of minor fixes and cleanups for UML.

Tiwei Bie (5):
um: Make local functions and variables static
um: Fix the declaration of vfree
um: Remove unused functions
um: Fix the return type of __switch_to
um: Add missing headers

arch/um/drivers/pcap_kern.c | 4 +--
arch/um/drivers/ubd_user.c | 2 +-
arch/um/include/shared/um_malloc.h | 2 +-
arch/um/kernel/kmsg_dump.c | 2 +-
arch/um/kernel/mem.c | 2 ++
arch/um/kernel/process.c | 34 ++++++------------------
arch/um/kernel/reboot.c | 1 +
arch/um/kernel/skas/mmu.c | 1 +
arch/um/kernel/skas/process.c | 1 +
arch/um/kernel/time.c | 6 ++---
arch/um/kernel/tlb.c | 7 +----
arch/um/os-Linux/drivers/ethertap_kern.c | 2 +-
arch/um/os-Linux/drivers/tuntap_kern.c | 2 +-
arch/um/os-Linux/signal.c | 4 +--
arch/x86/um/bugs_32.c | 1 +
arch/x86/um/bugs_64.c | 1 +
arch/x86/um/fault.c | 1 +
arch/x86/um/os-Linux/mcontext.c | 1 +
arch/x86/um/os-Linux/registers.c | 2 +-
19 files changed, 31 insertions(+), 45 deletions(-)

--
2.34.1



2024-01-23 11:24:22

by Tiwei Bie

[permalink] [raw]
Subject: [PATCH 5/5] um: Add missing headers

This will address below -Wmissing-prototypes warnings:

arch/um/kernel/mem.c:202:8: warning: no previous prototype for ‘pgd_alloc’ [-Wmissing-prototypes]
arch/um/kernel/mem.c:215:7: warning: no previous prototype for ‘uml_kmalloc’ [-Wmissing-prototypes]
arch/um/kernel/process.c:207:6: warning: no previous prototype for ‘arch_cpu_idle’ [-Wmissing-prototypes]
arch/um/kernel/process.c:328:15: warning: no previous prototype for ‘arch_align_stack’ [-Wmissing-prototypes]
arch/um/kernel/reboot.c:45:6: warning: no previous prototype for ‘machine_restart’ [-Wmissing-prototypes]
arch/um/kernel/reboot.c:51:6: warning: no previous prototype for ‘machine_power_off’ [-Wmissing-prototypes]
arch/um/kernel/reboot.c:57:6: warning: no previous prototype for ‘machine_halt’ [-Wmissing-prototypes]
arch/um/kernel/skas/mmu.c:17:5: warning: no previous prototype for ‘init_new_context’ [-Wmissing-prototypes]
arch/um/kernel/skas/mmu.c:60:6: warning: no previous prototype for ‘destroy_context’ [-Wmissing-prototypes]
arch/um/kernel/skas/process.c:36:12: warning: no previous prototype for ‘start_uml’ [-Wmissing-prototypes]
arch/um/kernel/tlb.c:594:6: warning: no previous prototype for ‘force_flush_all’ [-Wmissing-prototypes]
arch/x86/um/bugs_64.c:9:6: warning: no previous prototype for ‘arch_check_bugs’ [-Wmissing-prototypes]
arch/x86/um/bugs_64.c:13:6: warning: no previous prototype for ‘arch_examine_signal’ [-Wmissing-prototypes]
arch/x86/um/fault.c:18:5: warning: no previous prototype for ‘arch_fixup’ [-Wmissing-prototypes]
arch/x86/um/os-Linux/mcontext.c:7:6: warning: no previous prototype for ‘get_regs_from_mc’ [-Wmissing-prototypes]

Signed-off-by: Tiwei Bie <[email protected]>
---
arch/um/kernel/mem.c | 2 ++
arch/um/kernel/process.c | 2 ++
arch/um/kernel/reboot.c | 1 +
arch/um/kernel/skas/mmu.c | 1 +
arch/um/kernel/skas/process.c | 1 +
arch/um/kernel/tlb.c | 1 +
arch/x86/um/bugs_32.c | 1 +
arch/x86/um/bugs_64.c | 1 +
arch/x86/um/fault.c | 1 +
arch/x86/um/os-Linux/mcontext.c | 1 +
10 files changed, 12 insertions(+)

diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 38d5a71a579b..ca91accd64fc 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -12,12 +12,14 @@
#include <linux/slab.h>
#include <asm/fixmap.h>
#include <asm/page.h>
+#include <asm/pgalloc.h>
#include <as-layout.h>
#include <init.h>
#include <kern.h>
#include <kern_util.h>
#include <mem_user.h>
#include <os.h>
+#include <um_malloc.h>
#include <linux/sched/task.h>

#ifdef CONFIG_KASAN
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index a7607ef1b02f..4235e2ca2664 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -15,6 +15,7 @@
#include <linux/proc_fs.h>
#include <linux/ptrace.h>
#include <linux/random.h>
+#include <linux/cpu.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/sched/debug.h>
@@ -27,6 +28,7 @@
#include <asm/current.h>
#include <asm/mmu_context.h>
#include <asm/switch_to.h>
+#include <asm/exec.h>
#include <linux/uaccess.h>
#include <as-layout.h>
#include <kern_util.h>
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index 48c0610d506e..25840eee1068 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -9,6 +9,7 @@
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/oom.h>
+#include <linux/reboot.h>
#include <kern_util.h>
#include <os.h>
#include <skas.h>
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 656fe16c9b63..aeed1c2aaf3c 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -10,6 +10,7 @@

#include <asm/pgalloc.h>
#include <asm/sections.h>
+#include <asm/mmu_context.h>
#include <as-layout.h>
#include <os.h>
#include <skas.h>
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index f2ac134c9752..fdd5922f9222 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -12,6 +12,7 @@
#include <kern.h>
#include <os.h>
#include <skas.h>
+#include <kern_util.h>

extern void start_kernel(void);

diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index 70b5e47e9761..8784f03fa4a6 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -8,6 +8,7 @@
#include <linux/sched/signal.h>

#include <asm/tlbflush.h>
+#include <asm/mmu_context.h>
#include <as-layout.h>
#include <mem_user.h>
#include <os.h>
diff --git a/arch/x86/um/bugs_32.c b/arch/x86/um/bugs_32.c
index 33daff4dade4..d29929efcc07 100644
--- a/arch/x86/um/bugs_32.c
+++ b/arch/x86/um/bugs_32.c
@@ -3,6 +3,7 @@
* Licensed under the GPL
*/

+#include <arch.h>
#include <signal.h>
#include <kern_util.h>
#include <longjmp.h>
diff --git a/arch/x86/um/bugs_64.c b/arch/x86/um/bugs_64.c
index 8cc8256c698d..b01295e8a676 100644
--- a/arch/x86/um/bugs_64.c
+++ b/arch/x86/um/bugs_64.c
@@ -4,6 +4,7 @@
* Licensed under the GPL
*/

+#include <arch.h>
#include <sysdep/ptrace.h>

void arch_check_bugs(void)
diff --git a/arch/x86/um/fault.c b/arch/x86/um/fault.c
index 84ac7f7b0257..0dde4d613a87 100644
--- a/arch/x86/um/fault.c
+++ b/arch/x86/um/fault.c
@@ -3,6 +3,7 @@
* Licensed under the GPL
*/

+#include <arch.h>
#include <sysdep/ptrace.h>

/* These two are from asm-um/uaccess.h and linux/module.h, check them. */
diff --git a/arch/x86/um/os-Linux/mcontext.c b/arch/x86/um/os-Linux/mcontext.c
index 49c3744cac37..e80ab7d28117 100644
--- a/arch/x86/um/os-Linux/mcontext.c
+++ b/arch/x86/um/os-Linux/mcontext.c
@@ -3,6 +3,7 @@
#define __FRAME_OFFSETS
#include <asm/ptrace.h>
#include <sysdep/ptrace.h>
+#include <sysdep/mcontext.h>

void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc)
{
--
2.34.1


2024-01-23 11:31:43

by Tiwei Bie

[permalink] [raw]
Subject: [PATCH 2/5] um: Fix the declaration of vfree

The definition of vfree has changed since commit b3bdda02aa54
("vmalloc: add const to void* parameters"). Update the declaration
of vfree in um_malloc.h to match the latest definition.

Signed-off-by: Tiwei Bie <[email protected]>
---
arch/um/include/shared/um_malloc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/um/include/shared/um_malloc.h b/arch/um/include/shared/um_malloc.h
index 13da93284c2c..d25084447c69 100644
--- a/arch/um/include/shared/um_malloc.h
+++ b/arch/um/include/shared/um_malloc.h
@@ -12,7 +12,7 @@ extern void *uml_kmalloc(int size, int flags);
extern void kfree(const void *ptr);

extern void *vmalloc(unsigned long size);
-extern void vfree(void *ptr);
+extern void vfree(const void *ptr);

#endif /* __UM_MALLOC_H__ */

--
2.34.1