]> git.baikalelectronics.ru Git - kernel.git/commit
lwt: Disable BH too in run_lwt_bpf()
authorDongdong Wang <wangdongdong.6@bytedance.com>
Sat, 5 Dec 2020 07:59:45 +0000 (23:59 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 7 Dec 2020 19:53:39 +0000 (11:53 -0800)
commit439f2f93c42accd1b913b7b054d4457648c864b3
tree1423dfd779aad5f398dd1330a84e060306d1fa56
parentefd481fdcd67916d03c9d71a5ed09fa91e3b589b
lwt: Disable BH too in run_lwt_bpf()

The per-cpu bpf_redirect_info is shared among all skb_do_redirect()
and BPF redirect helpers. Callers on RX path are all in BH context,
disabling preemption is not sufficient to prevent BH interruption.

In production, we observed strange packet drops because of the race
condition between LWT xmit and TC ingress, and we verified this issue
is fixed after we disable BH.

Although this bug was technically introduced from the beginning, that
is commit 8099c1b96ed6 ("bpf: BPF for lightweight tunnel infrastructure"),
at that time call_rcu() had to be call_rcu_bh() to match the RCU context.
So this patch may not work well before RCU flavor consolidation has been
completed around v5.0.

Update the comments above the code too, as call_rcu() is now BH friendly.

Signed-off-by: Dongdong Wang <wangdongdong.6@bytedance.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Cong Wang <cong.wang@bytedance.com>
Link: https://lore.kernel.org/bpf/20201205075946.497763-1-xiyou.wangcong@gmail.com
net/core/lwt_bpf.c