BPF List
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@meta.com>
To: Song Liu <songliubraving@meta.com>
Cc: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>,
	"Song Liu" <song@kernel.org>, bpf <bpf@vger.kernel.org>,
	Linux-Fsdevel <linux-fsdevel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"LSM List" <linux-security-module@vger.kernel.org>,
	"Kernel Team" <kernel-team@meta.com>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Eddy Z" <eddyz87@gmail.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Christian Brauner" <brauner@kernel.org>,
	"Jan Kara" <jack@suse.cz>, "KP Singh" <kpsingh@kernel.org>,
	"Matt Bobrowski" <mattbobrowski@google.com>,
	"Amir Goldstein" <amir73il@gmail.com>,
	"repnop@google.com" <repnop@google.com>,
	"Jeff Layton" <jlayton@kernel.org>,
	"Josef Bacik" <josef@toxicpanda.com>,
	"Mickaël Salaün" <mic@digikod.net>,
	"gnoack@google.com" <gnoack@google.com>
Subject: Re: [RFC/PATCH v2 bpf-next fanotify 7/7] selftests/bpf: Add test for BPF based fanotify fastpath handler
Date: Mon, 18 Nov 2024 20:51:21 +0000	[thread overview]
Message-ID: <B3CE1128-B988-46FE-AC3B-C024C8C987CA@fb.com> (raw)
In-Reply-To: <968F7C58-691D-4636-AA91-D0EA999EE3FD@fb.com>



> On Nov 15, 2024, at 1:05 PM, Song Liu <songliubraving@meta.com> wrote:

[...]
> 
>> 
>> fsnotify_open_perm->fsnotify->send_to_group->fanotify_handle_event.
>> 
>> is a pretty long path to call bpf prog and
>> preparing a giant 'struct fanotify_fastpath_event'
>> is not going to fast either.
>> 
>> If we want to accelerate that with bpf it needs to be done
>> sooner with negligible overhead.
> 
> Agreed. This is actually something I have been thinking 
> since the beginning of this work: Shall it be fanotify-bpf 
> or fsnotify-bpf. Given we have more materials, this is a 
> good time to have broader discussions on this. 
> 
> @all, please chime in whether we should redo this as
> fsnotify-bpf. AFAICT:
> 
> Pros of fanotify-bpf: 
> - There is existing user space that we can leverage/reuse.
> 
> Pros of fsnotify-bpf: 
> - Faster fast path. 
> 
> Another major pros/cons did I miss?

Adding more thoughts on this: I think it makes more sense to
go with fanotify-bpf. This is because one of the benefits of
fsnotify/fanotify over LSM solutions is the built-in event
filtering of events. While this call chain is a bit long:

fsnotify_open_perm->fsnotify->send_to_group->fanotify_handle_event.

There are built-in filtering in fsnotify() and 
send_to_group(), so logics in the call chain are useful. 

struct fanotify_fastpath_event is indeed big. But I think
we need to pass these information to the fastpath handler
either way. 


Overall, I think current fastpath design makes sense, 
though there are things we need to fix (as Amir and Alexei
pointed out). Please let me know comments and suggestions
on this. 

Thanks,
Song


  reply	other threads:[~2024-11-18 20:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14  8:43 [RFC/PATCH v2 bpf-next fanotify 0/7] Fanotify fastpath handler Song Liu
2024-11-14  8:43 ` [RFC/PATCH v2 bpf-next fanotify 1/7] fanotify: Introduce fanotify " Song Liu
2024-11-15  8:51   ` Amir Goldstein
2024-11-15 17:11     ` Song Liu
2024-11-15 17:32       ` Amir Goldstein
2024-11-14  8:43 ` [RFC/PATCH v2 bpf-next fanotify 2/7] samples/fanotify: Add a sample " Song Liu
2024-11-14  8:43 ` [RFC/PATCH v2 bpf-next fanotify 3/7] bpf: Make bpf inode storage available to tracing programs Song Liu
2024-11-14  8:43 ` [RFC/PATCH v2 bpf-next fanotify 4/7] bpf: fs: Add three kfuncs Song Liu
2024-11-14  8:43 ` [RFC/PATCH v2 bpf-next fanotify 5/7] bpf: Allow bpf map hold reference on dentry Song Liu
2024-11-14  8:43 ` [RFC/PATCH v2 bpf-next fanotify 6/7] fanotify: Enable bpf based fanotify fastpath handler Song Liu
2024-11-14  8:43 ` [RFC/PATCH v2 bpf-next fanotify 7/7] selftests/bpf: Add test for BPF " Song Liu
2024-11-14 20:14   ` Alexei Starovoitov
2024-11-14 23:02     ` Song Liu
2024-11-15  0:41       ` Alexei Starovoitov
2024-11-15  1:10         ` Song Liu
2024-11-15  1:31           ` Alexei Starovoitov
2024-11-15  7:01             ` Song Liu
2024-11-15 19:41               ` Alexei Starovoitov
2024-11-15 21:05                 ` Song Liu
2024-11-18 20:51                   ` Song Liu [this message]
2024-11-19  0:10                     ` Alexei Starovoitov
2024-11-19  1:10                       ` Song Liu
2024-11-19  7:59                         ` Amir Goldstein
2024-11-19  8:35                           ` Song Liu
2024-11-15  7:26     ` Amir Goldstein
2024-11-15 20:04       ` Alexei Starovoitov

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=B3CE1128-B988-46FE-AC3B-C024C8C987CA@fb.com \
    --to=songliubraving@meta.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=amir73il@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=gnoack@google.com \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@meta.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mattbobrowski@google.com \
    --cc=mic@digikod.net \
    --cc=repnop@google.com \
    --cc=song@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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