TSC offset support for Xen

Bug #1160378 reported by Stefan Bader
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
xen (Ubuntu)
Fix Released
Wishlist
Stefan Bader

Bug Description

TSC is only writable via MSR 0x10 which is a moving target. TSC offset timer feature will provide a new MSR 0x3b that exposes the "Thread Offset" directly. So, RDTSC result = Core TSC + Core Offset + Thread Offset. This allows system software to avoid barriers when writing the TSC.

We will expose TSC offset timer feature into guest, and try to see whether Xen could make use this feature itself.

Upstream Schedule: Xen 4.3

Implemented by the following patches in upstream Xen git repository:
6e03363 x86: Implement TSC adjust feature for HVM guest
e35cd2c x86: Save/restore TSC adjust during HVM guest migration
6fd5f43 x86: Expose TSC adjust to HVM guest

Revision history for this message
Stefan Bader (smb) wrote :

Tested to show no regressions without TSC adjust support (no hardware with support available, yet).

Revision history for this message
XiongZhang (xiong-y-zhang) wrote :

Haswell cpu should support this feature. According to intel software develop manual, processor support for the IA32_TSC_ADJUST MSR is indicated by CPUID.(EAX=07H, ECX=0H):EX.TSC_ADJUST(bit 1). if you run cpuid command on Haswell machine, this bit is 0, so you think haswell cpu can't support this feature. Actually because of the bug in cpuid tool, you get the wrong cpuid value.
When cpuid tool execute cpuid instruction, cpuid tool doesn't clear ecx to 0, this is aganist inte spec. After a little modification to CPUID tool, you can get EBX=0x2fbb, not EBX=0.

Revision history for this message
Stefan Bader (smb) wrote :

Thanks for the feedback. Incidentally, while discussing a potential bug in Xen related to SMEP, I realized the bug in the cpuid tool. Looking at /proc/cpuinfo or x86info gives me the correct info. So I will repeat the testing today (though probably it was done already without realizing).

Revision history for this message
Stefan Bader (smb) wrote :

Ok, I verified now that the cpuid feature bit gets passed into a HVM guest and no regression was observed.

Revision history for this message
Dave Walker (davewalker) wrote :

FFe: Requested on IRC and approved (based on the testing already done), but please be prepared to revert at hint of regression. Thanks

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xen - 4.2.1-0ubuntu3

---------------
xen (4.2.1-0ubuntu3) raring; urgency=low

  * Fix FTBS on i386
    - 0007-x86-Fix-i386-virtual-apic.patch
  * Fix HVM VCPUs getting stuck on boot when host supports SMEP (LP: #1157757)
    - 0008-vmx-Simplify-cr0-update-handling-by-deferring-cr4-ch.patch
    - 0009-VMX-disable-SMEP-feature-when-guest-is-in-non-paging.patch
    - 0010-VMX-Always-disable-SMEP-when-guest-is-in-non-paging-.patch
 -- Stefan Bader <email address hidden> Fri, 05 Apr 2013 16:39:45 +0200

Changed in xen (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.