Re: [PATCH v4 04/38] perf: Add a EVENT_GUEST flag

2025-05-21 Thread Namhyung Kim
On Mon, Mar 24, 2025 at 05:30:44PM +, Mingwei Zhang wrote: > From: Kan Liang > > Current perf doesn't explicitly schedule out all exclude_guest events > while the guest is running. There is no problem with the current > emulated vPMU. Because perf owns all the PMU counters. It can mask the >

Re: [PATCH v4 34/38] perf/x86/amd: Support PERF_PMU_CAP_MEDIATED_VPMU for AMD host

2025-05-21 Thread Namhyung Kim
On Mon, Mar 24, 2025 at 05:31:14PM +, Mingwei Zhang wrote: > From: Sandipan Das > > Apply the PERF_PMU_CAP_MEDIATED_VPMU flag for version 2 and later > implementations of the core PMU. Aside from having Global Control and > Status registers, virtualizing the PMU using the passthrough model >

Re: [PATCH v4 09/38] perf: Add switch_guest_ctx() interface

2025-05-21 Thread Namhyung Kim
On Mon, Mar 24, 2025 at 05:30:49PM +, Mingwei Zhang wrote: > From: Kan Liang > > When entering/exiting a guest, some contexts for a guest have to be > switched. For examples, there is a dedicated interrupt vector for > guests on Intel platforms. > > When PMI switch into a new guest vector, g

Re: [PATCH v4 05/38] perf: Add generic exclude_guest support

2025-05-21 Thread Namhyung Kim
On Mon, Mar 24, 2025 at 05:30:45PM +, Mingwei Zhang wrote: > From: Kan Liang > > Only KVM knows the exact time when a guest is entering/exiting. Expose > two interfaces to KVM to switch the ownership of the PMU resources. > > All the pinned events must be scheduled in first. Extend the > per

Re: [PATCH v4 04/38] perf: Add a EVENT_GUEST flag

2025-05-20 Thread Namhyung Kim
On Tue, May 20, 2025 at 12:09:02PM -0400, Liang, Kan wrote: > > > On 2025-05-19 2:58 a.m., Namhyung Kim wrote: > > Hello, > > > > On Mon, Mar 24, 2025 at 05:30:44PM +, Mingwei Zhang wrote: > >> From: Kan Liang > >> > >> Current perf do

Re: [PATCH v4 04/38] perf: Add a EVENT_GUEST flag

2025-05-18 Thread Namhyung Kim
Hello, On Mon, Mar 24, 2025 at 05:30:44PM +, Mingwei Zhang wrote: > From: Kan Liang > > Current perf doesn't explicitly schedule out all exclude_guest events > while the guest is running. There is no problem with the current > emulated vPMU. Because perf owns all the PMU counters. It can mas

Re: [PATCH] selftests/bpf: Fix kmem_cache iterator draining

2025-04-28 Thread Namhyung Kim
1/3 PASSED, 0 SKIPPED, 0 FAILED > > Fixes: a496d0cdc84d ("selftests/bpf: Add a test for kmem_cache_iter") > Signed-off-by: T.J. Mercier Oops, thanks for fixing this. Acked-by: Namhyung Kim Thanks, Namhyung > --- > tools/testing/selftests/bpf/prog_tests/kmem_cache_iter

[PATCH] perf tools: Fixup end address of modules

2024-12-18 Thread Namhyung Kim
Pavlu Cc: Sami Tolvanen Cc: Daniel Gomez Cc: linux-modu...@vger.kernel.org Signed-off-by: Namhyung Kim --- tools/perf/util/machine.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 27d5345d2b307a97..8bb34689e3ceeec4 100644 --- a/

Re: [PATCH v3 0/5] perf build: libtraceevent, libtracefs feature check with pkg-config

2024-07-17 Thread Namhyung Kim
Hello, On Fri, Jul 12, 2024 at 12:45 PM Guilherme Amadio wrote: > > Hi Namhyung, Arnaldo, > > Here is version 3 of the patchset. I see the change to send output to devnull > has already been applied, so I am submitting the remaining work only. > > The difference with previous changes is that in v

Re: [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools

2024-07-03 Thread Namhyung Kim
On Wed, Jul 3, 2024 at 4:05 PM Steven Rostedt wrote: > > On Wed, 3 Jul 2024 14:33:21 -0700 > Namhyung Kim wrote: > > > On Wed, Jul 03, 2024 at 03:36:17PM -0400, Steven Rostedt wrote: > > > On Tue, 2 Jul 2024 16:40:46 -0700 > > > Namhyung Kim wrote: > >

Re: [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools

2024-07-03 Thread Namhyung Kim
On Wed, Jul 03, 2024 at 03:36:17PM -0400, Steven Rostedt wrote: > On Tue, 2 Jul 2024 16:40:46 -0700 > Namhyung Kim wrote: > > > +CC Steve and linux-trace-kernel list. > > There doesn't seem to be a cover page, and it doesn't apply on > v6.10-rc6 nor on tip.

Re: [PATCH v2 3/6] tools: Make pkg-config dependency checks usable by other tools

2024-07-02 Thread Namhyung Kim
+CC Steve and linux-trace-kernel list. Thanks, Namhyung On Fri, Jun 28, 2024 at 10:34:29PM +0200, Guilherme Amadio wrote: > Other tools, in tools/verification and tools/tracing, make use of > libtraceevent and libtracefs as dependencies. This allows setting > up the feature check flags for them a

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 PERF_SAM

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

2024-02-16 Thread Namhyung Kim
S' and 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/too

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 a

[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 resourc

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
ould 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 > >

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 during th

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 threa

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: Namhyun

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

2021-04-13 Thread Namhyung Kim
o 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 | 2 + kernel/events/core.c

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

2021-04-13 Thread Namhyung Kim
ed-by: Song Liu 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

[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: Namhyun

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

2021-04-12 Thread Namhyung Kim
hange 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

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

2021-04-12 Thread Namhyung Kim
value 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-b

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
sages, 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

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 run

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 ev

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 s

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_eve

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

2021-03-25 Thread Namhyung Kim
er 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. T

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/da

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 (!static_cpu_has(X86_FEATURE_ARCH_LBR

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, t

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

2021-03-23 Thread Namhyung Kim
value 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 ---

[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 +

[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_ev

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
> idle >464,172,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

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-17 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 avo

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

2021-03-17 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 > progra

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 use

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

2021-03-16 Thread Namhyung Kim
; record as well. > > 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,

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: > > > > > +++ b/arch/x86/events/in

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/e

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 repe

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:42,

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 the

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 a

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

2021-03-11 Thread Namhyung Kim
rnal users 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

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

2021-03-02 Thread Namhyung Kim
t; Cc: Alexander Shishkin > 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-

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
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
... SUMMARY: 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

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

2021-03-01 Thread Namhyung Kim
39 #12 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 deletion

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

2021-03-01 Thread Namhyung Kim
tools/perf/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

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

2021-03-01 Thread Namhyung Kim
t applied cleanly. But I 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

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

2021-03-01 Thread Namhyung Kim
using 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

[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

  1   2   3   4   5   6   7   8   9   10   >