-
Notifications
You must be signed in to change notification settings - Fork 159
bpf: Fix conditions when timer/wq can be called #10948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Though hrtimer_start/cancel() inlines all of the smaller helpers in hrtimer.c and only call timerqueue_add/del() from lib/timerqueue.c where everything is not traceable and not kprobe-able (because all files in lib/ are not traceable), there are tracepoints within hrtimer that are called with locks held. Therefore prevent the deadlock by tightening conditions when timer/wq can be called synchronously. hrtimer/wq are using raw_spin_lock_irqsave(), so irqs_disabled() is enough. Fixes: 1bfbc26 ("bpf: Enable bpf_timer and bpf_wq in any context") Signed-off-by: Alexei Starovoitov <[email protected]>
Add a testcase that checks that deadlock avoidance is working as expected. Signed-off-by: Alexei Starovoitov <[email protected]>
Do not schedule timer/wq operation on a cpu that is in irq_work callback that is processing async_cmds queue. Otherwise the following loop is possible: bpf_timer_start() -> bpf_async_schedule_op() -> irq_work_queue(). irqrestore -> bpf_async_irq_worker() -> tracepoint -> bpf_timer_start(). Fixes: 1bfbc26 ("bpf: Enable bpf_timer and bpf_wq in any context") Signed-off-by: Alexei Starovoitov <[email protected]>
Strengthen timer_start_deadlock test and check for recursion now Signed-off-by: Alexei Starovoitov <[email protected]>
|
Upstream branch: b28dac3 |
AI reviewed your patch. Please fix the bug or email reply why it's not a bug. In-Reply-To-Subject: AI-authorship-score: low |
|
Forwarding comment 3845171225 via email |
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1050571 irrelevant now. Closing PR. |
Pull request for series with
subject: bpf: Tighten conditions when timer/wq can be called synchronously
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1050571