mbox series

[0/2] make weak attributes in {k,u}probes

Message ID 20220917015522.44583-1-zouyipeng@huawei.com (mailing list archive)
Headers show
Series make weak attributes in {k,u}probes | expand

Message

Yipeng Zou Sept. 17, 2022, 1:55 a.m. UTC
We have some function implementation under some arch does nothing.
We can mark it with weak attributes to improve.
1. arch_init_kprobes in kprobes
2. arch_uprobe_exception_notify in uprobes

Yipeng Zou (2):
  kprobes: make arch_init_kprobes as weak
  uprobes: make arch_uprobe_exception_notify as weak

 arch/arm/probes/uprobes/core.c     | 6 ------
 arch/arm64/kernel/probes/uprobes.c | 6 ------
 arch/csky/kernel/probes/kprobes.c  | 5 -----
 arch/csky/kernel/probes/uprobes.c  | 6 ------
 arch/riscv/kernel/probes/kprobes.c | 5 -----
 arch/riscv/kernel/probes/uprobes.c | 6 ------
 arch/s390/kernel/kprobes.c         | 5 -----
 arch/x86/kernel/kprobes/core.c     | 5 -----
 kernel/events/uprobes.c            | 6 ++++++
 kernel/kprobes.c                   | 5 +++++
 10 files changed, 11 insertions(+), 44 deletions(-)

Comments

Guo Ren Sept. 17, 2022, 10:58 a.m. UTC | #1
It's a riskless cleanup.

Acked-by: Guo Ren <guoren@kernel.org>

On Sat, Sep 17, 2022 at 9:59 AM Yipeng Zou <zouyipeng@huawei.com> wrote:
>
> We have some function implementation under some arch does nothing.
> We can mark it with weak attributes to improve.
> 1. arch_init_kprobes in kprobes
> 2. arch_uprobe_exception_notify in uprobes
>
> Yipeng Zou (2):
>   kprobes: make arch_init_kprobes as weak
>   uprobes: make arch_uprobe_exception_notify as weak
>
>  arch/arm/probes/uprobes/core.c     | 6 ------
>  arch/arm64/kernel/probes/uprobes.c | 6 ------
>  arch/csky/kernel/probes/kprobes.c  | 5 -----
>  arch/csky/kernel/probes/uprobes.c  | 6 ------
>  arch/riscv/kernel/probes/kprobes.c | 5 -----
>  arch/riscv/kernel/probes/uprobes.c | 6 ------
>  arch/s390/kernel/kprobes.c         | 5 -----
>  arch/x86/kernel/kprobes/core.c     | 5 -----
>  kernel/events/uprobes.c            | 6 ++++++
>  kernel/kprobes.c                   | 5 +++++
>  10 files changed, 11 insertions(+), 44 deletions(-)
>
> --
> 2.17.1
>
Naveen N. Rao Sept. 20, 2022, 5:02 p.m. UTC | #2
Yipeng Zou wrote:
> We have some function implementation under some arch does nothing.
> We can mark it with weak attributes to improve.

That's not always an improvement. See [1] for an example, among many 
other patches to reduce use of __weak functions in the kernel.

As an alternative, please consider the approach used in [1].


- Naveen

[1] https://lore.kernel.org/all/20220519091237.676736-1-naveen.n.rao@linux.vnet.ibm.com/
Peter Zijlstra Sept. 21, 2022, 8:25 a.m. UTC | #3
On Tue, Sep 20, 2022 at 10:32:46PM +0530, Naveen N. Rao wrote:
> Yipeng Zou wrote:
> > We have some function implementation under some arch does nothing.
> > We can mark it with weak attributes to improve.
> 
> That's not always an improvement. See [1] for an example, among many other
> patches to reduce use of __weak functions in the kernel.

More weak 'fun':

  https://lkml.kernel.org/r/20220419203807.655552918@infradead.org