From owner-svn-src-all@FreeBSD.ORG Thu Jun 17 12:44:30 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09C02106566C; Thu, 17 Jun 2010 12:44:30 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 7016F8FC0C; Thu, 17 Jun 2010 12:44:29 +0000 (UTC) Received: from c122-106-175-69.carlnfd1.nsw.optusnet.com.au (c122-106-175-69.carlnfd1.nsw.optusnet.com.au [122.106.175.69]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o5HCiPwK009548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 17 Jun 2010 22:44:26 +1000 Date: Thu, 17 Jun 2010 22:44:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Kostik Belousov In-Reply-To: <20100617071300.GX13238@deviant.kiev.zoral.com.ua> Message-ID: <20100617223406.B40711@delplex.bde.org> References: <201006130239.o5D2du3m086332@svn.freebsd.org> <20100613101025.GD1320@garage.freebsd.pl> <4C158B71.205@freebsd.org> <20100614085205.GD13238@deviant.kiev.zoral.com.ua> <4C1605A7.2000202@freebsd.org> <20100614104349.GF13238@deviant.kiev.zoral.com.ua> <4C198A90.3060905@freebsd.org> <20100617071300.GX13238@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Matthew Fleming , src-committers@FreeBSD.org, Pawel Jakub Dawidek , John Baldwin , svn-src-all@FreeBSD.org, brde@optusnet.com.au, svn-src-head@FreeBSD.org, Lawrence Stewart Subject: Re: svn commit: r209119 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jun 2010 12:44:30 -0000 On Thu, 17 Jun 2010, Kostik Belousov wrote: > On Thu, Jun 17, 2010 at 12:38:08PM +1000, Lawrence Stewart wrote: >> I've tested the above and it works. I also prefer the idea of having >> DPCPU_SUM return the sum so that you can do "var = DPCPU_SUM(...)". My >> only concern with this method is that the caller no longer has the >> choice to make the sum variable a larger type to avoid overflow. It >> would be nice to be able to have the DPCPU vars be uint32_t but be able >> to sum them into a uint64_t accumulator for example. Perhaps this isn't >> really an issue though... I'm not sure. > You are worried about overflow in the sum of 32 or 64 variables, but if > this is the case, then each member of the sum can overflow as well, IMO. > Either ignore the issue, or use a uintmax_t. Or use int variables so that the overflow trap can work, and fix the overflow trap to work (gcc -ftapv, but this is unusable in the kernel), and get a nice panic on all overflows, not just here :-). Bruce