Skip to content

Commit 8d20dcd

Browse files
johndale88kuba-moo
authored andcommitted
selftests: drv-net-hw: inject pp_alloc_fail errors in the right place
The tool pp_alloc_fail.py tested error recovery by injecting errors into the function page_pool_alloc_pages(). The page pool allocation function page_pool_dev_alloc() does not end up calling page_pool_alloc_pages(). page_pool_alloc_netmems() seems to be the function that is called by all of the page pool alloc functions in the API, so move error injection to that function instead. Signed-off-by: John Daley <johndale@cisco.com> Link: https://patch.msgid.link/20250115181312.3544-2-johndale@cisco.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 65a55aa commit 8d20dcd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

net/core/page_pool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,13 +595,13 @@ netmem_ref page_pool_alloc_netmems(struct page_pool *pool, gfp_t gfp)
595595
return netmem;
596596
}
597597
EXPORT_SYMBOL(page_pool_alloc_netmems);
598+
ALLOW_ERROR_INJECTION(page_pool_alloc_netmems, NULL);
598599

599600
struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp)
600601
{
601602
return netmem_to_page(page_pool_alloc_netmems(pool, gfp));
602603
}
603604
EXPORT_SYMBOL(page_pool_alloc_pages);
604-
ALLOW_ERROR_INJECTION(page_pool_alloc_pages, NULL);
605605

606606
/* Calculate distance between two u32 values, valid if distance is below 2^(31)
607607
* https://en.wikipedia.org/wiki/Serial_number_arithmetic#General_Solution

tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def _enable_pp_allocation_fail():
2121
if not os.path.exists("/sys/kernel/debug/fail_function"):
2222
raise KsftSkipEx("Kernel built without function error injection (or DebugFS)")
2323

24-
if not os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_pages"):
24+
if not os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_netmems"):
2525
with open("/sys/kernel/debug/fail_function/inject", "w") as fp:
26-
fp.write("page_pool_alloc_pages\n")
26+
fp.write("page_pool_alloc_netmems\n")
2727

2828
_write_fail_config({
2929
"verbose": 0,
@@ -37,7 +37,7 @@ def _disable_pp_allocation_fail():
3737
if not os.path.exists("/sys/kernel/debug/fail_function"):
3838
return
3939

40-
if os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_pages"):
40+
if os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_netmems"):
4141
with open("/sys/kernel/debug/fail_function/inject", "w") as fp:
4242
fp.write("\n")
4343

0 commit comments

Comments
 (0)