Skip to content

bpf: arena: reschedule while freeing the arena pages - #13440

Open
kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
bpf-next_basefrom
series/1151075=>bpf-next
Open

bpf: arena: reschedule while freeing the arena pages#13440
kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
bpf-next_basefrom
series/1151075=>bpf-next

Conversation

@kernel-patches-daemon-bpf

Copy link
Copy Markdown

Pull request for series with
subject: bpf: arena: reschedule while freeing the arena pages
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1151075

@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: 5e289c5
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1151075
version: 1

@kernel-patches-review-bot

Copy link
Copy Markdown
commit f31c4f03899a5d4ce4ad5dd663a0d92c0c4d694e
Author: Breno Leitao <leitao@debian.org>

bpf: arena: reschedule while freeing the arena pages

This patch addresses RCU stall and softlockup issues on non-preemptible
kernels by adding cond_resched() calls during arena page freeing.

> bpf: arena: reschedule while freeing the arena pages
>
> On non-preemptible kernels that is long enough to trip both the RCU
> stall detector and the softlockup watchdog. Observed on production arm64
> hosts at Meta:
>
>   rcu: INFO: rcu_sched self-detected stall on CPU
>   rcu:     37-....: (20999 ticks this GP) idle=3834/1/0x4000000000000000
>   Workqueue: events_unbound bpf_map_free_deferred
>   Call trace:
>    __apply_to_page_range+0x404/0x518
>    apply_to_existing_page_range+0x18/0x28
>    arena_map_free+0x54/0x98
>    bpf_map_free_deferred+0x70/0xf8
>    process_scheduled_works+0x17c/0x400
>    worker_thread+0x198/0x498
>   [...]
>   watchdog: BUG: soft lockup - CPU#37 stuck for 44s! [kworker/u288:15]
>   Kernel panic - not syncing: softlockup: hung tasks
>
> arena_map_free() sweeps the whole 4GiB arena address range in a single
> apply_to_existing_page_range() call and drops every populated page from
> the walk callback.
>
> Give up the CPU after releasing each page, using cond_resched().

This isn't a bug, but the opening sentence "On non-preemptible kernels
that is long enough ..." uses "that" without an antecedent.  The phrase
that explains what takes long enough (the 4GiB arena sweep) appears two
paragraphs later, after the stall trace.

Would moving the arena_map_free() description ahead of the stall trace
make the flow clearer?



AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

In-Reply-To-Subject: bpf: arena: reschedule while freeing the arena pages
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/32755827346

@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: d83fba2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1151075
version: 1

@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: ce36e38
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1151075
version: 1

@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: 05ea1b6
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1151075
version: 1

On non-preemptible kernels that is long enough to trip both the RCU
stall detector and the softlockup watchdog. Observed on production arm64
hosts at Meta:

  rcu: INFO: rcu_sched self-detected stall on CPU
  rcu:     37-....: (20999 ticks this GP) idle=3834/1/0x4000000000000000
  Workqueue: events_unbound bpf_map_free_deferred
  Call trace:
   __apply_to_page_range+0x404/0x518
   apply_to_existing_page_range+0x18/0x28
   arena_map_free+0x54/0x98
   bpf_map_free_deferred+0x70/0xf8
   process_scheduled_works+0x17c/0x400
   worker_thread+0x198/0x498
  [...]
  watchdog: BUG: soft lockup - CPU#37 stuck for 44s! [kworker/u288:15]
  Kernel panic - not syncing: softlockup: hung tasks

arena_map_free() sweeps the whole 4GiB arena address range in a single
apply_to_existing_page_range() call and drops every populated page from
the walk callback.

Give up the CPU after releasing each page, using cond_resched().

Fixes: 3174603 ("bpf: Introduce bpf_arena.")
Signed-off-by: Breno Leitao <leitao@debian.org>
@kernel-patches-daemon-bpf

Copy link
Copy Markdown
Author

Upstream branch: 1555de3
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1151075
version: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant