lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <92D9FFD5-D381-4E46-92BE-F981F0F91388@fb.com>
Date:   Tue, 24 Mar 2020 22:25:37 +0000
From:   Song Liu <songliubraving@...com>
To:     linux-kernel <linux-kernel@...r.kernel.org>
CC:     Kernel Team <Kernel-team@...com>,
        Peter Zijlstra <peterz@...radead.org>,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Alexey Budankov <alexey.budankov@...ux.intel.com>,
        Namhyung Kim <namhyung@...nel.org>, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH v11] perf: Sharing PMU counters across compatible events



> On Mar 24, 2020, at 2:43 PM, Song Liu <songliubraving@...com> wrote:
> 
> 
> 
>> On Mar 24, 2020, at 2:41 PM, Song Liu <songliubraving@...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@...radead.org>
>> Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
>> Cc: Jiri Olsa <jolsa@...nel.org>
>> Cc: Alexey Budankov <alexey.budankov@...ux.intel.com>
>> Cc: Namhyung Kim <namhyung@...nel.org>
>> Cc: Tejun Heo <tj@...nel.org>
>> Reported-by: kernel test robot <rong.a.chen@...el.com>
>> Signed-off-by: Song Liu <songliubraving@...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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ