Received: by 10.223.176.5 with SMTP id f5csp2139496wra; Wed, 31 Jan 2018 17:53:09 -0800 (PST) X-Google-Smtp-Source: AH8x2279neKGZMFtLxkM2HpJtpHV4aA8syaMqZ6TB4mQwQ0pIxnd1VUR65ngl1ry/e2rbxuVhJQ0 X-Received: by 10.101.91.193 with SMTP id o1mr11451674pgr.315.1517449988917; Wed, 31 Jan 2018 17:53:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517449988; cv=none; d=google.com; s=arc-20160816; b=Lmbx6DAl9N6xNl0Cr2FdPwmEGbPZZF+XIJ2lHJ6Vm67f+i/E6oY/8AytY/hSrpEvfE IYz4Pc817j7kdtTIQ2/Pm17RaVnTjZ2B2do4smoCLupcvhnqMbkuScur6f3lQTCWCXd1 uRP4Sys/SuhEop5cMOvVUmhuXsZ13r1JA6/1QnyA4HM1C+w3aOMF5dtolE5HyghKfKRp BRtBsBvcZJCmD3Z8zeb7j9ekc+Bu/6Ld7FPyI7I6sWabZRfLruqkiS72jZMZvnFfaWtl K5uSy9Z+v1hTsFSYdEkDJoOsspc5G2K/QnnCLtxsUP4GuaSlq40g0FoNkF0GSPTx42sn Xatg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=RCO+snO0FOrbe1IlbdsYPPgaMvGA0DjC20qx7dl71Eg=; b=o0pm0wR2ka/s4h615F2RHUM4O95TDl2tLR9EGIqrsxt3APnwx7lOl+1H3RRI3AShp7 TYrQZw27dJqzfhjlFMwIBA9kcAggS995FxuH27vkaLvb6li8Pj0goKESd9ioqlWNNGiz pN81krBp5Hij91IJeI3E7MuJNw6a7TXiGp+4sDmFH3pExmdlZGKceC14UqWgRonFdq7o l7n8ixWcC8PTkbJFJGwXvEq+JSYKj2GVb1UYOO86yuopseEAs03/TaMfRaEyFjd93l9c PfO+aWx8h2TwdhWLoToRgAUJxCGmJnCkI1GHWP+IZbrqeBDx6xjDhBU9+CdXsMdN5vmy trLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=EycLpcfC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16-v6si5331912pll.21.2018.01.31.17.52.53; Wed, 31 Jan 2018 17:53:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=EycLpcfC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932199AbeBABv6 (ORCPT + 99 others); Wed, 31 Jan 2018 20:51:58 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:43354 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932118AbeBABvz (ORCPT ); Wed, 31 Jan 2018 20:51:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=RCO+snO0FOrbe1IlbdsYPPgaMvGA0DjC20qx7dl71Eg=; b=EycLpcfC4dNiIUHps4Ex7b67ntXAD+QB9eHBwemTKFDcJSBE3twlP7VNqEHCLwj/KjtCL4Gs7AIrXjwW8Mh2jaA8FNEl949ShUvNjk4s79dAIkEImlBch0J4KjNlfkhsyZWQl1hopO10CFb93yaMc16qMyOc5c0KJrdYSxuO7mk=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1eh42A-0001cQ-Ds; Thu, 01 Feb 2018 02:51:26 +0100 Date: Thu, 1 Feb 2018 02:51:26 +0100 From: Andrew Lunn To: "Gustavo A. R. Silva" Cc: Alan Cox , "Gustavo A. R. Silva" , "Wong Hoi Sing, Edison" , "Hung Hing Lun, Mike" , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tcp_lp: use 64-bit arithmetic instead of 32-bit Message-ID: <20180201015126.GH16547@lunn.ch> References: <20180201002407.GA1608@embeddedgus> <20180201003236.06143fd0@alans-desktop> <20180131190749.Horde.bsc7GhewsZwdnkmDtMlSwWO@gator4166.hostgator.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180131190749.Horde.bsc7GhewsZwdnkmDtMlSwWO@gator4166.hostgator.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 31, 2018 at 07:07:49PM -0600, Gustavo A. R. Silva wrote: > > Hi Alan, > > Quoting Alan Cox : > > >On Wed, 31 Jan 2018 18:24:07 -0600 > >"Gustavo A. R. Silva" wrote: > > > >>Cast to s64 some variables and a macro in order to give the > >>compiler complete information about the proper arithmetic to > >>use. Notice that these elements are used in contexts that > >>expect expressions of type s64 (64 bits, signed). > >> > >>Currently such expression are being evaluated using 32-bit > >>arithmetic. > > > >The question you need to ask is 'can it overflow 32bit maths', otherwise > >you are potentially making the system do extra work for no reason. > > > > Yeah, I get your point and it seems that in this particular case there is no > risk of a 32bit overflow, but in general and IMHO as the code evolves, the > use of incorrect arithmetic may have security implications in the future, so > I advocate for code correctness in this case. Hi Gustavo Is this on the hotpath? How much overhead does it add to 32 bit architectures which don't have 64 bit arithmetic in hardware? There are a lot of embedded systems which are 32 bit. Andrew