Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3931576yba; Wed, 17 Apr 2019 00:35:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqylPuCmfz3NMvWXG7WX5lXMVlhOFg9L/1DgFuUGPa9K7Py2vf+HPwDJbawpyQtzsbodDaQF X-Received: by 2002:a17:902:a01:: with SMTP id 1mr59217529plo.36.1555486509378; Wed, 17 Apr 2019 00:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555486509; cv=none; d=google.com; s=arc-20160816; b=JtlYR9saP6Wdo1DX1bfoNl17t0YK7f2t4o6rpkUvPLWA7lquTNHxXrdsotCTDnzEWT cSlDyV3BMR1m1Fp75IbNKKlp4eoPniOSU0ontlLrm99eSw7HksCspOQUIurdijJnDZwx k+g+mzkR0W3U76g5egOnwqILmyqvaFdfnTa0zd6qAn+85UMwEaIElfx4z5spdovGeGtF 2x3xxjQSKfnP/lxZBPl40XKtjaS9fPGZ2BV847Ceht/V+MLUV+V+VJNIeWzGtz9GfMg4 xdUhT876WyVPxJLjUE70R9Mf3z2xJsJkCSI5uCYrLBd80xxUDHpiEBWPI+pImdjwoscg C8NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=4v1011yHRa49tg16dJTkEE9ZBSJeLWlI/Uc8Sj08Ghw=; b=jWHzhUGx1dn2QO1OkCAnphuqRHB/IDVMDQvSJl4RDrWAyaktTuP677Y4fkvPlLXSvw tT0G3dHl+e2QgPyiJ2gjvO+brurJJYw/TmcqD4LiMfX427IMGTUsa2yI/KuGm+JNY1IU wOGVkML73M4Hw6mHRecjDYsZuBbuwzFmURBQuHT003KQsWN7UbPTq8+31eLdUXUAPrsz KiO92kcAGtu6zggL+8jrmTEsplVOV6yLoLw5mnbZnH3+ndNsKp30AVGSBLOf7MMijAMX NF9vmySpz1xX560XcPU8LGmp6SAtdSeiSOhPSGJhnFYLSzLo9z0Nx6s+ouIAmnawxlw1 h29Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g69si24635728pgc.408.2019.04.17.00.34.54; Wed, 17 Apr 2019 00:35:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730384AbfDQHcp (ORCPT + 99 others); Wed, 17 Apr 2019 03:32:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50130 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbfDQHco (ORCPT ); Wed, 17 Apr 2019 03:32:44 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5D604882F5; Wed, 17 Apr 2019 07:32:44 +0000 (UTC) Received: from krava (unknown [10.43.17.48]) by smtp.corp.redhat.com (Postfix) with SMTP id 134406013D; Wed, 17 Apr 2019 07:32:41 +0000 (UTC) Date: Wed, 17 Apr 2019 09:32:41 +0200 From: Jiri Olsa To: Adrian Hunter Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Andi Kleen , Song Liu , Alexei Starovoitov , Daniel Borkmann Subject: Re: [PATCH 11/12] perf tools: Reuse shared eBPF dso objects Message-ID: <20190417073241.GC17024@krava> References: <20190416160127.30203-1-jolsa@kernel.org> <20190416160127.30203-12-jolsa@kernel.org> <746f02e3-a509-5081-8427-b610e52c1fb0@intel.com> <20190417065127.GA17024@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 17 Apr 2019 07:32:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > > > jirka > > > >> > >>> > >>> Link: http://lkml.kernel.org/n/tip-3damf8vq1dryhtpbk5b06jpt@git.kernel.org > >>> Signed-off-by: Jiri Olsa > >>> --- > >>> 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 > >>> @@ -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); > >>> } > >>> > >> > > >