Boost logo

Boost-Build :

Subject: Re: [Boost-build] x86 CPU spinning should use pause
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-10-04 11:35:21


On Tue, 4 Oct 2011, Hite, Christopher wrote:

>
> Sorry for posting to boost-build. I mean to do users.
>
> According to this Intel forum they take different times:
> http://software.intel.com/en-us/forums/showthread.php?t=48371
> That means they can't be the same instruction. I'd trust their whitepaper.
>
> Pause and no-op are two different use cases. No-ops can allow a
> debugger to put jumps into the code. This pause instruction means flush
> out memory operations.

Pause is not the same as the normal nop, but it is the same as rep-nop
(they produce the exact same machine code). See the page that I linked to
about that.

-- Jeremiah Willcock

>
>
>
> -----Original Message-----
> From: boost-build-bounces_at_[hidden] [mailto:boost-build-bounces_at_[hidden]] On Behalf Of Jeremiah Willcock
> Sent: Wednesday, September 28, 2011 7:12 PM
> To: Boost.Build developer's and user's list
> Subject: Re: [Boost-build] x86 CPU spinning should use pause
>
> On Wed, 28 Sep 2011, Hite, Christopher wrote:
>
>> #define BOOST_SMT_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" );
>>  
>> We should probably use:
>>         __asm__ __volatile__("pause;")
>>  
>> Why? Because one thread polling( or worse CASing) memory, causes multiple overlapping memory operations to be made:
>
> See
> http://stackoverflow.com/questions/7086220/what-does-rep-nop-mean-in-x86-assembly
> -- basically, "rep; nop" is exactly the same instruction as "pause".
>
> -- Jeremiah Willcock
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
>


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk