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-next>] [day] [month] [year] [list]
Message-ID: <5e9e32bb-b60e-44d1-82be-28c4d6ec82d5@default>
Date:	Mon, 21 Apr 2014 07:23:04 -0700 (PDT)
From:	Venkat Venkatsubra <venkat.x.venkatsubra@...cle.com>
To:	netdev@...r.kernel.org
Cc:	davem@...emloft.net, linux-kernel@...r.kernel.org,
	Rama Nichanamatlu <rama.nichanamatlu@...cle.com>,
	Sergey Linetskiy <sergey.linetskiy@...cle.com>,
	Vadim Makhervaks <vadim.makhervaks@...cle.com>,
	Guangyu Sun <guangyu.sun@...cle.com>
Subject: Performance problem with bond interface

We see a performance problem when the slaves of the bond 
don't support checksum offload features. What we see is
tcp_sendmsg's skb_add_data_nocache ending up not using the
csum_and_copy_from_user which would have computed the
checksum while copying from user buffer to kernel buffer.
Instead it computes later in dev_hard_start_xmit when it
figures out the slave doesn't support checksum offload and
ends up expensive . 

The bonding interface's "features" has  NETIF_F_HW_CSUM 
(or NETIF_F_NO_CSUM in 2.6.39) set which makes the 
stack think checksum need not be computed in software.
/*
* Check whether we can use HW checksum.
*/
if (sk->sk_route_caps & NETIF_F_ALL_CSUM)
     skb->ip_summed = CHECKSUM_PARTIAL;

But later in dev_hard_start_xmit it finds out the slave does not
support checksumming and decides to compute in software.

/* If packet is not checksummed and device does not
* support checksumming for this protocol, complete
* checksumming here.
*/
if (skb->ip_summed == CHECKSUM_PARTIAL) {
         skb_set_transport_header(skb,
              skb_checksum_start_offset(skb));
        if (!(features & NETIF_F_ALL_CSUM) &&
             skb_checksum_help(skb))
               goto out_kfree_skb;
}

We see this problem after this commit:
commit 1742f183fc218798dab6fcf0ded25b6608fc0a48
Author: MichaÅ<82> MirosÅ<82>aw <mirq-linux@...e.qmqm.pl>
Date:   Fri Apr 22 06:31:16 2011 +0000

    net: fix netdev_increment_features()

    Simplify and fix netdev_increment_features() to conform to what is
    stated in netdevice.h comments about NETIF_F_ONE_FOR_ALL.
    Include FCoE segmentation and VLAN-challedged flags in computation.

    Signed-off-by: MichaÅ<82> MirosÅ<82>aw <mirq-linux@...e.qmqm.pl>
    Signed-off-by: David S. Miller <davem@...emloft.net>

Prior to that the below code in netdev_increment_features was helping in
turning off NETIF_F_NO_CSUM on bond when the slaves don't support it: 
/* If device needs checksumming, downgrade to it. */
if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM))
        all ^= NETIF_F_NO_CSUM | (one & NETIF_F_ALL_CSUM);

The slaves are Mellanox IB adapters. This is on x86_64 platform.

Please let us know if you need any additional information.

Thanks.

Venkat
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ