On Wed, Jan 22, 2025 at 04:10:45PM +0100, Maciej Fijalkowski wrote: > If we store the pgcnt on few fragments while being in the middle of > gathering the whole frame and we stumbled upon DD bit not being set, we > terminate the NAPI Rx processing loop and come back later on. Then on > next NAPI execution we work on previously stored pgcnt. > > Imagine that second half of page was used actively by networking stack > and by the time we came back, stack is not busy with this page anymore > and decremented the refcnt. The page reuse algorithm in this case should > be good to reuse the page but given the old refcnt it will not do so and > attempt to release the page via page_frag_cache_drain() with > pagecnt_bias used as an arg. This in turn will result in negative refcnt > on struct page, which was initially observed by Xu Du. > > Therefore, move the page count storage from ice_get_rx_buf() to a place > where we are sure that whole frame has been collected, but before > calling XDP program as it internally can also change the page count of > fragments belonging to xdp_buff. > > Fixes: ac0753391195 ("ice: Store page count inside ice_rx_buf") > Reported-and-tested-by: Xu Du <x...@redhat.com> > Reviewed-by: Przemek Kitszel <przemyslaw.kits...@intel.com> > Co-developed-by: Jacob Keller <jacob.e.kel...@intel.com> > Signed-off-by: Jacob Keller <jacob.e.kel...@intel.com> > Signed-off-by: Maciej Fijalkowski <maciej.fijalkow...@intel.com>
Reviewed-by: Simon Horman <ho...@kernel.org>