From: Paolo Bonzini <pbonzini@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm-devel <kvm@vger.kernel.org>
Subject: Re: KVM: x86: update masterclock on TSC writes
Date: Tue, 04 Nov 2014 18:10:34 +0100 [thread overview]
Message-ID: <5459088A.50801@redhat.com> (raw)
In-Reply-To: <20141103211627.GA19724@amt.cnet>
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?
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
next prev parent reply other threads:[~2014-11-04 17:10 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 [this message]
2014-11-04 23:27 ` 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=5459088A.50801@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