Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Peter Rival <frival@zk3.dec.com>
To: axp-list@redhat.com
Subject: Re: how to simulate an unaligned ldl_l
Date: Mon, 14 Feb 2000 08:15:23 -0500	[thread overview]
Message-ID: <38A7FFEB.9FF8CC1@zk3.dec.com> (raw)
In-Reply-To: 200002140507.AAA02511@alpha2.estabrook.org

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


  reply	other threads:[~2000-02-14 13:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-13 23:20 how to simulate an unaligned ldl_l Ross A. Knepper
2000-02-14  5:07 ` Jay.Estabrook
2000-02-14 13:15   ` Peter Rival [this message]
2000-02-14 15:26     ` set_program_attributes message J. Pedro Sousa do Amaral
2000-02-14 15:51     ` how to simulate an unaligned ldl_l Joseph A. Martin
2000-02-15  3:08 ` Richard Henderson
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox