public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Some minor cleanups for UML
@ 2024-08-16  1:54 Tiwei Bie
  2024-08-16  1:54 ` [PATCH 1/6] um: Remove unused kpte_clear_flush macro Tiwei Bie
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Tiwei Bie @ 2024-08-16  1:54 UTC (permalink / raw)
  To: richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel, Tiwei Bie

Tiwei Bie (6):
  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 declarations of undefined functions

 arch/um/include/asm/pgtable.h           |  7 -------
 arch/um/include/asm/processor-generic.h | 10 +---------
 arch/um/include/shared/skas/mm_id.h     |  1 -
 arch/um/include/shared/skas/skas.h      |  2 --
 arch/um/kernel/exec.c                   |  3 ---
 arch/um/kernel/tlb.c                    | 17 +++++++----------
 6 files changed, 8 insertions(+), 32 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/6] um: Remove unused kpte_clear_flush macro
  2024-08-16  1:54 [PATCH 0/6] Some minor cleanups for UML Tiwei Bie
@ 2024-08-16  1:54 ` Tiwei Bie
  2024-08-16  1:54 ` [PATCH 2/6] um: Remove the redundant newpage check in update_pte_range Tiwei Bie
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Tiwei Bie @ 2024-08-16  1:54 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 related	[flat|nested] 9+ messages in thread

* [PATCH 2/6] um: Remove the redundant newpage check in update_pte_range
  2024-08-16  1:54 [PATCH 0/6] Some minor cleanups for UML Tiwei Bie
  2024-08-16  1:54 ` [PATCH 1/6] um: Remove unused kpte_clear_flush macro Tiwei Bie
@ 2024-08-16  1:54 ` Tiwei Bie
  2024-08-16  1:54 ` [PATCH 3/6] um: Remove unused fields from thread_struct Tiwei Bie
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Tiwei Bie @ 2024-08-16  1:54 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 | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index 44c6fc697f3a..dddbc473baa7 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -82,16 +82,13 @@ 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 related	[flat|nested] 9+ messages in thread

* [PATCH 3/6] um: Remove unused fields from thread_struct
  2024-08-16  1:54 [PATCH 0/6] Some minor cleanups for UML Tiwei Bie
  2024-08-16  1:54 ` [PATCH 1/6] um: Remove unused kpte_clear_flush macro Tiwei Bie
  2024-08-16  1:54 ` [PATCH 2/6] um: Remove the redundant newpage check in update_pte_range Tiwei Bie
@ 2024-08-16  1:54 ` Tiwei Bie
  2024-08-16  1:54 ` [PATCH 4/6] um: Remove unused mm_fd field from mm_id Tiwei Bie
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Tiwei Bie @ 2024-08-16  1:54 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 | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h
index 5a7c05275aa7..864389ee29f6 100644
--- a/arch/um/include/asm/processor-generic.h
+++ b/arch/um/include/asm/processor-generic.h
@@ -28,19 +28,11 @@ 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;
 	} request;
 };
@@ -51,7 +43,7 @@ struct thread_struct {
 	.fault_addr		= NULL, \
 	.prev_sched		= NULL, \
 	.arch			= INIT_ARCH_THREAD, \
-	.request		= { 0 } \
+	.request		= { } \
 }
 
 /*
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/6] um: Remove unused mm_fd field from mm_id
  2024-08-16  1:54 [PATCH 0/6] Some minor cleanups for UML Tiwei Bie
                   ` (2 preceding siblings ...)
  2024-08-16  1:54 ` [PATCH 3/6] um: Remove unused fields from thread_struct Tiwei Bie
@ 2024-08-16  1:54 ` Tiwei Bie
  2024-08-16  5:59   ` Benjamin Berg
  2024-08-16  1:54 ` [PATCH 5/6] um: Remove the call to SUBARCH_EXECVE1 macro Tiwei Bie
  2024-08-16  1:54 ` [PATCH 6/6] um: Remove declarations of undefined functions Tiwei Bie
  5 siblings, 1 reply; 9+ messages in thread
From: Tiwei Bie @ 2024-08-16  1:54 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 | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/um/include/shared/skas/mm_id.h b/arch/um/include/shared/skas/mm_id.h
index 1e76ba40feba..b3571a8afec9 100644
--- a/arch/um/include/shared/skas/mm_id.h
+++ b/arch/um/include/shared/skas/mm_id.h
@@ -8,7 +8,6 @@
 
 struct mm_id {
 	union {
-		int mm_fd;
 		int pid;
 	} u;
 	unsigned long stack;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/6] um: Remove the call to SUBARCH_EXECVE1 macro
  2024-08-16  1:54 [PATCH 0/6] Some minor cleanups for UML Tiwei Bie
                   ` (3 preceding siblings ...)
  2024-08-16  1:54 ` [PATCH 4/6] um: Remove unused mm_fd field from mm_id Tiwei Bie
@ 2024-08-16  1:54 ` Tiwei Bie
  2024-08-16  1:54 ` [PATCH 6/6] um: Remove declarations of undefined functions Tiwei Bie
  5 siblings, 0 replies; 9+ messages in thread
From: Tiwei Bie @ 2024-08-16  1:54 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 related	[flat|nested] 9+ messages in thread

* [PATCH 6/6] um: Remove declarations of undefined functions
  2024-08-16  1:54 [PATCH 0/6] Some minor cleanups for UML Tiwei Bie
                   ` (4 preceding siblings ...)
  2024-08-16  1:54 ` [PATCH 5/6] um: Remove the call to SUBARCH_EXECVE1 macro Tiwei Bie
@ 2024-08-16  1:54 ` Tiwei Bie
  5 siblings, 0 replies; 9+ messages in thread
From: Tiwei Bie @ 2024-08-16  1:54 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 related	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/6] um: Remove unused mm_fd field from mm_id
  2024-08-16  1:54 ` [PATCH 4/6] um: Remove unused mm_fd field from mm_id Tiwei Bie
@ 2024-08-16  5:59   ` Benjamin Berg
  2024-08-16  7:58     ` Tiwei Bie
  0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Berg @ 2024-08-16  5:59 UTC (permalink / raw)
  To: Tiwei Bie, richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel

Hi Tiwei,

On Fri, 2024-08-16 at 09:54 +0800, Tiwei Bie wrote:
> 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 | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/um/include/shared/skas/mm_id.h
> b/arch/um/include/shared/skas/mm_id.h
> index 1e76ba40feba..b3571a8afec9 100644
> --- a/arch/um/include/shared/skas/mm_id.h
> +++ b/arch/um/include/shared/skas/mm_id.h
> @@ -8,7 +8,6 @@
>  
>  struct mm_id {
>  	union {
> -		int mm_fd;
>  		int pid;
>  	} u;
>  	unsigned long stack;

Maybe we should also remove the union here while at it? It is pretty
pointless after all.

Benjamin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/6] um: Remove unused mm_fd field from mm_id
  2024-08-16  5:59   ` Benjamin Berg
@ 2024-08-16  7:58     ` Tiwei Bie
  0 siblings, 0 replies; 9+ messages in thread
From: Tiwei Bie @ 2024-08-16  7:58 UTC (permalink / raw)
  To: Benjamin Berg, richard, anton.ivanov, johannes; +Cc: linux-um, linux-kernel

Hi Benjamin,

On 2024/8/16 13:59, Benjamin Berg wrote:
> Hi Tiwei,
> 
> On Fri, 2024-08-16 at 09:54 +0800, Tiwei Bie wrote:
>> 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 | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/arch/um/include/shared/skas/mm_id.h
>> b/arch/um/include/shared/skas/mm_id.h
>> index 1e76ba40feba..b3571a8afec9 100644
>> --- a/arch/um/include/shared/skas/mm_id.h
>> +++ b/arch/um/include/shared/skas/mm_id.h
>> @@ -8,7 +8,6 @@
>>  
>>  struct mm_id {
>>  	union {
>> -		int mm_fd;
>>  		int pid;
>>  	} u;
>>  	unsigned long stack;
> 
> Maybe we should also remove the union here while at it? It is pretty
> pointless after all.

That makes sense. Will do. Thanks!

Regards,
Tiwei

> 
> Benjamin


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-08-16  7:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16  1:54 [PATCH 0/6] Some minor cleanups for UML Tiwei Bie
2024-08-16  1:54 ` [PATCH 1/6] um: Remove unused kpte_clear_flush macro Tiwei Bie
2024-08-16  1:54 ` [PATCH 2/6] um: Remove the redundant newpage check in update_pte_range Tiwei Bie
2024-08-16  1:54 ` [PATCH 3/6] um: Remove unused fields from thread_struct Tiwei Bie
2024-08-16  1:54 ` [PATCH 4/6] um: Remove unused mm_fd field from mm_id Tiwei Bie
2024-08-16  5:59   ` Benjamin Berg
2024-08-16  7:58     ` Tiwei Bie
2024-08-16  1:54 ` [PATCH 5/6] um: Remove the call to SUBARCH_EXECVE1 macro Tiwei Bie
2024-08-16  1:54 ` [PATCH 6/6] um: Remove declarations of undefined functions Tiwei Bie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox