diff mbox series

[X/B/F/G/H/Unstable,SRU,1/1] net: napi: remove useless stack trace

Message ID 20201127114745.2900-2-po-hsu.lin@canonical.com
State New
Headers show
Series net: napi: remove useless stack trace | expand

Commit Message

Po-Hsu Lin Nov. 27, 2020, 11:47 a.m. UTC
From: Eric Dumazet <edumazet@google.com>

BugLink: https://bugs.launchpad.net/bugs/1903596

Whenever a buggy NAPI driver returns more than its budget,
we emit a stack trace that is of no use, since it does not
tell which driver is buggy.

Instead, emit a message giving the function name, and a
descriptive message.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 427d5838e99632e9218eae752009c873cade89ac)
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
---
 net/core/dev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Stefan Bader Nov. 30, 2020, 7:41 a.m. UTC | #1
On 27.11.20 12:47, Po-Hsu Lin wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1903596
> 
> Whenever a buggy NAPI driver returns more than its budget,
> we emit a stack trace that is of no use, since it does not
> tell which driver is buggy.
> 
> Instead, emit a message giving the function name, and a
> descriptive message.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit 427d5838e99632e9218eae752009c873cade89ac)
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  net/core/dev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 2020170..e30ea80 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5670,7 +5670,9 @@ static int napi_poll(struct napi_struct *n, struct list_head *repoll)
>  		trace_napi_poll(n, work, weight);
>  	}
>  
> -	WARN_ON_ONCE(work > weight);
> +	if (unlikely(work > weight))
> +		pr_err_once("NAPI poll function %pS returned %d, exceeding its budget of %d.\n",
> +			    n->poll, work, weight);
>  
>  	if (likely(work < weight))
>  		goto out_unlock;
>
Kleber Sacilotto de Souza Dec. 3, 2020, 9:45 a.m. UTC | #2
On 27.11.20 12:47, Po-Hsu Lin wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1903596
> 
> Whenever a buggy NAPI driver returns more than its budget,
> we emit a stack trace that is of no use, since it does not
> tell which driver is buggy.
> 
> Instead, emit a message giving the function name, and a
> descriptive message.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit 427d5838e99632e9218eae752009c873cade89ac)
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

> ---
>   net/core/dev.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 2020170..e30ea80 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5670,7 +5670,9 @@ static int napi_poll(struct napi_struct *n, struct list_head *repoll)
>   		trace_napi_poll(n, work, weight);
>   	}
>   
> -	WARN_ON_ONCE(work > weight);
> +	if (unlikely(work > weight))
> +		pr_err_once("NAPI poll function %pS returned %d, exceeding its budget of %d.\n",
> +			    n->poll, work, weight);
>   
>   	if (likely(work < weight))
>   		goto out_unlock;
>
Ian May Dec. 8, 2020, 6:09 p.m. UTC | #3
Applied to:
  xenial/linux
  bionic/linux
  focal/linux
  groovy/linux

Thanks,
Ian

On 2020-11-27 19:47:45 , Po-Hsu Lin wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1903596
> 
> Whenever a buggy NAPI driver returns more than its budget,
> we emit a stack trace that is of no use, since it does not
> tell which driver is buggy.
> 
> Instead, emit a message giving the function name, and a
> descriptive message.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit 427d5838e99632e9218eae752009c873cade89ac)
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
> ---
>  net/core/dev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 2020170..e30ea80 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5670,7 +5670,9 @@ static int napi_poll(struct napi_struct *n, struct list_head *repoll)
>  		trace_napi_poll(n, work, weight);
>  	}
>  
> -	WARN_ON_ONCE(work > weight);
> +	if (unlikely(work > weight))
> +		pr_err_once("NAPI poll function %pS returned %d, exceeding its budget of %d.\n",
> +			    n->poll, work, weight);
>  
>  	if (likely(work < weight))
>  		goto out_unlock;
> -- 
> 2.7.4
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index 2020170..e30ea80 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5670,7 +5670,9 @@  static int napi_poll(struct napi_struct *n, struct list_head *repoll)
 		trace_napi_poll(n, work, weight);
 	}
 
-	WARN_ON_ONCE(work > weight);
+	if (unlikely(work > weight))
+		pr_err_once("NAPI poll function %pS returned %d, exceeding its budget of %d.\n",
+			    n->poll, work, weight);
 
 	if (likely(work < weight))
 		goto out_unlock;