Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-25 Thread Michael Ellerman
Namhyung Kim writes: > Hello, > > On Mon, Nov 23, 2020 at 8:00 PM Michael Ellerman wrote: >> >> Namhyung Kim writes: >> > Hi Peter and Kan, >> > >> > (Adding PPC folks) >> > >> > On Tue, Nov 17, 2020 at 2:01 PM Namhyung Kim wrote: >> >> >> >> Hello, >> >> >> >> On Thu, Nov 12, 2020 at 4:54 AM L

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-24 Thread Liang, Kan
On 11/24/2020 12:42 AM, Madhavan Srinivasan wrote: On 11/24/20 10:21 AM, Namhyung Kim wrote: Hello, On Mon, Nov 23, 2020 at 8:00 PM Michael Ellerman wrote: Namhyung Kim writes: Hi Peter and Kan, (Adding PPC folks) On Tue, Nov 17, 2020 at 2:01 PM Namhyung Kim wrote: Hello, On Thu,

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-23 Thread Madhavan Srinivasan
On 11/24/20 10:21 AM, Namhyung Kim wrote: Hello, On Mon, Nov 23, 2020 at 8:00 PM Michael Ellerman wrote: Namhyung Kim writes: Hi Peter and Kan, (Adding PPC folks) On Tue, Nov 17, 2020 at 2:01 PM Namhyung Kim wrote: Hello, On Thu, Nov 12, 2020 at 4:54 AM Liang, Kan wrote: On 11/11/

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-23 Thread Namhyung Kim
Hello, On Mon, Nov 23, 2020 at 8:00 PM Michael Ellerman wrote: > > Namhyung Kim writes: > > Hi Peter and Kan, > > > > (Adding PPC folks) > > > > On Tue, Nov 17, 2020 at 2:01 PM Namhyung Kim wrote: > >> > >> Hello, > >> > >> On Thu, Nov 12, 2020 at 4:54 AM Liang, Kan > >> wrote: > >> > > >> >

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-23 Thread Michael Ellerman
Namhyung Kim writes: > Hi Peter and Kan, > > (Adding PPC folks) > > On Tue, Nov 17, 2020 at 2:01 PM Namhyung Kim wrote: >> >> Hello, >> >> On Thu, Nov 12, 2020 at 4:54 AM Liang, Kan wrote: >> > >> > >> > >> > On 11/11/2020 11:25 AM, Peter Zijlstra wrote: >> > > On Mon, Nov 09, 2020 at 09:49:31AM

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-20 Thread Namhyung Kim
Hi Peter and Kan, (Adding PPC folks) On Tue, Nov 17, 2020 at 2:01 PM Namhyung Kim wrote: > > Hello, > > On Thu, Nov 12, 2020 at 4:54 AM Liang, Kan wrote: > > > > > > > > On 11/11/2020 11:25 AM, Peter Zijlstra wrote: > > > On Mon, Nov 09, 2020 at 09:49:31AM -0500, Liang, Kan wrote: > > > > > >>

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-16 Thread Namhyung Kim
Hello, On Thu, Nov 12, 2020 at 4:54 AM Liang, Kan wrote: > > > > On 11/11/2020 11:25 AM, Peter Zijlstra wrote: > > On Mon, Nov 09, 2020 at 09:49:31AM -0500, Liang, Kan wrote: > > > >> - When the large PEBS was introduced (9c964efa4330), the sched_task() > >> should > >> be invoked to flush the P

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-11 Thread Liang, Kan
On 11/11/2020 11:25 AM, Peter Zijlstra wrote: On Mon, Nov 09, 2020 at 09:49:31AM -0500, Liang, Kan wrote: - When the large PEBS was introduced (9c964efa4330), the sched_task() should be invoked to flush the PEBS buffer in each context switch. However, The perf_sched_events in account_event()

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-11 Thread Peter Zijlstra
On Mon, Nov 09, 2020 at 09:49:31AM -0500, Liang, Kan wrote: > - When the large PEBS was introduced (9c964efa4330), the sched_task() should > be invoked to flush the PEBS buffer in each context switch. However, The > perf_sched_events in account_event() is not updated accordingly. The > perf_event_

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-09 Thread Liang, Kan
On 11/9/2020 12:33 PM, Peter Zijlstra wrote: On Mon, Nov 09, 2020 at 09:49:31AM -0500, Liang, Kan wrote: Maybe we can frob x86_pmu_enable()... Could you please elaborate? Something horrible like this. It will detect the first time we enable the PMU on a new task (IOW we did a context swit

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-09 Thread Peter Zijlstra
On Mon, Nov 09, 2020 at 09:49:31AM -0500, Liang, Kan wrote: > - The patch 1 tries to fix broken per-CPU events. The CPU context cannot be > retrieved from the task->perf_event_ctxp. So it has to be tracked in the > sched_cb_list. Yes, the code is very similar to the original codes, but it > is act

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-09 Thread Peter Zijlstra
On Mon, Nov 09, 2020 at 09:49:31AM -0500, Liang, Kan wrote: > > Maybe we can frob x86_pmu_enable()... > > Could you please elaborate? Something horrible like this. It will detect the first time we enable the PMU on a new task (IOW we did a context switch) and wipe the counters when user RDPMC is

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-09 Thread Liang, Kan
On 11/9/2020 6:04 AM, Peter Zijlstra wrote: On Mon, Nov 09, 2020 at 10:52:35AM +0100, Peter Zijlstra wrote: On Fri, Nov 06, 2020 at 01:29:33PM -0800, kan.li...@linux.intel.com wrote: From: Kan Liang Sometimes the PMU internal buffers have to be flushed for per-CPU events during a context s

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-09 Thread Peter Zijlstra
On Mon, Nov 09, 2020 at 10:52:35AM +0100, Peter Zijlstra wrote: > On Fri, Nov 06, 2020 at 01:29:33PM -0800, kan.li...@linux.intel.com wrote: > > From: Kan Liang > > > > Sometimes the PMU internal buffers have to be flushed for per-CPU events > > during a context switch, e.g., large PEBS. Otherwis

Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events

2020-11-09 Thread Peter Zijlstra
On Fri, Nov 06, 2020 at 01:29:33PM -0800, kan.li...@linux.intel.com wrote: > From: Kan Liang > > Sometimes the PMU internal buffers have to be flushed for per-CPU events > during a context switch, e.g., large PEBS. Otherwise, the perf tool may > report samples in locations that do not belong to t