Re: Copying TLS/user register data per perf-sample?

2024-04-09 Thread Namhyung Kim
Hello, On Thu, Apr 4, 2024 at 12:26 PM Beau Belgrave wrote: > > Hello, > > I'm looking into the possibility of capturing user data that is pointed > to by a user register (IE: fs/gs for TLS on x86/64) for each sample via > perf_events. > > I was hoping to find a way to do this similar to

Re: [PATCH v1 0/4] perf parse-regs: Cleanup config and building

2024-02-16 Thread Namhyung Kim
d defines macro 'HAVE_PERF_REGS_SUPPORT' for statically > compiling the tool. > > [...] Applied to perf-tools-next, thanks! Best regards, -- Namhyung Kim

[PATCH 05/14] tools headers UAPI: Update tools's copy of vhost.h header

2023-11-21 Thread Namhyung Kim
;Michael S. Tsirkin" Cc: Jason Wang Cc: k...@vger.kernel.org Cc: virtualizat...@lists.linux.dev Cc: net...@vger.kernel.org Signed-off-by: Namhyung Kim --- tools/include/uapi/linux/vhost.h | 8 1 file changed, 8 insertions(+) diff --git a/tools/include/uapi/linux/vhost.h b/to

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

2021-04-20 Thread Namhyung Kim
Hi Peter, On Tue, Apr 20, 2021 at 7:28 PM Peter Zijlstra wrote: > > On Fri, Apr 16, 2021 at 06:49:09PM +0900, Namhyung Kim wrote: > > On Thu, Apr 15, 2021 at 11:51 PM Peter Zijlstra > > wrote: > > > > +static void perf_update_cgroup_node(struct perf_event *event

Re: [PATCH v3 3/3] perf tools: Add 'cgroup-switches' software event

2021-04-19 Thread Namhyung Kim
Hi Arnaldo, Could you please pick this up? The kernel part is landed in the tip.git already. Thanks, Namhyung On Wed, Feb 10, 2021 at 5:33 PM Namhyung Kim wrote: > > It counts how often cgroups are changed actually during the context > switches. > > # perf stat -a -e context-

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

2021-04-17 Thread Namhyung Kim
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" events with a config > option, stat.bpf-counter-events. Events with name in the option will use > BPF. > > This

[tip: perf/core] perf core: Add PERF_COUNT_SW_CGROUP_SWITCHES event

2021-04-16 Thread tip-bot2 for Namhyung Kim
The following commit has been merged into the perf/core branch of tip: Commit-ID: d0d1dd628527c77db2391ce0293c1ed344b2365f Gitweb: https://git.kernel.org/tip/d0d1dd628527c77db2391ce0293c1ed344b2365f Author:Namhyung Kim AuthorDate:Wed, 10 Feb 2021 17:33:26 +09:00 Committer

[tip: perf/core] perf core: Factor out __perf_sw_event_sched

2021-04-16 Thread tip-bot2 for Namhyung Kim
The following commit has been merged into the perf/core branch of tip: Commit-ID: 7c8056bb366b1b2dc8e4a3cc0b876e15a8ebca2c Gitweb: https://git.kernel.org/tip/7c8056bb366b1b2dc8e4a3cc0b876e15a8ebca2c Author:Namhyung Kim AuthorDate:Wed, 10 Feb 2021 17:33:25 +09:00 Committer

[tip: perf/core] perf core: Factor out __perf_sw_event_sched

2021-04-16 Thread tip-bot2 for Namhyung Kim
The following commit has been merged into the perf/core branch of tip: Commit-ID: 64f6aeb6dc7a2426278fd9017264cf24bfdbebd6 Gitweb: https://git.kernel.org/tip/64f6aeb6dc7a2426278fd9017264cf24bfdbebd6 Author:Namhyung Kim AuthorDate:Wed, 10 Feb 2021 17:33:25 +09:00 Committer

[tip: perf/core] perf core: Add PERF_COUNT_SW_CGROUP_SWITCHES event

2021-04-16 Thread tip-bot2 for Namhyung Kim
The following commit has been merged into the perf/core branch of tip: Commit-ID: a389ea9c161d142bf11fd4c553988c2daa9f5404 Gitweb: https://git.kernel.org/tip/a389ea9c161d142bf11fd4c553988c2daa9f5404 Author:Namhyung Kim AuthorDate:Wed, 10 Feb 2021 17:33:26 +09:00 Committer

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

2021-04-16 Thread Namhyung Kim
On Fri, Apr 16, 2021 at 8:59 PM Peter Zijlstra wrote: > > On Fri, Apr 16, 2021 at 08:22:38PM +0900, Namhyung Kim wrote: > > On Fri, Apr 16, 2021 at 7:28 PM Peter Zijlstra wrote: > > > > > > On Fri, Apr 16, 2021 at 11:29:30AM +0200, Peter Zijlstra wrote: > &

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

2021-04-16 Thread Namhyung Kim
On Fri, Apr 16, 2021 at 7:28 PM Peter Zijlstra wrote: > > On Fri, Apr 16, 2021 at 11:29:30AM +0200, Peter Zijlstra wrote: > > > > So I think we've had proposals for being able to close fds in the past; > > > while preserving groups etc. We've always pushed back on that because of > > > the

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

2021-04-16 Thread Namhyung Kim
On Fri, Apr 16, 2021 at 6:29 PM Peter Zijlstra wrote: > > > Duh.. this is a half-finished email I meant to save for later. Anyway, > I'll reply more. Nevermind, and thanks for your time! :-) Namhyung

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

2021-04-16 Thread Namhyung Kim
On Fri, Apr 16, 2021 at 6:27 PM Peter Zijlstra wrote: > > On Fri, Apr 16, 2021 at 08:48:12AM +0900, Namhyung Kim wrote: > > On Thu, Apr 15, 2021 at 11:51 PM Peter Zijlstra > > wrote: > > > On Tue, Apr 13, 2021 at 08:53:36AM -0700, Namhyung Kim wrote: > > >

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

2021-04-16 Thread Namhyung Kim
be deleted when the file descriptor of the > > perf_event is closed. > > > > Cc: Tejun Heo > > Reported-by: kernel test robot > > What, the whole thing? Oh, it's just for build issues when !CONFIG_CGROUP_PERF > > > Acked-by: Song Liu > > Signed-off

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

2021-04-15 Thread Namhyung Kim
Hi Peter, Thanks for your review! On Thu, Apr 15, 2021 at 11:51 PM Peter Zijlstra wrote: > > On Tue, Apr 13, 2021 at 08:53:36AM -0700, Namhyung Kim wrote: > > As we can run many jobs (in container) on a big machine, we want to > > measure each job's performance duri

Re: [PATCH] libperf: xyarray: Add bounds checks to xyarray__entry()

2021-04-14 Thread Namhyung Kim
Arnaldo Carvalho de Melo > Cc: Mark Rutland > Cc: Alexander Shishkin > Cc: Jiri Olsa > Cc: Namhyung Kim > Signed-off-by: Rob Herring > --- > tools/lib/perf/include/internal/xyarray.h | 9 - > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git

Re: [PATCH v8 2/4] libperf: Add evsel mmap support

2021-04-14 Thread Namhyung Kim
On Thu, Apr 15, 2021 at 3:23 AM Arnaldo Carvalho de Melo wrote: > > Em Wed, Apr 14, 2021 at 03:02:08PM -0300, Arnaldo Carvalho de Melo escreveu: > > Em Thu, Apr 15, 2021 at 01:41:35AM +0900, Namhyung Kim escreveu: > > > Hello, > > > > > > On Thu, Apr

Re: [PATCH v8 2/4] libperf: Add evsel mmap support

2021-04-14 Thread Namhyung Kim
On Thu, Apr 15, 2021 at 1:53 AM Rob Herring wrote: > > On Wed, Apr 14, 2021 at 11:41 AM Namhyung Kim wrote: > > > > Hello, > > > > On Thu, Apr 15, 2021 at 1:07 AM Rob Herring wrote: > > > +void *perf_evsel__mmap_base(struct perf_e

Re: [PATCH v8 2/4] libperf: Add evsel mmap support

2021-04-14 Thread Namhyung Kim
Hello, On Thu, Apr 15, 2021 at 1:07 AM Rob Herring wrote: > +void *perf_evsel__mmap_base(struct perf_evsel *evsel, int cpu, int thread) > +{ > + if (FD(evsel, cpu, thread) < 0 || MMAP(evsel, cpu, thread) == NULL) > + return NULL; I think you should check the cpu and the

Re: [PATCH V3 2/2] perf/x86: Reset the dirty counter to prevent the leak for an RDPMC task

2021-04-14 Thread Namhyung Kim
Hi Kan, On Wed, Apr 14, 2021 at 4:04 AM wrote: > diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c > index dd9f3c2..0d4a1a3 100644 > --- a/arch/x86/events/core.c > +++ b/arch/x86/events/core.c > @@ -1585,6 +1585,8 @@ static void x86_pmu_del(struct perf_event *event, int > flags) >

Re: [PATCH v7] perf annotate: Fix sample events lost in stdio mode

2021-04-14 Thread Namhyung Kim
Hi Arnaldo, On Wed, Apr 14, 2021 at 9:23 PM Arnaldo Carvalho de Melo wrote: > > Em Mon, Apr 12, 2021 at 03:22:29PM +0800, Yang Jihong escreveu: > > On 2021/3/31 10:18, Yang Jihong wrote: > > > On 2021/3/30 15:26, Namhyung Kim wrote: > > > > On Sat, Mar

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

2021-04-13 Thread Namhyung Kim
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 which includes the total buffer size and the cgroup id. Acked-by: Song Liu Signed-off-by: Namhyung Kim

[PATCH v3 0/2] perf core: Sharing events with multiple cgroups

2021-04-13 Thread Namhyung Kim
usec. Thanks, Namhyung Namhyung Kim (2): perf/core: Share an event with multiple cgroups perf/core: Support reading group events with shared cgroups include/linux/perf_event.h | 22 ++ include/uapi/linux/perf_event.h | 2 + kernel/events/core.c| 591

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

2021-04-13 Thread Namhyung Kim
Signed-off-by: Namhyung Kim --- include/linux/perf_event.h | 22 ++ include/uapi/linux/perf_event.h | 2 + kernel/events/core.c| 480 ++-- 3 files changed, 477 insertions(+), 27 deletions(-) diff --git a/include/linux/perf_event.h b/include/linux

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

2021-04-12 Thread Namhyung Kim
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 which includes the total buffer size and the cgroup id. Acked-by: Song Liu Signed-off-by: Namhyung Kim

[PATCH v2 0/2] perf core: Sharing events with multiple cgroups

2021-04-12 Thread Namhyung Kim
the HW PMU). It keeps the counters in a hash table with cgroup id as a key. With this change, average processing time of my internal test workload which runs tasks in a different cgroup and communicates by pipes dropped from 11.3 usec to 5.8 usec. Thanks, Namhyung Namhyung Kim (2): perf/core

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

2021-04-12 Thread Namhyung Kim
and timings. This attaches all cgroups in a single syscall and I didn't add the DETACH command deliberately to make the implementation simple. The attached cgroup nodes would be deleted when the file descriptor of the perf_event is closed. Cc: Tejun Heo Acked-by: Song Liu Signed-off-by: Namhyung Kim

Re: [PATCH v4 08/12] perf record: introduce --threads= command line option

2021-04-12 Thread Namhyung Kim
are based on prototypes [1], [2]. > > [1] git clone https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git > -b perf/record_threads > [2] https://lore.kernel.org/lkml/20180913125450.21342-1-jo...@kernel.org/ > > Suggested-by: Jiri Olsa > Suggested-by: Namhyun

[PATCH] perf record: Disallow -c and -F option at the same time

2021-04-02 Thread Namhyung Kim
, but I think it's rare to have both options and it'd be better changing them. Suggested-by: Alexey Alexandrov Signed-off-by: Namhyung Kim --- tools/perf/util/record.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c index

Re: [PATCH] tools: perf: util: Remove duplicate struct declaration

2021-04-01 Thread Namhyung Kim
Hello, On Thu, Apr 1, 2021 at 3:25 PM Wan Jiabing wrote: > > struct target is declared twice. One has been declared > at 21st line. Remove the duplicate. > > Signed-off-by: Wan Jiabing Acked-by: Namhyung Kim I think we can move all the forward declarations to the top (and sor

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

2021-03-30 Thread Namhyung Kim
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, at 9:21 AM, Namhyung Kim wrote: > >>> > >>> As we can

Re: [PATCH v5 0/4] perf stat: Introduce iostat mode to provide I/O performance metrics

2021-03-30 Thread Namhyung Kim
Hello, On Wed, Mar 24, 2021 at 11:30 PM Alexander Antonov wrote: > > The previous version can be found at: > v4: > https://lkml.kernel.org/r/20210203135830.38568-1-alexander.anto...@linux.intel.com/ > Changes in this revision are: > v4 -> v5: > - Addressed comments

Re: [PATCH v7] perf annotate: Fix sample events lost in stdio mode

2021-03-30 Thread Namhyung Kim
Hi Yang and Arnaldo, On Sat, Mar 27, 2021 at 11:16 AM Yang Jihong wrote: > On 2021/3/26 20:06, Arnaldo Carvalho de Melo wrote: > > So it seems to be working, what am I missing? Is this strictly non > > group related? > > > Yes, it is non group related. > This problem occurs only when different

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

2021-03-29 Thread Namhyung Kim
On Mon, Mar 29, 2021 at 2:32 AM Song Liu wrote: > > 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

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

2021-03-29 Thread Namhyung Kim
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 each job's performance during the run. To do that, the > > perf_event

Re: [PATCH v7] perf annotate: Fix sample events lost in stdio mode

2021-03-25 Thread Namhyung Kim
order to "dso,symbol" to avoid duplicate output when different > > processes correspond to the same symbol. > > > > Signed-off-by: Yang Jihong Acked-by: Namhyung Kim Thanks, Namhyung > > --- > > > > Changes since v6: > >- Remove separate setup

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

2021-03-24 Thread Namhyung Kim
Hi Song, Thanks for your review! On Thu, Mar 25, 2021 at 9:56 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 each job's performance during the run. To do

Re: [PATCH v4 RESEND 3/5] perf/x86/lbr: Move cpuc->lbr_xsave allocation out of sleeping region

2021-03-23 Thread Namhyung Kim
On Wed, Mar 24, 2021 at 12:47 PM Like Xu wrote: > > Hi Namhyung, > > On 2021/3/24 9:32, Namhyung Kim wrote: > > Hello, > > > > On Mon, Mar 22, 2021 at 3:14 PM Like Xu wrote: > >> +void reserve_lbr_buffers(struct perf_event *event) > >> +{ > >

Re: [PATCH] perf test: Change to use bash for daemon test

2021-03-23 Thread Namhyung Kim
signal 12 sent to session 'test [11596]' > signal 12 sent to session 'test [11596]' > test daemon ping > test daemon lock > test child finished with 0 > end > daemon operations: Ok > > [1] https://bugs.launchpad.net/ubuntu/+source/dash/+bug/139097 >

Re: [PATCH v4 RESEND 3/5] perf/x86/lbr: Move cpuc->lbr_xsave allocation out of sleeping region

2021-03-23 Thread Namhyung Kim
Hello, On Mon, Mar 22, 2021 at 3:14 PM Like Xu wrote: > +void reserve_lbr_buffers(struct perf_event *event) > +{ > + struct kmem_cache *kmem_cache = x86_get_pmu()->task_ctx_cache; > + struct cpu_hw_events *cpuc; > + int cpu; > + > + if

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

2021-03-23 Thread Namhyung Kim
Hi Song, On Wed, Mar 24, 2021 at 9:30 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 each job's performance during the run. To do that, the

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

2021-03-23 Thread Namhyung Kim
and timings. This attaches all cgroups in a single syscall and I didn't add the DETACH command deliberately to make the implementation simple. The attached cgroup nodes would be deleted when the file descriptor of the perf_event is closed. Cc: Tejun Heo Signed-off-by: Namhyung Kim --- include/linux

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

2021-03-23 Thread Namhyung Kim
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 --- kernel/events/core.c | 119 +-- 1

[RFC 0/2] perf core: Sharing events with multiple cgroups

2021-03-23 Thread Namhyung Kim
in a different cgroup and communicates by pipes dropped from 11.3 usec to 5.8 usec. Thanks, Namhyung Namhyung Kim (2): perf/core: Share an event with multiple cgroups perf/core: Support reading group events with shared cgroups include/linux/perf_event.h | 22 ++ include/uapi/linux/perf_event.h

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

2021-03-19 Thread Namhyung Kim
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 Liu wrote: > > > > On Mar 18, 2021, at 5:09 PM, Arnaldo wrote: > > > >

Re: [PATCH V2 1/5] perf/x86/intel/uncore: Parse uncore discovery tables

2021-03-18 Thread Namhyung Kim
Hi Kan, On Thu, Mar 18, 2021 at 3:05 AM wrote: > > From: Kan Liang > > A self-describing mechanism for the uncore PerfMon hardware has been > introduced with the latest Intel platforms. By reading through an MMIO > page worth of information, perf can 'discover' all the standard uncore > PerfMon

Re: [RESEND PATCH v2] perf stat: improve readability of shadow stats

2021-03-18 Thread Namhyung Kim
,105 instructions #0.24 insn per cycle > #6.07 stalled cycles > per insn > 91,567,662 branches # 11.438 M/sec > 7,756,054 branch-misses #8.47% of all b

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

2021-03-18 Thread Namhyung Kim
t;>> > >>> > >>>> 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, > >>&g

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

2021-03-18 Thread Namhyung Kim
On Thu, Mar 18, 2021 at 4:22 PM Song Liu wrote: > > > > > On Mar 17, 2021, at 10:54 PM, Namhyung Kim wrote: > > > > [...] > > >> + > >> +static int bperf_reload_leader_program(struct evsel *evsel, int > >> attr_map_fd, > >> +

Re: [PATCH v6] perf annotate: Fix sample events lost in stdio mode

2021-03-18 Thread Namhyung Kim
Hello, On Wed, Mar 17, 2021 at 6:44 PM Yang Jihong wrote: > > In hist__find_annotations function, since different hist_entry may point to > same > symbol, we free notes->src to signal already processed this symbol in stdio > mode; > when annotate, entry will skipped if notes->src is NULL to

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

2021-03-18 Thread Namhyung Kim
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 > as failed. > > For stable results between two runs (w/ and w/o --bpf-counters), the test >

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

2021-03-17 Thread Namhyung Kim
On Wed, Mar 17, 2021 at 6:18 AM Song Liu wrote: > +static int bperf_check_target(struct evsel *evsel, > + struct target *target, > + enum bperf_filter_type *filter_type, > + __u32 *filter_entry_cnt) > +{ > +

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

2021-03-17 Thread Namhyung Kim
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:28PM +0900, Namhyung Kim escreveu: > >> Hi Song, > >> > >> On Wed, Ma

[PATCH] libbpf: Fix error path in bpf_object__elf_init()

2021-03-17 Thread Namhyung Kim
When it failed to get section names, it should call bpf_object__elf_finish() like others. Signed-off-by: Namhyung Kim --- tools/lib/bpf/libbpf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 2f351d3ad3e7..8d610259f4be

[tip: perf/core] perf core: Allocate perf_buffer in the target node memory

2021-03-17 Thread tip-bot2 for Namhyung Kim
The following commit has been merged into the perf/core branch of tip: Commit-ID: 9483409ab5067941860754e78a4a44a60311d276 Gitweb: https://git.kernel.org/tip/9483409ab5067941860754e78a4a44a60311d276 Author:Namhyung Kim AuthorDate:Mon, 15 Mar 2021 12:34:36 +09:00 Committer

[tip: perf/core] perf core: Allocate perf_event in the target node memory

2021-03-17 Thread tip-bot2 for Namhyung Kim
The following commit has been merged into the perf/core branch of tip: Commit-ID: ff65338e78418e5970a7aabbabb94c46f2bb821d Gitweb: https://git.kernel.org/tip/ff65338e78418e5970a7aabbabb94c46f2bb821d Author:Namhyung Kim AuthorDate:Thu, 11 Mar 2021 20:54:13 +09:00 Committer

[tip: perf/core] perf core: Add a kmem_cache for struct perf_event

2021-03-17 Thread tip-bot2 for Namhyung Kim
The following commit has been merged into the perf/core branch of tip: Commit-ID: bdacfaf26da166dd56c62f23f27a4b3e71f2d89e Gitweb: https://git.kernel.org/tip/bdacfaf26da166dd56c62f23f27a4b3e71f2d89e Author:Namhyung Kim AuthorDate:Thu, 11 Mar 2021 20:54:12 +09:00 Committer

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

2021-03-16 Thread Namhyung Kim
Hi Song, On Wed, Mar 17, 2021 at 6:18 AM Song Liu wrote: > > perf uses performance monitoring counters (PMCs) to monitor system > performance. The PMCs are limited hardware resources. For example, > Intel CPUs have 3x fixed PMCs and 4x programmable PMCs per cpu. > > Modern data center systems

Re: [PATCH 1/2] perf/x86/intel: Fix a crash caused by zero PEBS status

2021-03-16 Thread Namhyung Kim
gt; Fixes: 01330d7288e0 ("perf/x86: Allow zero PEBS status with only single > active event") > Reported-by: Vince Weaver > Suggested-by: Peter Zijlstra (Intel) > Signed-off-by: Kan Liang > Cc: sta...@vger.kernel.org Tested-by: Namhyung Kim Thanks, Namhyung > --- >

Re: [PATCH] Revert "perf/x86: Allow zero PEBS status with only single active event"

2021-03-16 Thread Namhyung Kim
On Tue, Mar 16, 2021 at 9:28 PM Liang, Kan wrote: > > > > On 3/16/2021 3:22 AM, Namhyung Kim wrote: > > Hi Peter and Kan, > > > > On Thu, Mar 4, 2021 at 5:22 AM Peter Zijlstra wrote: > >> > >> On Wed, Mar 03, 2021 at 02:53:00PM -0500, Liang, Kan

Re: [PATCH] Revert "perf/x86: Allow zero PEBS status with only single active event"

2021-03-16 Thread Namhyung Kim
Hi Peter and Kan, On Thu, Mar 4, 2021 at 5:22 AM Peter Zijlstra wrote: > > On Wed, Mar 03, 2021 at 02:53:00PM -0500, Liang, Kan wrote: > > On 3/3/2021 1:59 PM, Peter Zijlstra wrote: > > > On Wed, Mar 03, 2021 at 05:42:18AM -0800, kan.li...@linux.intel.com wrote: > > > > > +++

Re: [PATCH] perf record: Fix memory leak in vDSO

2021-03-15 Thread Namhyung Kim
On Mon, Mar 15, 2021 at 10:28 PM Jiri Olsa wrote: > > On Mon, Mar 15, 2021 at 01:56:41PM +0900, Namhyung Kim wrote: > > I got several memory leak reports from Asan with a simple command. It > > was because VDSO is not released due to the refcount. Like in > > __dsos_ad

[PATCH] perf record: Fix memory leak in vDSO

2021-03-14 Thread Namhyung Kim
) leaked in 2 allocation(s). Signed-off-by: Namhyung Kim --- tools/perf/util/vdso.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c index 3cc91ad048ea..43beb169631d 100644 --- a/tools/perf/util/vdso.c +++ b/tools/perf/util/vdso.c @@ -133,6 +133,8

[PATCH] perf core: Allocate perf_buffer in the target node memory

2021-03-14 Thread Namhyung Kim
I found the ring buffer pages are allocated in the node but the ring buffer itself is not. Let's convert it to use kzalloc_node() too. Signed-off-by: Namhyung Kim --- kernel/events/ring_buffer.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/events

Re: [PATCH v4] perf annotate: Fix sample events lost in stdio mode

2021-03-12 Thread Namhyung Kim
On Sat, Mar 13, 2021 at 11:16 AM Yang Jihong wrote: > > In hist__find_annotations function, since different hist_entry may point to > same > symbol, we free notes->src to signal already processed this symbol in stdio > mode; > when annotate, entry will skipped if notes->src is NULL to avoid

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

2021-03-12 Thread Namhyung Kim
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 at 11:03 AM Song Liu wrote: > >> > >> perf uses performance monitoring counters (PMCs)

Re: [PATCH] perf annotate: Fix sample events lost in stdio mode

2021-03-12 Thread Namhyung Kim
On Fri, Mar 12, 2021 at 4:19 PM Yang Jihong wrote: > > > Hello, > On 2021/3/12 13:49, Namhyung Kim wrote: > > Hi, > > > > On Fri, Mar 12, 2021 at 12:24 PM Yang Jihong wrote: > >> > >> Hello, Namhyung > >> > >> On 2021/3/11 22:

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

2021-03-12 Thread Namhyung Kim
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, > Intel CPUs have 3x fixed PMCs and 4x programmable PMCs per cpu. > > Modern data center systems use

Re: [PATCH] perf annotate: Fix sample events lost in stdio mode

2021-03-11 Thread Namhyung Kim
Hi, On Fri, Mar 12, 2021 at 12:24 PM Yang Jihong wrote: > > Hello, Namhyung > > On 2021/3/11 22:42, Namhyung Kim wrote: > > Hi, > > > > On Thu, Mar 11, 2021 at 5:48 PM Yang Jihong wrote: > >> > >> Hello, > >> > >> On 2021/3/6

Re: [PATCH] perf annotate: Fix sample events lost in stdio mode

2021-03-11 Thread Namhyung Kim
Hi, On Thu, Mar 11, 2021 at 5:48 PM Yang Jihong wrote: > > Hello, > > On 2021/3/6 16:28, Yang Jihong wrote: > > In hist__find_annotations function, since have a hist_entry per IP for the > > same > > symbol, we free notes->src to signal already processed this symbol in stdio > > mode; > > when

[PATCH 1/2] perf core: Add a kmem_cache for struct perf_event

2021-03-11 Thread Namhyung Kim
From: Namhyung Kim The kernel can allocate a lot of struct perf_event when profiling. For example, 256 cpu x 8 events x 20 cgroups = 40K instances of the struct would be allocated on a large system. The size of struct perf_event in my setup is 1152 byte. As it's allocated by kmalloc, the actual

[PATCH 2/2] perf core: Allocate perf_event in the target node memory

2021-03-11 Thread Namhyung Kim
too. Signed-off-by: Namhyung Kim --- kernel/events/core.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 10f2548211d0..519faf0b7b54 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -11246,13 +11246,16

Re: [PATCH] perf diff: Don't crash on freeing errno-session

2021-03-02 Thread Namhyung Kim
; Cc: Arnaldo Carvalho de Melo > Cc: Ingo Molnar > Cc: Jiri Olsa > Cc: Mark Rutland > Cc: Namhyung Kim > Cc: Peter Zijlstra > Signed-off-by: Dmitry Safonov Acked-by: Namhyung Kim Thanks, Namhyung > --- > tools/perf/builtin-diff.c | 3 ++- > 1 file ch

Re: [PATCH] perf stat: improve readability of shadow stats

2021-03-01 Thread Namhyung Kim
On Tue, Mar 2, 2021 at 4:19 AM Jiri Olsa wrote: > > On Tue, Mar 02, 2021 at 01:24:02AM +0800, Changbin Du wrote: > > This does follow two changes: > > 1) Select appropriate unit between K/M/G. > > 2) Use 'cpu-sec' instead of 'sec' to state this is not the wall-time. > > > > $ sudo ./perf stat

Re: [PATCH 04/11] perf test: Fix cpu and thread map leaks in sw_clock_freq test

2021-03-01 Thread Namhyung Kim
Hi Jiri, On Tue, Mar 2, 2021 at 2:24 AM Jiri Olsa wrote: > > On Mon, Mar 01, 2021 at 11:04:02PM +0900, Namhyung Kim wrote: > > The evlist has the maps with its own refcounts so we don't need to set > > the pointers to NULL. Otherwise following error was reported by Asan. &

Re: [PATCH v3 07/12] perf record: init data file at mmap buffer object

2021-03-01 Thread Namhyung Kim
On Mon, Mar 1, 2021 at 10:33 PM Bayduraev, Alexey V wrote: > > On 01.03.2021 14:44, Namhyung Kim wrote: > > Hello, > > > > On Mon, Mar 1, 2021 at 8:16 PM Bayduraev, Alexey V > > wrote: > >> > >> Hi, > >> > >> On 20.11.2020 13:49,

[PATCH 11/11] perf test: Fix cpu and thread map leaks in perf_time_to_tsc test

2021-03-01 Thread Namhyung Kim
:308 SUMMARY: AddressSanitizer: 72 byte(s) leaked in 2 allocation(s). test child finished with 1 end Convert perf time to TSC: FAILED! Signed-off-by: Namhyung Kim --- tools/perf/tests/perf-time-to-tsc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/tests/perf

[PATCH 10/11] perf test: Fix cpu map leaks in cpu_map_print test

2021-03-01 Thread Namhyung Kim
byte(s) leaked in 7 allocation(s). test child finished with 1 end Print cpu map: FAILED! Signed-off-by: Namhyung Kim --- tools/perf/tests/cpumap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/tests/cpumap.c b/tools/perf/tests/cpumap.c index 29c793ac7d10

[PATCH 06/11] perf test: Fix cpu and thread map leaks in keep_tracking test

2021-03-01 Thread Namhyung Kim
end Use a dummy software event to keep tracking: FAILED! Signed-off-by: Namhyung Kim --- tools/perf/tests/keep-tracking.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c index e6f1b2a38e03

[PATCH 08/11] perf test: Fix a thread map leak in thread_map_synthesize test

2021-03-01 Thread Namhyung Kim
with 1 end Synthesize thread map: FAILED! Signed-off-by: Namhyung Kim --- tools/perf/tests/thread-map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/tests/thread-map.c b/tools/perf/tests/thread-map.c index 28f51c4bd373..9e1cf11149ef 100644 --- a/tools/perf/tests/thread

[PATCH 02/11] perf test: Fix a memory leak in attr test

2021-03-01 Thread Namhyung Kim
/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x7f091035f6a7 in __vasprintf_internal libio/vasprintf.c:71 SUMMARY: AddressSanitizer: 33 byte(s) leaked in 1 allocation(s). Signed-off-by: Namhyung Kim --- tools/perf/tests/attr.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff

[PATCH 05/11] perf test: Fix cpu and thread map leaks in code_reading test

2021-03-01 Thread Namhyung Kim
: AddressSanitizer: 471 byte(s) leaked in 2 allocation(s). test child finished with 1 end Object code reading: FAILED! Signed-off-by: Namhyung Kim --- tools/perf/tests/code-reading.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tools/perf/tests/code-reading.c

[PATCH 03/11] perf test: Fix cpu and thread map leaks in task_exit test

2021-03-01 Thread Namhyung Kim
0x7fc44e042d09 in __libc_start_main ../csu/libc-start.c:308 ... test child finished with 1 end Number of exit events of a simple workload: FAILED! Signed-off-by: Namhyung Kim --- tools/perf/tests/task-exit.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff

[PATCH 04/11] perf test: Fix cpu and thread map leaks in sw_clock_freq test

2021-03-01 Thread Namhyung Kim
/perf.c:539 #12 0x7fef5c83cd09 in __libc_start_main ../csu/libc-start.c:308 ... test child finished with 1 end Software clock events period values : FAILED! Signed-off-by: Namhyung Kim --- tools/perf/tests/sw-clock.c | 12 1 file changed, 4 insertions

[PATCHSET 00/11] perf test: Fix cpu/thread map leaks

2021-03-01 Thread Namhyung Kim
can add them if you want, so please let me know. It's also available at perf/asan-fix-v1 branch in git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git Thanks, Namhyung Namhyung Kim (11): perf test: Fix cpu and thread map leaks in basic mmap test perf test: Fix a memory

[PATCH 01/11] perf test: Fix cpu and thread map leaks in basic mmap test

2021-03-01 Thread Namhyung Kim
the mmap interface: FAILED! failed to open shell test directory: /home/namhyung/libexec/perf-core/tests/shell Signed-off-by: Namhyung Kim --- tools/perf/tests/mmap-basic.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index

[PATCH 09/11] perf test: Fix a memory leak in thread_map_remove test

2021-03-01 Thread Namhyung Kim
/asan_malloc_linux.cpp:145 #1 0x7f5444f8c6a7 in __vasprintf_internal libio/vasprintf.c:71 SUMMARY: AddressSanitizer: 14 byte(s) leaked in 1 allocation(s). test child finished with 1 end Remove thread map: FAILED! Signed-off-by: Namhyung Kim --- tools/perf/tests/thread-map.c | 7 ++- 1

[PATCH 07/11] perf test: Fix cpu and thread map leaks in switch_tracking test

2021-03-01 Thread Namhyung Kim
byte(s) leaked in 2 allocation(s). test child finished with 1 end Track with sched_switch: FAILED! Signed-off-by: Namhyung Kim --- tools/perf/tests/switch-tracking.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/switch-tracking.c b/tools

Re: [PATCH v3 07/12] perf record: init data file at mmap buffer object

2021-03-01 Thread Namhyung Kim
Hello, On Mon, Mar 1, 2021 at 8:16 PM Bayduraev, Alexey V wrote: > > Hi, > > On 20.11.2020 13:49, Namhyung Kim wrote: > > On Mon, Nov 16, 2020 at 03:19:41PM +0300, Alexey Budankov wrote: > > > > >> > >> @@ -1400,8 +1417,12 @@ static int record__mmap

Re: [PATCH] perf trace: Ensure read cmdlines are null terminated.

2021-02-28 Thread Namhyung Kim
Hi Ian, On Sat, Feb 27, 2021 at 7:14 AM Ian Rogers wrote: > > Issue detected by address sanitizer. > > Fixes: cd4ceb63438e (perf util: Save pid-cmdline mapping into tracing header) > Signed-off-by: Ian Rogers Acked-by: Namhyung Kim Thanks, Namhyung > --- > tools/

[PATCH v2 2/2] perf stat: Fix use-after-free when -r option is used

2021-02-24 Thread Namhyung Kim
in the previous run. Fix it by resetting the hash. Signed-off-by: Namhyung Kim --- tools/perf/util/evlist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 5121b4db66fe..882cd1f721d9 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util

[PATCH v2 1/2] libperf: Add perf_evlist__reset_id_hash()

2021-02-24 Thread Namhyung Kim
Add the perf_evlist__reset_id_hash() function as an internal function so that it can be called by perf to reset the hash table. This is necessary for perf stat to run the workload multiple times. Signed-off-by: Namhyung Kim --- tools/lib/perf/evlist.c | 13 + tools

Re: [PATCH 2/2] perf stat: Fix segfault when -r option is used

2021-02-24 Thread Namhyung Kim
On Wed, Feb 24, 2021 at 5:11 PM Namhyung Kim wrote: > > I got a segfault when using -r option with event groups. The option > makes it run the workload multiple times and it will reuse the evlist > and evsel for each run. Well, it might not see a segfault because the freed m

Re: [PATCH 1/2] libperf: Add perf_evlist__reset_id_hash()

2021-02-24 Thread Namhyung Kim
On Wed, Feb 24, 2021 at 5:11 PM Namhyung Kim wrote: > > Add the perf_evlist__reset_id_hash() function to libperf API so that > it can be called to reset the hash table. This is necessary for perf > stat to run the workload multiple times. > > Signed-off-by: Namhyung Kim &

[PATCH 2/2] perf stat: Fix segfault when -r option is used

2021-02-24 Thread Namhyung Kim
in the previous run. Fix it by resetting the hash. Signed-off-by: Namhyung Kim --- tools/perf/util/evlist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 5121b4db66fe..882cd1f721d9 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util

[PATCH 1/2] libperf: Add perf_evlist__reset_id_hash()

2021-02-24 Thread Namhyung Kim
Add the perf_evlist__reset_id_hash() function to libperf API so that it can be called to reset the hash table. This is necessary for perf stat to run the workload multiple times. Signed-off-by: Namhyung Kim --- tools/lib/perf/evlist.c | 13 + tools/lib/perf/include

[PATCH] perf daemon: Fix compile error with Asan

2021-02-23 Thread Namhyung Kim
: at offset 100 to object ‘name’ with size 100 declared here 162 | char name[100]; | ^~~~ Fixes: c0666261ff38 ("perf daemon: Add config file support") Signed-off-by: Namhyung Kim --- tools/perf/builtin-daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --g

Re: [PATCH V2 3/3] perf: Optimize sched_task() in a context switch

2021-02-22 Thread Namhyung Kim
On Wed, Jan 27, 2021 at 1:41 PM Namhyung Kim wrote: > > Hi, > > On Mon, Jan 18, 2021 at 4:04 PM Namhyung Kim wrote: > > > > Hi Peter and Kan, > > > > On Thu, Dec 10, 2020 at 11:25 PM Peter Zijlstra > > wrote: > > > > > >

Re: [PATCH 3/3] tools/lib/fs: Cache cgroupfs mount point

2021-02-19 Thread Namhyung Kim
Hi Arnaldo, On Wed, Feb 17, 2021 at 9:58 PM Arnaldo Carvalho de Melo wrote: > > Em Fri, Jan 08, 2021 at 02:51:44PM +0900, Namhyung Kim escreveu: > > On Wed, Jan 6, 2021 at 10:33 AM Namhyung Kim wrote: > > > > > > Hi Arnaldo, > > > > > > On Tue,

  1   2   3   4   5   6   7   8   9   10   >