Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp580069ybm; Wed, 27 May 2020 02:54:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcVuf2wXFTiAoN4/8y77c+G6y+SiNTbrtsMj4afLgyEqcMjnTE76gBOWDYUgDnABH+LMGU X-Received: by 2002:a17:906:468e:: with SMTP id a14mr5127901ejr.124.1590573274023; Wed, 27 May 2020 02:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590573274; cv=none; d=google.com; s=arc-20160816; b=jh7aWNdCNk7GnNoZ3qLTVUTxylvDjf6mgWROTyLGjSPO/+U+T/ubvMCMIPtJmfAixh kg+ZUwMEuc0j+xbEWHz06sNgQ8ByAQX3A3X14H6qoX+itw4l0rNf3gA/3lCS4iWYPjeB TClKYPKhKqRXhMOV+rnc8n/xQeMLy6izmJVLm290LVEMl9SQA8ZppUzOl4zNQ2On0Jis Z/MHfFFfE1l6iY3i3CTkfMI1nKDRjUd1xyzkEQuOdNbRHcFkWQ7r8fHsUsp9cuAu3Sum pIS5MkdvXfr9TXlEdNpEI/j/DXrtyf6dYBzacVI4FRO7VXi4vTTNbklJ5NZd6YwLhtmO puTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=iTJZDY5H/dFxsdNEjr0CYs0oWVGjpyqAezVJ96AZYfc=; b=hbB3gta6H9/jhGYiCaoVNozFI2zOgIlJwZxl30kChLEkmKTIX0PsQsunDfsujL/b2Y 1fJlhS8dbHnCRAomTlzxSiTnzCz4+GURlGCgHurJbg05CxSKVljNpDPwG1+QqvGFtBNz 7PY5FIaUgvvb9QgDQFFna8gbp2HZZakFp7CEaRnrWBRVc/ZnU0MCjb+OVkjxhR0829Ev MdzLfYFlXSDt6tJ21Pc58/ZPMXI7rjJmznc+laCaug3rGdA9GSz2foeoTKiSINP15bHD lnjjcVJg8KtG4kLFpx2591YBEHGgj4NztOK9PHjoQ2nqq4m753GQmRr2tDkSMnT7uKSt AoHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CV2ucSIX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id n1si1343458edv.442.2020.05.27.02.54.10; Wed, 27 May 2020 02:54:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CV2ucSIX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728217AbgE0FJY (ORCPT + 99 others); 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-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(-) > [...]