Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jiri Olsa <jolsa@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [jolsa-perf:trampoline_multi_10 17/21] kernel/trace/bpf_trace.c:3501:2: error: call to undeclared function 'bpf_trampoline_multi_detach'; ISO C99 and later do not support implicit function declarations
Date: Wed, 23 Oct 2024 19:48:44 +0800	[thread overview]
Message-ID: <202410231955.T13VLcJ9-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git trampoline_multi_10
head:   48132820c5a21b82d1a4507a86a67b3742fb110e
commit: c19eedd8a81d51880a58e66419820e592292cb95 [17/21] bpf: Add support to create tracing multi link
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20241023/202410231955.T13VLcJ9-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241023/202410231955.T13VLcJ9-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410231955.T13VLcJ9-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from kernel/trace/bpf_trace.c:8:
   include/linux/bpf.h:1393:51: warning: declaration of 'struct bpf_tramp_link' will not be visible outside of this function [-Wvisibility]
    1393 | static inline int bpf_trampoline_link_prog(struct bpf_tramp_link *link,
         |                                                   ^
   include/linux/bpf.h:1399:53: warning: declaration of 'struct bpf_tramp_link' will not be visible outside of this function [-Wvisibility]
    1399 | static inline int bpf_trampoline_unlink_prog(struct bpf_tramp_link *link,
         |                                                     ^
>> kernel/trace/bpf_trace.c:3501:2: error: call to undeclared function 'bpf_trampoline_multi_detach'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    3501 |         bpf_trampoline_multi_detach(link->prog, tr_link);
         |         ^
   kernel/trace/bpf_trace.c:3501:2: note: did you mean 'bpf_tracing_multi_attach'?
   include/linux/trace_events.h:781:5: note: 'bpf_tracing_multi_attach' declared here
     781 | int bpf_tracing_multi_attach(struct bpf_prog *prog, const union bpf_attr *attr);
         |     ^
>> kernel/trace/bpf_trace.c:3589:8: error: call to undeclared function 'bpf_trampoline_multi_attach'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    3589 |         err = bpf_trampoline_multi_attach(prog, ids, link);
         |               ^
   kernel/trace/bpf_trace.c:3589:8: note: did you mean 'bpf_tracing_multi_attach'?
   kernel/trace/bpf_trace.c:3538:5: note: 'bpf_tracing_multi_attach' declared here
    3538 | int bpf_tracing_multi_attach(struct bpf_prog *prog,
         |     ^
   2 warnings and 2 errors generated.


vim +/bpf_trampoline_multi_detach +3501 kernel/trace/bpf_trace.c

  3495	
  3496	static void bpf_tracing_multi_link_release(struct bpf_link *link)
  3497	{
  3498		struct bpf_tracing_multi_link *tr_link =
  3499			container_of(link, struct bpf_tracing_multi_link, link);
  3500	
> 3501		bpf_trampoline_multi_detach(link->prog, tr_link);
  3502	}
  3503	
  3504	static void bpf_tracing_multi_link_dealloc(struct bpf_link *link)
  3505	{
  3506		struct bpf_tracing_multi_link *tr_link =
  3507			container_of(link, struct bpf_tracing_multi_link, link);
  3508	
  3509		kfree(tr_link);
  3510	}
  3511	
  3512	static void bpf_tracing_multi_link_show_fdinfo(const struct bpf_link *link,
  3513						       struct seq_file *seq)
  3514	{
  3515		struct bpf_tracing_multi_link *tr_link =
  3516			container_of(link, struct bpf_tracing_multi_link, link);
  3517	
  3518		seq_printf(seq, "attach_type:\t%d\n", tr_link->attach_type);
  3519	}
  3520	
  3521	static int bpf_tracing_multi_link_fill_link_info(const struct bpf_link *link,
  3522							 struct bpf_link_info *info)
  3523	{
  3524		struct bpf_tracing_multi_link *tr_link =
  3525			container_of(link, struct bpf_tracing_multi_link, link);
  3526	
  3527		info->tracing.attach_type = tr_link->attach_type;
  3528		return 0;
  3529	}
  3530	
  3531	static const struct bpf_link_ops bpf_tracing_multi_link_lops = {
  3532		.release = bpf_tracing_multi_link_release,
  3533		.dealloc = bpf_tracing_multi_link_dealloc,
  3534		.show_fdinfo = bpf_tracing_multi_link_show_fdinfo,
  3535		.fill_link_info = bpf_tracing_multi_link_fill_link_info,
  3536	};
  3537	
  3538	int bpf_tracing_multi_attach(struct bpf_prog *prog,
  3539				     const union bpf_attr *attr)
  3540	{
  3541		struct bpf_attach_target_info tgt_info = {};
  3542		struct bpf_tracing_multi_link *link = NULL;
  3543		struct bpf_link_primer link_primer;
  3544		u32 i, j, cnt, *ids = NULL;
  3545		u32 __user *uids;
  3546		int err;
  3547	
  3548		if (check_multi_prog_type(prog))
  3549			return -EINVAL;
  3550	
  3551		uids = u64_to_user_ptr(attr->link_create.tracing_multi.btf_ids);
  3552		cnt = attr->link_create.tracing_multi.btf_ids_cnt;
  3553	
  3554		if (!cnt || !uids)
  3555			return -EINVAL;
  3556	
  3557		ids = kvmalloc_array(cnt, sizeof(*ids), GFP_KERNEL);
  3558		if (!ids)
  3559			return -ENOMEM;
  3560	
  3561		if (copy_from_user(ids, uids, cnt * sizeof(*ids))) {
  3562			err = -EFAULT;
  3563			goto error;
  3564		}
  3565	
  3566		link = kzalloc(struct_size(link, nodes, cnt), GFP_KERNEL);
  3567		if (!link) {
  3568			err = -ENOMEM;
  3569			goto error;
  3570		}
  3571	
  3572		bpf_link_init(&link->link, BPF_LINK_TYPE_TRACING_MULTI,
  3573			      &bpf_tracing_multi_link_lops, prog);
  3574		link->attach_type = prog->expected_attach_type;
  3575	
  3576		err = bpf_link_prime(&link->link, &link_primer);
  3577		if (err)
  3578			goto error;
  3579	
  3580		for (i = 0, j = 0; i < cnt; i++) {
  3581			err = bpf_check_attach_target(NULL, prog, NULL, ids[i], &tgt_info);
  3582			if (err)
  3583				continue;
  3584			ids[j++] = ids[i];
  3585		}
  3586	
  3587		link->nodes_cnt = j;
  3588	
> 3589		err = bpf_trampoline_multi_attach(prog, ids, link);

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-10-23 11:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202410231955.T13VLcJ9-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jolsa@kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox