Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp400238ybl; Mon, 2 Dec 2019 12:27:04 -0800 (PST) X-Google-Smtp-Source: APXvYqzZ1KbAAWNm0zsXZiJG5EC4nmg9HSBKi148HH+Sk4+aF9zp4kMilkK1mBiLzmUQ9cUrGuxM X-Received: by 2002:a17:907:444c:: with SMTP id on20mr1270385ejb.115.1575318424486; Mon, 02 Dec 2019 12:27:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575318424; cv=none; d=google.com; s=arc-20160816; b=Z7KiNqCZvfCKyIUTY4FmfY32CVwZ70YLhviH8/KOdRTCIWhfZwjrSfsdwzx9aO887j ADMqj+YjIOdt5QCCLjU36U7jsh0McKo2z9K1wGp7K1GwMg+lfGcOb9o0wvYcuP7Cb2DW P1+9KLeAg2r3W+/dfBOW0DGR+7mKQt/FAcbATpcf5aKtGq8umS/iEJ8uZ8+/haXwMtKr 9O8fINLqG6gbyUrTnPuaj+JLc5q9VVGvOxMu64EUl8pHwX20c2Vo1XJz5SXUSR7mKtd7 DnV/x8c+MfCyAVbTxbE4YloXr7eYmnCemubL7OfOMKpqd6AH+hB5M1KVvxofvTrn3UFI AIcA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=AnWD7sTCrH/sWowo7WOFM1CDDX20u+B+tWaH0Jnqtwk=; b=ai03nP6xyr0P+FAvu1Tgj/ixeqKqIZi8w8FoH7x9dstPHPlLh/1bVDnDWJpDFlcZNi LUcPB317aKV4866nXaYyX0S53z5iezVadDqL9lWzl/N0FDQ5/oM9gpAyOGWFi14sdBFT zJDzXjS35gHoCGxuqALKia7o0AiSWUiSEhoiVa60NkFMUHWD3iVYmcWqLuVuiapdW0Hw 99J6+iFkHZct8qGViSH76FpZK8kG7tLHtwGR79LK2RhWOHsI6M3Tq2S96xoiCADFT2x8 43acquAJgdzzFZEKdtPPeoEI96gbnY2yNCy9PIQBH8zR1GVoVX+kUYI+LHXormrMOyIA vGew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="C/H55AzQ"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9si479962edn.121.2019.12.02.12.26.40; Mon, 02 Dec 2019 12:27:04 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="C/H55AzQ"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727658AbfLBSnG (ORCPT + 99 others); Mon, 2 Dec 2019 13:43:06 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:41755 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727418AbfLBSnG (ORCPT ); Mon, 2 Dec 2019 13:43:06 -0500 Received: by mail-qt1-f193.google.com with SMTP id v2so774357qtv.8; Mon, 02 Dec 2019 10:43:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=AnWD7sTCrH/sWowo7WOFM1CDDX20u+B+tWaH0Jnqtwk=; b=C/H55AzQsVIXNNR37eV61Ui6BsPj6qxnpiS4smZk4LFHMtNhrnyr4UBxDT8noF/KRi 4FWHgATpEt1TvCf+lA8lvfY7OZm7F93zKsCIcy5uKJ6L4wMs6QEDoDJMzV0a7hfMLmsG uMbfEvCj/Ftyb4upOkqE/8UU7cXyEfRYhb6UOHa4lMXuwaKMUW7ChhwTK2x/DdX4MKN0 UDvxtFJHv/Wdy9XNDXAwafvbvag8Az7r1dcwvItwXpCf/aSM22J85zLdlkaIt9QZL9oV JnCyScixf2nZbms22YbVdS3xs+24xjJcdlqaPaPbXzMXN4Qr0r7TcYeg/8jRUb0+bRzL JNqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=AnWD7sTCrH/sWowo7WOFM1CDDX20u+B+tWaH0Jnqtwk=; b=n0VUocufSNV0ecBx/O8vqrAiUfXWBy5e1pho+Jm2FsXWT4HNwWonQYpys83jhzZ6Pm ehQyNIn4z5/jjLFfVP16bq/MMpIeu6K0rnkvkUFeOukKWqE/b91LeILlXZPLiY2r+Nd0 bXIJzrdc61gj3/COPhGAQpIrNzcGld0JfNtSihPBlCg1oiYU8uFyuYI/E5EwaeBBcmyV U2TGMt1vSnbiuDvvoCUybkQzjlFmsEutzVZ84xHUDrw54H7I0SxGdVbemreLha/uPJJm omaaI1LAAMU/IDNy5xWMwiFnSolpjEdLj1wrWKaWebNTQmmKYkD7NGnysVZZINh8e1k2 vzcg== X-Gm-Message-State: APjAAAUfu2pIYTfsIdwVKstNRMvv1DK+2ae1OQF8gdkXrtwV7AjjqGuj EfRr77fEm8Fwa7iDNxXITbE6ZHl0iTwotlzIvBA= X-Received: by 2002:ac8:1385:: with SMTP id h5mr835578qtj.59.1575312184786; Mon, 02 Dec 2019 10:43:04 -0800 (PST) MIME-Version: 1.0 References: <20191127094837.4045-1-jolsa@kernel.org> <87zhgappl7.fsf@toke.dk> In-Reply-To: <87zhgappl7.fsf@toke.dk> From: Andrii Nakryiko Date: Mon, 2 Dec 2019 10:42:53 -0800 Message-ID: Subject: Re: [PATCH 0/3] perf/bpftool: Allow to link libbpf dynamically To: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Networking , bpf , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Jesper Dangaard Brouer , Daniel Borkmann , Alexei Starovoitov , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 2, 2019 at 10:09 AM Toke H=C3=B8iland-J=C3=B8rgensen wrote: > > Andrii Nakryiko writes: > > > On Wed, Nov 27, 2019 at 1:49 AM Jiri Olsa wrote: > >> > >> hi, > >> adding support to link bpftool with libbpf dynamically, > >> and config change for perf. > >> > >> It's now possible to use: > >> $ make -C tools/bpf/bpftool/ LIBBPF_DYNAMIC=3D1 > > > > I wonder what's the motivation behind these changes, though? Why is > > linking bpftool dynamically with libbpf is necessary and important? > > They are both developed tightly within kernel repo, so I fail to see > > what are the huge advantages one can get from linking them > > dynamically. > > Well, all the regular reasons for using dynamic linking (memory usage, > binary size, etc). bpftool is 327KB with statically linked libbpf. Hardly a huge problem for either binary size or memory usage. CPU instruction cache usage is also hardly a concern for bpftool specifically. > But in particular, the ability to update the libbpf > package if there's a serious bug, and have that be picked up by all > utilities making use of it. I agree, and that works only for utilities linking with libbpf dynamically. For tools that build statically, you'd have to update tools anyways. And if you can update libbpf, you can as well update bpftool at the same time, so I don't think linking bpftool statically with libbpf causes any new problems. > No reason why bpftool should be special in that respect. But I think bpftool is special and we actually want it to be special and tightly coupled to libbpf with sometimes very intimate knowledge of libbpf and access to "hidden" APIs. That allows us to experiment with new stuff that requires use of bpftool (e.g., code generation for BPF programs), without having to expose and seal public APIs. And I don't think it's a problem from the point of code maintenance, because both live in the same repository and are updated "atomically" when new features are added or changed. Beyond superficial binary size worries, I don't see any good reason why we should add more complexity and variables to libbpf and bpftool build processes just to have a "nice to have" option of linking bpftool dynamically with libbpf. > > -Toke >