[PATCH 0/6] Get rid of CPUID from gettimeofday

Tim Gardner tim.gardner at canonical.com
Fri Jun 6 19:13:40 UTC 2008


Alok Kataria wrote:
> On Fri, 2008-06-06 at 08:17 -0700, Tim Gardner wrote:
>> Alok Kataria wrote:
>>> Hi,
>>>
>>> There have been a series of patches committed to the mainline kernel
>>> recently that address a performance issue for gettimeofday when running
>>> on hypervisors that enable hardware assisted virtualization.  The
>>> non-ideal performance occurs because a CPUID instruction is used to
>>> serialize the pipeline before RDTSC, and when using hardware
>>> virtualization, CPUID always exits to the hypervisor.
>>>
>>> The code in question also exists in the ubuntu-hardy tree.
>>>
>>> The fix is to use MFENCE/LFENCE instead of CPUID.
>>> This series of patches backports those commits for current ubuntu's git
>>> tree.
>>>
>>> Please have a look.
>>>
>>> Thanks,
>>> Alok
>>>
>> So, I've been messing with your patch set, but it is kind of wound up in
>> the 'TSC Clocksource' patch which I reverted because it was shown to
>> cause suspend regressions:
>>
>> http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-hardy.git;a=commit;h=d617b07f7e8b465f29c82d84fbc12febf43b2900
>>
>> It was suggested in the LP report that the original TSC commit was
>> incomplete when compared to upstream:
>>
>> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/226279/comments/95
>>
>> In fact, this appears to be the case.
> 
> Hi Tim,
> 
> The patch that i had posted earlier for TSC did take into account the
> software-suspend breakage. 
> Looking back at the mail conversation that we had back then, the patch
> does have all those changes related to software suspend too. Attached is
> the mail conversation.
> 

It appears that the original TSC patch that I applied simply wasn't
applied correctly, it missed the patch to kernel/time/timekeeping.c. I
think it looks correct now.

>>  I've re-applied the original TSC
>> patch, then your most recent patch set. Please review at
>> git://kernel.ubuntu.com/rtg/ubuntu-hardy-tsc.
> 

I had to add support for native_read_tsc in order to build amd64. See
attached.

I've pushed to git://kernel.ubuntu.com/rtg/ubuntu-hardy-tsc

rtg
-- 
Tim Gardner tim.gardner at ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-UBUNTU-Add-native_read_tsc-to-non-__i386__-code.patch
Type: text/x-diff
Size: 964 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20080606/680d8f09/attachment.patch>


More information about the kernel-team mailing list