linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/3] Fix late DMA unmap crash for page pool
@ 2025-03-25 15:45 Toke Høiland-Jørgensen
  2025-03-25 15:45 ` [PATCH net-next v2 1/3] page_pool: Move pp_magic check into helper functions Toke Høiland-Jørgensen
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Toke Høiland-Jørgensen @ 2025-03-25 15:45 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Jesper Dangaard Brouer,
	Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Andrew Lunn,
	Eric Dumazet, Paolo Abeni, Ilias Apalodimas, Simon Horman,
	Andrew Morton, Mina Almasry, Yonglong Liu, Yunsheng Lin,
	Pavel Begunkov, Matthew Wilcox
  Cc: netdev, bpf, linux-rdma, linux-mm,
	Toke Høiland-Jørgensen, Qiuling Ren, Yuying Ma

This series fixes the late dma_unmap crash for page pool first reported
by Yonglong Liu in [0]. It is an alternative approach to the one
submitted by Yunsheng Lin, most recently in [1]. The first two commits
are small refactors of the page pool code, in preparation of the main
change in patch 3. See the commit message of patch 3 for the details.

-Toke

[0] https://lore.kernel.org/lkml/8067f204-1380-4d37-8ffd-007fc6f26738@kernel.org/T/
[1] https://lore.kernel.org/r/20250307092356.638242-1-linyunsheng@huawei.com

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
Changes in v2:
- Always leave two bits at the top of pp_magic as zero, instead of one

- Add an rcu_read_lock() around __page_pool_dma_sync_for_device()

- Add a comment in poison.h with a reference to the bitmask definition

- Add a longer description of the logic of the bitmask definitions to
  the comment in types.h, and a summary of the security implications of
  using the pp_magic field to the commit message of patch 3

- Collect Mina's Reviewed-by and Yonglong's Tested-by tags

- Link to v1: https://lore.kernel.org/r/20250314-page-pool-track-dma-v1-0-c212e57a74c2@redhat.com

---
Toke Høiland-Jørgensen (3):
      page_pool: Move pp_magic check into helper functions
      page_pool: Turn dma_sync and dma_sync_cpu fields into a bitmap
      page_pool: Track DMA-mapped pages and unmap them when destroying the pool

 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c |  4 +-
 include/linux/poison.h                           |  4 ++
 include/net/page_pool/helpers.h                  |  6 +-
 include/net/page_pool/types.h                    | 67 +++++++++++++++++-
 mm/page_alloc.c                                  |  9 +--
 net/core/devmem.c                                |  3 +-
 net/core/netmem_priv.h                           | 33 ++++++++-
 net/core/page_pool.c                             | 87 ++++++++++++++++++++----
 net/core/skbuff.c                                | 16 +----
 net/core/xdp.c                                   |  4 +-
 10 files changed, 186 insertions(+), 47 deletions(-)
---
base-commit: 45e36a8e3c17c4d50ecbc863893f253fb46ac070
change-id: 20250310-page-pool-track-dma-0332343a460e



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-03-27  7:21 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-25 15:45 [PATCH net-next v2 0/3] Fix late DMA unmap crash for page pool Toke Høiland-Jørgensen
2025-03-25 15:45 ` [PATCH net-next v2 1/3] page_pool: Move pp_magic check into helper functions Toke Høiland-Jørgensen
2025-03-25 15:45 ` [PATCH net-next v2 2/3] page_pool: Turn dma_sync and dma_sync_cpu fields into a bitmap Toke Høiland-Jørgensen
2025-03-25 22:17   ` Jakub Kicinski
2025-03-26  8:12     ` Toke Høiland-Jørgensen
2025-03-26 11:23       ` Jakub Kicinski
2025-03-26 11:29         ` Jakub Kicinski
2025-03-26 18:00   ` Saeed Mahameed
2025-03-25 15:45 ` [PATCH net-next v2 3/3] page_pool: Track DMA-mapped pages and unmap them when destroying the pool Toke Høiland-Jørgensen
2025-03-26 13:54   ` Jesper Dangaard Brouer
2025-03-26 18:22   ` Saeed Mahameed
2025-03-26 20:02     ` Mina Almasry
2025-03-27  0:29       ` Saeed Mahameed
2025-03-27  1:37         ` Mina Almasry
2025-03-27  3:53     ` Yunsheng Lin
2025-03-27  4:59       ` Mina Almasry
2025-03-27  7:21         ` Yunsheng Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox