From owner-freebsd-arch@FreeBSD.ORG Sat Dec 19 11:42:24 2009 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8965A1065746; Sat, 19 Dec 2009 11:42:24 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe01.swip.net [212.247.154.1]) by mx1.freebsd.org (Postfix) with ESMTP id AC4FE8FC08; Sat, 19 Dec 2009 11:42:23 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=MnI1ikcADjEx7bvsp0jZvQ==:17 a=Fa0p2dj8wnFP207fzp8A:9 a=NRoDMZWEEsvWI_krVPgA:7 a=f3fVchOcrPINIEe5_G_UAmhSYaQA:4 a=u4nCZWMP6T-Rh-9c:21 Received: from [188.126.201.140] (account mc467741@c2i.net HELO laptop.adsl.tele2.no) by mailfe01.swip.net (CommuniGate Pro SMTP 5.2.16) with ESMTPA id 293568362; Sat, 19 Dec 2009 12:42:21 +0100 From: Hans Petter Selasky To: freebsd-arch@freebsd.org Date: Sat, 19 Dec 2009 12:44:14 +0100 User-Agent: KMail/1.11.4 (FreeBSD/9.0-CURRENT; KDE/4.2.4; i386; ; ) References: <20091215103759.P97203@beagle.kn.op.dlr.de> <200912151313.28326.jhb@freebsd.org> <20091219112711.GR55913@acme.spoerlein.net> In-Reply-To: <20091219112711.GR55913@acme.spoerlein.net> X-Face: (%:6u[ldzJ`0qjD7sCkfdMmD*RxpO< =?iso-8859-1?q?Q0yAl=7E=3F=60=27F=3FjDVb=5DE6TQ7=27=23h-VlLs=7Dk/=0A=09?=(yxg(p!IL.`#ng"%`BMrham7%UK,}VH\wUOm=^>wEEQ+KWt[{J#x6ow~JO:,zwp.(t; @ =?iso-8859-1?q?Aq=0A=09=3A4=3A=26nFCgDb8=5B3oIeTb=5E=27?=",; u{5{}C9>"PuY\)!=#\u9SSM-nz8+SR~B\!qBv MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200912191244.17803.hselasky@c2i.net> Cc: Ulrich =?iso-8859-1?q?Sp=F6rlein?= , Harti Brandt Subject: Re: network statistics in SMP X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Dec 2009 11:42:24 -0000 On Saturday 19 December 2009 12:27:12 Ulrich Sp=F6rlein wrote: > On Tue, 15.12.2009 at 13:13:28 -0500, John Baldwin wrote: > > On Tuesday 15 December 2009 12:45:13 pm Harti Brandt wrote: > > > I see. I was also thinking along these lines, but was not sure whether > > > it is worth the trouble. I suppose this does not help to implement > > > 64-bit counters on 32-bit architectures, though, because you cannot > > > read them reliably without locking to sum them up, right? > > > > Either that or you just accept that you have a small race since it is > > only stats. :) > > This might be stupid, but can we not easily *read* 64bit counters > on 32bit machines like this: > > do { > h1 =3D read_upper_32bits; > l1 =3D read_lower_32bits; > h2 =3D read_upper_32bits; > l2 =3D read_lower_32bits; /* not needed */ > } while (h1 !=3D h2); Hi, Just a comment. You know you don't need a while loop to get a stable value?= =20 Should be implemented like this, in my opinion: h1 =3D read_upper_32bits; l1 =3D read_lower_32bits; h2 =3D read_upper_32bits; if (h1 !=3D h2) l1 =3D 0xffffffffUL; sum64 =3D (h1<<32) | l1; =2D-HPS