Skip to content

Commit 622d136

Browse files
elvinongbldavem330
authored andcommitted
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+ MIPS#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: 2539650 ("xdp: Helpers for disabling napi_direct of xdp_return_frame") Signed-off-by: Ong Boon Leong <[email protected]> Acked-by: Jesper Dangaard Brouer <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c609e6a commit 622d136

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/core/xdp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ static void __xdp_return(void *data, struct xdp_mem_info *mem, bool napi_direct,
350350
/* mem->id is valid, checked in xdp_rxq_info_reg_mem_model() */
351351
xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params);
352352
page = virt_to_head_page(data);
353-
napi_direct &= !xdp_return_frame_no_direct();
353+
if (napi_direct && xdp_return_frame_no_direct())
354+
napi_direct = false;
354355
page_pool_put_full_page(xa->page_pool, page, napi_direct);
355356
rcu_read_unlock();
356357
break;

0 commit comments

Comments
 (0)