-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'xdp-page_pool-fixes-and-in-flight-accounting'
Jesper Dangaard Brouer says: ==================== xdp: page_pool fixes and in-flight accounting This patchset fix page_pool API and users, such that drivers can use it for DMA-mapping. A number of places exist, where the DMA-mapping would not get released/unmapped, all these are fixed. This occurs e.g. when an xdp_frame gets converted to an SKB. As network stack doesn't have any callback for XDP memory models. The patchset also address a shutdown race-condition. Today removing a XDP memory model, based on page_pool, is only delayed one RCU grace period. This isn't enough as redirected xdp_frames can still be in-flight on different queues (remote driver TX, cpumap or veth). We stress that when drivers use page_pool for DMA-mapping, then they MUST use one packet per page. This might change in the future, but more work lies ahead, before we can lift this restriction. This patchset change the page_pool API to be more strict, as in-flight page accounting is added. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Showing
12 changed files
with
502 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef __LINUX_NET_XDP_PRIV_H__ | ||
#define __LINUX_NET_XDP_PRIV_H__ | ||
|
||
#include <linux/rhashtable.h> | ||
|
||
/* Private to net/core/xdp.c, but used by trace/events/xdp.h */ | ||
struct xdp_mem_allocator { | ||
struct xdp_mem_info mem; | ||
union { | ||
void *allocator; | ||
struct page_pool *page_pool; | ||
struct zero_copy_allocator *zc_alloc; | ||
}; | ||
int disconnect_cnt; | ||
unsigned long defer_start; | ||
struct rhash_head node; | ||
struct rcu_head rcu; | ||
struct delayed_work defer_wq; | ||
unsigned long defer_warn; | ||
}; | ||
|
||
#endif /* __LINUX_NET_XDP_PRIV_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#undef TRACE_SYSTEM | ||
#define TRACE_SYSTEM page_pool | ||
|
||
#if !defined(_TRACE_PAGE_POOL_H) || defined(TRACE_HEADER_MULTI_READ) | ||
#define _TRACE_PAGE_POOL_H | ||
|
||
#include <linux/types.h> | ||
#include <linux/tracepoint.h> | ||
|
||
#include <net/page_pool.h> | ||
|
||
TRACE_EVENT(page_pool_inflight, | ||
|
||
TP_PROTO(const struct page_pool *pool, | ||
s32 inflight, u32 hold, u32 release), | ||
|
||
TP_ARGS(pool, inflight, hold, release), | ||
|
||
TP_STRUCT__entry( | ||
__field(const struct page_pool *, pool) | ||
__field(s32, inflight) | ||
__field(u32, hold) | ||
__field(u32, release) | ||
), | ||
|
||
TP_fast_assign( | ||
__entry->pool = pool; | ||
__entry->inflight = inflight; | ||
__entry->hold = hold; | ||
__entry->release = release; | ||
), | ||
|
||
TP_printk("page_pool=%p inflight=%d hold=%u release=%u", | ||
__entry->pool, __entry->inflight, __entry->hold, __entry->release) | ||
); | ||
|
||
TRACE_EVENT(page_pool_state_release, | ||
|
||
TP_PROTO(const struct page_pool *pool, | ||
const struct page *page, u32 release), | ||
|
||
TP_ARGS(pool, page, release), | ||
|
||
TP_STRUCT__entry( | ||
__field(const struct page_pool *, pool) | ||
__field(const struct page *, page) | ||
__field(u32, release) | ||
), | ||
|
||
TP_fast_assign( | ||
__entry->pool = pool; | ||
__entry->page = page; | ||
__entry->release = release; | ||
), | ||
|
||
TP_printk("page_pool=%p page=%p release=%u", | ||
__entry->pool, __entry->page, __entry->release) | ||
); | ||
|
||
TRACE_EVENT(page_pool_state_hold, | ||
|
||
TP_PROTO(const struct page_pool *pool, | ||
const struct page *page, u32 hold), | ||
|
||
TP_ARGS(pool, page, hold), | ||
|
||
TP_STRUCT__entry( | ||
__field(const struct page_pool *, pool) | ||
__field(const struct page *, page) | ||
__field(u32, hold) | ||
), | ||
|
||
TP_fast_assign( | ||
__entry->pool = pool; | ||
__entry->page = page; | ||
__entry->hold = hold; | ||
), | ||
|
||
TP_printk("page_pool=%p page=%p hold=%u", | ||
__entry->pool, __entry->page, __entry->hold) | ||
); | ||
|
||
#endif /* _TRACE_PAGE_POOL_H */ | ||
|
||
/* This part must be outside protection */ | ||
#include <trace/define_trace.h> |
Oops, something went wrong.