From owner-cvs-all Fri Nov 30 13: 0:17 2001 Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id B7D6337B419; Fri, 30 Nov 2001 13:00:04 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id IAA25051; Sat, 1 Dec 2001 08:00:02 +1100 Date: Sat, 1 Dec 2001 08:00:10 +1100 (EST) From: Bruce Evans X-X-Sender: To: Luigi Rizzo Cc: Peter Wemm , , Subject: Re: NFS and unaligned accesses (was Re: cvs commit: src/sys/pci if_sis.c) In-Reply-To: <20011129090643.E19821@iguana.aciri.org> Message-ID: <20011201074728.P2691-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 29 Nov 2001, Luigi Rizzo wrote: > So to go back where this came from, and hopefully disprove > what I always considered to be an urban legend: > > the "sis" and other drivers do an m_devget() (which involves a > bcopy) to make sure that buffers are aligned (to a 32 bit boundary, > probably) in the upper level layers. On architectures which trap > on unaligned accesses there is no other way, but on the i386 at > least, the bcopy() just makes you pays the cost of misalignment in > advance (and even when you do not need e.g. because you > are forwarding traffic or handling TCP, which has its own > alignment constraints and more often than not ends up in userspace). > > The remedy seems as bad or worse than the evil. On some i386's at least, bcopy() can be "optimized" so that alignment doesn't matter much (align the destination), but this isn't done because it would pessimize the usual case where everything is aligned, especially for small counts. Aligning the destination instead of the source (when one of them must remained misaligned) is best (at least on i386's) because read caching tends to work better than write buffering/caching. Perhaps this changed when writes started being preallocated for the PII or PPro. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message