[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4CBDB645-513F-4CCA-9FA0-B29110F10C0E@fb.com>
Date: Wed, 17 Apr 2019 16:56:41 +0000
From: Song Liu <songliubraving@...com>
To: Jiri Olsa <jolsa@...hat.com>
CC: Adrian Hunter <adrian.hunter@...el.com>,
Jiri Olsa <jolsa@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Andi Kleen <ak@...ux.intel.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>
Subject: Re: [PATCH 11/12] perf tools: Reuse shared eBPF dso objects
> On Apr 17, 2019, at 12:32 AM, Jiri Olsa <jolsa@...hat.com> wrote:
>
> On Wed, Apr 17, 2019 at 09:55:25AM +0300, Adrian Hunter wrote:
>> On 17/04/19 9:51 AM, Jiri Olsa wrote:
>>> On Wed, Apr 17, 2019 at 09:35:32AM +0300, Adrian Hunter wrote:
>>>> On 16/04/19 7:01 PM, Jiri Olsa wrote:
>>>>> The eBPF program can be loaded multiple times
>>>>> with the same name (tag). We can share dso
>>>>> objects for those programs.
>>>>
>>>> Doesn't a eBPF program get recompiled differently every time it is loaded?
>>>
>>> yes, but those with same tag are identical
>>
>> But won't recompiled eBPF programs be different due to blinded constants?
>> Or perhaps in the future other code randomization?
>
> ah right.. that can happen, let's skip this one then
>
> perhaps we could add bpf prog id to be part of the name
> to make it unique.. I'll check
>
> thanks,
> jirka
I thought about similar optimizations. However, this is not easy.
Tag of a BPF program is calculated _before_ JiT, so we really cannot
say two programs with same tag are identical. Current implementation
iterates over all bpf program IDs, so same program id will not appear
twice in the same perf session.
I think the more realistic opportunity of optimizations comes from
sharing the dsos cross multiple perf.data files.
Thanks,
Song
>>
>>>
>>> jirka
>>>
>>>>
>>>>>
>>>>> Link: http://lkml.kernel.org/n/tip-3damf8vq1dryhtpbk5b06jpt@git.kernel.org
>>>>> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
>>>>> ---
>>>>> tools/perf/util/machine.c | 14 +++++++++++---
>>>>> 1 file changed, 11 insertions(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
>>>>> index d4aa44489011..a60653827891 100644
>>>>> --- a/tools/perf/util/machine.c
>>>>> +++ b/tools/perf/util/machine.c
>>>>> @@ -23,6 +23,7 @@
>>>>> #include "linux/hash.h"
>>>>> #include "asm/bug.h"
>>>>> #include "bpf-event.h"
>>>>> +#include "dso.h"
>>>>>
>>>>> #include "sane_ctype.h"
>>>>> #include <symbol/kallsyms.h>
>>>>> @@ -699,11 +700,18 @@ static int machine__process_ksymbol_register(struct machine *machine,
>>>>>
>>>>> map = map_groups__find(&machine->kmaps, event->ksymbol_event.addr);
>>>>> if (!map) {
>>>>> - map = dso__new_map(event->ksymbol_event.name);
>>>>> - if (!map)
>>>>> + struct dso *dso;
>>>>> +
>>>>> + dso = dsos__findnew(&machine->dsos, event->ksymbol_event.name);
>>>>> + if (!dso)
>>>>> return -ENOMEM;
>>>>>
>>>>> - map->start = event->ksymbol_event.addr;
>>>>> + map = map__new2(event->ksymbol_event.addr, dso);
>>>>> + if (!map) {
>>>>> + dso__put(dso);
>>>>> + return -ENOMEM;
>>>>> + }
>>>>> +
>>>>> map->end = map->start + event->ksymbol_event.len;
>>>>> map_groups__insert(&machine->kmaps, map);
>>>>> }
Powered by blists - more mailing lists