public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm-devel <kvm@vger.kernel.org>
Subject: Re: [PATCH v2] KVM: x86: update masterclock values on TSC writes
Date: Wed, 05 Nov 2014 20:49:38 +0100	[thread overview]
Message-ID: <545A7F52.8070408@redhat.com> (raw)
In-Reply-To: <545A7ED1.3050504@redhat.com>



On 05/11/2014 20:47, Paolo Bonzini wrote:
> 
> 
> On 05/11/2014 19:19, Marcelo Tosatti wrote:
>>>>>> +	 * If the vcpus have matched TSCs and host clocksource is TSC,
>>>>>> +	 * perform request to enable masterclock.
>>>>>> +	 *
>>>>>> +	 * If the masterclock is enabled, perform request to update
>>>>>> +	 * masterclock values.
>>>>>> +	 */
>>>>>> +	if ((vcpus_matched && gtod->clock.vclock_mode == VCLOCK_TSC) ||
>>>>>> +	     ka->use_master_clock)
>>>>
>>>> This is not an explanation, it is a literal translation from C to
>>>> English. :)  Can you also explain the why, especially for the first half
>>>> of the condition?
>>>>
>>>> Paolo
>> The comment on top of pvclock_update_vm_gtod_copy says:
>>
>> "Rely on synchronization of host TSCs and guest TSCs for monotonicity."
>>
>> Then with this patch
>>
>> "If the vcpus have matched TSCs and host clocksource is TSC"
>>
>> Is it sufficient to add
>>
>> "Masterclock requires synchronized guest TSC and host clocksource TSC" 
>> to this patch?
> 
> Got it now, thanks.  I think I misread one "enable" as "update" in your
> comment, sorry.  I'll apply v2 tomorrow.

Slightly reworded:

        /*
         * Once the masterclock is enabled, always perform request in
         * order to update it.
         *
         * Until then, if the vcpus have matched TSCs and host clocksource
         * is TSC, perform request to enable masterclock.
         */
        if (ka->use_master_clock ||
            (vcpus_matched && gtod->clock.vclock_mode == VCLOCK_TSC))
                kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu);

Paolo

  reply	other threads:[~2014-11-05 19:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04 23:30 [PATCH v2] KVM: x86: update masterclock values on TSC writes Marcelo Tosatti
2014-11-05  9:36 ` Paolo Bonzini
2014-11-05 18:19   ` Marcelo Tosatti
2014-11-05 19:47     ` Paolo Bonzini
2014-11-05 19:49       ` Paolo Bonzini [this message]
2014-11-05 19:58         ` Marcelo Tosatti

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=545A7F52.8070408@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox