lkml.org 
[lkml]   [2022]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] perf: Rewrite core context handling
On Tue, Oct 11, 2022 at 06:49:55PM +0530, Ravi Bangoria wrote:
> On 11-Oct-22 4:59 PM, Peter Zijlstra wrote:
> > On Sat, Oct 08, 2022 at 11:54:24AM +0530, Ravi Bangoria wrote:
> >
> >> +static void perf_event_swap_task_ctx_data(struct perf_event_context *prev_ctx,
> >> + struct perf_event_context *next_ctx)
> >> +{
> >> + struct perf_event_pmu_context *prev_epc, *next_epc;
> >> +
> >> + if (!prev_ctx->nr_task_data)
> >> + return;
> >> +
> >> + prev_epc = list_first_entry(&prev_ctx->pmu_ctx_list,
> >> + struct perf_event_pmu_context,
> >> + pmu_ctx_entry);
> >> + next_epc = list_first_entry(&next_ctx->pmu_ctx_list,
> >> + struct perf_event_pmu_context,
> >> + pmu_ctx_entry);
> >> +
> >> + while (&prev_epc->pmu_ctx_entry != &prev_ctx->pmu_ctx_list &&
> >> + &next_epc->pmu_ctx_entry != &next_ctx->pmu_ctx_list) {
> >> +
> >> + WARN_ON_ONCE(prev_epc->pmu != next_epc->pmu);
> >> +
> >> + /*
> >> + * PMU specific parts of task perf context can require
> >> + * additional synchronization. As an example of such
> >> + * synchronization see implementation details of Intel
> >> + * LBR call stack data profiling;
> >> + */
> >> + if (prev_epc->pmu->swap_task_ctx)
> >> + prev_epc->pmu->swap_task_ctx(prev_epc, next_epc);
> >> + else
> >> + swap(prev_epc->task_ctx_data, next_epc->task_ctx_data);
> >
> > Did I forget to advance the iterators here?
>
> Yeah. Seems so. I overlooked it too.

OK; so I'm not slowly going crazy staring at this code ;-) Let me go add
it now then. :-)

But first I gotta taxi the kids around for a bit, bbl.

\
 
 \ /
  Last update: 2022-10-11 16:04    [W:0.118 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site