linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
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>, Qiuling Ren <qren@redhat.com>,
	Yuying Ma <yuma@redhat.com>
Subject: Re: [PATCH net-next v7 2/2] page_pool: Track DMA-mapped pages and unmap them when destroying the pool
Date: Fri, 4 Apr 2025 17:55:43 +0200	[thread overview]
Message-ID: <3b933890-7ff2-4aaf-aea5-06e5889ca087@intel.com> (raw)
In-Reply-To: <20250404-page-pool-track-dma-v7-2-ad34f069bc18@redhat.com>

From: Toke Høiland-Jørgensen <toke@redhat.com>
Date: Fri, 04 Apr 2025 12:18:36 +0200

> When enabling DMA mapping in page_pool, pages are kept DMA mapped until
> they are released from the pool, to avoid the overhead of re-mapping the
> pages every time they are used. This causes resource leaks and/or
> crashes when there are pages still outstanding while the device is torn
> down, because page_pool will attempt an unmap through a non-existent DMA
> device on the subsequent page return.

[...]

> -#define PP_MAGIC_MASK ~0x3UL
> +#define PP_MAGIC_MASK ~(PP_DMA_INDEX_MASK | 0x3UL)
>  
>  /**
>   * struct page_pool_params - page pool parameters
> @@ -173,10 +212,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 */

Yunsheng said this change to a full bool is redundant in the v6 thread
¯\_(ツ)_/¯
I hope you've read it.

>  	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

Thanks,
Olek


  reply	other threads:[~2025-04-04 15:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-04 10:18 [PATCH net-next v7 0/2] Fix late DMA unmap crash for page pool Toke Høiland-Jørgensen
2025-04-04 10:18 ` [PATCH net-next v7 1/2] page_pool: Move pp_magic check into helper functions Toke Høiland-Jørgensen
2025-04-06 18:56   ` Zi Yan
2025-04-07  8:53     ` Toke Høiland-Jørgensen
2025-04-07 11:53       ` Zi Yan
2025-04-07 12:24       ` Zi Yan
2025-04-07 13:14         ` Toke Høiland-Jørgensen
2025-04-07 13:36           ` Zi Yan
2025-04-07 14:15             ` Zi Yan
2025-04-07 14:43               ` Jesper Dangaard Brouer
2025-04-07 15:50                 ` Zi Yan
2025-04-07 16:05                   ` Toke Høiland-Jørgensen
2025-04-07 16:06                     ` Zi Yan
2025-04-04 10:18 ` [PATCH net-next v7 2/2] page_pool: Track DMA-mapped pages and unmap them when destroying the pool Toke Høiland-Jørgensen
2025-04-04 15:55   ` Alexander Lobakin [this message]
2025-04-04 16:14     ` Alexander Lobakin
2025-04-05 12:50       ` Toke Høiland-Jørgensen
2025-04-07 11:26         ` Yunsheng Lin
2025-04-07 11:49           ` 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=3b933890-7ff2-4aaf-aea5-06e5889ca087@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=qren@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=toke@redhat.com \
    --cc=willy@infradead.org \
    --cc=yuma@redhat.com \
    /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