|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] x86/time: Adjust init-time handling of pit0_ticks
On 19/12/16 16:51, Jan Beulich wrote:
>>>> On 19.12.16 at 17:38, <andrew.cooper3@xxxxxxxxxx> wrote:
>> There is no need for the volatile cast in the timer interrupt. pit0_ticks
>> has
>> external linkage, preventing the compiler from eliding the update. This
>> reduces the generated assembly from a read, local modify, write to a single
>> add instruction.
> I don't think external linkage is the reason here, considering the
> effects of whole-program-optimization.
In the case of whole-program-optimisation, the compiler would observe
that one function wrote to the variable, and one function read from it.
I presume that is also sufficient to prevent the eliding?
>
>> --- a/xen/arch/x86/io_apic.c
>> +++ b/xen/arch/x86/io_apic.c
>> @@ -1485,8 +1485,7 @@ static int __init timer_irq_works(void)
>> {
>> unsigned long t1, flags;
>>
>> - t1 = pit0_ticks;
>> - mb();
>> + t1 = ACCESS_ONCE(pit0_ticks);
> Any reason not to use the available read_atomic() here?
ACCESS_ONCE() doesn't force an explicit reg/mem mov instruction,
although in practice it doesn't make any difference in this case.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |