Subject: Re: pointer atomicity
To: None <tech-kern@NetBSD.org>
From: Andrey Petrov <petrov@NetBSD.org>
List: tech-kern
Date: 01/12/2006 14:13:04
On Thu, Jan 12, 2006 at 08:19:25PM +0000, David Laight wrote:
> On Wed, Jan 11, 2006 at 03:02:35PM -0800, Jason Thorpe wrote:
> > >>
> > >>i386 when the data is misaligned and crosses a page boundary and the
> > >>second read faults.
> > >>
> > >
> > >Wouldn't failed instruction be repeated after page fault resolved?
> >
> > Yes.
>
> But if the transfer were a write doesn't the first half happen before
> the fault? So a reader could get half the old and half the new?
>
True, somehow I thought about read operation only. Looking at linux's
include/asm-*/atomic.h read and write operations are atomic on most
of cpus, provided proper alignment.
-Andrey Petrov