From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A594DC432C0 for ; Mon, 2 Dec 2019 18:43:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7843E20718 for ; Mon, 2 Dec 2019 18:43:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C/H55AzQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727586AbfLBSnG (ORCPT ); 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-Google-Smtp-Source: APXvYqwIgwsCAJeW/GmVHa9v0gX68uVrUsI9VUspc7LOGfwihg3b/Uvp8JTHV9/ke+jwXgb2EQ+fGHCGnVhYxRtGJLo= 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: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@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 >