lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 23 Apr 2021 08:42:45 +0800
From:   Yunsheng Lin <linyunsheng@...wei.com>
To:     Tanner Love <tannerlove.kernel@...il.com>, <netdev@...r.kernel.org>
CC:     <davem@...emloft.net>, Tanner Love <tannerlove@...gle.com>,
        Eric Dumazet <edumazet@...gle.com>,
        Mahesh Bandewar <maheshb@...gle.com>
Subject: Re: [PATCH net-next 3/3] net: update netdev_rx_csum_fault() print
 dump only once

On 2021/4/23 3:47, Tanner Love wrote:
> From: Tanner Love <tannerlove@...gle.com>
> 
> Printing this stack dump multiple times does not provide additional
> useful information, and consumes time in the data path. Printing once
> is sufficient.
> 
> Signed-off-by: Tanner Love <tannerlove@...gle.com>
> Acked-by: Eric Dumazet <edumazet@...gle.com>
> Acked-by: Mahesh Bandewar <maheshb@...gle.com>
> ---
>  net/core/dev.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index d9bf63dbe4fd..26b82b5d8563 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -148,6 +148,7 @@
>  #include <net/devlink.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/prandom.h>
> +#include <linux/once.h>
>  
>  #include "net-sysfs.h"
>  
> @@ -3487,13 +3488,16 @@ EXPORT_SYMBOL(__skb_gso_segment);
>  
>  /* Take action when hardware reception checksum errors are detected. */
>  #ifdef CONFIG_BUG
> -void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)
> +static void do_netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)
>  {
> -	if (net_ratelimit()) {
>  		pr_err("%s: hw csum failure\n", dev ? dev->name : "<unknown>");
>  		skb_dump(KERN_ERR, skb, true);
>  		dump_stack();

Once the "if ()" is removed, one level of indent seems enough?

> -	}
> +}
> +
> +void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)
> +{
> +	DO_ONCE_LITE(do_netdev_rx_csum_fault, dev, skb);
>  }
>  EXPORT_SYMBOL(netdev_rx_csum_fault);
>  #endif
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ