lkml.org 
[lkml]   [2010]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC 02/12] x86/ticketlock: convert spin loop to C
  On 08/06/2010 01:17 PM, H. Peter Anvin wrote:
> On 08/06/2010 07:53 AM, Jeremy Fitzhardinge wrote:
>> On 08/06/2010 05:43 AM, Jan Beulich wrote:
>>> You certainly mean "the compiler currently treats this as being:" - I
>>> don't think there's a guarantee it'll always be doing so.
>>>
>>>> for (;;) {
>>>> if (inc.tickets.head == inc.tickets.tail)
>>>> goto out;
>>>> ...
>>>> }
>>>> out: barrier();
>>>> }
>>>>
>>>> (Which would probably be a reasonable way to clarify the code.)
>>> I therefore think it needs to be written this way.
>>
>> Agreed.
>>
>
> A call/return to an actual out-of-line function is a barrier (and will
> always be a barrier, as it is the fundamental ABI sequence points),
> but to an inline function it is not.

Yes. So the goto explicitly puts the barrier into the control flow which
should stop the compiler from doing anything unexpected.

J


\
 
 \ /
  Last update: 2010-08-06 22:35    [W:0.068 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site