* [PATCH v3 0/7] Some minor cleanups for UML
@ 2024-08-26 10:08 Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 1/7] um: Remove unused kpte_clear_flush macro Tiwei Bie
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Tiwei Bie @ 2024-08-26 10:08 UTC (permalink / raw)
To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie
Changes in v3:
- Remove "um: Remove declarations of undefined functions";
- Add "um: Remove the declaration of user_thread function";
- Add "um: Remove outdated asm/sysrq.h header";
- Minor tweaks on commit log;
Changes in v2 (https://lore.kernel.org/linux-um/20240816095953.638401-1-tiwei.btw@antgroup.com/):
- Remove the pointless union (suggested by Benjamin Berg);
- Minor tweaks on coding style;
v1: https://lore.kernel.org/linux-um/20240816015447.320394-1-tiwei.btw@antgroup.com/
Tiwei Bie (7):
um: Remove unused kpte_clear_flush macro
um: Remove the redundant newpage check in update_pte_range
um: Remove unused fields from thread_struct
um: Remove unused mm_fd field from mm_id
um: Remove the call to SUBARCH_EXECVE1 macro
um: Remove the declaration of user_thread function
um: Remove outdated asm/sysrq.h header
arch/um/include/asm/pgtable.h | 7 -------
arch/um/include/asm/processor-generic.h | 20 +++++---------------
arch/um/include/asm/sysrq.h | 8 --------
arch/um/include/shared/skas/mm_id.h | 5 +----
arch/um/include/shared/skas/skas.h | 1 -
arch/um/kernel/exec.c | 3 ---
arch/um/kernel/process.c | 8 ++++----
arch/um/kernel/reboot.c | 2 +-
arch/um/kernel/skas/mmu.c | 12 ++++++------
arch/um/kernel/skas/process.c | 4 ++--
arch/um/kernel/sysrq.c | 1 -
arch/um/kernel/time.c | 2 +-
arch/um/kernel/tlb.c | 16 ++++++----------
arch/um/os-Linux/skas/mem.c | 2 +-
arch/um/os-Linux/skas/process.c | 2 +-
arch/x86/um/sysrq_32.c | 1 -
arch/x86/um/sysrq_64.c | 1 -
17 files changed, 28 insertions(+), 67 deletions(-)
delete mode 100644 arch/um/include/asm/sysrq.h
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 1/7] um: Remove unused kpte_clear_flush macro
2024-08-26 10:08 [PATCH v3 0/7] Some minor cleanups for UML Tiwei Bie
@ 2024-08-26 10:08 ` Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 2/7] um: Remove the redundant newpage check in update_pte_range Tiwei Bie
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tiwei Bie @ 2024-08-26 10:08 UTC (permalink / raw)
To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie
This macro has no users, and __flush_tlb_one doesn't exist either.
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
arch/um/include/asm/pgtable.h | 7 -------
1 file changed, 7 deletions(-)
diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h
index 5bb397b65efb..83373c9963e7 100644
--- a/arch/um/include/asm/pgtable.h
+++ b/arch/um/include/asm/pgtable.h
@@ -359,11 +359,4 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte)
return pte;
}
-/* Clear a kernel PTE and flush it from the TLB */
-#define kpte_clear_flush(ptep, vaddr) \
-do { \
- pte_clear(&init_mm, (vaddr), (ptep)); \
- __flush_tlb_one((vaddr)); \
-} while (0)
-
#endif
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 2/7] um: Remove the redundant newpage check in update_pte_range
2024-08-26 10:08 [PATCH v3 0/7] Some minor cleanups for UML Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 1/7] um: Remove unused kpte_clear_flush macro Tiwei Bie
@ 2024-08-26 10:08 ` Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 3/7] um: Remove unused fields from thread_struct Tiwei Bie
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tiwei Bie @ 2024-08-26 10:08 UTC (permalink / raw)
To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie
The two checks have been identical since commit ef714f15027c ("um:
remove force_flush_all from fork_handler"). And the inner one isn't
necessary anymore.
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
arch/um/kernel/tlb.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index 44c6fc697f3a..548af31d4111 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -82,16 +82,12 @@ static inline int update_pte_range(pmd_t *pmd, unsigned long addr,
(x ? UM_PROT_EXEC : 0));
if (pte_newpage(*pte)) {
if (pte_present(*pte)) {
- if (pte_newpage(*pte)) {
- __u64 offset;
- unsigned long phys =
- pte_val(*pte) & PAGE_MASK;
- int fd = phys_mapping(phys, &offset);
-
- ret = ops->mmap(ops->mm_idp, addr,
- PAGE_SIZE, prot, fd,
- offset);
- }
+ __u64 offset;
+ unsigned long phys = pte_val(*pte) & PAGE_MASK;
+ int fd = phys_mapping(phys, &offset);
+
+ ret = ops->mmap(ops->mm_idp, addr, PAGE_SIZE,
+ prot, fd, offset);
} else
ret = ops->unmap(ops->mm_idp, addr, PAGE_SIZE);
} else if (pte_newprot(*pte))
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 3/7] um: Remove unused fields from thread_struct
2024-08-26 10:08 [PATCH v3 0/7] Some minor cleanups for UML Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 1/7] um: Remove unused kpte_clear_flush macro Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 2/7] um: Remove the redundant newpage check in update_pte_range Tiwei Bie
@ 2024-08-26 10:08 ` Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 4/7] um: Remove unused mm_fd field from mm_id Tiwei Bie
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tiwei Bie @ 2024-08-26 10:08 UTC (permalink / raw)
To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie
These fields are no longer used since the removal of tt mode.
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
arch/um/include/asm/processor-generic.h | 20 +++++---------------
arch/um/kernel/process.c | 8 ++++----
arch/um/kernel/skas/process.c | 4 ++--
3 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h
index 5a7c05275aa7..bce4595798da 100644
--- a/arch/um/include/asm/processor-generic.h
+++ b/arch/um/include/asm/processor-generic.h
@@ -28,20 +28,10 @@ struct thread_struct {
struct arch_thread arch;
jmp_buf switch_buf;
struct {
- int op;
- union {
- struct {
- int pid;
- } fork, exec;
- struct {
- int (*proc)(void *);
- void *arg;
- } thread;
- struct {
- void (*proc)(void *);
- void *arg;
- } cb;
- } u;
+ struct {
+ int (*proc)(void *);
+ void *arg;
+ } thread;
} request;
};
@@ -51,7 +41,7 @@ struct thread_struct {
.fault_addr = NULL, \
.prev_sched = NULL, \
.arch = INIT_ARCH_THREAD, \
- .request = { 0 } \
+ .request = { } \
}
/*
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index f36b63f53bab..be2856af6d4c 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -109,8 +109,8 @@ void new_thread_handler(void)
schedule_tail(current->thread.prev_sched);
current->thread.prev_sched = NULL;
- fn = current->thread.request.u.thread.proc;
- arg = current->thread.request.u.thread.arg;
+ fn = current->thread.request.thread.proc;
+ arg = current->thread.request.thread.arg;
/*
* callback returns only if the kernel thread execs a process
@@ -158,8 +158,8 @@ int copy_thread(struct task_struct * p, const struct kernel_clone_args *args)
arch_copy_thread(¤t->thread.arch, &p->thread.arch);
} else {
get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp);
- p->thread.request.u.thread.proc = args->fn;
- p->thread.request.u.thread.arg = args->fn_arg;
+ p->thread.request.thread.proc = args->fn;
+ p->thread.request.thread.arg = args->fn_arg;
handler = new_thread_handler;
}
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index 5f9c1c5f36e2..68657988c8d1 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -39,8 +39,8 @@ int __init start_uml(void)
init_new_thread_signals();
- init_task.thread.request.u.thread.proc = start_kernel_proc;
- init_task.thread.request.u.thread.arg = NULL;
+ init_task.thread.request.thread.proc = start_kernel_proc;
+ init_task.thread.request.thread.arg = NULL;
return start_idle_thread(task_stack_page(&init_task),
&init_task.thread.switch_buf);
}
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 4/7] um: Remove unused mm_fd field from mm_id
2024-08-26 10:08 [PATCH v3 0/7] Some minor cleanups for UML Tiwei Bie
` (2 preceding siblings ...)
2024-08-26 10:08 ` [PATCH v3 3/7] um: Remove unused fields from thread_struct Tiwei Bie
@ 2024-08-26 10:08 ` Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 5/7] um: Remove the call to SUBARCH_EXECVE1 macro Tiwei Bie
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tiwei Bie @ 2024-08-26 10:08 UTC (permalink / raw)
To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie
It's no longer used since the removal of the SKAS3/4 support.
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
arch/um/include/shared/skas/mm_id.h | 5 +----
arch/um/kernel/reboot.c | 2 +-
arch/um/kernel/skas/mmu.c | 12 ++++++------
arch/um/kernel/time.c | 2 +-
arch/um/os-Linux/skas/mem.c | 2 +-
arch/um/os-Linux/skas/process.c | 2 +-
6 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/arch/um/include/shared/skas/mm_id.h b/arch/um/include/shared/skas/mm_id.h
index 1e76ba40feba..140388c282f6 100644
--- a/arch/um/include/shared/skas/mm_id.h
+++ b/arch/um/include/shared/skas/mm_id.h
@@ -7,10 +7,7 @@
#define __MM_ID_H
struct mm_id {
- union {
- int mm_fd;
- int pid;
- } u;
+ int pid;
unsigned long stack;
int syscall_data_len;
};
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index 3736bca626ba..680bce4bd8fa 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -29,7 +29,7 @@ static void kill_off_processes(void)
t = find_lock_task_mm(p);
if (!t)
continue;
- pid = t->mm->context.id.u.pid;
+ pid = t->mm->context.id.pid;
task_unlock(t);
os_kill_ptraced_process(pid, 1);
}
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 47f98d87ea3c..886ed5e65674 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -32,11 +32,11 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm)
new_id->stack = stack;
block_signals_trace();
- new_id->u.pid = start_userspace(stack);
+ new_id->pid = start_userspace(stack);
unblock_signals_trace();
- if (new_id->u.pid < 0) {
- ret = new_id->u.pid;
+ if (new_id->pid < 0) {
+ ret = new_id->pid;
goto out_free;
}
@@ -83,12 +83,12 @@ void destroy_context(struct mm_struct *mm)
* whole UML suddenly dying. Also, cover negative and
* 1 cases, since they shouldn't happen either.
*/
- if (mmu->id.u.pid < 2) {
+ if (mmu->id.pid < 2) {
printk(KERN_ERR "corrupt mm_context - pid = %d\n",
- mmu->id.u.pid);
+ mmu->id.pid);
return;
}
- os_kill_ptraced_process(mmu->id.u.pid, 1);
+ os_kill_ptraced_process(mmu->id.pid, 1);
free_pages(mmu->id.stack, ilog2(STUB_DATA_PAGES));
}
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 47b9f5e63566..29b27b90581f 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -839,7 +839,7 @@ static irqreturn_t um_timer(int irq, void *dev)
if (get_current()->mm != NULL)
{
/* userspace - relay signal, results in correct userspace timers */
- os_alarm_process(get_current()->mm->context.id.u.pid);
+ os_alarm_process(get_current()->mm->context.id.pid);
}
(*timer_clockevent.event_handler)(&timer_clockevent);
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index c55430775efd..9a13ac23c606 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -78,7 +78,7 @@ static inline long do_syscall_stub(struct mm_id *mm_idp)
{
struct stub_data *proc_data = (void *)mm_idp->stack;
int n, i;
- int err, pid = mm_idp->u.pid;
+ int err, pid = mm_idp->pid;
n = ptrace_setregs(pid, syscall_regs);
if (n < 0) {
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index f7088345b3fc..b6f656bcffb1 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -588,5 +588,5 @@ void reboot_skas(void)
void __switch_mm(struct mm_id *mm_idp)
{
- userspace_pid[0] = mm_idp->u.pid;
+ userspace_pid[0] = mm_idp->pid;
}
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 5/7] um: Remove the call to SUBARCH_EXECVE1 macro
2024-08-26 10:08 [PATCH v3 0/7] Some minor cleanups for UML Tiwei Bie
` (3 preceding siblings ...)
2024-08-26 10:08 ` [PATCH v3 4/7] um: Remove unused mm_fd field from mm_id Tiwei Bie
@ 2024-08-26 10:08 ` Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 6/7] um: Remove the declaration of user_thread function Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 7/7] um: Remove outdated asm/sysrq.h header Tiwei Bie
6 siblings, 0 replies; 8+ messages in thread
From: Tiwei Bie @ 2024-08-26 10:08 UTC (permalink / raw)
To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie
This macro has never been defined by any supported sub-architectures
in tree since it was introduced by commit 1d3468a6643a ("[PATCH uml:
move _kern.c files").
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
arch/um/kernel/exec.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
index 2c15bb2c104c..cb8b5cd9285c 100644
--- a/arch/um/kernel/exec.c
+++ b/arch/um/kernel/exec.c
@@ -35,8 +35,5 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
PT_REGS_IP(regs) = eip;
PT_REGS_SP(regs) = esp;
clear_thread_flag(TIF_SINGLESTEP);
-#ifdef SUBARCH_EXECVE1
- SUBARCH_EXECVE1(regs->regs);
-#endif
}
EXPORT_SYMBOL(start_thread);
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 6/7] um: Remove the declaration of user_thread function
2024-08-26 10:08 [PATCH v3 0/7] Some minor cleanups for UML Tiwei Bie
` (4 preceding siblings ...)
2024-08-26 10:08 ` [PATCH v3 5/7] um: Remove the call to SUBARCH_EXECVE1 macro Tiwei Bie
@ 2024-08-26 10:08 ` Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 7/7] um: Remove outdated asm/sysrq.h header Tiwei Bie
6 siblings, 0 replies; 8+ messages in thread
From: Tiwei Bie @ 2024-08-26 10:08 UTC (permalink / raw)
To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie
This function has never been defined since its declaration was
introduced by commit 1da177e4c3f4 ("Linux-2.6.12-rc2").
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
arch/um/include/shared/skas/skas.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/um/include/shared/skas/skas.h b/arch/um/include/shared/skas/skas.h
index ebaa116de30b..95f5d5d6389a 100644
--- a/arch/um/include/shared/skas/skas.h
+++ b/arch/um/include/shared/skas/skas.h
@@ -10,7 +10,6 @@
extern int userspace_pid[];
-extern int user_thread(unsigned long stack, int flags);
extern void new_thread_handler(void);
extern void handle_syscall(struct uml_pt_regs *regs);
extern long execute_syscall_skas(void *r);
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 7/7] um: Remove outdated asm/sysrq.h header
2024-08-26 10:08 [PATCH v3 0/7] Some minor cleanups for UML Tiwei Bie
` (5 preceding siblings ...)
2024-08-26 10:08 ` [PATCH v3 6/7] um: Remove the declaration of user_thread function Tiwei Bie
@ 2024-08-26 10:08 ` Tiwei Bie
6 siblings, 0 replies; 8+ messages in thread
From: Tiwei Bie @ 2024-08-26 10:08 UTC (permalink / raw)
To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie
This header no longer serves a purpose after show_trace was removed
by commit 9d1ee8ce92e1 ("um: Rewrite show_stack()").
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
arch/um/include/asm/sysrq.h | 8 --------
arch/um/kernel/sysrq.c | 1 -
arch/x86/um/sysrq_32.c | 1 -
arch/x86/um/sysrq_64.c | 1 -
4 files changed, 11 deletions(-)
delete mode 100644 arch/um/include/asm/sysrq.h
diff --git a/arch/um/include/asm/sysrq.h b/arch/um/include/asm/sysrq.h
deleted file mode 100644
index 8fc8c65cd357..000000000000
--- a/arch/um/include/asm/sysrq.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __UM_SYSRQ_H
-#define __UM_SYSRQ_H
-
-struct task_struct;
-extern void show_trace(struct task_struct* task, unsigned long *stack);
-
-#endif
diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
index 746715379f12..4bb8622dc512 100644
--- a/arch/um/kernel/sysrq.c
+++ b/arch/um/kernel/sysrq.c
@@ -11,7 +11,6 @@
#include <linux/sched/debug.h>
#include <linux/sched/task_stack.h>
-#include <asm/sysrq.h>
#include <asm/stacktrace.h>
#include <os.h>
diff --git a/arch/x86/um/sysrq_32.c b/arch/x86/um/sysrq_32.c
index f2383484840d..a1ee415c008d 100644
--- a/arch/x86/um/sysrq_32.c
+++ b/arch/x86/um/sysrq_32.c
@@ -9,7 +9,6 @@
#include <linux/sched/debug.h>
#include <linux/kallsyms.h>
#include <asm/ptrace.h>
-#include <asm/sysrq.h>
/* This is declared by <linux/sched.h> */
void show_regs(struct pt_regs *regs)
diff --git a/arch/x86/um/sysrq_64.c b/arch/x86/um/sysrq_64.c
index 0bf6de40abff..340d8a243c8a 100644
--- a/arch/x86/um/sysrq_64.c
+++ b/arch/x86/um/sysrq_64.c
@@ -12,7 +12,6 @@
#include <linux/utsname.h>
#include <asm/current.h>
#include <asm/ptrace.h>
-#include <asm/sysrq.h>
void show_regs(struct pt_regs *regs)
{
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-08-26 10:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-26 10:08 [PATCH v3 0/7] Some minor cleanups for UML Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 1/7] um: Remove unused kpte_clear_flush macro Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 2/7] um: Remove the redundant newpage check in update_pte_range Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 3/7] um: Remove unused fields from thread_struct Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 4/7] um: Remove unused mm_fd field from mm_id Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 5/7] um: Remove the call to SUBARCH_EXECVE1 macro Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 6/7] um: Remove the declaration of user_thread function Tiwei Bie
2024-08-26 10:08 ` [PATCH v3 7/7] um: Remove outdated asm/sysrq.h header Tiwei Bie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®