Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-26 Thread Oleg Nesterov
On 09/26, Liao, Chang wrote: > > 在 2024/9/23 18:52, Oleg Nesterov 写道: > > On 09/23, Will Deacon wrote: > >> > >> However, we should use __GFP_ZERO anyway > >> because I don't think it's a good idea to map an uninitialised page into > >> userspace. > > > > Agreed, and imo this even needs a separate

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-26 Thread Liao, Chang
在 2024/9/23 18:52, Oleg Nesterov 写道: > On 09/23, Will Deacon wrote: >> >> However, we should use __GFP_ZERO anyway >> because I don't think it's a good idea to map an uninitialised page into >> userspace. > > Agreed, and imo this even needs a separate "fix info leak" patch. Do you mean to fill

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-23 Thread Catalin Marinas
On Mon, Sep 23, 2024 at 08:18:57AM +0100, Will Deacon wrote: > On Mon, Sep 23, 2024 at 09:57:14AM +0800, Liao, Chang wrote: > > Unfortunately, the comparison assumes the D-cache and I-cache are already > > in sync for the slot being copied. But this assumption is flawed if we start > > with a page

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-23 Thread Liao, Chang
在 2024/9/23 15:18, Will Deacon 写道: > On Mon, Sep 23, 2024 at 09:57:14AM +0800, Liao, Chang wrote: >> 在 2024/9/20 23:32, Catalin Marinas 写道: >>> On Fri, Sep 20, 2024 at 04:58:31PM +0800, Liao, Chang wrote: 在 2024/9/19 22:18, Oleg Nesterov 写道: > On 09/19, Liao Chang wrote: >> --- a/ar

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-23 Thread Liao, Chang
在 2024/9/22 22:09, Will Deacon 写道: > On Fri, Sep 20, 2024 at 07:32:23PM +0200, Oleg Nesterov wrote: >> On 09/20, Catalin Marinas wrote: >>> >>> On Fri, Sep 20, 2024 at 04:58:31PM +0800, Liao, Chang wrote: 在 2024/9/19 22:18, Oleg Nesterov 写道: > On 09/19, Liao Chang wrote: >

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-23 Thread Oleg Nesterov
On 09/23, Will Deacon wrote: > > However, we should use __GFP_ZERO anyway > because I don't think it's a good idea to map an uninitialised page into > userspace. Agreed, and imo this even needs a separate "fix info leak" patch. Oleg.

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-23 Thread Will Deacon
On Mon, Sep 23, 2024 at 09:57:14AM +0800, Liao, Chang wrote: > 在 2024/9/20 23:32, Catalin Marinas 写道: > > On Fri, Sep 20, 2024 at 04:58:31PM +0800, Liao, Chang wrote: > >> 在 2024/9/19 22:18, Oleg Nesterov 写道: > >>> On 09/19, Liao Chang wrote: > --- a/arch/arm64/kernel/probes/uprobes.c > +

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-22 Thread Liao, Chang
在 2024/9/20 23:32, Catalin Marinas 写道: > On Fri, Sep 20, 2024 at 04:58:31PM +0800, Liao, Chang wrote: >> >> >> 在 2024/9/19 22:18, Oleg Nesterov 写道: >>> On 09/19, Liao Chang wrote: --- a/arch/arm64/kernel/probes/uprobes.c +++ b/arch/arm64/kernel/probes/uprobes.c @@ -17,12 +17,

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-22 Thread Oleg Nesterov
On 09/22, Will Deacon wrote: > > On Fri, Sep 20, 2024 at 07:32:23PM +0200, Oleg Nesterov wrote: > > On 09/20, Catalin Marinas wrote: > > > > > > On Fri, Sep 20, 2024 at 04:58:31PM +0800, Liao, Chang wrote: > > > > > > > > > > > > 在 2024/9/19 22:18, Oleg Nesterov 写道: > > > > > On 09/19, Liao Chang w

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-22 Thread Will Deacon
On Fri, Sep 20, 2024 at 07:32:23PM +0200, Oleg Nesterov wrote: > On 09/20, Catalin Marinas wrote: > > > > On Fri, Sep 20, 2024 at 04:58:31PM +0800, Liao, Chang wrote: > > > > > > > > > 在 2024/9/19 22:18, Oleg Nesterov 写道: > > > > On 09/19, Liao Chang wrote: > > > >> > > > >> --- a/arch/arm64/kernel

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-20 Thread Oleg Nesterov
On 09/20, Catalin Marinas wrote: > > On Fri, Sep 20, 2024 at 04:58:31PM +0800, Liao, Chang wrote: > > > > > > 在 2024/9/19 22:18, Oleg Nesterov 写道: > > > On 09/19, Liao Chang wrote: > > >> > > >> --- a/arch/arm64/kernel/probes/uprobes.c > > >> +++ b/arch/arm64/kernel/probes/uprobes.c > > >> @@ -17,1

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-20 Thread Catalin Marinas
On Fri, Sep 20, 2024 at 04:58:31PM +0800, Liao, Chang wrote: > > > 在 2024/9/19 22:18, Oleg Nesterov 写道: > > On 09/19, Liao Chang wrote: > >> > >> --- a/arch/arm64/kernel/probes/uprobes.c > >> +++ b/arch/arm64/kernel/probes/uprobes.c > >> @@ -17,12 +17,16 @@ void arch_uprobe_copy_ixol(struct page

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-20 Thread Oleg Nesterov
On 09/20, Liao, Chang wrote: > > 在 2024/9/19 22:18, Oleg Nesterov 写道: > > On 09/19, Liao Chang wrote: > >> > >> --- a/arch/arm64/kernel/probes/uprobes.c > >> +++ b/arch/arm64/kernel/probes/uprobes.c > >> @@ -17,12 +17,16 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned > >> long vaddr, >

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-20 Thread Liao, Chang
在 2024/9/19 22:18, Oleg Nesterov 写道: > On 09/19, Liao Chang wrote: >> >> --- a/arch/arm64/kernel/probes/uprobes.c >> +++ b/arch/arm64/kernel/probes/uprobes.c >> @@ -17,12 +17,16 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned >> long vaddr, >> void *xol_page_kaddr = kmap_atomic(p

Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-19 Thread Oleg Nesterov
On 09/19, Liao Chang wrote: > > --- a/arch/arm64/kernel/probes/uprobes.c > +++ b/arch/arm64/kernel/probes/uprobes.c > @@ -17,12 +17,16 @@ void arch_uprobe_copy_ixol(struct page *page, unsigned > long vaddr, > void *xol_page_kaddr = kmap_atomic(page); > void *dst = xol_page_kaddr + (vad

[PATCH] arm64: uprobes: Optimize cache flushes for xol slot

2024-09-19 Thread Liao Chang
The profiling of single-thread selftests bench reveals a bottlenect in caches_clean_inval_pou() on ARM64. On my local testing machine, this function takes approximately 34% of CPU cycles for trig-uprobe-nop and trig-uprobe-push. This patch add a check to avoid unnecessary cache flush when writing