2023-04-11 07:20:55

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH 0/2] Clean up uprobes for MIPS

When I read uprobes code of all archs, I found that some code for MIPS
is useless, so do some cleanups.

Tiezhu Yang (2):
MIPS: Use def_bool y for ARCH_SUPPORTS_UPROBES
MIPS: Remove set_swbp() in uprobes.c

arch/mips/Kconfig | 3 +--
arch/mips/kernel/uprobes.c | 18 ------------------
2 files changed, 1 insertion(+), 20 deletions(-)

--
2.1.0


2023-04-11 07:21:41

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH 1/2] MIPS: Use def_bool y for ARCH_SUPPORTS_UPROBES

Like all the other archs, use def_bool y for ARCH_SUPPORTS_UPROBES,
then no need to select ARCH_SUPPORTS_UPROBES.

Signed-off-by: Tiezhu Yang <[email protected]>
---
arch/mips/Kconfig | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index a975f14..db9e8fc 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -16,7 +16,6 @@ config MIPS
select ARCH_HAS_UBSAN_SANITIZE_ALL
select ARCH_HAS_GCOV_PROFILE_ALL
select ARCH_KEEP_MEMBLOCK
- select ARCH_SUPPORTS_UPROBES
select ARCH_USE_BUILTIN_BSWAP
select ARCH_USE_CMPXCHG_LOCKREF if 64BIT
select ARCH_USE_MEMTEST
@@ -1060,7 +1059,7 @@ config FW_CFE
bool

config ARCH_SUPPORTS_UPROBES
- bool
+ def_bool y

config DMA_NONCOHERENT
bool
--
2.1.0

2023-04-11 07:22:04

by Tiezhu Yang

[permalink] [raw]
Subject: [PATCH 2/2] MIPS: Remove set_swbp() in uprobes.c

set_swbp() in arch/mips/kernel/uprobes.c is same with the weak version
in kernel/events/uprobes.c, remove it.

Signed-off-by: Tiezhu Yang <[email protected]>
---
arch/mips/kernel/uprobes.c | 18 ------------------
1 file changed, 18 deletions(-)

diff --git a/arch/mips/kernel/uprobes.c b/arch/mips/kernel/uprobes.c
index 6c063aa..6b630ed 100644
--- a/arch/mips/kernel/uprobes.c
+++ b/arch/mips/kernel/uprobes.c
@@ -207,24 +207,6 @@ unsigned long arch_uretprobe_hijack_return_addr(
return ra;
}

-/**
- * set_swbp - store breakpoint at a given address.
- * @auprobe: arch specific probepoint information.
- * @mm: the probed process address space.
- * @vaddr: the virtual address to insert the opcode.
- *
- * For mm @mm, store the breakpoint instruction at @vaddr.
- * Return 0 (success) or a negative errno.
- *
- * This version overrides the weak version in kernel/events/uprobes.c.
- * It is required to handle MIPS16 and microMIPS.
- */
-int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm,
- unsigned long vaddr)
-{
- return uprobe_write_opcode(auprobe, mm, vaddr, UPROBE_SWBP_INSN);
-}
-
void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
void *src, unsigned long len)
{
--
2.1.0

2023-04-12 13:40:25

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH 0/2] Clean up uprobes for MIPS

On Tue, Apr 11, 2023 at 03:17:46PM +0800, Tiezhu Yang wrote:
> When I read uprobes code of all archs, I found that some code for MIPS
> is useless, so do some cleanups.
>
> Tiezhu Yang (2):
> MIPS: Use def_bool y for ARCH_SUPPORTS_UPROBES
> MIPS: Remove set_swbp() in uprobes.c
>
> arch/mips/Kconfig | 3 +--
> arch/mips/kernel/uprobes.c | 18 ------------------
> 2 files changed, 1 insertion(+), 20 deletions(-)

series applied to mips-next.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]