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 35D09EE498E for ; Fri, 18 Aug 2023 17:51:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379074AbjHRRvO (ORCPT ); Fri, 18 Aug 2023 13:51:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379330AbjHRRvI (ORCPT ); Fri, 18 Aug 2023 13:51:08 -0400 X-Greylist: delayed 128519 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 18 Aug 2023 10:50:37 PDT Received: from out-44.mta1.migadu.com (out-44.mta1.migadu.com [95.215.58.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91AF13C27 for ; Fri, 18 Aug 2023 10:50:37 -0700 (PDT) Message-ID: <817af9ec-0ba3-fab0-6d8a-4529ede337b5@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692381035; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hqxWvBhaCsyfEq5wGsBx9n9QLyA/MnvQvOYFUo4ueBs=; b=PWqcNg7ZjSYdMSk9lLy7m8evQejk3eQNAdF2jUKrwyNYzB1dfFUnxIm99B5i4eQOnjCFc7 GYQRWZbolKNGfrgQqufAl0cZiULtTUY1Su+VDfkW5hOcuZTnB4FZgOp6U9jX35MSwsln4K 7mvSW8C3LmSC00nhdVV9wBbaHqPxm40= Date: Fri, 18 Aug 2023 10:50:30 -0700 MIME-Version: 1.0 Reply-To: yonghong.song@linux.dev Subject: Re: [PATCH bpf-next v5] selftests/bpf: trace_helpers.c: optimize kallsyms cache Content-Language: en-US To: Rong Tao , olsajiri@gmail.com Cc: andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, haoluo@google.com, john.fastabend@gmail.com, kpsingh@kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, martin.lau@linux.dev, mykolal@fb.com, rongtao@cestc.cn, sdf@google.com, shuah@kernel.org, song@kernel.org References: X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yonghong Song In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/18/23 8:36 AM, Rong Tao wrote: > Hi, jirka > > Sadly, we can't include libbpf_internal.h in trace_helpers.{h,c}. > we only have the following headers when compile samples/bpf/: > > tree of samples/bpf/libbpf/ > +-- bpf_helper_defs.h > +-- include > |   '-- bpf > |   +-- bpf_core_read.h > |   +-- bpf_endian.h > |   +-- bpf.h > |   +-- bpf_helper_defs.h > |   +-- bpf_helpers.h > |   +-- bpf_tracing.h > |   +-- btf.h > |   +-- libbpf_common.h > |   +-- libbpf.h > |   +-- libbpf_legacy.h > |   +-- libbpf_version.h > |   +-- skel_internal.h > |   '-- usdt.bpf.h > +-- libbpf.a > > No libbpf_internal.h here. > > What if we add a declaration to libbpf_ensure_mem() in trace_helpers.c? [~/work/bpf-next/tools/testing/selftests/bpf/prog_tests (master)]$ grep libbpf_internal.h * cpu_mask.c:#include "bpf/libbpf_internal.h" kprobe_multi_test.c:#include "bpf/libbpf_internal.h" kprobe_multi_testmod_test.c:#include "bpf/libbpf_internal.h" module_fentry_shadow.c:#include "bpf/libbpf_internal.h" perf_branches.c:#include "bpf/libbpf_internal.h" perf_buffer.c:#include "bpf/libbpf_internal.h" raw_tp_test_run.c:#include "bpf/libbpf_internal.h" [~/work/bpf-next/tools/testing/selftests/bpf/prog_tests (master)]$ grep libbpf_ensure_mem *.c kprobe_multi_test.c: err = libbpf_ensure_mem((void **) &syms, &cap, [~/work/bpf-next/tools/testing/selftests/bpf/prog_tests (master)]$ Looks like it is already used for selftets. The libbpf_internal.h exists in the following directory when you build the selftest. [~/work/bpf-next/tools/testing/selftests/bpf/tools/include/bpf (master)]$ ls bpf_core_read.h bpf.h bpf_helpers.h btf.h libbpf_common.h libbpf_internal.h libbpf_version.h relo_core.h usdt.bpf.h bpf_endian.h bpf_helper_defs.h bpf_tracing.h hashmap.h libbpf.h libbpf_legacy.h nlattr.h skel_internal.h > > Good Day, > Rong Tao > >