All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/1] selftests: drv-net-hw: fix pp_alloc_fail test error
@ 2025-01-14 22:31 John Daley
  2025-01-14 22:31 ` [PATCH net-next 1/1] selftests: drv-net-hw: inject pp_alloc_fail errors in the right place John Daley
  0 siblings, 1 reply; 4+ messages in thread
From: John Daley @ 2025-01-14 22:31 UTC (permalink / raw)
  To: shuah, kuba, sdf, willemb, linux-kselftest, linux-kernel; +Cc: John Daley

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.

Signed-off-by: John Daley <johndale@cisco.com>

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(-)

-- 
2.44.0


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

* [PATCH net-next 1/1] selftests: drv-net-hw: inject pp_alloc_fail errors in the right place
  2025-01-14 22:31 [PATCH net-next 0/1] selftests: drv-net-hw: fix pp_alloc_fail test error John Daley
@ 2025-01-14 22:31 ` John Daley
  2025-01-15  0:37   ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: John Daley @ 2025-01-14 22:31 UTC (permalink / raw)
  To: shuah, kuba, sdf, willemb, linux-kselftest, linux-kernel; +Cc: John Daley

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>
---
 net/core/page_pool.c                                    | 2 +-
 tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 9733206d6406..a3de752c5178 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -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
diff --git a/tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py b/tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py
index 05b6fbb3fcdd..ad192fef3117 100755
--- a/tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py
+++ b/tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py
@@ -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")
 
-- 
2.44.0


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

* Re: [PATCH net-next 1/1] selftests: drv-net-hw: inject pp_alloc_fail errors in the right place
  2025-01-14 22:31 ` [PATCH net-next 1/1] selftests: drv-net-hw: inject pp_alloc_fail errors in the right place John Daley
@ 2025-01-15  0:37   ` Jakub Kicinski
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2025-01-15  0:37 UTC (permalink / raw)
  To: John Daley; +Cc: shuah, sdf, willemb, linux-kselftest, linux-kernel

On Tue, 14 Jan 2025 14:31:59 -0800 John Daley wrote:
> 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.

LGTM, thanks!

Please resend and CC netdev@, tho.

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

* [PATCH net-next 1/1] selftests: drv-net-hw: inject pp_alloc_fail errors in the right place
  2025-01-15 18:13 [PATCH net-next 0/1] selftests: drv-net-hw: fix pp_alloc_fail test error John Daley
@ 2025-01-15 18:13 ` John Daley
  0 siblings, 0 replies; 4+ messages in thread
From: John Daley @ 2025-01-15 18:13 UTC (permalink / raw)
  To: shuah, kuba, sdf, willemb, linux-kselftest, linux-kernel
  Cc: netdev, John Daley

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>
---
 net/core/page_pool.c                                    | 2 +-
 tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 9733206d6406..a3de752c5178 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -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
diff --git a/tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py b/tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py
index 05b6fbb3fcdd..ad192fef3117 100755
--- a/tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py
+++ b/tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py
@@ -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")
 
-- 
2.44.0


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

end of thread, other threads:[~2025-01-15 18:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14 22:31 [PATCH net-next 0/1] selftests: drv-net-hw: fix pp_alloc_fail test error John Daley
2025-01-14 22:31 ` [PATCH net-next 1/1] selftests: drv-net-hw: inject pp_alloc_fail errors in the right place John Daley
2025-01-15  0:37   ` Jakub Kicinski
  -- strict thread matches above, loose matches on Subject: below --
2025-01-15 18:13 [PATCH net-next 0/1] selftests: drv-net-hw: fix pp_alloc_fail test error John Daley
2025-01-15 18:13 ` [PATCH net-next 1/1] selftests: drv-net-hw: inject pp_alloc_fail errors in the right place John Daley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.