Skip to contentSkip to conversation

selftests: drv-net-hw: fix pp_alloc_fail test error

PATCH Applied John Daley 2 participants 3 messages Jan 15, 2025 – Jan 17, 2025

Subsystems (4)
lore
Share & tools
lore

John Daley

author
#0 lore raw

cover selftests: drv-net-hw: fix pp_alloc_fail test error

The tool pp_alloc_fail.py tested error recovery by injecting errors into page_pool_alloc_pages(). Perhaps due to the netmems conversion, page_pool_put_full_page() does not end up calling that function.

page_pool_alloc_netmems() seems to be the base function for all the the allocation functions in the API call, so put the error injection there instead.

John Daley (1):
page_pool: inject pp_alloc_fail errors in the right place

 net/core/page_pool.c                                    | 2 +-
 tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.44.0
author
#1 lore raw

PATCH 1/1 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.

---
 net/core/page_pool.c                                    | 2 +-
 tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
net/core/page_pool.c +1 -1
index 9733206d6406..a3de752c5178 100644
@@ -595,13 +595,13 @@ netmem_ref page_pool_alloc_netmems(struct page_pool *pool, gfp_t gfp)
 	return netmem;
 }
 EXPORT_SYMBOL(page_pool_alloc_netmems);
+ALLOW_ERROR_INJECTION(page_pool_alloc_netmems, NULL);
 
 struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp)
 {
 	return netmem_to_page(page_pool_alloc_netmems(pool, gfp));
 }
 EXPORT_SYMBOL(page_pool_alloc_pages);
-ALLOW_ERROR_INJECTION(page_pool_alloc_pages, NULL);
 
 /* Calculate distance between two u32 values, valid if distance is below 2^(31)
  *  https://en.wikipedia.org/wiki/Serial_number_arithmetic#General_Solution
tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py +3 -3
index 05b6fbb3fcdd..ad192fef3117 100755
@@ -21,9 +21,9 @@ def _enable_pp_allocation_fail():
     if not os.path.exists("/sys/kernel/debug/fail_function"):
         raise KsftSkipEx("Kernel built without function error injection (or DebugFS)")
 
-    if not os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_pages"):
+    if not os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_netmems"):
         with open("/sys/kernel/debug/fail_function/inject", "w") as fp:
-            fp.write("page_pool_alloc_pages\n")
+            fp.write("page_pool_alloc_netmems\n")
 
     _write_fail_config({
         "verbose": 0,
@@ -37,7 +37,7 @@ def _disable_pp_allocation_fail():
     if not os.path.exists("/sys/kernel/debug/fail_function"):
         return
 
-    if os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_pages"):
+    if os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_netmems"):
         with open("/sys/kernel/debug/fail_function/inject", "w") as fp:
             fp.write("\n")
 
Signature · 1 line
2.44.0
#2 lore raw
In reply to John Daley
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Wed, 15 Jan 2025 10:13:11 -0800 you wrote:

The tool pp_alloc_fail.py tested error recovery by injecting errors into page_pool_alloc_pages(). Perhaps due to the netmems conversion, page_pool_put_full_page() does not end up calling that function.

page_pool_alloc_netmems() seems to be the base function for all the the allocation functions in the API call, so put the error injection there instead.

[...]

Here is the summary with links:
- [net-next,1/1] selftests: drv-net-hw: inject pp_alloc_fail errors in the right place

    https://git.kernel.org/netdev/net-next/c/8d20dcda404d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html