From: Song Liu <songliubraving@fb.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Kernel Team <Kernel-team@fb.com>,
Peter Zijlstra <peterz@infradead.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Jiri Olsa <jolsa@kernel.org>,
Alexey Budankov <alexey.budankov@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>, Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH v11] perf: Sharing PMU counters across compatible events
Date: Tue, 24 Mar 2020 22:25:37 +0000 [thread overview]
Message-ID: <92D9FFD5-D381-4E46-92BE-F981F0F91388@fb.com> (raw)
In-Reply-To: <4359BCB5-1FB5-4A5A-B528-10CDDA97A5DF@fb.com>
> On Mar 24, 2020, at 2:43 PM, Song Liu <songliubraving@fb.com> wrote:
>
>
>
>> On Mar 24, 2020, at 2:41 PM, Song Liu <songliubraving@fb.com> wrote:
>>
>> This patch tries to enable PMU sharing. When multiple perf_events are
>> counting the same metric, they can share the hardware PMU counter. We
>> call these events as "compatible events".
>>
>> The PMU sharing are limited to events within the same perf_event_context
>> (ctx). When a event is installed or enabled, search the ctx for compatible
>> events. This is implemented in perf_event_setup_dup(). One of these
>> compatible events are picked as the master (stored in event->dup_master).
>> Similarly, when the event is removed or disabled, perf_event_remove_dup()
>> is used to clean up sharing.
>>
>> If the master event is a cgroup event or a event in a group, it is
>> possible that some slave events are ACTIVE, but the master event is not.
>> To handle this scenario, we introduced PERF_EVENT_STATE_ENABLED. Also,
>> since PMU drivers write into event->count, master event needs another
>> variable (master_count) for the reading of this event.
>>
>> On the critical paths (add, del read), sharing PMU counters doesn't
>> increase the complexity. Helper functions event_pmu_[add|del|read]() are
>> introduced to cover these cases. All these functions have O(1) time
>> complexity.
>>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
>> Cc: Jiri Olsa <jolsa@kernel.org>
>> Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
>> Cc: Namhyung Kim <namhyung@kernel.org>
>> Cc: Tejun Heo <tj@kernel.org>
>> Reported-by: kernel test robot <rong.a.chen@intel.com>
>> Signed-off-by: Song Liu <songliubraving@fb.com>
>>
>> ---
>> Changes in v12:
>> Fix new failures perf_event_tests. (kernel test robot)
>
> Typo in subject. This is actually v12.
I was stupid... This version didn't work... Please discard it.
Song
next prev parent reply other threads:[~2020-03-24 22:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-24 21:41 Song Liu
2020-03-24 21:43 ` Song Liu
2020-03-24 22:25 ` Song Liu [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-03-07 0:09 Song Liu
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=92D9FFD5-D381-4E46-92BE-F981F0F91388@fb.com \
--to=songliubraving@fb.com \
--cc=Kernel-team@fb.com \
--cc=acme@redhat.com \
--cc=alexey.budankov@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tj@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
all inboxes | Powered by JetHome®