Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp1993702rwj; Sun, 18 Dec 2022 20:24:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXvbi+MKurrydzZlaL7dL84xb5avqI4iVaVGKILVMcsD1RS+I4SjtkpNlP+JxsxcC/SYHegP X-Received: by 2002:a17:906:85ca:b0:7ef:b60e:cb02 with SMTP id i10-20020a17090685ca00b007efb60ecb02mr7383648ejy.48.1671423846669; Sun, 18 Dec 2022 20:24:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671423846; cv=none; d=google.com; s=arc-20160816; b=X4MX91SzLBIe1mLVaKt5Lo/IwTOg1ga0MPcRwIcDKFcycDPntFNetOh7VsFct0z9ZV crsooctxQChJ54PLCLfzliCHXfav1QhuBHRcAYgca3hyUqR4PNk0sk9v/ZiRvT+off60 +3ZJM9/dpYqk5pDQGMSWA9WC4KroJHAPd9fpY3qYVC0jsGB4z1FWliF0Y77bJG3LdUov 82jPXVeuFgMRz6CdF1BEIlASHGCdk1gF6fFJ0J9CZiY8vmK7nm1BR3WeDVbbPoSYXdH+ pAUql7V9vTnDWK0/UJuIfJu6Bpf14setegScfJ2M3OYMEFaiDEYoiRlkjMh8r8rQg1Nc BiXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ufkpDtqwrwaASbEeUOXsA7V1EpiSQ5Rn4rC/a+dn8wY=; b=PzrbQk2IpwerGAkn7zuPwoxRh0eStkTyJlsIHqBwg2ko7H6r/sXHOkLmaUqVXws1iX YB9NDXIB+2feMJKTq3EUOKMKXcb+cA2rFabqVZRUanH+yv4e0N/jNihrBHgwd7W/sfKG GsQAF4VpVI5SIO7DBik+8ppG61Uoo87XYwSnwyYbvxH2fE7TIWgtYYAyh9HtY15kyPHf NWtUTEOE+vKF5QmQ4bW7t9iNsj8WiEFs0v3Lq6nPq6D7ErUfe6k9suyKL2oQCWFwc6Ox hlAnOxbCKQgrmPzMY0gMys/Ft1MjzRduthGaVEsmtqo9cBWsbX4GuKvUriTl2latNZnj rF4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kREEY0cP; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r17-20020a05640251d100b004604906b23csi7817134edd.545.2022.12.18.20.23.49; Sun, 18 Dec 2022 20:24:06 -0800 (PST) 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=@linaro.org header.s=google header.b=kREEY0cP; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231322AbiLSDp2 (ORCPT + 70 others); Sun, 18 Dec 2022 22:45:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231315AbiLSDpZ (ORCPT ); Sun, 18 Dec 2022 22:45:25 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83FA7AE61 for ; Sun, 18 Dec 2022 19:45:24 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id t2so7823035ply.2 for ; Sun, 18 Dec 2022 19:45:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ufkpDtqwrwaASbEeUOXsA7V1EpiSQ5Rn4rC/a+dn8wY=; b=kREEY0cPLyCDghlpTDJ8V2o21sNnI1qpq49TZewEDl/Dy9Ne8Ooj9q26jiMTKqFAIb jBm2PZTjWpl34gp/877YXeDvIXjtCJWXKIaECssweFHZ5k1h5DDv9U5eGtl44jBz4hzu 7KXJLAe/wVbUrVRtPcZe9ZC0NbeMdZEI9d7zvYAUZvVTZrSb3NRCvih54mACbYLptfDn 74DCdpslCI0Cwo5zyeylqRxVGM87agTMsIotS/ZrP7kwNkSWGrXauryCBHRi+LstpufE 2J3jR7tMjbU114xqDI/y7p4jqBSd9YSHLVng8uf5gUhJFr28NryNS12H9ZXh3iKVfOB7 3MeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ufkpDtqwrwaASbEeUOXsA7V1EpiSQ5Rn4rC/a+dn8wY=; b=44gW26DwQd1zXPEbrixykYGG7wQk8hSjAOO4qZqvWOTygYT+8o5dkF5AdGJ+o2XhhU i6d7kTZJw5YNLZWMsUCqvN8aE4fI9WCcoERGnQzh2JYe5dGPO23aVQD7hHVNSMOzApdn WAjIqsH2MCx0ctqUN5hAeKqpUpc8Prp6T4i/ShKv8tWyUIVY5Ygm1g+gXgUA1KbcqB0Q uqkPnxl7UPzsOalwVuSi4MTMu3qg8eEiTiZtZohTDmRpqlSDNQ9ovgm89aLzRWEQTmu+ NRPOPjblS9bXKjnz6KYpd8ARTqpvbIQo4xF4syIopvWndwCRJVK262hisvZzJmsVYLc4 umIg== X-Gm-Message-State: ANoB5pkFy5J/LUY0/pgJF8pscwto8M+tmDvAEwToht/W/2Uedaielcnd W7viefvrW29dNESK5Nzk+jFTTw== X-Received: by 2002:a17:90a:4f49:b0:219:b04d:a1 with SMTP id w9-20020a17090a4f4900b00219b04d00a1mr41521474pjl.41.1671421523739; Sun, 18 Dec 2022 19:45:23 -0800 (PST) Received: from leoy-yangtze.lan ([152.70.116.104]) by smtp.gmail.com with ESMTPSA id 21-20020a631955000000b004772abe41f6sm5194521pgz.83.2022.12.18.19.45.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Dec 2022 19:45:23 -0800 (PST) Date: Mon, 19 Dec 2022 11:45:08 +0800 From: Leo Yan To: Changbin Du Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Quentin Monnet , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Shuah Khan , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Rutland , Alexander Shishkin , Namhyung Kim , Mykola Lysenko , linux-perf-users@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v3 1/2] libbpf: show error info about missing ".BTF" section Message-ID: References: <20221217223509.88254-1-changbin.du@gmail.com> <20221217223509.88254-2-changbin.du@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221217223509.88254-2-changbin.du@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Hi Changbin, On Sun, Dec 18, 2022 at 06:35:08AM +0800, Changbin Du wrote: > Show the real problem instead of just saying "No such file or directory". > > Now will print below info: > libbpf: failed to find '.BTF' ELF section in /home/changbin/work/linux/vmlinux Recently I encountered the same issue, it could be caused by: either missing to install tool pahole or missing to enable kernel configuration CONFIG_DEBUG_INFO_BTF. Could we give explict info for reasoning failure? Like: "libbpf: failed to find '.BTF' ELF section in /home/changbin/work/linux/vmlinux, please install pahole and enable CONFIG_DEBUG_INFO_BTF=y for kernel building". > Error: failed to load BTF from /home/changbin/work/linux/vmlinux: No such file or directory This log is confusing when we can find vmlinux file but without BTF section. Consider to use a separate patch to detect vmlinux not found case and print out "No such file or directory"? Thanks, Leo > Signed-off-by: Changbin Du > --- > tools/lib/bpf/btf.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c > index 71e165b09ed5..dd2badf1a54e 100644 > --- a/tools/lib/bpf/btf.c > +++ b/tools/lib/bpf/btf.c > @@ -990,6 +990,7 @@ static struct btf *btf_parse_elf(const char *path, struct btf *base_btf, > err = 0; > > if (!btf_data) { > + pr_warn("failed to find '%s' ELF section in %s\n", BTF_ELF_SEC, path); > err = -ENOENT; > goto done; > } > -- > 2.37.2 >