Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3909505yba; Tue, 16 Apr 2019 23:57:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJ5OKWg6HZ0EFsLRP1QRyTOSUXANwBCU0C/zzjfWRGWURcX/lD3w803tMpVwn8q3Vu1xfC X-Received: by 2002:a65:5003:: with SMTP id f3mr25639070pgo.29.1555484274210; Tue, 16 Apr 2019 23:57:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555484274; cv=none; d=google.com; s=arc-20160816; b=WF4oOoN7V9ODzTx6ffEbOHCI1ewQ6x4Pba6gFEr4r3bk7RTo1MLd7Epb10vPF/DoNw ZBY7s+KBY5YsPKnMHok+zRMe1a64zjQQN6yZGsIu3tzfcnBXoaFZAmkRcOy0EuNDE49O Ll6KrvOCCsBJu6aKgVfPQ6r6YGbRwh3Y1aN+GoplgpIX+GlfIiH6wF+cVQbiyLMgqYeo h2AS6vryJKquNY38QEvXp91IrfN3V5vmBj8Wc9eQopY3jyZbzKpwcoYFQeDAdO3JJgB+ MrJNog8GQZtO629Yhxdj3HXQeWPyti23lENU4mRthKRfGuGwqLcKzcApiicsS+bZTuey vnPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=zP3vR4utxI2lgwouM4hHIEhacf4dkVnTn3PojUCiPSo=; b=GAbHCvCHkVLU42NuJm0UjqJEC8cOI1qCuEFRC4rjptTWTTxFWj0S0qq63Oo4fryC28 Xzddt9kZTnfGoa4DES888gi1t4pIYiVRxMxEq7TgX+tmyEtvLryHPbEY8f6e75NjWnbL xq2DrXEmMqUBdSt8GwBqcPDzv5nIMRk7tKONO3AUqOERqpaCQ5/WwEBuijP3kfa36vA9 NlEXA66aznnNpzzAwg9waRojMELHLNH7Z3w/aV3sxORLWwJvLw0Eovc9M/+WK7HecPky CAX+A5z8lTH0Flpm3bjS7FMyiq+8mlzbSgCsaa+ykOCGjErUAygvf9moavu8NruRw1NT 3tHA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g20si50390612pfi.266.2019.04.16.23.57.39; Tue, 16 Apr 2019 23:57:54 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730948AbfDQG4r (ORCPT + 99 others); Wed, 17 Apr 2019 02:56:47 -0400 Received: from mga02.intel.com ([134.134.136.20]:3634 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730691AbfDQG4r (ORCPT ); Wed, 17 Apr 2019 02:56:47 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Apr 2019 23:56:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,361,1549958400"; d="scan'208";a="165437887" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.198]) ([10.237.72.198]) by fmsmga001.fm.intel.com with ESMTP; 16 Apr 2019 23:56:43 -0700 Subject: Re: [PATCH 11/12] perf tools: Reuse shared eBPF dso objects To: Jiri Olsa Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Andi Kleen , Song Liu , Alexei Starovoitov , Daniel Borkmann References: <20190416160127.30203-1-jolsa@kernel.org> <20190416160127.30203-12-jolsa@kernel.org> <746f02e3-a509-5081-8427-b610e52c1fb0@intel.com> <20190417065127.GA17024@krava> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Wed, 17 Apr 2019 09:55:25 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190417065127.GA17024@krava> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > > 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); >>> } >>> >> >