diff mbox series

[net-next,1/6] net: page_pool: support error injection

Message ID 20240426232400.624864-2-kuba@kernel.org
State Accepted
Commit 12b6c3a0380a220edb03691689167be13faa4f45
Headers show
Series selftests: net: page_poll allocation error injection | expand

Commit Message

Jakub Kicinski April 26, 2024, 11:23 p.m. UTC
Because of caching / recycling using the general page allocation
failures to induce errors in page pool allocation is very hard.
Add direct error injection support to page_pool_alloc_pages().

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: hawk@kernel.org
CC: ilias.apalodimas@linaro.org
---
 net/core/page_pool.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jesper Dangaard Brouer April 30, 2024, 3:27 p.m. UTC | #1
On 27/04/2024 01.23, Jakub Kicinski wrote:
> Because of caching / recycling using the general page allocation
> failures to induce errors in page pool allocation is very hard.
> Add direct error injection support to page_pool_alloc_pages().
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>


Sounds good to me :-)

Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>

> ---
> CC: hawk@kernel.org
> CC: ilias.apalodimas@linaro.org
> ---
>   net/core/page_pool.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index 273c24429bce..8bcc7014a61a 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -5,6 +5,7 @@
>    *	Copyright (C) 2016 Red Hat, Inc.
>    */
>   
> +#include <linux/error-injection.h>
>   #include <linux/types.h>
>   #include <linux/kernel.h>
>   #include <linux/slab.h>
> @@ -550,6 +551,7 @@ struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp)
>   	return page;
>   }
>   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 mbox series

Patch

diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 273c24429bce..8bcc7014a61a 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -5,6 +5,7 @@ 
  *	Copyright (C) 2016 Red Hat, Inc.
  */
 
+#include <linux/error-injection.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
@@ -550,6 +551,7 @@  struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp)
 	return page;
 }
 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