From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 18547 invoked from network); 14 Feb 2000 13:19:01 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 14 Feb 2000 13:19:01 -0000 Received: from zmamail01.zma.compaq.com (mailout.zma.compaq.com [161.114.64.101]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id IAA24623 for ; Mon, 14 Feb 2000 08:19:00 -0500 Received: by zmamail01.zma.compaq.com (Postfix, from userid 12345) id EFFD92A9; Mon, 14 Feb 2000 08:18:29 -0500 (EST) Received: from flume.zk3.dec.com (broflume.zk3.dec.com [16.141.0.42]) by zmamail01.zma.compaq.com (Postfix) with ESMTP id DC75D26E for ; Mon, 14 Feb 2000 08:18:29 -0500 (EST) Received: from zk3.dec.com by flume.zk3.dec.com (8.8.8/1.1.8.2/16Jan95-0946AM) id IAA0000024192; Mon, 14 Feb 2000 08:18:29 -0500 (EST) Sender: frival@zk3.dec.com Message-ID: <38A7FFEB.9FF8CC1@zk3.dec.com> Date: Mon, 14 Feb 2000 08:15:23 -0500 From: Peter Rival Organization: Tru64 QMG Performance Engineering X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.12-20smp i586) X-Accept-Language: en MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: how to simulate an unaligned ldl_l References: <200002140507.AAA02511@alpha2.estabrook.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Jay.Estabrook@compaq.com wrote: > >>> "Ross A. Knepper" said: > > > > i've been looking at porting reiserfs to alpha. unfortunately, it has a > > bunch of unaligned data accesses. naturally, intel doesnt care. on > > alpha, most unaligned LDx/STx instructions are emulated by a software > > trap (outside the kernel that is -- i don't know about inside). however, > > this is not the case with the load_locked and store_conditional > > instructions. > > Uh, oh... :-\ > > > i'm looking at a number of routines that use these instructions for > > atomicity, via clear_bit(), set_bit(), etc. in asm/bitops.h. is there any > > clever way to circumvent this problem? the only hack i can think of at > > the moment is to use ldl_u to extract it, put it into an aligned longword > > buffer and do the ldl_l on that address instead. i feel like i'd have to > > be insane to try this, however :) > > > > anybody had this problem before? found a solution? > > The only solution is to align those accesses. > > The load_locked and store_conditional *MUST* be used with aligned operands, > otherwise what they are attempting to do (protect change of state from SMP > meddling) cannot be relied on. > > And I believe strongly that this will be a problem on other architectures > beside Alpha. You must convince the authors to rework the data structures to > size and align the important fields correctly for operation on other > platorms than INTEL. > Jay - would it be enough to just simply wrap these data structures in an __aligned(32) -type declaration? Worst case I'd think would be that we'd have to re-order struct members,which should only be a problem if they are written to disk as is. But that's what conversion programs are for ;) - Pete