Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3906718yba; Tue, 16 Apr 2019 23:52:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7IrY/1wXxis6906Gu9M7gkh3JVEfjmHlWaglaw34Tr91D0gP7T7J82qTyXdiF9Wn5cX1s X-Received: by 2002:a17:902:703:: with SMTP id 3mr88053422pli.224.1555483959933; Tue, 16 Apr 2019 23:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555483959; cv=none; d=google.com; s=arc-20160816; b=IFkmEmI4k5ZIhD1zTA162j+MqAemTHPwl89lyPhsbVEJN91VbNwcZjIAXehkP1lYwz mhuzRN03V6Ayx/As+VU04ZgrfDm7rNq/KQPA3whotsnURyrtxsD9BmFQJheF76CIy0UF nr0yMnRLqkbS8X68ivONBWUp9ypiOluHNgbm0I5/FdWj/S650nInpSA7nrHUnk+UVGrn /eR0uprNa7C32SMi7h92xQaljEzLnPYBog3GdHTIyhWoCVcg02Qnrq2zQzJ8N8ui6Zhw iRYE8hWCOYpwm56uOGbLDzvAj5A/y1TdtnR2P3GuRa+zesXZPXgimr+xixpYWxUCDQRb I6TA== 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=e7tIYkwmGIFqq6GHk0u4zQq74vfs6VmRPEjz4Nvwxcs=; b=H3mKGfVUQ7v/L5Y6IYvuGGJ/+37e+84KMasK/2CXWEWv6XdVIuARy/ZPNRY3Ncx/9G JWOzye/k1qGZ6czvF7tWlwUpnQhhKLa3HpNcINFkifoPTYpRbYq2FpWpgbRt9/skT3En AzunCXZ3mZdfeOexWioXfax+Ou/DI9TOd88sxIGypeT8Sq1gshsk/izeXXI+SQKFuKlh lyxak4nPQaaxHyy78xT0EqWkdj+2EZaWdP2HhmbvVA6quR05FV6eLPCGX+T/eZW/dju2 d6W70CWcB3I3TimVpBtjXAVuwKvh47gw4I1jwUEE9EQXAAiPLiJl9M9KRV0ISUWWEbjX vHqw== 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 e193si46323344pgc.339.2019.04.16.23.52.24; Tue, 16 Apr 2019 23:52:39 -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 S1729782AbfDQGvd (ORCPT + 99 others); Wed, 17 Apr 2019 02:51:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54614 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726313AbfDQGvb (ORCPT ); Wed, 17 Apr 2019 02:51:31 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C11233092647; Wed, 17 Apr 2019 06:51:30 +0000 (UTC) Received: from krava (unknown [10.43.17.48]) by smtp.corp.redhat.com (Postfix) with SMTP id 231465D9C8; Wed, 17 Apr 2019 06:51:27 +0000 (UTC) Date: Wed, 17 Apr 2019 08:51:27 +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: <20190417065127.GA17024@krava> References: <20190416160127.30203-1-jolsa@kernel.org> <20190416160127.30203-12-jolsa@kernel.org> <746f02e3-a509-5081-8427-b610e52c1fb0@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <746f02e3-a509-5081-8427-b610e52c1fb0@intel.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 17 Apr 2019 06:51:30 +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: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 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); > > } > > >