Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp671269pxb; Fri, 14 Jan 2022 13:40:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvWcHmtf2NAtLXaPSkc0WdL5jVJe6GpeOnhEno1+vqwgjbQI9B3/HAhxMRdnMJfk1Nr0vN X-Received: by 2002:a05:6a00:8c5:b0:4bc:4c7e:7742 with SMTP id s5-20020a056a0008c500b004bc4c7e7742mr10705533pfu.18.1642196436434; Fri, 14 Jan 2022 13:40:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642196436; cv=none; d=google.com; s=arc-20160816; b=Wjqh9P7pIF9a1nINHUQcqYaWw3dDOPTQ56rtquLDDJ4XV0BOsFOTDorzUBQxQvQXYe Z5MyYPMUfHKSi5IM30udYo89grxf/fOgLkcOjF8xdAJFYwQRlLuCHMOJyAy7qQDive50 j4O7PAhHixDj0VjXs3wCMCCRLCILb5oc+IYB0pg2+yUdwzu8QbB489wsnv1cEnbF0sO5 pxnfYYA+ClhVYQh3ZuEGd8ZzXjR828d0qYhDplpDu7K1rWSRE0o7qYHni7vBoyr2H/sM KQCsyNHNP/bF5u9Ko+y/IRwxELrVcay5kgwmeI/lt1FJHbZf0g0hqxsBnV88Wmj6ZSir GNWA== 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=oWNup3WEK+Z5PYvEX6Ms7ECgpaqQd6Nt47Sgqvp9kdY=; b=OBiB3MO3K99i1nGIkTcHQ6nDrJt9KouZcTrv+gaRYQjLfsIdQPKrMPQmpPHqH/GGGF emycsktBDB0+4e2YcqpCiVjouqFfAzYpNFHAzXpRtQQPFyYA58WU44bv+fQcDWQZ+fPm 02JEUooju1mlCyvS7ZGaOVErKMQ0qeL/WCrSQOZtAUCjHGK6qUnqBJlfWEjfRi4fQp8Y juehUb1VEjUT8At2w2fjwjGbYgAoU0VwtY+inMhVG4NyDEuRSLgP3tRUU06RhIwswbLh GzwGd7QRiKD3jwDrSuUSuJnLYKF2sUtdK6wZOuhR4PzULLa0WdV0oPFmcyZtl1vxzDG2 7YdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I65dKPgn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t8si6236462pjq.54.2022.01.14.13.40.24; Fri, 14 Jan 2022 13:40:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I65dKPgn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238379AbiANPKy (ORCPT + 99 others); Fri, 14 Jan 2022 10:10:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:55884 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235516AbiANPKx (ORCPT ); Fri, 14 Jan 2022 10:10:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642173052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oWNup3WEK+Z5PYvEX6Ms7ECgpaqQd6Nt47Sgqvp9kdY=; b=I65dKPgnES/YwWS9eeBGkO0aP2nEC4F91YSrAFnf86BWqsRcIiJ2Osz7FM51vu6qw+nmyF 3K8POd5lGyJzA0eRJedDJY6ei7Ls+OVxHWeIL79thzOkyuQiEBgckhr03r1+K/L4Ko9TxW DcN798rliUG2A7c5OtJTAQMfBhwSd8I= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-515-G3duCLxxMcCAFSFz7xPQcw-1; Fri, 14 Jan 2022 10:10:51 -0500 X-MC-Unique: G3duCLxxMcCAFSFz7xPQcw-1 Received: by mail-wm1-f69.google.com with SMTP id v190-20020a1cacc7000000b0034657bb6a66so2387668wme.6 for ; Fri, 14 Jan 2022 07:10:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oWNup3WEK+Z5PYvEX6Ms7ECgpaqQd6Nt47Sgqvp9kdY=; b=Ij6y/FaU9KGi3ADHAmDz6Zr+AtmvYCz/A+12++hv3Zgfmy+1anL7qTbLO3CB5SDP1i s5mv1FVrrzFwKpoO+3nzK0l91D0uZrp17xxHCpV65gf5Berxt2KVAMmW2nFDmt/XevdL v7i50jJH/XAroM4lTkMyE8pFhuKugBcdNnlecNuQ2MRKGvIlQRFcpOJtZxbHKtM6IrPw 87gAP9YDriTMj4Y/xgcyjwmJLJKl8f+xJANOk1l1bt3Crf+IvxWqbrXtCuLB6Sq0Eoi5 gI5ihfQV0JCJZUk6i00ZsEDA4oK5TJDRQhHG+TWgk/C8jNiaDQ0i/MVbkU4pA8dkPJc6 qibQ== X-Gm-Message-State: AOAM530c+3g3VKZUpCNiqbM00Vr7AJyDYXrXPIfrtTZ6LfCghLLGdGwA IJIrbz61J9DZcGaXkKaOSY0JzohBboDGVO6YWMFomlljDbvptFXrgb9GokibGoePPs25Th5Dcgh 8NtMHqmZbF5v0ER2zZgBe8CZg X-Received: by 2002:a05:6000:1b89:: with SMTP id r9mr8674437wru.21.1642173050397; Fri, 14 Jan 2022 07:10:50 -0800 (PST) X-Received: by 2002:a05:6000:1b89:: with SMTP id r9mr8674412wru.21.1642173050166; Fri, 14 Jan 2022 07:10:50 -0800 (PST) Received: from krava (nat-pool-brq-u.redhat.com. [213.175.37.12]) by smtp.gmail.com with ESMTPSA id p18sm5136909wma.40.2022.01.14.07.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 07:10:49 -0800 (PST) Date: Fri, 14 Jan 2022 16:10:48 +0100 From: Jiri Olsa To: Masami Hiramatsu Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , netdev@vger.kernel.org, bpf@vger.kernel.org, lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Steven Rostedt , "Naveen N . Rao" , Anil S Keshavamurthy , "David S . Miller" Subject: Re: [RFC PATCH v2 0/8] fprobe: Introduce fprobe function entry/exit probe Message-ID: References: <164199616622.1247129.783024987490980883.stgit@devnote2> <20220114234704.41f28e8b5e63368c655d848e@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220114234704.41f28e8b5e63368c655d848e@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 14, 2022 at 11:47:04PM +0900, Masami Hiramatsu wrote: > Hi Jiri and Alexei, > > On Thu, 13 Jan 2022 13:27:34 +0100 > Jiri Olsa wrote: > > > On Wed, Jan 12, 2022 at 05:01:15PM +0100, Jiri Olsa wrote: > > > On Wed, Jan 12, 2022 at 11:02:46PM +0900, Masami Hiramatsu wrote: > > > > Hi Jiri and Alexei, > > > > > > > > Here is the 2nd version of fprobe. This version uses the > > > > ftrace_set_filter_ips() for reducing the registering overhead. > > > > Note that this also drops per-probe point private data, which > > > > is not used anyway. > > > > > > > > This introduces the fprobe, the function entry/exit probe with > > > > multiple probe point support. This also introduces the rethook > > > > for hooking function return as same as kretprobe does. This > > > > > > nice, I was going through the multi-user-graph support > > > and was wondering that this might be a better way > > > > > > > abstraction will help us to generalize the fgraph tracer, > > > > because we can just switch it from rethook in fprobe, depending > > > > on the kernel configuration. > > > > > > > > The patch [1/8] and [7/8] are from your series[1]. Other libbpf > > > > patches will not be affected by this change. > > > > > > I'll try the bpf selftests on top of this > > > > I'm getting crash and stall when running bpf selftests, > > the fprobe sample module works fine, I'll check on that > > I've tried to build tools/testing/selftests/bpf on my machine, > but I got below errors. Would you know how I can setup to build > the bpf selftests correctly? (I tried "make M=samples/bpf", but same result) what's your clang version? your distro might be behind, I'm using clang 14 compiled from sources: $ /opt/clang/bin/clang --version clang version 14.0.0 (https://github.com/llvm/llvm-project.git 9f8ffaaa0bddcefeec15a3df9858fd50b05fcbae) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/clang/bin and compiling bpf selftests with: $ CLANG=/opt/clang/bin/clang make jirka > > ~/ksrc/linux/tools/testing/selftests/bpf$ make > [...] > CLANG /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool/pid_iter.bpf.o > skeleton/pid_iter.bpf.c:35:10: error: incomplete definition of type 'struct bpf_link' > return BPF_CORE_READ((struct bpf_link *)ent, id); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool//bootstrap/libbpf//include/bpf/bpf_core_read.h:403:2: note: expanded from macro 'BPF_CORE_READ' > ___type((src), a, ##__VA_ARGS__) __r; \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool//bootstrap/libbpf//include/bpf/bpf_core_read.h:274:29: note: expanded from macro '___type' > #define ___type(...) typeof(___arrow(__VA_ARGS__)) > ^~~~~~~~~~~~~~~~~~~~~ > /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool//bootstrap/libbpf//include/bpf/bpf_core_read.h:272:23: note: expanded from macro '___arrow' > #define ___arrow(...) ___apply(___arrow, ___narg(__VA_ARGS__))(__VA_ARGS__) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) > /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool//bootstrap/libbpf//include/bpf/bpf_core_read.h:223:25: note: expanded from macro '___concat' > #define ___concat(a, b) a ## b > ^ > :16:1: note: expanded from here > ___arrow2 > ^ > /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool//bootstrap/libbpf//include/bpf/bpf_core_read.h:263:26: note: expanded from macro '___arrow2' > #define ___arrow2(a, b) a->b > ~^ > skeleton/pid_iter.bpf.c:35:32: note: forward declaration of 'struct bpf_link' > return BPF_CORE_READ((struct bpf_link *)ent, id); > ^ > skeleton/pid_iter.bpf.c:35:10: error: incomplete definition of type 'struct bpf_link' > return BPF_CORE_READ((struct bpf_link *)ent, id); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool//bootstrap/libbpf//include/bpf/bpf_core_read.h:404:2: note: expanded from macro 'BPF_CORE_READ' > BPF_CORE_READ_INTO(&__r, (src), a, ##__VA_ARGS__); \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool//bootstrap/libbpf//include/bpf/bpf_core_read.h:311:2: note: expanded from macro 'BPF_CORE_READ_INTO' > ___core_read(bpf_core_read, bpf_core_read, \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool//bootstrap/libbpf//include/bpf/bpf_core_read.h:302:2: note: expanded from macro '___core_read' > ___apply(___core_read, ___empty(__VA_ARGS__))(fn, fn_ptr, dst, \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) > /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool//bootstrap/libbpf//include/bpf/bpf_core_read.h:296:2: note: expanded from macro '___core_read0' > ___read(fn, dst, ___type(src), src, a); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool//bootstrap/libbpf//include/bpf/bpf_core_read.h:277:59: note: expanded from macro '___read' > read_fn((void *)(dst), sizeof(*(dst)), &((src_type)(src))->accessor) > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ > /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool//bootstrap/libbpf//include/bpf/bpf_core_read.h:206:79: note: expanded from macro 'bpf_core_read' > bpf_probe_read_kernel(dst, sz, (const void *)__builtin_preserve_access_index(src)) > ^~~ > skeleton/pid_iter.bpf.c:35:32: note: forward declaration of 'struct bpf_link' > return BPF_CORE_READ((struct bpf_link *)ent, id); > ^ > skeleton/pid_iter.bpf.c:35:10: error: returning 'void' from a function with incompatible result type '__u32' (aka 'unsigned int') > return BPF_CORE_READ((struct bpf_link *)ent, id); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool//bootstrap/libbpf//include/bpf/bpf_core_read.h:402:36: note: expanded from macro 'BPF_CORE_READ' > #define BPF_CORE_READ(src, a, ...) ({ \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > skeleton/pid_iter.bpf.c:42:17: warning: declaration of 'struct bpf_iter__task_file' will not be visible outside of this function [-Wvisibility] > int iter(struct bpf_iter__task_file *ctx) > ^ > skeleton/pid_iter.bpf.c:44:25: error: incomplete definition of type 'struct bpf_iter__task_file' > struct file *file = ctx->file; > ~~~^ > skeleton/pid_iter.bpf.c:42:17: note: forward declaration of 'struct bpf_iter__task_file' > int iter(struct bpf_iter__task_file *ctx) > ^ > skeleton/pid_iter.bpf.c:45:32: error: incomplete definition of type 'struct bpf_iter__task_file' > struct task_struct *task = ctx->task; > ~~~^ > skeleton/pid_iter.bpf.c:42:17: note: forward declaration of 'struct bpf_iter__task_file' > int iter(struct bpf_iter__task_file *ctx) > ^ > skeleton/pid_iter.bpf.c:76:19: error: incomplete definition of type 'struct bpf_iter__task_file' > bpf_seq_write(ctx->meta->seq, &e, sizeof(e)); > ~~~^ > skeleton/pid_iter.bpf.c:42:17: note: forward declaration of 'struct bpf_iter__task_file' > int iter(struct bpf_iter__task_file *ctx) > ^ > 1 warning and 6 errors generated. > make[1]: *** [Makefile:188: /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/build/bpftool/pid_iter.bpf.o] Error 1 > make: *** [Makefile:219: /home/mhiramat/ksrc/linux/tools/testing/selftests/bpf/tools/sbin/bpftool] Error 2 > > > Thank you, > > -- > Masami Hiramatsu >