Patch "xdp: fix xdp_return_frame() kernel BUG throw for page_pool memory model" has been added to the 5.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    xdp: fix xdp_return_frame() kernel BUG throw for page_pool memory model

to the 5.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xdp-fix-xdp_return_frame-kernel-bug-throw-for-page_p.patch
and it can be found in the queue-5.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3285b223c5f18c2f733945102b5b8bd0158c471a
Author: Ong Boon Leong <boon.leong.ong@xxxxxxxxx>
Date:   Wed Mar 31 21:25:03 2021 +0800

    xdp: fix xdp_return_frame() kernel BUG throw for page_pool memory model
    
    [ Upstream commit 622d13694b5f048c01caa7ba548498d9880d4cb0 ]
    
    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@xxxxxxxxx>
    Acked-by: Jesper Dangaard Brouer <brouer@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/xdp.c b/net/core/xdp.c
index 3a8c9ab4ecbe..a86bc3660729 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -350,7 +350,8 @@ static void __xdp_return(void *data, struct xdp_mem_info *mem, bool napi_direct,
 		/* mem->id is valid, checked in xdp_rxq_info_reg_mem_model() */
 		xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params);
 		page = virt_to_head_page(data);
-		napi_direct &= !xdp_return_frame_no_direct();
+		if (napi_direct && xdp_return_frame_no_direct())
+			napi_direct = false;
 		page_pool_put_full_page(xa->page_pool, page, napi_direct);
 		rcu_read_unlock();
 		break;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux