Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1017452rwe; Thu, 25 Aug 2022 13:42:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR5zRbiajXxvYHc4awZQhKare+tWkxXgKx6Q7hbzOtm6ql/mH1N9fnvyV9KBLMcR4pD0Rcl+ X-Received: by 2002:a05:6402:84d:b0:435:a764:9aad with SMTP id b13-20020a056402084d00b00435a7649aadmr4776883edz.332.1661460154566; Thu, 25 Aug 2022 13:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661460154; cv=none; d=google.com; s=arc-20160816; b=nSZvJaDdIEq7QQZLJUCGb12vYkOZfJ7qV6tPLgkoEORsO5qD4pcuy1Hxtqxi3vP/f2 UXw18bnjEQw6JVvwFacIG9CBaLZxFHNPJlL2qNEmspXHHPx3LXuXRmPnkrqMPpUb1XiS lHrpTepNO/Yn9x0ZGJk/WVNDPZvO8DIUhgwno3H60SeHZAJ5Ayfq5lvNwmeAxx6agnvq D6OLPR/lT48cFYgTyHXuxLu4H1TgbKIWXQXagcxKH1q2k4U4PEbMc3qVrM6uLzFMoTWZ 98xKM//oNoo6peEhqFdmVyhEeKLc5lzIoC0OvLqadcoIzVpcbiuoisLyfL7M/w3jEmH3 7KGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=adXeMAqrdZFFCHGRW4ZrYNTwe8MV97cHNOLtkyOs6EU=; b=diK6drz6kiTkmQLg7TGA0xkh7R2bdfJcQSiZlJuM13C02V6YcsUJVGq7kYXXobElHq Y9yGF7QHSAFSh9pVHYkXIpHRDxTInYTbWULX8LKebZqF4IRRKRhzlJfjQQhvcwk9S2eY NGZaZRBT6Ogu+RLXpa+dQGK7JvqZEUw+ODk/Yc3JT3WMChdE8HWVBSS+etkKjP1+guFI 6xsva8drhKegbaWZUkm7xrcrrLmCRU9uf3UjckoSHIdfVA3+sUdsIHMc2BisftTi/Y5F zKO873TPF9RwzLjEPG5Iv8rskdtvBsUGqvrAx+DA9sGUqa/eS5nVw//KtSL+k9aoJ1uJ gnxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l5kivjE0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a1709064fc700b007306dbac8c6si132605ejw.28.2022.08.25.13.42.08; Thu, 25 Aug 2022 13:42:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l5kivjE0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S243819AbiHYU2e (ORCPT + 99 others); Thu, 25 Aug 2022 16:28:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243788AbiHYU2S (ORCPT ); Thu, 25 Aug 2022 16:28:18 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1749065839; Thu, 25 Aug 2022 13:27:10 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id v14so5191028ejf.9; Thu, 25 Aug 2022 13:27:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=adXeMAqrdZFFCHGRW4ZrYNTwe8MV97cHNOLtkyOs6EU=; b=l5kivjE0h3XoUlY7SvzjG0YIOLa1TWG4HJ6tD1gMB+eK/qYHFL14CmPxJsT3of3i2K tpRg+9J0YxFu8WNb1uPRhDZql4XgrVUoJsuIJoRelImNhUY2gpZe88Pzp4wyqMpZu7Pr pS8rbDewmJdX7H3kamDg4vPb9sTmX4R4P1/bN/7XqN2HNZ+nBPhoh5qoajQ06Vd4/rKW 2/oJFJrhuVn+/xLTu5gliICAK+ir+oStb1iPLNUNAm8WgaYelqg+568OeLmEO7/LquH6 IzM+m6qjSFnp0yRfPfe1g54IKT8quqhrfjvJcuooyzi2nWrivaZOAst8+aOup2NVSKb6 J0hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=adXeMAqrdZFFCHGRW4ZrYNTwe8MV97cHNOLtkyOs6EU=; b=rjZrfRVoiKfMAs2xu3lUMwpkTdZpfNLz5nYKYOK3ZY82Yn14Kej4ksiTPYmwfX5XR2 PvTbxpj89P1/k9kNzAflFeVa9W4OdwSMqsR1MDmpPRQ+8kdgBxQCy6qQ3S9qclvo0E6f hViyglwVyWhgUgTDSbFf5yk1XfoEAQk79g6bZMGJSPTb0TjR8fE3CXffoCyVBfZMo6d5 1aLMOVLpTY45i1bkrmkhNF0hDl88E2PdCZAVPRzRJ/tI0y6KpuqtarNEzOcRvt/7Dgk3 G+YFzJAOmmP/KpbiGjWU+i4vNjLGZJ6yuSdR52TrTWlAAyerKXfLQaDSakhXv3jlI2Ui fWXQ== X-Gm-Message-State: ACgBeo0DdUM0siXpAHA0U77tORM8FVhtwhwNU35xCMRGv6NLZ0oqU/d3 Sr5Jvn0anVrRsa4i8jP+LG8YnIhJSRkUHu+UxXI= X-Received: by 2002:a17:906:8a43:b0:73d:7cc2:245e with SMTP id gx3-20020a1709068a4300b0073d7cc2245emr3535868ejc.114.1661459216870; Thu, 25 Aug 2022 13:26:56 -0700 (PDT) MIME-Version: 1.0 References: <1661349907-57222-1-git-send-email-chentao.kernel@linux.alibaba.com> In-Reply-To: <1661349907-57222-1-git-send-email-chentao.kernel@linux.alibaba.com> From: Andrii Nakryiko Date: Thu, 25 Aug 2022 13:26:45 -0700 Message-ID: Subject: Re: [PATCH] libbpf: Support raw btf placed in the default path To: "chentao.ct" Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 24, 2022 at 7:05 AM chentao.ct wrote: > > Now only elf btf can be placed in the default path, raw btf should > also can be there. > It's not clear what you are trying to achieve. Do you want libbpf to attempt to load /boot/vmlinux-%1$s as raw BTF as well (so you can sort of sneak in pregenerated BTF), or what exactly? btf__load_vmlinux_btf() code already supports loading raw BTF, it just needs to be explicitly specified in locations table. So with your change locations[i].raw_btf check doesn't make sense and we need to clean this up. But first, let's discuss the use case, instead of your specific solution. > Signed-off-by: chentao.ct > --- > tools/lib/bpf/btf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c > index bb1e06e..b22b5b3 100644 > --- a/tools/lib/bpf/btf.c > +++ b/tools/lib/bpf/btf.c > @@ -4661,7 +4661,7 @@ struct btf *btf__load_vmlinux_btf(void) > } locations[] = { > /* try canonical vmlinux BTF through sysfs first */ > { "/sys/kernel/btf/vmlinux", true /* raw BTF */ }, > - /* fall back to trying to find vmlinux ELF on disk otherwise */ > + /* fall back to trying to find vmlinux RAW/ELF on disk otherwise */ > { "/boot/vmlinux-%1$s" }, > { "/lib/modules/%1$s/vmlinux-%1$s" }, > { "/lib/modules/%1$s/build/vmlinux" }, > @@ -4686,7 +4686,7 @@ struct btf *btf__load_vmlinux_btf(void) > if (locations[i].raw_btf) > btf = btf__parse_raw(path); > else > - btf = btf__parse_elf(path, NULL); > + btf = btf__parse(path, NULL); > err = libbpf_get_error(btf); > pr_debug("loading kernel BTF '%s': %d\n", path, err); > if (err) > -- > 2.2.1 >