From owner-freebsd-arch Tue Jan 15 17: 6:30 2002 Delivered-To: freebsd-arch@freebsd.org Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id B5B4E37B400; Tue, 15 Jan 2002 17:06:23 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_22672)/8.9.3) with ESMTP id MAA01630; Wed, 16 Jan 2002 12:06:17 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37640) with ESMTP id <01KD4ZN364F4VM9P2R@cim.alcatel.com.au>; Wed, 16 Jan 2002 12:06:14 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.6/8.11.6) id g0G16BJ73440; Wed, 16 Jan 2002 12:06:11 +1100 Content-return: prohibited Date: Wed, 16 Jan 2002 12:06:11 +1100 From: Peter Jeremy Subject: Re: 64 bit counters again In-reply-to: <3C4492EE.5A60AD0B@mindspring.com>; from tlambert2@mindspring.com on Tue, Jan 15, 2002 at 12:37:02PM -0800 To: Terry Lambert Cc: Michal Mertl , Bosko Milekic , "James E. Housley" , Thomas Hurst , arch@FreeBSD.ORG Mail-Followup-To: Terry Lambert , Michal Mertl , Bosko Milekic , "James E. Housley" , Thomas Hurst , arch@FreeBSD.ORG Message-id: <20020116120611.A72285@gsmx07.alcatel.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.2.5i References: <3C4492EE.5A60AD0B@mindspring.com> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2002-Jan-15 12:37:02 -0800, Terry Lambert wrote: >Michal Mertl wrote: >> I wrote it so it's just matter of one #define change to have all counters >> switch to 32 or 64 bit. > >If it is #if'ed (e.g. "#if (sizeof(long)>=8) || FORCE_64_BIT_CONUTERS"), >then I have no problem with the code going in, so long as it is off by >default on 32 bit machines. I tend to agree with this point. Most people probably don't care about "bytes since reboot" and average bandwidth calculations don't need more than 32 bits for most installations. (Gig-Ethernet interfaces running close to wire speed on an IA32 is not a common configuration and I doubt it ever will be). >> I kind of measured the speed of just different addition implementation >> (DUAL pIII cumine, ServerWorks and 440BX dual boards with SMP kernel) - >[ ... ] >> It seems you and others were right. SMP atomic implementations are a bit >> expensive. But even the worst case 50 clocks for locked cmpxchg8b isn't >> that bad but IMMV. > >Uh, that's a factor of 16 in the cases that I think most of >us will care about, so I think MMDV. Comparing an unlocked 32-bit operation to a locked 64-bit SMP operation is unrealistic. The comparison is either ~2.7:1 (simple) or ~2.4:1 (locked) - neither of which are outrageous. Also, you need to take into account the impact of this change on the overall times - I suspect the extra ~30 cycles for the locked case is still only a small fraction of the total processing time. Note that in the UP case, you don't need atomic ops to access or update a multi-word object. The only requirements are that RMW primitives are used and the words are always updated in the same order (logically, LSW to MSW) - ie addl change,(mem);adcl 0,4(mem). For the update case "addl, interrupt, addl, adcl, reti, adcl" is safe. The counter value in memory will be out by 2^32 during the interrupt but that doesn't matter to the interrupt and will be corrected by the second adcl. For the read case, the reader uses something like: loop: movl 4(mem),%edx movl (mem),%eax cmpl 4(mem),%edx jnz loop If an interrupt updates the MSW then you take another pass around the loop, otherwise you always read the correct value. For the SMP case, you either need to use locks or you need to use per-CPU counters. (And the per-CPU counters can be read by another CPU using the above trick). >FWIW, HP is selling 10Gbit parts now; you can buy the cards >from them online today, if you wanted to. It is very likely >that we will see IA64 based networking hardware to support >multiple ports on these things. 10 ports is 100Gbit. That >puts us within one order of magnitude of terabit. IA64 is 64-bit. The current argument is about 64-bit operations on a 32-bit machine. Multi-port 10Gbit cards are going to need a re-designed bus as well. Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message