All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: andrew.cooper3@citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH] x86/time: Don't use virtual TSC if host and guest frequencies are equal
Date: Thu, 16 Mar 2017 10:22:59 -0400	[thread overview]
Message-ID: <83388c04-8987-63c4-7d89-24f55a59e354@oracle.com> (raw)
In-Reply-To: <58CAA1A50200007800143D2F@prv-mh.provo.novell.com>

On 03/16/2017 09:31 AM, Jan Beulich wrote:
>>>> On 16.03.17 at 13:44, <boris.ostrovsky@oracle.com> wrote:
>> On 03/16/2017 06:40 AM, Jan Beulich wrote:
>>>>>> On 15.03.17 at 20:48, <boris.ostrovsky@oracle.com> wrote:
>>>> --- a/xen/arch/x86/time.c
>>>> +++ b/xen/arch/x86/time.c
>>>> @@ -2051,17 +2051,11 @@ void tsc_set_info(struct domain *d,
>>>>          d->arch.vtsc_offset = get_s_time() - elapsed_nsec;
>>>>          d->arch.tsc_khz = gtsc_khz ?: cpu_khz;
>>>>          set_time_scale(&d->arch.vtsc_to_ns, d->arch.tsc_khz * 1000);
>>>> -        /*
>>>> -         * In default mode use native TSC if the host has safe TSC and:
>>>> -         *  HVM/PVH: host and guest frequencies are the same (either
>>>> -         *           "naturally" or via TSC scaling)
>>>> -         *  PV: guest has not migrated yet (and thus arch.tsc_khz == cpu_khz)
>>>> -         */
>>>> +
>>>>          if ( tsc_mode == TSC_MODE_DEFAULT && host_tsc_is_safe() &&
>>>> -             (has_hvm_container_domain(d) ?
>>>> -              (d->arch.tsc_khz == cpu_khz ||
>>>> -               hvm_get_tsc_scaling_ratio(d->arch.tsc_khz)) :
>>>> -              incarnation == 0) )
>>>> +             (d->arch.tsc_khz == cpu_khz || incarnation == 0 ||
>>> Is the incarnation comparison really needed here, i.e. doesn't it
>>> being zero imply the two frequencies to match in default mode?
>> It is not necessary but I wanted to keep it for clarity so that it is
>> explicit that when a domain is born we don't use vtsc.
> Well, considering the history here, I think its presence is rather
> going to raise questions than to answer any, so if anything I'd
> suggest to have an ASSERT() to that effect, at once serving as
> sort of documentation. But I may be the only one thinking this
> way ...


Haven't thought about an ASSERT. I can do that. Something like

ASSERT(gtsc_khz == 0 ? incarnation == 0 : true);

-boris


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

  reply	other threads:[~2017-03-16 14:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15 19:48 [PATCH] x86/time: Don't use virtual TSC if host and guest frequencies are equal Boris Ostrovsky
2017-03-16 10:40 ` Jan Beulich
2017-03-16 12:44   ` Boris Ostrovsky
2017-03-16 13:31     ` Jan Beulich
2017-03-16 14:22       ` Boris Ostrovsky [this message]
2017-03-16 15:34         ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83388c04-8987-63c4-7d89-24f55a59e354@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.