This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why is defined PPC_ISYNC defined as "sync;isync"


On Mon, 2008-12-08 at 09:58 -0600, Ryan Arnold wrote:
> On Sun, Dec 7, 2008 at 9:43 PM, Sean P Curry
> <spcurry5@linux.vnet.ibm.com> wrote:
> > Can anyone tell me why the macro PPC_ISYNC (located in
> > libc/sysdeps/powerpc/powerpc[32/64]/dl-machine.c) is defined as: asm
> > volatile("sync; isync"...) ?? (why is the "sync" instruction present
> > before the "isync")
> 
> Hi Sean,
> 
> 'sync' is a data-cache synchronization instruction, i.e. a memory
> barrier that synchronizes loads and stores.
> 
> 'isync' is a context synchronization instruction.  It guarantees that
> all instructions prior to the isync are completed before the isync
> completes.
> 
> They're coupled together because isync may complete before storage
> access associated with instructions preceding the isync instruction
> have been performed and we don't want that, hence we need to perform a
> sync as well.
> 
> Ryan

I understand the difference between these two instructions, but I don't
understand why both are included in the definition of PPC_ISYNC (because
the macro "PPC_SYNC" is available). If both storage synchronization and
context synchronization are required, wouldn't it be better to use
"PPC_SYNC;PPC_ISYNC"? That way, when _only_ context synchronization is
required, PPC_ISYNC can be used without the unnecessary "sync"
instruction attached.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]