On Jun 10 2024, Alexei Starovoitov wrote:
> On Sat, Jun 8, 2024 at 2:01 AM Benjamin Tissoires wrote:
> >
> > The idea is to provide a list of stucts and their editable fields.
> >
> > Currently no functional changes are introduced here, we will add some
> > more w
the device export 3 nodes,
all with the same name.
Signed-off-by: Benjamin Tissoires
---
changes in v3:
- amend for new WRITE_RANGE API
new in v2
---
drivers/hid/bpf/hid_bpf_struct_ops.c | 3 +++
include/linux/hid_bpf.h | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff
The idea is to provide a list of stucts and their editable fields.
Currently no functional changes are introduced here, we will add some
more writeable fields in the next patch.
Signed-off-by: Benjamin Tissoires
---
changes in v3:
- rewrote WRITE_RANGE macro to not deal with offset from
Without this helpers like bpf_printk() or bpf_map_update() are not
available, making anything but change of bytes impossible to do.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
new in v2
---
drivers/hid/bpf/hid_bpf_struct_ops.c | 1 +
1 file changed, 1 insertion(+)
diff --git
There is no real reasons to paper over warnings for such small programs.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
drivers/hid/bpf/progs/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/bpf/progs/Makefile b/drivers/hid
warning: unused variable ‘tilt’ [-Wunused-variable]
Signed-off-by: Peter Hutterer
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
drivers/hid/bpf/progs/XPPen__Artist24.bpf.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/hid/bpf/progs/XPPen__Artist24
This is the current decision we took: we don't provide automatic loading
of HID-BPF by the kernel directly, but rely on an external tool for it.
This tool is currently udev-hid-bpf, so let's make people aware of it.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
Now that we are using struct_ops, the docs need to be changed.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
changes in v2
- use BPF_F_BEFORE
---
Documentation/hid/hid-bpf.rst | 156 +++---
include/linux/hid_bpf.h | 8 +--
2 files changed
I got a weird verifier error with a subprog once, so let's have a test
for it.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
tools/testing/selftests/hid/hid_bpf.c | 41 +
tools/testing/selftests/hid/progs/hid.c | 24
We can now rely on struct_ops as we cleared the users in-tree.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
changes in v2:
- remove now unused enum hid_bpf_attach_flags
---
drivers/hid/bpf/Makefile| 2 +-
drivers/hid/bpf/entrypoints/Makefile
Very mechanical:
- Change HID_BPF_DEVICE_EVENT and HID_BPF_RDESC_FIXUP #defines
- add a matching SEC(".struct_ops.link")
- in ArtistPro16Gen2 make the 2 functions static and have a new one
calling them
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
d
We are going to switch over struct_ops, so instead of having to manually
replace all fields one by one, let's have a common place to change it.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
drivers/hid/bpf/progs/FR-TEC__Raptor-Mach-2.bpf.c | 4 ++--
drivers
This is mostly mechanical: attach_prog is dropped, and
the SEC are converted into struct_ops.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2 but the commit message.
---
samples/hid/Makefile | 5 ++--
samples/hid/hid_bpf_attach.bpf.c | 18
We drop the need for the attach() bpf syscall, but we need to set up
the hid_id field before calling __load().
The .bpf.c part is mechanical: we create one struct_ops per HID-BPF
program, as all the tests are for one program at a time.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
- the "attach" is now generic through BPF-core: the caller just needs to
set hid_id and flags before calling __load().
- all the BPF tough part is not handled in BPF-core through generic
processing
- hid_bpf_ctx is now only writable where it needs be
Signed-off-by: Benjamin
no code change, but this way we reduce code duplication and we
can export it later.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
drivers/hid/bpf/hid_bpf_dispatch.c | 47 ++
1 file changed, 27 insertions(+), 20 deletions
Those operations are the ones from HID, not HID-BPF, and I'd like to
reuse hid_bpf_ops as the user facing struct_ops API.
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
drivers/hid/bpf/hid_bpf_dispatch.c | 22 +++---
drivers/hid/hid-core.c
).
The matching user-space loader (udev-hid-bpf) MR is at
https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/86
I'll put it out of draft once this is merged.
Cheers,
Benjamin
Signed-off-by: Benjamin Tissoires
---
Changes in v3:
- took Alexei's review into account
- Link to v2
On Jun 07 2024, Alexei Starovoitov wrote:
> On Fri, Jun 7, 2024 at 8:28 AM Benjamin Tissoires wrote:
> > +struct hid_bpf_ops {
> > + /* hid_id needs to stay first so we can easily change it
> > +* from userspace.
> > +*/
> > +
the device export 3 nodes,
all with the same name.
Signed-off-by: Benjamin Tissoires
---
new in v2
---
drivers/hid/bpf/hid_bpf_struct_ops.c | 3 +++
include/linux/hid_bpf.h | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/bpf/hid_bpf_struct_ops.c
b
The idea is to provide a list of stucts and their editable fields.
Currently no functional changes are introduced here, we will add some
more writeable fields in the next patch.
Signed-off-by: Benjamin Tissoires
---
new in v2
---
drivers/hid/bpf/hid_bpf_struct_ops.c | 91
Without this helpers like bpf_printk() or bpf_map_update() are not
available, making anything but change of bytes impossible to do.
Signed-off-by: Benjamin Tissoires
---
new in v2
---
drivers/hid/bpf/hid_bpf_struct_ops.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/bpf
There is no real reasons to paper over warnings for such small programs.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
drivers/hid/bpf/progs/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/bpf/progs/Makefile b/drivers/hid/bpf/progs
warning: unused variable ‘tilt’ [-Wunused-variable]
Signed-off-by: Peter Hutterer
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
drivers/hid/bpf/progs/XPPen__Artist24.bpf.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/hid/bpf/progs/XPPen__Artist24.bpf.c
b/drivers
This is the current decision we took: we don't provide automatic loading
of HID-BPF by the kernel directly, but rely on an external tool for it.
This tool is currently udev-hid-bpf, so let's make people aware of it.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
Documentation/hid
Now that we are using struct_ops, the docs need to be changed.
Signed-off-by: Benjamin Tissoires
---
changes in v2
- use BPF_F_BEFORE
---
Documentation/hid/hid-bpf.rst | 156 +++---
include/linux/hid_bpf.h | 8 +--
2 files changed, 76 insertions
I got a weird verifier error with a subprog once, so let's have a test
for it.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
tools/testing/selftests/hid/hid_bpf.c | 41 +
tools/testing/selftests/hid/progs/hid.c | 24 +++
2 files
We can now rely on struct_ops as we cleared the users in-tree.
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- remove now unused enum hid_bpf_attach_flags
---
drivers/hid/bpf/Makefile| 2 +-
drivers/hid/bpf/entrypoints/Makefile| 93
drivers
Very mechanical:
- Change HID_BPF_DEVICE_EVENT and HID_BPF_RDESC_FIXUP #defines
- add a matching SEC(".struct_ops.link")
- in ArtistPro16Gen2 make the 2 functions static and have a new one
calling them
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
drivers/hid/bp
We are going to switch over struct_ops, so instead of having to manually
replace all fields one by one, let's have a common place to change it.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
drivers/hid/bpf/progs/FR-TEC__Raptor-Mach-2.bpf.c | 4 ++--
drivers/hid/bpf/progs
This is mostly mechanical: attach_prog is dropped, and
the SEC are converted into struct_ops.
Signed-off-by: Benjamin Tissoires
---
no changes in v2 but the commit message.
---
samples/hid/Makefile | 5 ++--
samples/hid/hid_bpf_attach.bpf.c | 18 -
samples/hid
We drop the need for the attach() bpf syscall, but we need to set up
the hid_id field before calling __load().
The .bpf.c part is mechanical: we create one struct_ops per HID-BPF
program, as all the tests are for one program at a time.
Signed-off-by: Benjamin Tissoires
---
changes in v2
- the "attach" is now generic through BPF-core: the caller just needs to
set hid_id and flags before calling __load().
- all the BPF tough part is not handled in BPF-core through generic
processing
- hid_bpf_ctx is now only writable where it needs be
Signed-off-by: Benjamin
no code change, but this way we reduce code duplication and we
can export it later.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
drivers/hid/bpf/hid_bpf_dispatch.c | 47 ++
1 file changed, 27 insertions(+), 20 deletions(-)
diff --git
Those operations are the ones from HID, not HID-BPF, and I'd like to
reuse hid_bpf_ops as the user facing struct_ops API.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
drivers/hid/bpf/hid_bpf_dispatch.c | 22 +++---
drivers/hid/hid-core.c | 6
).
The matching user-space loader (udev-hid-bpf) MR is at
https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/86
I'll put it out of draft once this is merged.
Cheers,
Benjamin
Signed-off-by: Benjamin Tissoires
---
Changes in v2:
- drop HID_BPF_FLAGS enum and use BPF_F_BEFORE
On May 28 2024, Alexei Starovoitov wrote:
> On Tue, May 28, 2024 at 6:15 AM Benjamin Tissoires wrote:
> >
> > We do this implementation in several steps to not have the CI failing:
> > - first (this patch), we add struct_ops while keeping the existing infra
> > ava
There is no real reasons to paper over warnings for such small programs.
Signed-off-by: Benjamin Tissoires
---
drivers/hid/bpf/progs/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/bpf/progs/Makefile b/drivers/hid/bpf/progs/Makefile
index 63ed7e02adf1
warning: unused variable ‘tilt’ [-Wunused-variable]
Signed-off-by: Peter Hutterer
Signed-off-by: Benjamin Tissoires
---
drivers/hid/bpf/progs/XPPen__Artist24.bpf.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/hid/bpf/progs/XPPen__Artist24.bpf.c
b/drivers/hid/bpf/progs
This is the current decision we took: we don't provide automatic loading
of HID-BPF by the kernel directly, but rely on an external tool for it.
This tool is currently udev-hid-bpf, so let's make people aware of it.
Signed-off-by: Benjamin Tissoires
---
Documentation/hid/hid-bpf.rst | 17
Now that we are using struct_ops, the docs need to be changed.
Signed-off-by: Benjamin Tissoires
---
Documentation/hid/hid-bpf.rst | 145 +++---
include/linux/hid_bpf.h | 8 +--
2 files changed, 71 insertions(+), 82 deletions(-)
diff --git
I got a weird verifier error with a subprog once, so let's have a test
for it.
Signed-off-by: Benjamin Tissoires
---
tools/testing/selftests/hid/hid_bpf.c | 41 +
tools/testing/selftests/hid/progs/hid.c | 24 +++
2 files changed, 65 insertions
We can now rely on struct_ops as we cleared the users in-tree.
Signed-off-by: Benjamin Tissoires
---
drivers/hid/bpf/Makefile| 2 +-
drivers/hid/bpf/entrypoints/Makefile| 93
drivers/hid/bpf/entrypoints/README | 4 -
drivers/hid/bpf
Very mechanical:
- Change HID_BPF_DEVICE_EVENT and HID_BPF_RDESC_FIXUP #defines
- add a matching SEC(".struct_ops.link")
- in ArtistPro16Gen2 make the 2 functions static and have a new one
calling them
Signed-off-by: Benjamin Tissoires
---
drivers/hid/bpf/progs/FR-TEC__Raptor-Ma
We are going to switch over struct_ops, so instead of having to manually
replace all fields one by one, let's have a common place to change it.
Signed-off-by: Benjamin Tissoires
---
drivers/hid/bpf/progs/FR-TEC__Raptor-Mach-2.bpf.c | 4 ++--
drivers/hid/bpf/progs/HP__Elite-Presenter.bpf.c
hid_mouse is currently failing with bpf_printk() not available in
struct_ops program type.
Signed-off-by: Benjamin Tissoires
---
samples/hid/Makefile | 5 ++--
samples/hid/hid_bpf_attach.bpf.c | 18 -
samples/hid/hid_bpf_attach.h | 14 --
samples/hid
We drop the need for the attach() bpf syscall, but we need to set up
the hid_id field before calling __load().
The .bpf.c part is mechanical: we create one struct_ops per HID-BPF
program, as all the tests are for one program at a time.
Signed-off-by: Benjamin Tissoires
---
tools/testing
- the "attach" is now generic through BPF-core: the caller just needs to
set hid_id and flags before calling __load().
- all the BPF tough part is not handled in BPF-core through generic
processing
- hid_bpf_ctx is now only writable where it needs be
Signed-off-by: Benjamin Tissoires
--
no code change, but this way we reduce code duplication and we
can export it later.
Signed-off-by: Benjamin Tissoires
---
drivers/hid/bpf/hid_bpf_dispatch.c | 47 ++
1 file changed, 27 insertions(+), 20 deletions(-)
diff --git a/drivers/hid/bpf
Those operations are the ones from HID, not HID-BPF, and I'd like to
reuse hid_bpf_ops as the user facing struct_ops API.
Signed-off-by: Benjamin Tissoires
---
drivers/hid/bpf/hid_bpf_dispatch.c | 22 +++---
drivers/hid/hid-core.c | 6 +++---
include/linux/hid_bpf.h
).
The matching user-space loader (udev-hid-bpf) MR is at
https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/86
I'll put it out of draft once this is merged.
Cheers,
Benjamin
Signed-off-by: Benjamin Tissoires
---
Benjamin Tissoires (13):
HID: rename struct hid_bpf_ops
On Wed, 10 Apr 2024 19:19:20 +0200, Benjamin Tissoires wrote:
> When I introduced HID-BPF, I mentioned that we should ship the HID-BPF
> programs in the kernel when they are fixes so that everybody can benefit
> from them.
>
> I tried multiple times to do so but I was confro
And then cleanup the verifier about the special cases about this kfunc.
Signed-off-by: Benjamin Tissoires
---
This is an RFC, and is not meant to be fully reviewed/applied as it is.
I'm posting this to show what I wanted to explain in
https://lore.kernel.org/bpf
This allows kfunc to request the prog_aux environment in their
implementation, to have access to the originated bpf_prog for example.
Signed-off-by: Benjamin Tissoires
---
This is an RFC, and is not meant to be fully reviewed/applied as it is.
I'm posting this to show what I wanted to explain
It looks like the generic implementation based on __s_async suffix works
well enough. So let's use it.
Note:
- currently we lose the return value range
- the second argument is not of type PTR_TO_MAP_KEY
Signed-off-by: Benjamin Tissoires
---
This is an RFC, and is not meant to be fully
The type of bpf_wq callbacks changed. So adapt to it and make use of
wq_callback_fn_t.
Signed-off-by: Benjamin Tissoires
---
This is an RFC, and is not meant to be fully reviewed/applied as it is.
I'm posting this to show what I wanted to explain in
https://lore.kernel.org/bpf
This allows users to rely on it by using it from the vmlinux.h
Signed-off-by: Benjamin Tissoires
---
This is an RFC, and is not meant to be fully reviewed/applied as it is.
I'm posting this to show what I wanted to explain in
https://lore.kernel.org/bpf
still mostly a WIP, but it seems to be working for the couple of tests.
Signed-off-by: Benjamin Tissoires
---
This is an RFC, and is not meant to be fully reviewed/applied as it is.
I'm posting this to show what I wanted to explain in
https://lore.kernel.org/bpf
No code change but is a preparatory patch for being able to declare
async callbacks from bpf kfuncs.
Signed-off-by: Benjamin Tissoires
---
This is an RFC, and is not meant to be fully reviewed/applied as it is.
I'm posting this to show what I wanted to explain in
https://lore.kernel.org/bpf
There is no change of behavior: for each kfunc, we store the prog
sleepable state. But this allows to declare an async non sleepable
callback from a syscall, where everything is sleepable.
Signed-off-by: Benjamin Tissoires
---
This is an RFC, and is not meant to be fully reviewed/applied
This is a RFC, following[0].
It works, still needs some care but this is mainly to see if this will
have a chance to get upsrteamed or if I should rely on struct_ops
instead.
Cheers,
Benjamin
Signed-off-by: Benjamin Tissoires
---
Benjamin Tissoires (8):
bpf: ignore sleepable prog
Some copy/paste leftover, this is never used
Fixes: e3d9eac99afd ("selftests/bpf: wq: add bpf_wq_init() checks")
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
tools/testing/selftests/bpf/prog_tests/wq.c | 2 --
1 file changed, 2 deletions(-)
diff --g
t;)
Signed-off-by: Benjamin Tissoires
---
changes in v3:
- fix unloading of bpf_wq, again
changes in v2:
- fix wq being not freed (and static call not used)
---
kernel/bpf/hashtab.c | 49 +
1 file changed, 13 insertions(+), 36 deletions(-)
Signed-off-by: Benjamin Tissoires
---
no changes in v3
no changes in v2
---
kernel/bpf/arraymap.c | 15 ---
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
index 580d07b15471..feabc0193852 100644
--- a/kernel/bpf/arraymap.c
+++ b/
Few patches that should have been there from day 1.
Anyway, they are coming now.
Signed-off-by: Benjamin Tissoires
---
Changes in v3:
- fixed bpf_test module not being able to be removed, because the bpf_wq
was never freed
- Link to v2:
https://lore.kernel.org/r/20240430-bpf-next-v2-0
On Apr 30 2024, Benjamin Tissoires wrote:
> If someone stores both a timer and a workqueue in a hash map, on free, we
> would walk it twice.
> Add a check in htab_free_malloced_timers_or_wq and free the timers
> and workqueues if they are present.
>
> Fixes: 246331e3f1ea (
Some copy/paste leftover, this is never used
Fixes: e3d9eac99afd ("selftests/bpf: wq: add bpf_wq_init() checks")
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
tools/testing/selftests/bpf/prog_tests/wq.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/tools/testing
t;)
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- fix wq being not freed (and static call not used)
---
kernel/bpf/hashtab.c | 49 +
1 file changed, 13 insertions(+), 36 deletions(-)
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hasht
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
kernel/bpf/arraymap.c | 15 ---
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
index 580d07b15471..feabc0193852 100644
--- a/kernel/bpf/arraymap.c
+++ b/kernel/bpf/arraymap.c
Few patches that should have been there from day 1.
Anyway, they are coming now.
Signed-off-by: Benjamin Tissoires
---
Changes in v2:
- fix wq in hashtabs not being freed (and static call not being used)
- Link to v1:
https://lore.kernel.org/r/20240425-bpf-next-v1-0-1d8330e6c...@kernel.org
On Apr 25 2024, Alexei Starovoitov wrote:
> On Thu, Apr 25, 2024 at 6:59 AM Benjamin Tissoires wrote:
> >
> > If someone stores both a timer and a workqueue in a hash map, on free, we
> > would walk it twice.
> > Add a check in htab_free_malloced_timer
Some copy/paste leftover, this is never used
Fixes: e3d9eac99afd ("selftests/bpf: wq: add bpf_wq_init() checks")
Signed-off-by: Benjamin Tissoires
---
tools/testing/selftests/bpf/prog_tests/wq.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tes
t;)
Signed-off-by: Benjamin Tissoires
---
kernel/bpf/hashtab.c | 16 +---
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
index 0179183c543a..20162ae741e9 100644
--- a/kernel/bpf/hashtab.c
+++ b/kernel/bpf/hashtab.c
@@ -1515
Signed-off-by: Benjamin Tissoires
---
kernel/bpf/arraymap.c | 15 ---
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
index 580d07b15471..feabc0193852 100644
--- a/kernel/bpf/arraymap.c
+++ b/kernel/bpf/arraymap.c
@@ -436,13 +436,14 @@ s
Few patches that should have been there from day 1.
Anyway, they are coming now.
Signed-off-by: Benjamin Tissoires
---
Benjamin Tissoires (3):
bpf: do not walk twice the map on free
bpf: do not walk twice the hash map on free
selftests/bpf: drop an unused local variable
On Apr 24 2024, Andrii Nakryiko wrote:
> On Sat, Apr 20, 2024 at 2:10 AM Benjamin Tissoires wrote:
> >
> > Allows to test if allocation/free works
> >
> > Signed-off-by: Benjamin Tissoires
> >
> > ---
> >
> > changes in v2:
> > - dropped
On Apr 24 2024, Alexei Starovoitov wrote:
> On Wed, Apr 24, 2024 at 8:06 AM Alexei Starovoitov
> wrote:
> >
> > On Tue, Apr 23, 2024 at 7:55 PM Alexei Starovoitov
> > wrote:
> > >
> > > On Sat, Apr 20, 2024 at 2:10 AM Benjamin Tissoires
>
Allows to test if allocation/free works
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- remove #define CLOCK_MONOTONIC 1 leftover
---
tools/testing/selftests/bpf/bpf_experimental.h | 1 +
tools/testing/selftests/bpf/prog_tests/wq.c| 22 ++
tools/testing
again, copy/paste from bpf_timer_start().
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- dropped spinlock and use READ_ONCE() instead
---
kernel/bpf/helpers.c | 18 ++
1 file changed, 18 insertions(+)
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index
We assign the callback and set everything up.
The actual tests of these callbacks will be done when bpf_wq_start() is
available.
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- removed mark_precise checks
- adapted without BPF_F_WQ_SLEEPABLE
---
tools/testing/selftests/bpf
To support sleepable async callbacks, we need to tell push_async_cb()
whether the cb is sleepable or not.
The verifier now detects that we are in bpf_wq_set_callback_impl and
can allow a sleepable callback to happen.
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- dropped flags check
Allows to test if allocation/free works
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- dropped mark_precise checks
---
tools/testing/selftests/bpf/bpf_experimental.h | 1 +
tools/testing/selftests/bpf/prog_tests/wq.c | 8 +++
tools/testing/selftests/bpf/progs/wq.c | 10
.
We also need to duplicate the timer code for the checking if the map
argument is matching the provided workqueue.
Signed-off-by: Benjamin Tissoires
---
FWIW, I still have one concern with this implementation:
- bpf_wq_work() access ->prog without protection, but I think this might
be rac
We simply try in all supported map types if we can store/load a bpf_wq.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
tools/testing/selftests/bpf/prog_tests/wq.c | 11 +++
tools/testing/selftests/bpf/progs/wq.c | 135
2 files changed, 146
Currently bpf_wq_cancel_and_free() is just a placeholder as there is
no memory allocation for bpf_wq just yet.
Again, duplication of the bpf_timer approach
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- removed extra fallthrough
---
include/linux/bpf.h | 2 ++
kernel/bpf
.
Signed-off-by: Benjamin Tissoires
---
changes in v2:
- clean up already done checks in process_wq_func()
- adjust comment
- gate check_kfunc_args check with map->record->wq_off.
---
kernel/bpf/verifier.c | 65 +++
1 file changed, 65 inse
When a kfunc is declared with a KF_ARG_PTR_TO_MAP, we should have
reg->map_ptr set to a non NULL value, otherwise, that means that the
underlying type is not a map.
Signed-off-by: Benjamin Tissoires
---
new in v2
---
kernel/bpf/verifier.c | 5 +
1 file changed, 5 insertions(+)
diff --
cp include/uapi/linux/bpf.h tools/include/uapi/linux/bpf.h
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
tools/include/uapi/linux/bpf.h | 4
1 file changed, 4 insertions(+)
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index cee0a7915c08
Mostly a copy/paste from the bpf_timer API, without the initialization
and free, as they will be done in a separate patch.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
include/linux/bpf.h | 11 ++-
include/uapi/linux/bpf.h | 4
kernel/bpf/btf.c | 17
Same reason than most bpf_timer* functions, we need almost the same for
workqueues.
So extract the generic part out of it so bpf_wq_cancel_and_free can reuse
it.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
kernel/bpf/helpers.c | 42 +-
1
In the same way we have a generic __bpf_async_init(), we also need
to share code between timer and workqueue for the set_callback call.
We just add an unused flags parameter, as it will be used for workqueues.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
kernel/bpf/helpers.c
No code change except for the new flags argument being stored in the
local data struct.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
kernel/bpf/helpers.c | 91
1 file changed, 63 insertions(+), 28 deletions(-)
diff --git
changed. Everything related to async callback
is now on top of bpf_hrtimer.
Signed-off-by: Benjamin Tissoires
---
no changes in v2
---
kernel/bpf/helpers.c | 71
1 file changed, 38 insertions(+), 33 deletions(-)
diff --git a/kernel/bpf
ann
To: Andrii Nakryiko
To: Martin KaFai Lau
To: Eduard Zingerman
To: Song Liu
To: Yonghong Song
To: John Fastabend
To: KP Singh
To: Stanislav Fomichev
To: Hao Luo
To: Jiri Olsa
To: Mykola Lysenko
To: Shuah Khan
Cc:
Cc:
Cc:
Signed-off-by: Benjamin Tissoires
[0]
https://lore.kernel.org/
On Apr 19 2024, Alexei Starovoitov wrote:
> On Fri, Apr 19, 2024 at 8:14 AM Benjamin Tissoires wrote:
> >
> >
> > Honestly I just felt the patch series was big enough for a PoC and
> > comparison with sleepable bpf_timer. But if we think this needs not to
> >
On Apr 19 2024, Alexei Starovoitov wrote:
> On Fri, Apr 19, 2024 at 8:12 AM Benjamin Tissoires wrote:
> >
> >
> > It's something I added while adding the tests. And some tests were passing
> > in case I was having a non sleepable callback. But if we have
> > bpf
On Apr 18 2024, Alexei Starovoitov wrote:
> On Tue, Apr 16, 2024 at 04:08:30PM +0200, Benjamin Tissoires wrote:
> > again, copy/paste from bpf_timer_start().
> >
> > Signed-off-by: Benjamin Tissoires
> > ---
> > kernel/bpf/helpers.c | 24 +++
On Apr 18 2024, Alexei Starovoitov wrote:
> On Tue, Apr 16, 2024 at 04:08:24PM +0200, Benjamin Tissoires wrote:
> > We need to teach the verifier about the second argument which is declared
> > as void * but which is of type KF_ARG_PTR_TO_MAP. We could have dropped
> >
On Thu, Apr 18, 2024 at 5:25 AM Song Liu wrote:
>
> On Tue, Apr 16, 2024 at 7:11 AM Benjamin Tissoires wrote:
> [...]
>
> > +SEC("?tc")
> > +__log_level(2)
> > +__failure
> > +/* check that the first argument of bpf_wq_set_callback()
> >
Allows to test if allocation/free works
Signed-off-by: Benjamin Tissoires
---
tools/testing/selftests/bpf/bpf_experimental.h | 1 +
tools/testing/selftests/bpf/prog_tests/wq.c| 22 ++
tools/testing/selftests/bpf/progs/wq.c | 22 +++---
3 files
1 - 100 of 278 matches
Mail list logo