]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
page_pool: fix inconsistency for page_pool_ring_[un]lock()
authorYunsheng Lin <linyunsheng@huawei.com>
Mon, 22 May 2023 03:17:14 +0000 (11:17 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 9 Aug 2023 09:38:16 +0000 (11:38 +0200)
commit6b218455564dffd1ca427f6bcc298dbb3d7423f0
tree7d9ee3c7c6c532f4c4967bed18c0a93259273433
parent5f31298805e543aa4c081c5c7283eab0affa80d9
page_pool: fix inconsistency for page_pool_ring_[un]lock()

BugLink: https://bugs.launchpad.net/bugs/2028979
[ Upstream commit 368d3cb406cdd074d1df2ad9ec06d1bfcb664882 ]

page_pool_ring_[un]lock() use in_softirq() to decide which
spin lock variant to use, and when they are called in the
context with in_softirq() being false, spin_lock_bh() is
called in page_pool_ring_lock() while spin_unlock() is
called in page_pool_ring_unlock(), because spin_lock_bh()
has disabled the softirq in page_pool_ring_lock(), which
causes inconsistency for spin lock pair calling.

This patch fixes it by returning in_softirq state from
page_pool_producer_lock(), and use it to decide which
spin lock variant to use in page_pool_producer_unlock().

As pool->ring has both producer and consumer lock, so
rename it to page_pool_producer_[un]lock() to reflect
the actual usage. Also move them to page_pool.c as they
are only used there, and remove the 'inline' as the
compiler may have better idea to do inlining or not.

Fixes: 7886244736a4 ("net: page_pool: Add bulk support for ptr_ring")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Link: https://lore.kernel.org/r/20230522031714.5089-1-linyunsheng@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
include/net/page_pool.h
net/core/page_pool.c