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=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 94166C433E0 for ; Wed, 27 May 2020 05:09:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 70FFE207E8 for ; Wed, 27 May 2020 05:09:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CV2ucSIX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728331AbgE0FJY (ORCPT ); Wed, 27 May 2020 01:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725379AbgE0FJY (ORCPT ); Wed, 27 May 2020 01:09:24 -0400 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C961CC061A0F; Tue, 26 May 2020 22:09:22 -0700 (PDT) Received: by mail-qk1-x741.google.com with SMTP id n11so17766473qkn.8; Tue, 26 May 2020 22:09:22 -0700 (PDT) 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; bh=iTJZDY5H/dFxsdNEjr0CYs0oWVGjpyqAezVJ96AZYfc=; b=CV2ucSIXe0MdSExnbrnR5g8LCcsNtUBsRqlV7OJ81wsKo/I80iYTbnje8gCPtLzotg O/YpGSdI8XfPKAPb/VIKE7fe8oTuueeMQ7uKoV92WBfrYFyWnPMG4zmoqCexfLkeJRAd tUxqBCvupS1Oibc9N4FogsLIC8iHxjVSDb6m2q+k19yvZXY5AStxX63XSFxZB0Rparq9 yBERo1OiS8WKvUEvXOrpVPrn7zJ9Qn64oDkfiPEpTeGPJniEF79Gyk/QiV8wnd61UihC mP9T8z8kzMwvuo9IMPUu2wIe9knSTIMZ60oKMD5iWKGZgbYYZ82o/5CasO2jj8s4L2MK dzMg== 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; bh=iTJZDY5H/dFxsdNEjr0CYs0oWVGjpyqAezVJ96AZYfc=; b=sgXgyTXrGUAQD+v5hTjVxnxMI4zxFL1lGsKuv+0d4ZaUl93gKB7PWQs5enyxLcmO5D n/FSK13VpgC9Op8tym8d3BI+1JWLjyT9bzo+ZoyxCh5Y5/b+dIcxonfToRcWqD1DBMAW 2/v02FPyQfbhFumPVBlURIPExNnRaibnhq2eGfcNMCoQZJeRiVvMpnmKZwrlTP0Qu7Rh pn1IDxc5/S/xeft0oMD4bGXCIavGfMLx7zbYP8qIhSm/oUoWRB0ZEZSGcMQc9y8Q5h78 J7PNreaIKVY8WGHsqhXz1sV1UNbPYRIpL3E5y9YF+Ep2csvBzTii0z9bbgeis9mB6Wt7 lIBA== X-Gm-Message-State: AOAM532coFs+vFKmG3ZPr9ylee3ApV7nDEQQXSYDF9RxUrYHFc8kowsW wsuzxnhZXJocMbs1Pgs+WYE9sd3MWVEmahUIX/B6j0ovQKo= X-Google-Smtp-Source: ABdhPJz2hDPmT8O5VsGbH8yEh55w28aOevI54yyqsu2GyAFXInQi43st7eNYjtxellJx6xBU+/QQkEMLYA8BcdzN+ys= X-Received: by 2002:a37:a89:: with SMTP id 131mr2339534qkk.92.1590556162058; Tue, 26 May 2020 22:09:22 -0700 (PDT) MIME-Version: 1.0 References: <20200527015704.2294223-1-dxu@dxuuu.xyz> In-Reply-To: <20200527015704.2294223-1-dxu@dxuuu.xyz> From: Andrii Nakryiko Date: Tue, 26 May 2020 22:09:11 -0700 Message-ID: Subject: Re: [PATCH bpf-next] libbpf: Export bpf_object__load_vmlinux_btf To: Daniel Xu Cc: Alexei Starovoitov , Daniel Borkmann , Martin Lau , Song Liu , Yonghong Song , Andrii Nakryiko , john fastabend , KP Singh , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , bpf , Networking , open list , clang-built-linux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 26, 2020 at 7:09 PM Daniel Xu wrote: > > Right now the libbpf model encourages loading the entire object at once. > In this model, libbpf handles loading BTF from vmlinux for us. However, > it can be useful to selectively load certain maps and programs inside an > object without loading everything else. There is no way to selectively load or not load a map. All maps are created, unless they are reusing map FD or pinned instances. See below, I'd like to understand the use case better. > > In the latter model, there was perviously no way to load BTF on-demand. > This commit exports the bpf_object__load_vmlinux_btf such that we are > able to load BTF on demand. > Let's start with the real problem, not a solution. Do you have specific use case where you need bpf_object__load_vmlinux_btf()? It might not do anything if none of BPF programs in the object requires BTF, because it's very much tightly coupled with loading bpf_object as a whole model. I'd like to understand what you are after with this, before exposing internal implementation details as an API. > Signed-off-by: Daniel Xu > --- > tools/lib/bpf/libbpf.c | 2 +- > tools/lib/bpf/libbpf.h | 1 + > tools/lib/bpf/libbpf.map | 1 + > 3 files changed, 3 insertions(+), 1 deletion(-) > [...]