From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Tariq Toukan <tariqt@nvidia.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
"Simon Horman" <horms@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"Mina Almasry" <almasrymina@google.com>,
Yonglong Liu <liuyonglong@huawei.com>,
Yunsheng Lin <linyunsheng@huawei.com>,
Pavel Begunkov <asml.silence@gmail.com>,
Matthew Wilcox <willy@infradead.org>, <netdev@vger.kernel.org>,
<bpf@vger.kernel.org>, <linux-rdma@vger.kernel.org>,
<linux-mm@kvack.org>
Subject: Re: [PATCH net-next v3 2/3] page_pool: Turn dma_sync into a full-width bool field
Date: Wed, 26 Mar 2025 18:40:27 +0100 [thread overview]
Message-ID: <b025e2b7-ff99-4659-811c-8071d4aa8031@intel.com> (raw)
In-Reply-To: <20250326-page-pool-track-dma-v3-2-8e464016e0ac@redhat.com>
From: Toke Høiland-Jørgensen <toke@redhat.com>
Date: Wed, 26 Mar 2025 09:18:39 +0100
> Change the single-bit boolean for dma_sync into a full-width bool, so we
> can read it as volatile with READ_ONCE(). A subsequent patch will add
> writing with WRITE_ONCE() on teardown.
Don't we have something like READ_ONCE(), but for one bit? Like
atomic-load-blah?
>
> Reviewed-by: Mina Almasry <almasrymina@google.com>
> Tested-by: Yonglong Liu <liuyonglong@huawei.com>
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---
> include/net/page_pool/types.h | 6 +++---
> net/core/page_pool.c | 2 +-
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h
> index df0d3c1608929605224feb26173135ff37951ef8..d6c93150384fbc4579bb0d0afb357ebb26c564a3 100644
> --- a/include/net/page_pool/types.h
> +++ b/include/net/page_pool/types.h
> @@ -173,10 +173,10 @@ struct page_pool {
> int cpuid;
> u32 pages_state_hold_cnt;
>
> - bool has_init_callback:1; /* slow::init_callback is set */
> + bool dma_sync; /* Perform DMA sync for device */
> + bool dma_sync_for_cpu:1; /* Perform DMA sync for cpu */
> bool dma_map:1; /* Perform DMA mapping */
> - bool dma_sync:1; /* Perform DMA sync for device */
> - bool dma_sync_for_cpu:1; /* Perform DMA sync for cpu */
> + bool has_init_callback:1; /* slow::init_callback is set */
> #ifdef CONFIG_PAGE_POOL_STATS
> bool system:1; /* This is a global percpu pool */
> #endif
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index acef1fcd8ddcfd1853a6f2055c1f1820ab248e8d..fb32768a97765aacc7f1103bfee38000c988b0de 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -466,7 +466,7 @@ page_pool_dma_sync_for_device(const struct page_pool *pool,
> netmem_ref netmem,
> u32 dma_sync_size)
> {
> - if (pool->dma_sync && dma_dev_need_sync(pool->p.dev))
> + if (READ_ONCE(pool->dma_sync) && dma_dev_need_sync(pool->p.dev))
> __page_pool_dma_sync_for_device(pool, netmem, dma_sync_size);
> }
Thanks,
Olek
next prev parent reply other threads:[~2025-03-26 17:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 8:18 [PATCH net-next v3 0/3] Fix late DMA unmap crash for page pool Toke Høiland-Jørgensen
2025-03-26 8:18 ` [PATCH net-next v3 1/3] page_pool: Move pp_magic check into helper functions Toke Høiland-Jørgensen
2025-03-26 12:55 ` Jesper Dangaard Brouer
2025-03-26 15:29 ` Ilias Apalodimas
2025-03-26 8:18 ` [PATCH net-next v3 2/3] page_pool: Turn dma_sync into a full-width bool field Toke Høiland-Jørgensen
2025-03-26 12:56 ` Jesper Dangaard Brouer
2025-03-26 17:40 ` Alexander Lobakin [this message]
2025-03-26 8:18 ` [PATCH net-next v3 3/3] page_pool: Track DMA-mapped pages and unmap them when destroying the pool Toke Høiland-Jørgensen
2025-03-26 11:48 ` [PATCH net-next v3 0/3] Fix late DMA unmap crash for page pool Jakub Kicinski
2025-03-26 12:20 ` Toke Høiland-Jørgensen
2025-03-26 14:49 ` Jakub Kicinski
2025-03-27 10:41 ` Toke Høiland-Jørgensen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b025e2b7-ff99-4659-811c-8071d4aa8031@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=akpm@linux-foundation.org \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=asml.silence@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linyunsheng@huawei.com \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=toke@redhat.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox