From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: Benjamin Tissoires <bentiss@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Jiri Kosina <jikos@kernel.org>,
Jonathan Corbet <corbet@lwn.net>, Shuah Khan <shuah@kernel.org>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-input@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH RFC bpf-next 0/9] allow HID-BPF to do device IOs
Date: Fri, 9 Feb 2024 17:26:27 +0100 [thread overview]
Message-ID: <CAO-hwJ+UeaBydN9deA8KBbgBiC_UCt6oXX-wGnNuSr8fhUrkXw@mail.gmail.com> (raw)
In-Reply-To: <87bk8pve2z.fsf@toke.dk>
On Fri, Feb 9, 2024 at 4:42 PM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> Benjamin Tissoires <bentiss@kernel.org> writes:
>
> > [Putting this as a RFC because I'm pretty sure I'm not doing the things
> > correctly at the BPF level.]
> > [Also using bpf-next as the base tree as there will be conflicting
> > changes otherwise]
> >
> > Ideally I'd like to have something similar to bpf_timers, but not
> > in soft IRQ context. So I'm emulating this with a sleepable
> > bpf_tail_call() (see "HID: bpf: allow to defer work in a delayed
> > workqueue").
>
> Why implement a new mechanism? Sounds like what you need is essentially
> the bpf_timer functionality, just running in a different context, right?
Heh, that's exactly why I put in a RFC :)
So yes, the bpf_timer approach is cleaner, but I need it in a
workqueue, as a hrtimer in a softIRQ would prevent me to kzalloc and
wait for the device.
> So why not just add a flag to the timer setup that controls the callback
> context? I've been toying with something similar for restarting XDP TX
> for my queueing patch series (though I'm not sure if this will actually
> end up being needed in the end):
>
> https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git/commit/?h=xdp-queueing-08&id=54bc201a358d1ac6ebfe900099315bbd0a76e862
>
Oh, nice. Good idea. But would it be OK to have a "timer-like" where
it actually defers the job in a workqueue instead of using an hrtimer?
I thought I would have to rewrite the entire bpf_timer approach
without the softIRQ, but if I can just add a new flag, that will make
things way simpler for me.
This however raises another issue if I were to use the bpf_timers: now
the HID-BPF kfuncs will not be available as they are only available to
tracing prog types. And when I tried to call them from a bpf_timer (in
softIRQ) they were not available.
Cheers,
Benjamin
next prev parent reply other threads:[~2024-02-09 16:26 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 13:26 [PATCH RFC bpf-next 0/9] allow HID-BPF to do device IOs Benjamin Tissoires
2024-02-09 13:26 ` [PATCH RFC bpf-next 1/9] bpf: allow more maps in sleepable bpf programs Benjamin Tissoires
2024-02-09 13:26 ` [PATCH RFC bpf-next 2/9] HID: bpf/dispatch: regroup kfuncs definitions Benjamin Tissoires
2024-02-09 13:26 ` [PATCH RFC bpf-next 3/9] HID: bpf: export hid_hw_output_report as a BPF kfunc Benjamin Tissoires
2024-02-09 13:26 ` [PATCH RFC bpf-next 4/9] selftests/hid: Add test for hid_bpf_hw_output_report Benjamin Tissoires
2024-02-09 13:26 ` [PATCH RFC bpf-next 5/9] HID: bpf: allow to inject HID event from BPF Benjamin Tissoires
2024-02-09 13:26 ` [PATCH RFC bpf-next 6/9] selftests/hid: add tests for hid_bpf_input_report Benjamin Tissoires
2024-02-09 13:26 ` [PATCH RFC bpf-next 7/9] HID: bpf: allow to defer work in a delayed workqueue Benjamin Tissoires
2024-02-09 13:26 ` [PATCH RFC bpf-next 8/9] selftests/hid: add test for hid_bpf_schedule_delayed_work Benjamin Tissoires
2024-02-09 13:26 ` [PATCH RFC bpf-next 9/9] selftests/hid: add another set of delayed work tests Benjamin Tissoires
2024-02-09 15:42 ` [PATCH RFC bpf-next 0/9] allow HID-BPF to do device IOs Toke Høiland-Jørgensen
2024-02-09 16:26 ` Benjamin Tissoires [this message]
2024-02-09 17:05 ` Toke Høiland-Jørgensen
2024-02-12 16:47 ` Benjamin Tissoires
2024-02-12 17:46 ` Toke Høiland-Jørgensen
2024-02-12 18:20 ` Benjamin Tissoires
2024-02-12 21:24 ` Alexei Starovoitov
2024-02-13 17:46 ` Benjamin Tissoires
2024-02-13 19:23 ` Kumar Kartikeya Dwivedi
2024-02-13 19:51 ` Toke Høiland-Jørgensen
2024-02-13 20:52 ` Alexei Starovoitov
2024-02-14 12:56 ` Toke Høiland-Jørgensen
2024-02-13 20:48 ` Alexei Starovoitov
2024-02-14 17:10 ` Benjamin Tissoires
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=CAO-hwJ+UeaBydN9deA8KBbgBiC_UCt6oXX-wGnNuSr8fhUrkXw@mail.gmail.com \
--to=benjamin.tissoires@redhat.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bentiss@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=jikos@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=toke@redhat.com \
--cc=yonghong.song@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;
as well as URLs for NNTP newsgroup(s).