From owner-freebsd-alpha Tue Jun 19 20:25:59 2001 Delivered-To: freebsd-alpha@freebsd.org Received: from technokratis.com (modemcable052.174-202-24.mtl.mc.videotron.ca [24.202.174.52]) by hub.freebsd.org (Postfix) with ESMTP id 489D437B406 for ; Tue, 19 Jun 2001 20:25:33 -0700 (PDT) (envelope-from bmilekic@technokratis.com) Received: (from bmilekic@localhost) by technokratis.com (8.11.3/8.11.3) id f5K3QO129943; Tue, 19 Jun 2001 23:26:24 -0400 (EDT) (envelope-from bmilekic) Date: Tue, 19 Jun 2001 23:26:24 -0400 From: Bosko Milekic To: Terry Lambert Cc: freebsd-alpha@FreeBSD.ORG Subject: Re: vx, lge, nge, dc, rl, sf, sis, sk, vr, wb users please TEST Message-ID: <20010619232624.A29829@technokratis.com> References: <20010619191602.A28591@technokratis.com> <200106200224.TAA24251@usr05.primenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200106200224.TAA24251@usr05.primenet.com>; from tlambert@primenet.com on Wed, Jun 20, 2001 at 02:24:02AM +0000 Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Wed, Jun 20, 2001 at 02:24:02AM +0000, Terry Lambert wrote: > > http://people.freebsd.org/~bmilekic/code/mdevget.patch > > Please run this past Bill Paul. I already did this. :-) > The reason for the pre-adjustment of the m_devget is to ensure > that the structure in the IP header is aligned, given the fact > that there is a 14 byte ethernet header in front of it. I know. The problem is that the way the alignment issue is presently handeled is wrong. See, to trick m_devget() into writing the start of the data offset two bytes into the target mbuf chain's first mbuf's data region (to make the alignment OK), what was done was to pass for the `source buffer address' argument to m_devget(), the actual address of the source buffer MINUS ETHER_ALIGN (2 bytes). This had the effect of copying the end of the previous cluster or the end of the mbuf header (depending on where the source buffer is stored) to the first two bytes of the target mbuf. Admittedly, this is a cute trick, but it's wrong. What can happen (and will likely happen w/ mb_alloc b/c mb_alloc keeps separate maps for clusters and mbufs, to make address space limitations easier to maintain) is that the "previous cluster" sits on another page which just so happens to not be allocated yet, which will generate a page fault during the bcopy() in m_devget(). > An alignment of 16 should work on the Alpha and IA64, without > needing modification. As Jonathan Lemon kindly explained to me, the 2 byte alignment at the start of the data region makes things ok as the ethernet header is 14 bytes so the data following it will be properly aligned. This makes the Alpha happy and the x86 faster. > The m_devget basically copies the data to force it to be aligned > (ugly, but necessary on brain damaged hardware). Again, I know. What the change does, if you just glance over at it, is change the `offset from source buffer' argument of m_devget() which came with the initial import of m_devget() [and which is coincidentally not used ANYWHERE in our code, and is thus useless] to now mean `offset into the data region of the first mbuf of the target mbuf chain before copying the source buffer data.' I hope this clarifies things. > Are these changes really necessary for the Alpha to work? Absolutely. To test whether or not they are correct, it would be nice if the people with the hardware gave it a whirl. By the way, the patch is for -CURRENT but once it is committed, I'll mark it "MFC in 2 weeks," as this applies to -STABLE as well (even though -STABLE is not seeing mb_alloc, the trickery used to fool m_devget() is still technically wrong). > Terry Lambert > terry@lambert.org > --- > Any opinions in this posting are my own and not those of my present > or previous employers. K? Cheerio, -- Bosko Milekic bmilekic@technokratis.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message