qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Roman Kagan <rkagan@virtuozzo.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Denis Plotnikov <dplotnikov@virtuozzo.com>,
	qemu-devel@nongnu.org, den@virtuozzo.com
Subject: Re: [Qemu-devel] [svt-core] [PATCH] kvmclock: update system_time_msr address forcibly
Date: Thu, 25 May 2017 17:50:04 +0200	[thread overview]
Message-ID: <82464a9c-765f-8de8-e600-fec6b13e4f8c@redhat.com> (raw)
In-Reply-To: <20170525094004.GA27740@rkaganb.sw.ru>



On 25/05/2017 11:40, Roman Kagan wrote:
>>>> +    kvmclock_struct_pa = env->system_time_msr & ~1ULL;
>>>> +
>>>>      if (!(env->system_time_msr & 1ULL)) {
>>>>          /* KVM clock not active */
>>>>          return 0;
>>> Roman.
>> Can't you avoid that call to each CPU? (ie fix the synchronization 
>> of the system time address problem in some other way?)
> Sorry, what call do you mean?  On one hand I suggested exactly to only
> call cpu_synchronize_state on the current (== first) cpu.  On the other,
> cpu_synchronize_state is heavier than just fetching a single msr.
> 
> Anyway kvmclock_current_nsec is only called in kvmclock_vm_state_change
> callback which is certainly not performance-critical, so IMO less new
> code here is better than more efficiency.
> 
> Or maybe I misunderstand your reason to request that the synchronization
> problem is fixed in some other way?

Denis's patch is problematic in that KVM_GET_MSRS should run in the VCPU
thread (using run_on_cpu).  cpu_synchronize_state() is heavier, but
solves this problem nicely.  Since it's not performance critical as you
say, calling cpu_synchronize_state() from kvmclock_current_nsec() seems
the best solution.

Paolo

      reply	other threads:[~2017-05-25 15:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 14:07 [Qemu-devel] [PATCH] kvmclock: update system_time_msr address forcibly Denis Plotnikov
2017-05-24 14:09 ` Denis V. Lunev
2017-05-24 14:37   ` Denis Plotnikov
2017-05-24 15:54 ` [Qemu-devel] [svt-core] " Roman Kagan
2017-05-24 17:20   ` Marcelo Tosatti
2017-05-25  9:40     ` Roman Kagan
2017-05-25 15:50       ` Paolo Bonzini [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=82464a9c-765f-8de8-e600-fec6b13e4f8c@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=den@virtuozzo.com \
    --cc=dplotnikov@virtuozzo.com \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rkagan@virtuozzo.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;
as well as URLs for NNTP newsgroup(s).