* [PATCH v2 1/6] um: Remove unused kpte_clear_flush macro
2024-08-16 9:59 [PATCH v2 0/6] Some minor cleanups for UML Tiwei Bie
@ 2024-08-16 9:59 ` Tiwei Bie
2024-08-16 9:59 ` [PATCH v2 2/6] um: Remove the redundant newpage check in update_pte_range Tiwei Bie
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Tiwei Bie @ 2024-08-16 9:59 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] 7+ messages in thread* [PATCH v2 2/6] um: Remove the redundant newpage check in update_pte_range
2024-08-16 9:59 [PATCH v2 0/6] Some minor cleanups for UML Tiwei Bie
2024-08-16 9:59 ` [PATCH v2 1/6] um: Remove unused kpte_clear_flush macro Tiwei Bie
@ 2024-08-16 9:59 ` Tiwei Bie
2024-08-16 9:59 ` [PATCH v2 3/6] um: Remove unused fields from thread_struct Tiwei Bie
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Tiwei Bie @ 2024-08-16 9:59 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] 7+ messages in thread* [PATCH v2 3/6] um: Remove unused fields from thread_struct
2024-08-16 9:59 [PATCH v2 0/6] Some minor cleanups for UML Tiwei Bie
2024-08-16 9:59 ` [PATCH v2 1/6] um: Remove unused kpte_clear_flush macro Tiwei Bie
2024-08-16 9:59 ` [PATCH v2 2/6] um: Remove the redundant newpage check in update_pte_range Tiwei Bie
@ 2024-08-16 9:59 ` Tiwei Bie
2024-08-16 9:59 ` [PATCH v2 4/6] um: Remove unused mm_fd field from mm_id Tiwei Bie
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Tiwei Bie @ 2024-08-16 9:59 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] 7+ messages in thread* [PATCH v2 4/6] um: Remove unused mm_fd field from mm_id
2024-08-16 9:59 [PATCH v2 0/6] Some minor cleanups for UML Tiwei Bie
` (2 preceding siblings ...)
2024-08-16 9:59 ` [PATCH v2 3/6] um: Remove unused fields from thread_struct Tiwei Bie
@ 2024-08-16 9:59 ` Tiwei Bie
2024-08-16 9:59 ` [PATCH v2 5/6] um: Remove the call to SUBARCH_EXECVE1 macro Tiwei Bie
2024-08-16 9:59 ` [PATCH v2 6/6] um: Remove declarations of undefined functions Tiwei Bie
5 siblings, 0 replies; 7+ messages in thread
From: Tiwei Bie @ 2024-08-16 9:59 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] 7+ messages in thread* [PATCH v2 5/6] um: Remove the call to SUBARCH_EXECVE1 macro
2024-08-16 9:59 [PATCH v2 0/6] Some minor cleanups for UML Tiwei Bie
` (3 preceding siblings ...)
2024-08-16 9:59 ` [PATCH v2 4/6] um: Remove unused mm_fd field from mm_id Tiwei Bie
@ 2024-08-16 9:59 ` Tiwei Bie
2024-08-16 9:59 ` [PATCH v2 6/6] um: Remove declarations of undefined functions Tiwei Bie
5 siblings, 0 replies; 7+ messages in thread
From: Tiwei Bie @ 2024-08-16 9:59 UTC (permalink / raw)
To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie
This macro isn't 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] 7+ messages in thread* [PATCH v2 6/6] um: Remove declarations of undefined functions
2024-08-16 9:59 [PATCH v2 0/6] Some minor cleanups for UML Tiwei Bie
` (4 preceding siblings ...)
2024-08-16 9:59 ` [PATCH v2 5/6] um: Remove the call to SUBARCH_EXECVE1 macro Tiwei Bie
@ 2024-08-16 9:59 ` Tiwei Bie
5 siblings, 0 replies; 7+ messages in thread
From: Tiwei Bie @ 2024-08-16 9:59 UTC (permalink / raw)
To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie
The definitions of these functions do not exist anymore.
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
arch/um/include/shared/skas/skas.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/um/include/shared/skas/skas.h b/arch/um/include/shared/skas/skas.h
index ebaa116de30b..85c50122ab98 100644
--- a/arch/um/include/shared/skas/skas.h
+++ b/arch/um/include/shared/skas/skas.h
@@ -10,10 +10,8 @@
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);
extern unsigned long current_stub_stack(void);
extern struct mm_id *current_mm_id(void);
extern void current_mm_sync(void);
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread