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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 280B3C4332F for ; Mon, 19 Dec 2022 03:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231326AbiLSDp2 (ORCPT ); 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-Google-Smtp-Source: AA0mqf7PKPQzRVWRGzVuTYxLiD4/XBylyvC0Ia68WHidlagaoY58bNmKTs8hhuLKkg2UsWRYpxtzQw== 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> 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 >