From: Ravi Bangoria <ravi.bangoria@amd.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: acme@kernel.org, alexander.shishkin@linux.intel.com,
jolsa@redhat.com, namhyung@kernel.org, songliubraving@fb.com,
eranian@google.com, ak@linux.intel.com, mark.rutland@arm.com,
frederic@kernel.org, maddy@linux.ibm.com, irogers@google.com,
will@kernel.org, robh@kernel.org, mingo@redhat.com,
catalin.marinas@arm.com, ndesaulniers@google.com,
srw@sladewatkins.net, linux-arm-kernel@lists.infradead.org,
linux-perf-users@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
sandipan.das@amd.com, ananth.narayan@amd.com,
kim.phillips@amd.com, santosh.shukla@amd.com,
Ravi Bangoria <ravi.bangoria@amd.com>
Subject: Re: [PATCH v2] perf: Rewrite core context handling
Date: Tue, 11 Oct 2022 18:49:55 +0530 [thread overview]
Message-ID: <ba47d079-6d97-0412-69a0-fa15999b5024@amd.com> (raw)
In-Reply-To: <Y0VTn0qLWd925etP@hirez.programming.kicks-ass.net>
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.
Thanks,
Ravi
next prev parent reply other threads:[~2022-10-11 13:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221008062424.313-1-ravi.bangoria@amd.com>
2022-10-11 11:29 ` [PATCH v2] perf: Rewrite core context handling Peter Zijlstra
2022-10-11 13:19 ` Ravi Bangoria [this message]
2022-10-11 14:02 ` Peter Zijlstra
2022-10-11 17:47 ` Peter Zijlstra
2022-10-12 8:39 ` Ravi Bangoria
2022-10-12 12:16 ` Peter Zijlstra
2022-10-12 20:47 ` Peter Zijlstra
2022-10-13 10:07 ` Ravi Bangoria
2022-10-13 10:59 ` Peter Zijlstra
2022-10-14 9:56 ` Ravi Bangoria
2022-10-14 14:50 ` Peter Zijlstra
2022-10-17 9:33 ` Ravi Bangoria
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ba47d079-6d97-0412-69a0-fa15999b5024@amd.com \
--to=ravi.bangoria@amd.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ananth.narayan@amd.com \
--cc=catalin.marinas@arm.com \
--cc=eranian@google.com \
--cc=frederic@kernel.org \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=kim.phillips@amd.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
--cc=robh@kernel.org \
--cc=sandipan.das@amd.com \
--cc=santosh.shukla@amd.com \
--cc=songliubraving@fb.com \
--cc=srw@sladewatkins.net \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox