Re: [PATCH] livepatch: introduce klp_func called interface

2024-06-04 Thread Song Liu
On Tue, May 21, 2024 at 1:04 AM Petr Mladek wrote: [...] > > > > Yes, but the information you get is limited compared to what is available > > now. You would obtain the information that a patched function was called > > but ftrace could also give you the context and more. > > Another motivation

[PATCH] kallsyms, livepatch: Fix livepatch with CONFIG_LTO_CLANG

2024-06-04 Thread Song Liu
this by calling kallsyms_on_each_match_symbol without the postfix; and then match the full name (with postfix) in klp_match_callback. Signed-off-by: Song Liu --- include/linux/kallsyms.h | 13 + kernel/kallsyms.c| 21 - kernel/livepatch/core.c | 32

Re: [PATCH v6 08/16] mm/execmem, arch: convert remaining overrides of module_alloc to execmem

2024-04-26 Thread Song Liu
g > warnings when the initial allocation fails but there is a fallback range > defined. > > Signed-off-by: Mike Rapoport (IBM) > Acked-by: Will Deacon nit: We should probably move the logic for ARCH_WANTS_EXECMEM_LATE to a separate patch. Otherwise, Acked-by: Song Liu

Re: [PATCH v6 07/16] mm/execmem, arch: convert simple overrides of module_alloc to execmem

2024-04-26 Thread Song Liu
ture does > not implement execmem_arch_setup(), execmem_alloc() will fall back to > module_alloc(). > > Signed-off-by: Mike Rapoport (IBM) Acked-by: Song Liu

Re: [PATCH v6 06/16] mm: introduce execmem_alloc() and execmem_free()

2024-04-26 Thread Song Liu
will be used to identify the calling subsystem and to > allow architectures define parameters for ranges suitable for that > subsystem. > > No functional changes. > > Signed-off-by: Mike Rapoport (IBM) > Acked-by: Masami Hiramatsu (Google) Acked-by: Song Liu

Re: [PATCH v6 05/16] module: make module_memory_{alloc,free} more self-contained

2024-04-26 Thread Song Liu
On Fri, Apr 26, 2024 at 1:30 AM Mike Rapoport wrote: > > From: "Mike Rapoport (IBM)" > > Move the logic related to the memory allocation and freeing into > module_memory_alloc() and module_memory_free(). > > Signed-off-by: Mike Rapoport (IBM) Acked-by: Song Liu

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-22 Thread Song Liu
Hi Masami and Mike, On Sat, Apr 20, 2024 at 2:11 AM Masami Hiramatsu wrote: [...] > > > > > > IIUC, we need to update __execmem_cache_alloc() to take a range pointer as > > > input. module text will use "range" for EXECMEM_MODULE_TEXT, while kprobe > > > will use "range" for EXECMEM_KPROBE.

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-19 Thread Song Liu
On Fri, Apr 19, 2024 at 1:00 PM Mike Rapoport wrote: > > On Fri, Apr 19, 2024 at 10:32:39AM -0700, Song Liu wrote: > > On Fri, Apr 19, 2024 at 10:03 AM Mike Rapoport wrote: > > [...] > > > > > > > > > > [1] > > > > > https

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-19 Thread Song Liu
On Fri, Apr 19, 2024 at 10:03 AM Mike Rapoport wrote: [...] > > > > > > [1] https://lore.kernel.org/all/20240411160526.2093408-1-r...@kernel.org > > > > For the ROX to work, we need different users (module text, kprobe, etc.) to > > have > > the same execmem_range. From [1]: > > > > static void

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-19 Thread Song Liu
On Thu, Apr 18, 2024 at 11:56 PM Mike Rapoport wrote: > > On Thu, Apr 18, 2024 at 02:01:22PM -0700, Song Liu wrote: > > On Thu, Apr 18, 2024 at 10:54 AM Mike Rapoport wrote: > > > > > > On Thu, Apr 18, 2024 at 09:13:27AM -0700, Song Liu wrote: > > >

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-18 Thread Song Liu
On Thu, Apr 18, 2024 at 10:54 AM Mike Rapoport wrote: > > On Thu, Apr 18, 2024 at 09:13:27AM -0700, Song Liu wrote: > > On Thu, Apr 18, 2024 at 8:37 AM Mike Rapoport wrote: > > > > > > > > > > I'm looking at execmem_types more as definition of the cons

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-18 Thread Song Liu
On Thu, Apr 18, 2024 at 8:37 AM Mike Rapoport wrote: > [...] > > > > Is +/- 2G enough for all realistic use cases? If so, I guess we don't > > really need > > EXECMEM_ANYWHERE below? > > > > > > > > > > * I'm not sure about BPF's requirements; it seems happy doing the same > > > > as > > > >

Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free()

2024-04-17 Thread Song Liu
On Tue, Apr 16, 2024 at 12:23 AM Mike Rapoport wrote: > > On Mon, Apr 15, 2024 at 06:36:39PM +0100, Mark Rutland wrote: > > On Mon, Apr 15, 2024 at 09:52:41AM +0200, Peter Zijlstra wrote: > > > On Thu, Apr 11, 2024 at 07:00:41PM +0300, Mike Rapoport wrote: > > > > +/** > > > > + * enum

Re: [RFC][PATCH 0/4] Make bpf_jit and kprobes work with CONFIG_MODULES=n

2024-03-06 Thread Song Liu
-- if we're going to all this might as well do it > > now. And for that I'd just like to ask you paint the bikeshed with > > Song Liu as he's been the one slowly making way to help us get there > > with the "module: replace module_layout with module_memory", > > an

Re: [PATCH] tracing/kprobes: Fix symbol counting logic by looking at modules as well

2023-10-27 Thread Song Liu
n EADDRNOTAVAIL when func matches > several symbols") > Signed-off-by: Andrii Nakryiko Acked-by: Song Liu

Re: [PATCH v3 02/13] mm: introduce execmem_text_alloc() and execmem_free()

2023-09-23 Thread Song Liu
On Sat, Sep 23, 2023 at 8:39 AM Mike Rapoport wrote: > > On Thu, Sep 21, 2023 at 03:34:18PM -0700, Song Liu wrote: > > On Mon, Sep 18, 2023 at 12:30 AM Mike Rapoport wrote: > > > > > > > [...] > > > > > diff --git a/arch/s390/kernel/module.c b/ar

Re: [PATCH v3 06/13] mm/execmem: introduce execmem_data_alloc()

2023-09-22 Thread Song Liu
On Fri, Sep 22, 2023 at 12:17 AM Christophe Leroy wrote: > > > > Le 22/09/2023 à 00:52, Song Liu a écrit : > > On Mon, Sep 18, 2023 at 12:31 AM Mike Rapoport wrote: > >> > > [...] > >> diff --git a/include/linux/execmem.h b/include/linux/execmem.h &g

Re: [PATCH v3 06/13] mm/execmem: introduce execmem_data_alloc()

2023-09-21 Thread Song Liu
On Mon, Sep 18, 2023 at 12:31 AM Mike Rapoport wrote: > [...] > diff --git a/include/linux/execmem.h b/include/linux/execmem.h > index 519bdfdca595..09d45ac786e9 100644 > --- a/include/linux/execmem.h > +++ b/include/linux/execmem.h > @@ -29,6 +29,7 @@ > * @EXECMEM_KPROBES: parameters for

Re: [PATCH v3 02/13] mm: introduce execmem_text_alloc() and execmem_free()

2023-09-21 Thread Song Liu
On Mon, Sep 18, 2023 at 12:30 AM Mike Rapoport wrote: > [...] > diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c > index 42215f9404af..db5561d0c233 100644 > --- a/arch/s390/kernel/module.c > +++ b/arch/s390/kernel/module.c > @@ -21,6 +21,7 @@ > #include > #include >

Re: [PATCH v3 09/13] powerpc: extend execmem_params for kprobes allocations

2023-09-21 Thread Song Liu
On Mon, Sep 18, 2023 at 12:31 AM Mike Rapoport wrote: > [...] > @@ -135,5 +138,13 @@ struct execmem_params __init *execmem_arch_params(void) > > range->pgprot = prot; > > + execmem_params.ranges[EXECMEM_KPROBES].start = VMALLOC_START; > +

Re: [PATCH v3 02/13] mm: introduce execmem_text_alloc() and execmem_free()

2023-09-21 Thread Song Liu
On Mon, Sep 18, 2023 at 12:30 AM Mike Rapoport wrote: > [...] > + > +/** > + * enum execmem_type - types of executable memory ranges > + * > + * There are several subsystems that allocate executable memory. > + * Architectures define different restrictions on placement, > + * permissions,

Re: [PATCH v3 02/13] mm: introduce execmem_text_alloc() and execmem_free()

2023-09-21 Thread Song Liu
On Mon, Sep 18, 2023 at 12:30 AM Mike Rapoport wrote: > [...] > + > +#include > +#include > +#include > +#include > + > +static void *execmem_alloc(size_t size) > +{ > + return module_alloc(size); > +} > + > +void *execmem_text_alloc(enum execmem_type type, size_t size) > +{ > +

Re: [PATCH v4 3/4] perf-stat: introduce config stat.bpf-counter-events

2021-04-20 Thread Song Liu
> On Apr 20, 2021, at 10:31 AM, Jiri Olsa wrote: > > On Mon, Apr 19, 2021 at 01:36:48PM -0700, Song Liu wrote: > > SNIP > >> if (stat_config.initial_delay < 0) { >> @@ -784,11 +790,11 @@ static int __run_perf_stat(int argc, c

[PATCH v4 4/4] perf-stat: introduce ':b' modifier

2021-04-19 Thread Song Liu
# use bpf for both cycles and cs Suggested-by: Jiri Olsa Signed-off-by: Song Liu --- tools/perf/util/bpf_counter.c | 2 +- tools/perf/util/evsel.h| 1 + tools/perf/util/parse-events.c | 8 +++- tools/perf/util/parse-events.l | 2 +- 4 files changed, 10 insertions(+), 3 deletions

[PATCH v4 3/4] perf-stat: introduce config stat.bpf-counter-events

2021-04-19 Thread Song Liu
e sesssion. For example: perf config stat.bpf-counter-events=instructions perf stat -e instructions,cs The second command will use BPF for "instructions" but not "cs". Signed-off-by: Song Liu --- tools/perf/Documentation/perf-stat.txt | 2 ++ tools/perf/bu

[PATCH v4 2/4] perf bpf: check perf_attr_map is compatible with the perf binary

2021-04-19 Thread Song Liu
perf_attr_map could be shared among different version of perf binary. Add bperf_attr_map_compatible() to check whether the existing attr_map is compatible with current perf binary. Signed-off-by: Song Liu --- tools/perf/util/bpf_counter.c | 19 +++ 1 file changed, 19 insertions

[PATCH v4 1/4] perf util: move bpf_perf definitions to a libperf header

2021-04-19 Thread Song Liu
By following the same protocol, other tools can share hardware PMCs with perf. Move perf_event_attr_map_entry and BPF_PERF_DEFAULT_ATTR_MAP_PATH to bpf_perf.h for other tools to use. Signed-off-by: Song Liu --- tools/lib/perf/include/perf/bpf_perf.h | 31 ++ tools/perf

[PATCH v4 0/4] perf util: bpf perf improvements

2021-04-19 Thread Song Liu
ges v1 => v2: 1. Separte 2/3 from 1/3. (Jiri) 2. Rename bperf.h to bpf_perf.h. (Jiri) 3. Other small fixes/optimizations. (Jiri) Song Liu (4): perf util: move bpf_perf definitions to a libperf header perf bpf: check perf_attr_map is compatible with the perf binary perf-stat: introdu

Re: [PATCH v3 3/4] perf-stat: introduce config stat.bpf-counter-events

2021-04-19 Thread Song Liu
> On Apr 19, 2021, at 7:26 AM, Jiri Olsa wrote: > > On Fri, Apr 16, 2021 at 03:13:24PM -0700, Song Liu wrote: > > SNIP > >> +/* >> + * Returns: >> + * 0 if all events use BPF; >> + * 1 if some events do NOT use BPF; >&

Re: [PATCH v3 3/4] perf-stat: introduce config stat.bpf-counter-events

2021-04-19 Thread Song Liu
> On Apr 17, 2021, at 9:45 AM, Namhyung Kim wrote: > > Hi Song, > > On Sat, Apr 17, 2021 at 7:13 AM Song Liu wrote: >> >> Currently, to use BPF to aggregate perf event counters, the user uses >> --bpf-counters option. Enable "use bpf by default&quo

[PATCH v3 3/4] perf-stat: introduce config stat.bpf-counter-events

2021-04-16 Thread Song Liu
e sesssion. For example: perf config stat.bpf-counter-events=instructions perf stat -e instructions,cs The second command will use BPF for "instructions" but not "cs". Signed-off-by: Song Liu --- tools/perf/Documentation/perf-stat.txt | 2 ++ tools/perf/bu

[PATCH v3 4/4] perf-stat: introduce ':b' modifier

2021-04-16 Thread Song Liu
# use bpf for both cycles and cs Suggested-by: Jiri Olsa Signed-off-by: Song Liu --- tools/perf/util/bpf_counter.c | 2 +- tools/perf/util/evsel.h| 1 + tools/perf/util/parse-events.c | 8 +++- tools/perf/util/parse-events.l | 2 +- 4 files changed, 10 insertions(+), 3 deletions

[PATCH v3 2/4] perf bpf: check perf_attr_map is compatible with the perf binary

2021-04-16 Thread Song Liu
perf_attr_map could be shared among different version of perf binary. Add bperf_attr_map_compatible() to check whether the existing attr_map is compatible with current perf binary. Signed-off-by: Song Liu --- tools/perf/util/bpf_counter.c | 19 +++ 1 file changed, 19 insertions

[PATCH v3 1/4] perf util: move bpf_perf definitions to a libperf header

2021-04-16 Thread Song Liu
By following the same protocol, other tools can share hardware PMCs with perf. Move perf_event_attr_map_entry and BPF_PERF_DEFAULT_ATTR_MAP_PATH to bpf_perf.h for other tools to use. Signed-off-by: Song Liu --- tools/lib/perf/include/perf/bpf_perf.h | 31 ++ tools/perf

[PATCH v3 0/4] perf util: bpf perf improvements

2021-04-16 Thread Song Liu
ier. (Jiri) 2. Allow configuring stat.bpf-counter-events with any event name (instead of limiting to hardware events). (Jiri) Changes v1 => v2: 1. Separte 2/3 from 1/3. (Jiri) 2. Rename bperf.h to bpf_perf.h. (Jiri) 3. Other small fixes/optimizations. (Jiri) Song Liu (4): perf util

Re: [PATCH v2 3/3] perf-stat: introduce config stat.bpf-counter-events

2021-04-08 Thread Song Liu
> On Apr 8, 2021, at 11:24 AM, Jiri Olsa wrote: > > On Thu, Apr 08, 2021 at 06:08:20PM +0000, Song Liu wrote: >> >> >>> On Apr 8, 2021, at 10:45 AM, Jiri Olsa wrote: >>> >>> On Thu, Apr 08, 2021 at 05:28:10PM +, Song Liu wrote: >>

Re: [PATCH v2 3/3] perf-stat: introduce config stat.bpf-counter-events

2021-04-08 Thread Song Liu
> On Apr 8, 2021, at 11:50 AM, Arnaldo Carvalho de Melo wrote: > > Em Thu, Apr 08, 2021 at 08:24:47PM +0200, Jiri Olsa escreveu: >> On Thu, Apr 08, 2021 at 06:08:20PM +, Song Liu wrote: >>> >>> >>>> On Apr 8, 2021, at 10:45 AM, Jiri Olsa wr

Re: [PATCH v2 3/3] perf-stat: introduce config stat.bpf-counter-events

2021-04-08 Thread Song Liu
> On Apr 8, 2021, at 10:45 AM, Jiri Olsa wrote: > > On Thu, Apr 08, 2021 at 05:28:10PM +0000, Song Liu wrote: >> >> >>> On Apr 8, 2021, at 10:20 AM, Jiri Olsa wrote: >>> >>> On Thu, Apr 08, 2021 at 04:39:33PM +, Song Liu wrote: >>

Re: [PATCH v2 3/3] perf-stat: introduce config stat.bpf-counter-events

2021-04-08 Thread Song Liu
> On Apr 8, 2021, at 10:20 AM, Jiri Olsa wrote: > > On Thu, Apr 08, 2021 at 04:39:33PM +0000, Song Liu wrote: >> >> >>> On Apr 8, 2021, at 4:47 AM, Jiri Olsa wrote: >>> >>> On Tue, Apr 06, 2021 at 05:36:01PM -0700, Song Liu wrote: &g

Re: [PATCH v2 3/3] perf-stat: introduce config stat.bpf-counter-events

2021-04-08 Thread Song Liu
> On Apr 8, 2021, at 4:47 AM, Jiri Olsa wrote: > > On Tue, Apr 06, 2021 at 05:36:01PM -0700, Song Liu wrote: >> Currently, to use BPF to aggregate perf event counters, the user uses >> --bpf-counters option. Enable "use bpf by default" events with a config >

[PATCH v2 3/3] perf-stat: introduce config stat.bpf-counter-events

2021-04-06 Thread Song Liu
n the same sesssion. For example: perf config stat.bpf-counter-events=instructions perf stat -e instructions,cs The second command will use BPF for "instructions" but not "cs". Signed-off-by: Song Liu --- tools/perf/Documentation/perf-stat.txt | 2 ++ tools/perf/bu

[PATCH v2 1/3] perf util: move bpf_perf definitions to a libperf header

2021-04-06 Thread Song Liu
By following the same protocol, other tools can share hardware PMCs with perf. Move perf_event_attr_map_entry and BPF_PERF_DEFAULT_ATTR_MAP_PATH to bpf_perf.h for other tools to use. Signed-off-by: Song Liu --- tools/lib/perf/include/perf/bpf_perf.h | 31 ++ tools/perf

[PATCH v2 2/3] perf bpf: check perf_attr_map is compatible with the perf binary

2021-04-06 Thread Song Liu
perf_attr_map could be shared among different version of perf binary. Add bperf_attr_map_compatible() to check whether the existing attr_map is compatible with current perf binary. Signed-off-by: Song Liu --- tools/perf/util/bpf_counter.c | 19 +++ 1 file changed, 19 insertions

[PATCH v2 0/3] perf util: bpf perf improvements

2021-04-06 Thread Song Liu
f.h. (Jiri) 3. Other small fixes/optimizations. (Jiri) Song Liu (3): perf util: move bpf_perf definitions to a libperf header perf bpf: check perf_attr_map is compatible with the perf binary perf-stat: introduce config stat.bpf-counter-events tools/lib/perf/include/perf/bpf_perf.h |

Re: [PATCH 2/2] perf-stat: introduce config stat.bpf-counter-events

2021-04-06 Thread Song Liu
> On Apr 6, 2021, at 7:21 AM, Jiri Olsa wrote: > > On Fri, Apr 02, 2021 at 05:29:38PM -0700, Song Liu wrote: >> Currently, to use BPF to aggregate perf event counters, the user uses >> --bpf-counters option. Enable "use bpf by default" events with a config >

Re: [PATCH 1/2] perf util: move bperf definitions to a libperf header

2021-04-06 Thread Song Liu
> On Apr 6, 2021, at 7:21 AM, Jiri Olsa wrote: > > On Fri, Apr 02, 2021 at 05:29:37PM -0700, Song Liu wrote: >> By following the same protocol, other tools can share hardware PMCs with >> perf. Move perf_event_attr_map_entry and BPERF_DEFAULT_ATTR_MAP_PATH to >> bpe

[PATCH 2/2] perf-stat: introduce config stat.bpf-counter-events

2021-04-02 Thread Song Liu
n the same sesssion. For example: perf config stat.bpf-counter-events=instructions perf stat -e instructions,cs The second command will use BPF for "instructions" but not "cs". Signed-off-by: Song Liu --- tools/perf/Documentation/perf-stat.txt | 2 ++ tools/perf/bu

[PATCH 1/2] perf util: move bperf definitions to a libperf header

2021-04-02 Thread Song Liu
-off-by: Song Liu --- tools/lib/perf/include/perf/bperf.h | 29 +++ tools/perf/util/bpf_counter.c | 44 ++--- 2 files changed, 50 insertions(+), 23 deletions(-) create mode 100644 tools/lib/perf/include/perf/bperf.h diff --git a/tools/lib/perf/include

Re: [PATCH -next] libbpf: remove redundant semi-colon

2021-04-01 Thread Song Liu
On Thu, Apr 1, 2021 at 10:58 AM Yang Yingliang wrote: > > Signed-off-by: Yang Yingliang Please add a short commit log. Thanks, Song > --- > tools/lib/bpf/linker.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c > index

Re: [PATCH] linux/bpf.h: Remove repeated struct declaration

2021-04-01 Thread Song Liu
On Thu, Apr 1, 2021 at 12:22 AM Wan Jiabing wrote: > > struct btf_type is declared twice. One is declared at 35th line. > The blew one is not needed. Remove the duplicate. > > Signed-off-by: Wan Jiabing Acked-by: Song Liu

Re: [PATCH] linux/bpf-cgroup.h: Delete repeated struct declaration

2021-04-01 Thread Song Liu
> On Mar 31, 2021, at 11:46 PM, Wan Jiabing wrote: > > struct bpf_prog is declared twice. There is one declaration > which is independent on the MACRO at 18th line. > So the below one is not needed though. Remove the duplicate. > > Signed-off-by: Wan Jiabing

Re: [PATCH 1/2] perf/core: Share an event with multiple cgroups

2021-04-01 Thread Song Liu
> On Mar 30, 2021, at 8:11 AM, Namhyung Kim wrote: > > On Tue, Mar 30, 2021 at 3:33 PM Song Liu wrote: >>> On Mar 29, 2021, at 4:33 AM, Namhyung Kim wrote: >>> >>> On Mon, Mar 29, 2021 at 2:17 AM Song Liu wrote: >>>>> On Mar 23, 2021,

Re: [syzbot] possible deadlock in register_for_each_vma

2021-03-31 Thread Song Liu
> On Mar 31, 2021, at 9:59 AM, Oleg Nesterov wrote: > > On 03/28, Hillf Danton wrote: >> >> On Sat, 27 Mar 2021 18:53:08 Oleg Nesterov wrote: >>> Hi Hillf, >>> >>> it seems that you already understand the problem ;) I don't. >> >> It is simpler than you thought - I always blindly believe

Re: [Patch bpf-next] bpf: remove unused parameter from ___bpf_prog_run

2021-03-31 Thread Song Liu
On Wed, Mar 31, 2021 at 12:14 AM He Fengqing wrote: > > 'stack' parameter is not used in ___bpf_prog_run, > the base address have been set to FP reg. So consequently remove it. > > Signed-off-by: He Fengqing Acked-by: Song Liu

Re: [PATCH bpf-next v2] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-30 Thread Song Liu
> On Mar 30, 2021, at 3:37 PM, Pedro Tammela wrote: > > The current code only checks flags in 'bpf_ringbuf_output()'. > > Signed-off-by: Pedro Tammela Acked-by: Song Liu

Re: [PATCH bpf-next] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-30 Thread Song Liu
> On Mar 30, 2021, at 7:22 AM, Pedro Tammela wrote: > > Em seg., 29 de mar. de 2021 às 13:10, Song Liu > escreveu: >> >> >> >>> On Mar 28, 2021, at 9:10 AM, Pedro Tammela wrote: >>> >>> The current code only checks flags in 'bpf

Re: [Patch bpf-next] net: filter: Remove unused bpf_load_pointer

2021-03-30 Thread Song Liu
On Mon, Mar 29, 2021 at 7:11 PM He Fengqing wrote: > > Remove unused bpf_load_pointer function in filter.h > > Signed-off-by: He Fengqing Acked-by: Song Liu [...]

Re: [PATCH 1/2] perf/core: Share an event with multiple cgroups

2021-03-30 Thread Song Liu
> On Mar 29, 2021, at 4:33 AM, Namhyung Kim wrote: > > On Mon, Mar 29, 2021 at 2:17 AM Song Liu wrote: >>> On Mar 23, 2021, at 9:21 AM, Namhyung Kim wrote: >>> >>> As we can run many jobs (in container) on a big machine, we want to >>> measure

Re: [PATCH] selftests/bpf: add LDFLAGS when building test_verifier

2021-03-29 Thread Song Liu
On Mon, Mar 29, 2021 at 11:13 AM Jisheng Zhang wrote: > > From: Jisheng Zhang > > This is useful for cross compile process to point linker to the > correct libelf, libcap, libz path. LGTM: Acked-by: Song Liu btw: Do we also need LDFLAGS for some other binaries, like test_cpp,

Re: [PATCH bpf-next] libbpf: Add '_wait()' and '_nowait()' macros for 'bpf_ring_buffer__poll()'

2021-03-29 Thread Song Liu
> On Mar 28, 2021, at 9:10 AM, Pedro Tammela wrote: > > 'bpf_ring_buffer__poll()' abstracts the polling method, so abstract the > constants that make the implementation don't wait or wait indefinetly > for data. > > Signed-off-by: Pedro Tammela > --- > tools/lib/bpf/libbpf.h

Re: [PATCH bpf-next] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-29 Thread Song Liu
> On Mar 28, 2021, at 9:10 AM, Pedro Tammela wrote: > > The current code only checks flags in 'bpf_ringbuf_output()'. > > Signed-off-by: Pedro Tammela > --- > include/uapi/linux/bpf.h | 8 > kernel/bpf/ringbuf.c | 13 +++-- > tools/include/uapi/linux/bpf.h |

Re: [PATCH bpf-next] bpf: add 'BPF_RB_MAY_WAKEUP' flag

2021-03-29 Thread Song Liu
p in processing, > so let's provide a more descriptive notation for this value. > > Signed-off-by: Pedro Tammela Acked-by: Song Liu

Re: [PATCH 2/2] perf/core: Support reading group events with shared cgroups

2021-03-28 Thread Song Liu
> On Mar 23, 2021, at 9:21 AM, Namhyung Kim wrote: > > This enables reading event group's counter values together with a > PERF_EVENT_IOC_READ_CGROUP command like we do in the regular read(). > Users should give a correct size of buffer to be read. > > Signed-off-by: Namhyung Kim > --- >

Re: [PATCH 1/2] perf/core: Share an event with multiple cgroups

2021-03-28 Thread Song Liu
> On Mar 23, 2021, at 9:21 AM, Namhyung Kim wrote: > > As we can run many jobs (in container) on a big machine, we want to > measure each job's performance during the run. To do that, the > perf_event can be associated to a cgroup to measure it only. > > However such cgroup events need to

Re: [PATCH] mm, thp: Relax the VM_DENYWRITE constraint on file-backed THPs

2021-03-28 Thread Song Liu
l it be a problem if a slow writer (say a slow scp) writes to the shared library while the shared library is in use? Thanks, Song > > From, > Collin > > On Mon, Mar 22, 2021 at 4:55 PM Song Liu wrote: > On Mon, Mar 22, 2021 at 3:00 PM Collin Fijalkovich > wrote: > >

Re: [PATCH] bpf: remove redundant assignment of variable id

2021-03-26 Thread Song Liu
On Fri, Mar 26, 2021 at 12:45 PM Colin King wrote: > > From: Colin Ian King > > The variable id is being assigned a value that is never > read, the assignment is redundant and can be removed. > > Addresses-Coverity: ("Unused value") > Signed-off-by: C

Re: [PATCH 1/2] perf/core: Share an event with multiple cgroups

2021-03-24 Thread Song Liu
> On Mar 23, 2021, at 9:21 AM, Namhyung Kim wrote: > > As we can run many jobs (in container) on a big machine, we want to > measure each job's performance during the run. To do that, the > perf_event can be associated to a cgroup to measure it only. > > However such cgroup events need to

Re: [PATCH 1/2] perf/core: Share an event with multiple cgroups

2021-03-23 Thread Song Liu
> On Mar 23, 2021, at 9:21 AM, Namhyung Kim wrote: > > As we can run many jobs (in container) on a big machine, we want to > measure each job's performance during the run. To do that, the > perf_event can be associated to a cgroup to measure it only. > > However such cgroup events need to

Re: [PATCH v2 0/3] perf-stat: share hardware PMCs with BPF

2021-03-23 Thread Song Liu
> On Mar 23, 2021, at 2:10 PM, Arnaldo Carvalho de Melo wrote: > > Em Fri, Mar 19, 2021 at 04:14:42PM +0000, Song Liu escreveu: >>> On Mar 19, 2021, at 8:58 AM, Namhyung Kim wrote: >>> On Sat, Mar 20, 2021 at 12:35 AM Arnaldo Carvalho de Melo >>> wrote

Re: [PATCH v2 1/3] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-22 Thread Song Liu
> On Mar 19, 2021, at 11:41 AM, Arnaldo Carvalho de Melo > wrote: > > Em Thu, Mar 18, 2021 at 10:15:13PM +0100, Jiri Olsa escreveu: >> On Tue, Mar 16, 2021 at 02:18:35PM -0700, Song Liu wrote: >>> bperf is off by default. To enable it, pass --bpf-counters option t

Re: [PATCH] mm, thp: Relax the VM_DENYWRITE constraint on file-backed THPs

2021-03-22 Thread Song Liu
On Mon, Mar 22, 2021 at 3:00 PM Collin Fijalkovich wrote: > > Transparent huge pages are supported for read-only non-shmem filesystems, > but are only used for vmas with VM_DENYWRITE. This condition ensures that > file THPs are protected from writes while an application is running > (ETXTBSY).

Re: [PATCH] md: Fix missing unused status line of /proc/mdstat

2021-03-22 Thread Song Liu
On Wed, Mar 17, 2021 at 7:05 AM Jan Glauber wrote: > > Reading /proc/mdstat with a read buffer size that would not > fit the unused status line in the first read will skip this > line from the output. > > So 'dd if=/proc/mdstat bs=64 2>/dev/null' will not print something > like: unused devices:

Re: [PATCH v2 1/3] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-19 Thread Song Liu
> On Mar 19, 2021, at 11:55 AM, Jiri Olsa wrote: > > On Fri, Mar 19, 2021 at 03:41:57PM -0300, Arnaldo Carvalho de Melo wrote: > > SNIP > >> LD >> /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf-in.o >> LINK

Re: [PATCH v2 0/3] perf-stat: share hardware PMCs with BPF

2021-03-19 Thread Song Liu
> On Mar 19, 2021, at 8:58 AM, Namhyung Kim wrote: > > Hi Arnaldo, > > On Sat, Mar 20, 2021 at 12:35 AM Arnaldo Carvalho de Melo > wrote: >> >> Em Fri, Mar 19, 2021 at 09:54:59AM +0900, Namhyung Kim escreveu: >>> On Fri, Mar 19, 2021 at 9:22 AM Song

Re: [PATCH v2 0/3] perf-stat: share hardware PMCs with BPF

2021-03-18 Thread Song Liu
> On Mar 18, 2021, at 5:09 PM, Arnaldo wrote: > > > > On March 18, 2021 6:14:34 PM GMT-03:00, Jiri Olsa wrote: >> On Thu, Mar 18, 2021 at 03:52:51AM +, Song Liu wrote: >>> >>> >>>> On Mar 17, 2021, at 6:11 AM, Arnaldo Carvalho de Me

Re: [PATCH v2 1/3] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-18 Thread Song Liu
> On Mar 18, 2021, at 6:49 AM, Namhyung Kim wrote: > > On Thu, Mar 18, 2021 at 4:22 PM Song Liu wrote: >> >> >> >>> On Mar 17, 2021, at 10:54 PM, Namhyung Kim wrote: >>> >> >> [...] >> >>>> + >>>

Re: [PATCH v2 3/3] perf-test: add a test for perf-stat --bpf-counters option

2021-03-18 Thread Song Liu
> On Mar 17, 2021, at 11:07 PM, Namhyung Kim wrote: > > On Wed, Mar 17, 2021 at 6:18 AM Song Liu wrote: >> >> Add a test to compare the output of perf-stat with and without option >> --bpf-counters. If the difference is more than 10%, the test is considered >

Re: [PATCH v2 1/3] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-18 Thread Song Liu
> On Mar 17, 2021, at 10:54 PM, Namhyung Kim wrote: > [...] >> + >> +static int bperf_reload_leader_program(struct evsel *evsel, int attr_map_fd, >> + struct perf_event_attr_map_entry >> *entry) >> +{ >> + struct bperf_leader_bpf *skel =

Re: [PATCH v2 0/3] perf-stat: share hardware PMCs with BPF

2021-03-18 Thread Song Liu
> On Mar 17, 2021, at 9:32 PM, Namhyung Kim wrote: > > On Thu, Mar 18, 2021 at 12:52 PM Song Liu wrote: >> >> >> >>> On Mar 17, 2021, at 6:11 AM, Arnaldo Carvalho de Melo >>> wrote: >>> >>> Em Wed, Mar 17, 2021 at 02:29:28P

Re: [PATCH v2 0/3] perf-stat: share hardware PMCs with BPF

2021-03-17 Thread Song Liu
> On Mar 17, 2021, at 6:11 AM, Arnaldo Carvalho de Melo wrote: > > Em Wed, Mar 17, 2021 at 02:29:28PM +0900, Namhyung Kim escreveu: >> Hi Song, >> >> On Wed, Mar 17, 2021 at 6:18 AM Song Liu wrote: >>> >>> perf uses performance monitoring coun

[PATCH v2 3/3] perf-test: add a test for perf-stat --bpf-counters option

2021-03-16 Thread Song Liu
) not depend on the behavior of IO subsystem (for less noise from caching). So far, the best option we found is stressapptest. Signed-off-by: Song Liu --- tools/perf/tests/shell/stat_bpf_counters.sh | 34 + 1 file changed, 34 insertions(+) create mode 100755 tools/perf/tests

[PATCH v2 2/3] perf-stat: measure t0 and ref_time after enable_counters()

2021-03-16 Thread Song Liu
Take measurements of t0 and ref_time after enable_counters(), so that they only measure the time consumed when the counters are enabled. Signed-off-by: Song Liu --- tools/perf/builtin-stat.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/perf/builtin-stat.c

[PATCH v2 0/3] perf-stat: share hardware PMCs with BPF

2021-03-16 Thread Song Liu
r default attr-map path. 7. Use cpu__max_cpu() instead of libbpf_num_possible_cpus(). 8. Add flag "enabled" to the follower program. Then move follower attach to bperf__load() and simplify bperf__enable(). Song Liu (3): perf-stat: introduce bperf, share hardware PMCs with BPF

[PATCH v2 1/3] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-16 Thread Song Liu
fs/bpf/perf_attr_map. The user could change the path with option --bpf-attr-map. Signed-off-by: Song Liu --- Known limitations: 1. Do not support per cgroup events; 2. Do not support monitoring of BPF program (perf-stat -b); 3. Do not support event groups; 4. Do not support inherit events during f

Re: [PATCH] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-15 Thread Song Liu
> On Mar 15, 2021, at 8:34 AM, Andi Kleen wrote: > >> I still think that there is value in taking those measurements after we >> enable the counters, as, for instance, for interval mode we want >> measurements with the counters enabled, whatever happens before the >> counters are enabled is

Re: [PATCH] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-15 Thread Song Liu
> On Mar 15, 2021, at 7:09 AM, Jiri Olsa wrote: > > On Mon, Mar 15, 2021 at 07:51:11AM +0000, Song Liu wrote: > > SNIP [...] >> >> It is mostly to cover corner cases, like something else used the same >> name. > > about that.. we just take the o

Re: [PATCH] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-15 Thread Song Liu
> On Mar 14, 2021, at 3:48 PM, Jiri Olsa wrote: > > On Thu, Mar 11, 2021 at 06:02:57PM -0800, Song Liu wrote: >> perf uses performance monitoring counters (PMCs) to monitor system >> performance. The PMCs are limited hardware resources. For example, >> Intel CPU

Re: [PATCH] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-13 Thread Song Liu
> On Mar 13, 2021, at 2:06 PM, Jiri Olsa wrote: > > On Fri, Mar 12, 2021 at 04:09:53PM +0000, Song Liu wrote: >> >> >>> On Mar 12, 2021, at 7:45 AM, Song Liu wrote: >>> >>> >>> >>>> On Mar 12, 2021, at 4:12 AM, Jiri O

Re: [PATCH] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-13 Thread Song Liu
> On Mar 12, 2021, at 6:47 PM, Namhyung Kim wrote: > > On Sat, Mar 13, 2021 at 12:38 AM Song Liu wrote: >> >> >> >>> On Mar 12, 2021, at 12:36 AM, Namhyung Kim wrote: >>> >>> Hi, >>> >>> On Fri, Mar 12, 2021

Re: [PATCH] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-12 Thread Song Liu
> On Mar 12, 2021, at 6:24 AM, Arnaldo Carvalho de Melo wrote: > > Em Thu, Mar 11, 2021 at 06:02:57PM -0800, Song Liu escreveu: >> perf uses performance monitoring counters (PMCs) to monitor system >> performance. The PMCs are limited hardware resources. For example,

Re: [PATCH] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-12 Thread Song Liu
> On Mar 12, 2021, at 7:45 AM, Song Liu wrote: > > > >> On Mar 12, 2021, at 4:12 AM, Jiri Olsa wrote: >> >> On Thu, Mar 11, 2021 at 06:02:57PM -0800, Song Liu wrote: >>> perf uses performance monitoring counters (PMCs) to monitor system >>

Re: [PATCH] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-12 Thread Song Liu
> On Mar 12, 2021, at 6:24 AM, Arnaldo Carvalho de Melo wrote: > > Em Thu, Mar 11, 2021 at 06:02:57PM -0800, Song Liu escreveu: >> perf uses performance monitoring counters (PMCs) to monitor system >> performance. The PMCs are limited hardware resources. For example,

Re: [PATCH] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-12 Thread Song Liu
> On Mar 12, 2021, at 4:12 AM, Jiri Olsa wrote: > > On Thu, Mar 11, 2021 at 06:02:57PM -0800, Song Liu wrote: >> perf uses performance monitoring counters (PMCs) to monitor system >> performance. The PMCs are limited hardware resources. For example, >> Intel CPU

Re: [PATCH] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-12 Thread Song Liu
> On Mar 12, 2021, at 12:36 AM, Namhyung Kim wrote: > > Hi, > > On Fri, Mar 12, 2021 at 11:03 AM Song Liu wrote: >> >> perf uses performance monitoring counters (PMCs) to monitor system >> performance. The PMCs are limited hardware resources. For example,

[PATCH] perf-stat: introduce bperf, share hardware PMCs with BPF

2021-03-11 Thread Song Liu
cles -a perf stat --use-bpf -e cycles -C 1,3,4 perf stat --use-bpf -e cycles -p 123 perf stat --use-bpf -e cycles -t 100,101 Signed-off-by: Song Liu --- tools/perf/Makefile.perf | 1 + tools/perf/builtin-stat.c | 20 +- tools/perf/util/bpf_c

Re: [PATCH 2/3] perf tool: Enable warnings when compiling BPF programs

2021-03-06 Thread Song Liu
> On Mar 6, 2021, at 12:08 AM, Ian Rogers wrote: > > Add -Wall -Werror when compiling BPF skeletons. > > Signed-off-by: Ian Rogers Acked-by: Song Liu > --- > tools/perf/Makefile.perf | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/to

Re: [PATCH 3/3] perf bpf: Minor whitespace cleanup.

2021-03-06 Thread Song Liu
> On Mar 6, 2021, at 12:08 AM, Ian Rogers wrote: > > Missed space after #include. > > Signed-off-by: Ian Rogers Acked-by: Song Liu > --- > tools/perf/util/bpf_counter.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/u

Re: [PATCH 1/3] perf skel: Remove some unused variables.

2021-03-06 Thread Song Liu
> On Mar 6, 2021, at 12:08 AM, Ian Rogers wrote: > > Fixes -Wall warnings. > > Signed-off-by: Ian Rogers Acked-by: Song Liu Thanks for the clean up! > --- > tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-)

[PATCH v6 bpf-next 6/6] bpf: runqslower: use task local storage

2021-02-25 Thread Song Liu
, as those in handle__sched_wakeup, are much faster with task local storage. If we disable hashtab prealloc, task local storage is much faster for all 3 functions. Acked-by: Andrii Nakryiko Signed-off-by: Song Liu --- tools/bpf/runqslower/runqslower.bpf.c | 33 +-- 1 file

[PATCH v6 bpf-next 4/6] selftests/bpf: test deadlock from recursive bpf_task_storage_[get|delete]

2021-02-25 Thread Song Liu
Add a test with recursive bpf_task_storage_[get|delete] from fentry programs on bpf_local_storage_lookup and bpf_local_storage_update. Without proper deadlock prevent mechanism, this test would cause deadlock. Signed-off-by: Song Liu --- .../bpf/prog_tests/task_local_storage.c | 23

  1   2   3   4   5   6   7   8   9   10   >