Skip to contentSkip to conversation

um: Minor fixes and cleanups

PATCH New Tiwei Bie 1 participant 5 messages Jul 8, 2025 User-mode Linux (UML)

lore
Share & tools
lore

Tiwei Bie

author
#0 lore raw

cover um: Minor fixes and cleanups

From: Tiwei Bie <[email protected]>

Tiwei Bie (4):
um: Make unscheduled_userspace_iterations static
um: Make mm_list and mm_list_lock static
um: Avoid redefining ARCH_HAS_CACHE_LINE_SIZE
um: rtc: Avoid shadowing err in uml_rtc_start()

 arch/um/Kconfig                 | 4 +---
 arch/um/drivers/rtc_user.c      | 2 +-
 arch/um/kernel/skas/mmu.c       | 4 ++--
 arch/um/os-Linux/skas/process.c | 2 +-
 4 files changed, 5 insertions(+), 7 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/4 um: Make unscheduled_userspace_iterations static

From: Tiwei Bie <[email protected]>

It's only used within process.c. Make it static.

---
 arch/um/os-Linux/skas/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/os-Linux/skas/process.c +1 -1
index e42ffac23e3c..d3dd4fb559cf 100644
@@ -548,7 +548,7 @@ int start_userspace(struct mm_id *mm_id)
 	return err;
 }
 
-int unscheduled_userspace_iterations;
+static int unscheduled_userspace_iterations;
 extern unsigned long tt_extra_sched_jiffies;
 
 void userspace(struct uml_pt_regs *regs)
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 2/4 um: Make mm_list and mm_list_lock static

In reply to Tiwei Bie

From: Tiwei Bie <[email protected]>

They are only used within mmu.c. Make them static.

---
 arch/um/kernel/skas/mmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/um/kernel/skas/mmu.c +2 -2
index 849fafa4b54f..afe9a2f251ef 100644
@@ -20,8 +20,8 @@
 /* Ensure the stub_data struct covers the allocated area */
 static_assert(sizeof(struct stub_data) == STUB_DATA_PAGES * UM_KERN_PAGE_SIZE);
 
-spinlock_t mm_list_lock;
-struct list_head mm_list;
+static spinlock_t mm_list_lock;
+static struct list_head mm_list;
 
 int init_new_context(struct task_struct *task, struct mm_struct *mm)
 {
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH 3/4 um: Avoid redefining ARCH_HAS_CACHE_LINE_SIZE

In reply to Tiwei Bie

From: Tiwei Bie <[email protected]>

There is a generic ARCH_HAS_CACHE_LINE_SIZE option introduced by commit c2280be81de4 ("mm: generalize ARCH_HAS_CACHE_LINE_SIZE") in mm/Kconfig. Select that instead.

---
 arch/um/Kconfig | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/um/Kconfig +1 -3
index c2d2d2d99bbe..9083bfdb7735 100644
@@ -6,6 +6,7 @@ config UML
 	bool
 	default y
 	select ARCH_WANTS_DYNAMIC_TASK_STRUCT
+	select ARCH_HAS_CACHE_LINE_SIZE
 	select ARCH_HAS_CPU_FINALIZE_INIT
 	select ARCH_HAS_FORTIFY_SOURCE
 	select ARCH_HAS_GCOV_PROFILE_ALL
@@ -83,9 +84,6 @@ config NR_CPUS
 	range 1 1
 	default 1
 
-config ARCH_HAS_CACHE_LINE_SIZE
-	def_bool y
-
 source "arch/$(HEADER_ARCH)/um/Kconfig"
 
 config MAY_HAVE_RUNTIME_DEPS
Signature · 1 line
2.34.1
author
#4 lore raw

PATCH 4/4 um: rtc: Avoid shadowing err in uml_rtc_start()

In reply to Tiwei Bie

From: Tiwei Bie <[email protected]>

Remove the declaration of 'err' inside the 'if (timetravel)' block, as it would otherwise be unavailable outside that block, potentially leading to uml_rtc_start() returning an uninitialized value.

Fixes dde8b58d5127 ("um: add a pseudo RTC")
---
 arch/um/drivers/rtc_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/rtc_user.c +1 -1
index 51e79f3148cd..67912fcf7b28 100644
@@ -28,7 +28,7 @@ int uml_rtc_start(bool timetravel)
 	int err;
 
 	if (timetravel) {
-		int err = os_pipe(uml_rtc_irq_fds, 1, 1);
+		err = os_pipe(uml_rtc_irq_fds, 1, 1);
 		if (err)
 			goto fail;
 	} else {
Signature · 1 line
2.34.1