2024-05-27 13:41:47

by Tiwei Bie

[permalink] [raw]
Subject: [PATCH 0/2] um: Remove some dead code

Tiwei Bie (2):
um: Remove unused ncpus variable
um: Remove /proc/sysemu support code

arch/um/include/shared/kern_util.h | 1 -
arch/um/kernel/process.c | 67 ------------------------------
arch/um/kernel/um_arch.c | 3 --
3 files changed, 71 deletions(-)

--
2.34.1



2024-05-27 13:49:41

by Tiwei Bie

[permalink] [raw]
Subject: [PATCH 1/2] um: Remove unused ncpus variable

It's no longer used. And uml_ncpus_setup doesn't exist anymore.

Signed-off-by: Tiwei Bie <[email protected]>
---
arch/um/include/shared/kern_util.h | 1 -
arch/um/kernel/um_arch.c | 3 ---
2 files changed, 4 deletions(-)

diff --git a/arch/um/include/shared/kern_util.h b/arch/um/include/shared/kern_util.h
index 95521b1f5b20..d8ffd2db168e 100644
--- a/arch/um/include/shared/kern_util.h
+++ b/arch/um/include/shared/kern_util.h
@@ -13,7 +13,6 @@ struct siginfo;

extern int uml_exitcode;

-extern int ncpus;
extern int kmalloc_ok;

#define UML_ROUND_UP(addr) \
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index e95f805e5004..8e594cda6d77 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -126,9 +126,6 @@ unsigned long uml_reserved; /* Also modified in mem_init */
unsigned long start_vm;
unsigned long end_vm;

-/* Set in uml_ncpus_setup */
-int ncpus = 1;
-
/* Set in early boot */
static int have_root __initdata;
static int have_console __initdata;
--
2.34.1


2024-05-27 13:49:57

by Tiwei Bie

[permalink] [raw]
Subject: [PATCH 2/2] um: Remove /proc/sysemu support code

Currently /proc/sysemu will never be registered, as sysemu_supported
is initialized to zero implicitly and no code updates it. And there is
also nothing to configure via sysemu in UML anymore.

Signed-off-by: Tiwei Bie <[email protected]>
---
arch/um/kernel/process.c | 67 ----------------------------------------
1 file changed, 67 deletions(-)

diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index d2134802f6a8..79f41f06a98f 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -237,73 +237,6 @@ int copy_from_user_proc(void *to, void __user *from, int size)
return copy_from_user(to, from, size);
}

-static atomic_t using_sysemu = ATOMIC_INIT(0);
-int sysemu_supported;
-
-static void set_using_sysemu(int value)
-{
- if (value > sysemu_supported)
- return;
- atomic_set(&using_sysemu, value);
-}
-
-static int get_using_sysemu(void)
-{
- return atomic_read(&using_sysemu);
-}
-
-static int sysemu_proc_show(struct seq_file *m, void *v)
-{
- seq_printf(m, "%d\n", get_using_sysemu());
- return 0;
-}
-
-static int sysemu_proc_open(struct inode *inode, struct file *file)
-{
- return single_open(file, sysemu_proc_show, NULL);
-}
-
-static ssize_t sysemu_proc_write(struct file *file, const char __user *buf,
- size_t count, loff_t *pos)
-{
- char tmp[2];
-
- if (copy_from_user(tmp, buf, 1))
- return -EFAULT;
-
- if (tmp[0] >= '0' && tmp[0] <= '2')
- set_using_sysemu(tmp[0] - '0');
- /* We use the first char, but pretend to write everything */
- return count;
-}
-
-static const struct proc_ops sysemu_proc_ops = {
- .proc_open = sysemu_proc_open,
- .proc_read = seq_read,
- .proc_lseek = seq_lseek,
- .proc_release = single_release,
- .proc_write = sysemu_proc_write,
-};
-
-static int __init make_proc_sysemu(void)
-{
- struct proc_dir_entry *ent;
- if (!sysemu_supported)
- return 0;
-
- ent = proc_create("sysemu", 0600, NULL, &sysemu_proc_ops);
-
- if (ent == NULL)
- {
- printk(KERN_WARNING "Failed to register /proc/sysemu\n");
- return 0;
- }
-
- return 0;
-}
-
-late_initcall(make_proc_sysemu);
-
int singlestepping(void)
{
return test_thread_flag(TIF_SINGLESTEP);
--
2.34.1