]> git.baikalelectronics.ru Git - kernel.git/commit
xdp: fix xdp_return_frame() kernel BUG throw for page_pool memory model
authorOng Boon Leong <boon.leong.ong@intel.com>
Wed, 31 Mar 2021 13:25:03 +0000 (21:25 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 31 Mar 2021 22:15:23 +0000 (15:15 -0700)
commit622d13694b5f048c01caa7ba548498d9880d4cb0
tree1c33751ca3d24ab7507578ddf0ef1713110dc85b
parentc609e6aae4efcf383fe86b195d1b060befcb3666
xdp: fix xdp_return_frame() kernel BUG throw for page_pool memory model

xdp_return_frame() may be called outside of NAPI context to return
xdpf back to page_pool. xdp_return_frame() calls __xdp_return() with
napi_direct = false. For page_pool memory model, __xdp_return() calls
xdp_return_frame_no_direct() unconditionally and below false negative
kernel BUG throw happened under preempt-rt build:

[  430.450355] BUG: using smp_processor_id() in preemptible [00000000] code: modprobe/3884
[  430.451678] caller is __xdp_return+0x1ff/0x2e0
[  430.452111] CPU: 0 PID: 3884 Comm: modprobe Tainted: G     U      E     5.12.0-rc2+ #45

Changes in v2:
 - This patch fixes the issue by making xdp_return_frame_no_direct() is
   only called if napi_direct = true, as recommended for better by
   Jesper Dangaard Brouer. Thanks!

Fixes: 2539650fadbf ("xdp: Helpers for disabling napi_direct of xdp_return_frame")
Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/xdp.c