[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 1/3] x86: Use native RDTSC(P) execution when guest and host frequencies are the same



On 04/16/2014 05:54 AM, Jan Beulich wrote:
On 16.04.14 at 03:27, <boris.ostrovsky@xxxxxxxxxx> wrote:
@@ -1889,10 +1890,14 @@ void tsc_set_info(struct domain *d,
          d->arch.vtsc_offset = get_s_time() - elapsed_nsec;
          d->arch.tsc_khz = gtsc_khz ? gtsc_khz : cpu_khz;
          set_time_scale(&d->arch.vtsc_to_ns, d->arch.tsc_khz * 1000 );
-        /* use native TSC if initial host has safe TSC, has not migrated
-         * yet and tsc_khz == cpu_khz */
-        if ( host_tsc_is_safe() && incarnation == 0 &&
-                d->arch.tsc_khz == cpu_khz )
+        /*
+         * Use native TSC if initial host has safe TSC and either has not
+         * migrated yet or tsc_khz == cpu_khz (either "naturally" or via
+         * TSC scaling)
+         */
+        if ( host_tsc_is_safe() &&
+             (incarnation == 0 || d->arch.tsc_khz == cpu_khz ||
+              cpu_has_tsc_ratio) )
Can't you drop checking incarnation to be zero then? In that case,
afaict d->arch.tsc_khz == cpu_khz due to gtsc_khz being passed
in as zero from arch_domain_create().

Yes, it's pointless. I was thinking that maybe toolstack may pass gtsc_khz != cpu_khz during initial boot (it doesn't do it now, but theoretically it could) but then we shouldn't be using vtsc=0 in that case anyway.

-boris

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.