From: Marcelo Tosatti <mtosatti@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm-devel <kvm@vger.kernel.org>
Subject: Re: KVM: x86: update masterclock on TSC writes
Date: Tue, 4 Nov 2014 21:27:27 -0200 [thread overview]
Message-ID: <20141104232727.GA29191@amt.cnet> (raw)
In-Reply-To: <5459088A.50801@redhat.com>
On Tue, Nov 04, 2014 at 06:10:34PM +0100, Paolo Bonzini wrote:
> Extending the context we have:
> > if (vcpus_matched && gtod->clock.vclock_mode == VCLOCK_TSC)
> > if (!ka->use_master_clock)
> > do_request = 1;
> >
> > - if (!vcpus_matched && ka->use_master_clock)
> > + if (ka->use_master_clock)
> > do_request = 1;
> >
> > if (do_request)
> > kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu);
>
> The patch also makes the previous "if (!ka->use_master_clock)" redundant.
> If you enter the first "if", do_request will be 1 independent of
> ka->use_master_clock. So you should also drop that one, and possibly
> rewrite it simply like this:
>
> if ((vcpus_matched && gtod->clock.vclock_mode == VCLOCK_TSC) ||
> ka->use_master_clock)
> kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu);
>
> But this brings the question: what is vclock_mode in your case? If it
> is VCLOCK_TSC, are you sure that the bug is fixed because you modified
> the second "if", or could it be fixed also by removing instead the
> "if (!ka->use_master_clock)"? This would leave the optimization in the
> case "!vcpus_matched && ka->use_master_clock". Or is the optimization
> always invalid?
The bug is fixed by always updating masterclock values, when it is
enabled.
> A different way to state the same question: can you explain the
> resulting condition
>
> ((vcpus_matched && gtod->clock.vclock_mode == VCLOCK_TSC) ||
> ka->use_master_clock)
>
> ? Please add a comment to kvm_track_tsc_matching that clarifies this
> logic.
>
> Paolo
Sure, sending v2.
prev parent reply other threads:[~2014-11-04 23:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 21:16 KVM: x86: update masterclock on TSC writes Marcelo Tosatti
2014-11-04 17:10 ` Paolo Bonzini
2014-11-04 23:27 ` Marcelo Tosatti [this message]
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=20141104232727.GA29191@amt.cnet \
--to=mtosatti@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@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